Get rid of trailing whitespace.

Commit generated by command:

find -type f ! -path '*.git*' ! -path '*.png' ! -path '*.ico' ! -path \
    '*.ogg' | xargs -I '{}' sed -i '{}' -e 's/\t*$//g' -e 's/ *$//g'
master
Jacek Wielemborek 10 years ago
parent 3750a85c5f
commit e6c9e78935

@ -6,7 +6,7 @@ locale = {
name = "es", name = "es",
charset = "cp1252", charset = "cp1252",
languageName = "Español", languageName = "Español",
translation = { translation = {
["1a) Offensive Name"] = "1a) Nombre ofensivo", ["1a) Offensive Name"] = "1a) Nombre ofensivo",
["1b) Invalid Name Format"] = "1b) Formato invalido para nombre", ["1b) Invalid Name Format"] = "1b) Formato invalido para nombre",
@ -154,7 +154,7 @@ locale = {
["Hide spells for higher exp. levels"] = "Ocultar hechizos para niveles mas altos que tu experiencia.", ["Hide spells for higher exp. levels"] = "Ocultar hechizos para niveles mas altos que tu experiencia.",
["Hide spells for other vocations"] = "Ocultar hechizos que sean para otra vocación", ["Hide spells for other vocations"] = "Ocultar hechizos que sean para otra vocación",
["Hit Points"] = "Puntos de vida", ["Hit Points"] = "Puntos de vida",
["Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks"] = "Mantenga presionado el botón derecho del ratón para navegar\nDezplaze la rueda central del ratón para ampliar\nbotón derecho del mouse para crear marcas del mapa", ["Hold left mouse button to navigate\nScroll mouse middle button to zoom\nRight mouse button to create map marks"] = "Mantenga presionado el botón derecho del ratón para navegar\nDezplaze la rueda central del ratón para ampliar\nbotón derecho del mouse para crear marcas del mapa",
["Hotkeys"] = "Hotkeys", ["Hotkeys"] = "Hotkeys",
["If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."] = "Si se cierra el programa, tu personaje puede permanecer en el juego.\nHaga clic en 'Salir' para asegurarse de que personaje deja el juego correctamente.\nHaga click en 'Salir' si desea salir del programa sin tener que salir de tu personaje.", ["If you shut down the program, your character might stay in the game.\nClick on 'Logout' to ensure that you character leaves the game properly.\nClick on 'Exit' if you want to exit the program without logging out your character."] = "Si se cierra el programa, tu personaje puede permanecer en el juego.\nHaga clic en 'Salir' para asegurarse de que personaje deja el juego correctamente.\nHaga click en 'Salir' si desea salir del programa sin tener que salir de tu personaje.",
["Ignore"] = "Ignorar", ["Ignore"] = "Ignorar",
@ -374,5 +374,5 @@ locale = {
["Don't stretch or shrink Game Window"] = "No estirar o encoger Ventana de Juego" ["Don't stretch or shrink Game Window"] = "No estirar o encoger Ventana de Juego"
} }
} }
modules.client_locales.installLocale(locale) modules.client_locales.installLocale(locale)

@ -146,7 +146,7 @@ MinimapFlagWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
MinimapFlagCheckBox MinimapFlagCheckBox
id: flag1 id: flag1
@ -190,7 +190,7 @@ MinimapFlagWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
MinimapFlagCheckBox MinimapFlagCheckBox
id: flag11 id: flag11

@ -53,7 +53,7 @@ function startup()
end end
function init() function init()
connect(g_app, { onRun = startup, connect(g_app, { onRun = startup,
onExit = exit }) onExit = exit })
g_window.setMinimumSize({ width = 600, height = 480 }) g_window.setMinimumSize({ width = 600, height = 480 })
@ -94,11 +94,11 @@ function init()
if not g_crypt.setMachineUUID(g_configs.get('uuid')) then if not g_crypt.setMachineUUID(g_configs.get('uuid')) then
g_configs.set('uuid', g_crypt.getMachineUUID()) g_configs.set('uuid', g_crypt.getMachineUUID())
g_configs.save() g_configs.save()
end end
end end
function terminate() function terminate()
disconnect(g_app, { onRun = startup, disconnect(g_app, { onRun = startup,
onExit = exit }) onExit = exit })
-- save window configs -- save window configs
g_settings.set('window-size', g_window.getUnmaximizedSize()) g_settings.set('window-size', g_window.getUnmaximizedSize())

@ -243,7 +243,7 @@ function CharacterList.create(characters, account, otui)
else else
accountStatusLabel:setText(tr('Free Account')) accountStatusLabel:setText(tr('Free Account'))
end end
if account.premDays > 0 and account.premDays <= 7 then if account.premDays > 0 and account.premDays <= 7 then
accountStatusLabel:setOn(true) accountStatusLabel:setOn(true)
else else

@ -81,7 +81,7 @@ MainWindow
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: next.top anchors.bottom: next.top
margin-bottom: 1 margin-bottom: 1
Label Label
id: accountStatusLabel id: accountStatusLabel
!text: tr('Free Account') !text: tr('Free Account')

@ -225,7 +225,7 @@ function EnterGame.doLogin()
g_settings.set('host', G.host) g_settings.set('host', G.host)
g_settings.set('port', G.port) g_settings.set('port', G.port)
g_settings.set('client-version', clientVersion) g_settings.set('client-version', clientVersion)
protocolLogin = ProtocolLogin.create() protocolLogin = ProtocolLogin.create()
protocolLogin.onLoginError = onError protocolLogin.onLoginError = onError

@ -39,10 +39,10 @@ Panel
id: fullscreen id: fullscreen
!text: tr('Fullscreen') !text: tr('Fullscreen')
tooltip: Ctrl+Shift+F tooltip: Ctrl+Shift+F
OptionCheckBox OptionCheckBox
id: dontStretchShrink id: dontStretchShrink
!text: tr('Don\'t stretch/shrink Game Window') !text: tr('Don\'t stretch/shrink Game Window')
Label Label
id: backgroundFrameRateLabel id: backgroundFrameRateLabel

@ -50,7 +50,7 @@ function ServerList.add(host, port, protocol, load)
end end
local widget = g_ui.createWidget('ServerWidget', serverTextList) local widget = g_ui.createWidget('ServerWidget', serverTextList)
widget:setId(host) widget:setId(host)
if not load then if not load then
servers[host] = { servers[host] = {
port = port, port = port,

@ -131,11 +131,11 @@ function init()
commandTextEdit = terminalWindow:getChildById('commandTextEdit') commandTextEdit = terminalWindow:getChildById('commandTextEdit')
g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit) g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit)
g_keyboard.bindKeyPress('Down', function() navigateCommand(-1) end, commandTextEdit) g_keyboard.bindKeyPress('Down', function() navigateCommand(-1) end, commandTextEdit)
g_keyboard.bindKeyPress('Ctrl+C', g_keyboard.bindKeyPress('Ctrl+C',
function() function()
if commandTextEdit:hasSelection() or not terminalSelectText:hasSelection() then return false end if commandTextEdit:hasSelection() or not terminalSelectText:hasSelection() then return false end
g_window.setClipboardText(terminalSelectText:getSelection()) g_window.setClipboardText(terminalSelectText:getSelection())
return true return true
end, commandTextEdit) end, commandTextEdit)
g_keyboard.bindKeyDown('Tab', completeCommand, commandTextEdit) g_keyboard.bindKeyDown('Tab', completeCommand, commandTextEdit)
g_keyboard.bindKeyDown('Enter', doCommand, commandTextEdit) g_keyboard.bindKeyDown('Enter', doCommand, commandTextEdit)

@ -55,7 +55,7 @@ end
function table.find(t, value, lowercase) function table.find(t, value, lowercase)
for k,v in pairs(t) do for k,v in pairs(t) do
if lowercase and type(value) == 'string' and type(v) == 'string' then if lowercase and type(value) == 'string' and type(v) == 'string' then
if v:lower() == value:lower() then return k end if v:lower() == value:lower() then return k end
end end
if v == value then return k end if v == value then return k end
@ -64,7 +64,7 @@ end
function table.findbykey(t, key, lowercase) function table.findbykey(t, key, lowercase)
for k,v in pairs(t) do for k,v in pairs(t) do
if lowercase and type(key) == 'string' and type(k) == 'string' then if lowercase and type(key) == 'string' and type(k) == 'string' then
if k:lower() == key:lower() then return v end if k:lower() == key:lower() then return v end
end end
if k == key then return v end if k == key then return v end
@ -149,7 +149,7 @@ function table.size(t)
for i, n in pairs(t) do for i, n in pairs(t) do
size = size + 1 size = size + 1
end end
return size return size
end end

@ -81,7 +81,7 @@ function UIMiniWindow:setup()
self:minimize() self:minimize()
end end
end end
self:getChildById('miniwindowTopBar').onDoubleClick = self:getChildById('miniwindowTopBar').onDoubleClick =
function() function()
if self:isOn() then if self:isOn() then

@ -8,7 +8,7 @@ end
local function updateMargins(tabBar, ignored) local function updateMargins(tabBar, ignored)
if #tabBar.tabs == 0 then return end if #tabBar.tabs == 0 then return end
local currentMargin = 0 local currentMargin = 0
for i = 1, #tabBar.tabs do for i = 1, #tabBar.tabs do
tabBar.tabs[i]:setMarginLeft(currentMargin) tabBar.tabs[i]:setMarginLeft(currentMargin)
@ -279,17 +279,17 @@ end
function UIMoveableTabBar:moveTab(tab, units) function UIMoveableTabBar:moveTab(tab, units)
local index = table.find(self.tabs, tab) local index = table.find(self.tabs, tab)
if index == nil then return end if index == nil then return end
local focus = false local focus = false
if self.currentTab == tab then if self.currentTab == tab then
self:selectPrevTab() self:selectPrevTab()
focus = true focus = true
end end
table.remove(self.tabs, index) table.remove(self.tabs, index)
local newIndex = math.min(#self.tabs+1, math.max(index + units, 1)) local newIndex = math.min(#self.tabs+1, math.max(index + units, 1))
table.insert(self.tabs, newIndex, tab) table.insert(self.tabs, newIndex, tab)
if focus then self:selectTab(tab) end if focus then self:selectTab(tab) end
updateMargins(self) updateMargins(self)
return newIndex return newIndex

@ -47,7 +47,7 @@ end
function UIRadioGroup:clearSelected() function UIRadioGroup:clearSelected()
if not self.selectedWidget then return end if not self.selectedWidget then return end
local previousSelectedWidget = self.selectedWidget local previousSelectedWidget = self.selectedWidget
self.selectedWidget:setChecked(false) self.selectedWidget:setChecked(false)
self.selectedWidget = nil self.selectedWidget = nil

@ -32,11 +32,11 @@ function init()
filterPanel = battleWindow:recursiveGetChildById('filterPanel') filterPanel = battleWindow:recursiveGetChildById('filterPanel')
toggleFilterButton = battleWindow:recursiveGetChildById('toggleFilterButton') toggleFilterButton = battleWindow:recursiveGetChildById('toggleFilterButton')
if isHidingFilters() then if isHidingFilters() then
hideFilterPanel() hideFilterPanel()
end end
sortTypeBox = battleWindow:recursiveGetChildById('sortTypeBox') sortTypeBox = battleWindow:recursiveGetChildById('sortTypeBox')
sortOrderBox = battleWindow:recursiveGetChildById('sortOrderBox') sortOrderBox = battleWindow:recursiveGetChildById('sortOrderBox')
hidePlayersButton = battleWindow:recursiveGetChildById('hidePlayers') hidePlayersButton = battleWindow:recursiveGetChildById('hidePlayers')
@ -63,7 +63,7 @@ function init()
sortOrderBox:addOption('Desc.', 'desc') sortOrderBox:addOption('Desc.', 'desc')
sortOrderBox:setCurrentOptionByData(getSortOrder()) sortOrderBox:setCurrentOptionByData(getSortOrder())
sortOrderBox.onOptionChange = onChangeSortOrder sortOrderBox.onOptionChange = onChangeSortOrder
connect(Creature, { connect(Creature, {
onSkullChange = updateCreatureSkull, onSkullChange = updateCreatureSkull,
onEmblemChange = updateCreatureEmblem, onEmblemChange = updateCreatureEmblem,
@ -73,7 +73,7 @@ function init()
onAppear = onCreatureAppear, onAppear = onCreatureAppear,
onDisappear = onCreatureDisappear onDisappear = onCreatureDisappear
}) })
connect(LocalPlayer, { connect(LocalPlayer, {
onPositionChange = onCreaturePositionChange onPositionChange = onCreaturePositionChange
}) })
@ -95,7 +95,7 @@ function terminate()
battleWindow:destroy() battleWindow:destroy()
mouseWidget:destroy() mouseWidget:destroy()
disconnect(Creature, { disconnect(Creature, {
onSkullChange = updateCreatureSkull, onSkullChange = updateCreatureSkull,
onEmblemChange = updateCreatureEmblem, onEmblemChange = updateCreatureEmblem,
onOutfitChange = onCreatureOutfitChange, onOutfitChange = onCreatureOutfitChange,
@ -108,7 +108,7 @@ function terminate()
disconnect(LocalPlayer, { disconnect(LocalPlayer, {
onPositionChange = onCreaturePositionChange onPositionChange = onCreaturePositionChange
}) })
disconnect(g_game, { disconnect(g_game, {
onAttackingCreatureChange = onAttack, onAttackingCreatureChange = onAttack,
onFollowingCreatureChange = onFollow, onFollowingCreatureChange = onFollow,
@ -296,17 +296,17 @@ function onCreaturePositionChange(creature, newPos, oldPos)
for id, creatureButton in pairs(battleButtonsByCreaturesList) do for id, creatureButton in pairs(battleButtonsByCreaturesList) do
table.insert(distanceList, {distance = getDistanceBetween(newPos, creatureButton.creature:getPosition()), widget = creatureButton}) table.insert(distanceList, {distance = getDistanceBetween(newPos, creatureButton.creature:getPosition()), widget = creatureButton})
end end
if isSortAsc() then if isSortAsc() then
table.sort(distanceList, function(a, b) return a.distance < b.distance end) table.sort(distanceList, function(a, b) return a.distance < b.distance end)
else else
table.sort(distanceList, function(a, b) return a.distance > b.distance end) table.sort(distanceList, function(a, b) return a.distance > b.distance end)
end end
for i = 1, #distanceList do for i = 1, #distanceList do
battlePanel:moveChildToIndex(distanceList[i].widget, i) battlePanel:moveChildToIndex(distanceList[i].widget, i)
end end
end end
for id, creatureButton in pairs(battleButtonsByCreaturesList) do for id, creatureButton in pairs(battleButtonsByCreaturesList) do
addCreature(creatureButton.creature) addCreature(creatureButton.creature)
@ -356,7 +356,7 @@ function addCreature(creature)
if not creatureAgeList[creatureId] then if not creatureAgeList[creatureId] then
creatureAgeList[creatureId] = os.time() creatureAgeList[creatureId] = os.time()
end end
if not battleButton then if not battleButton then
battleButton = g_ui.createWidget('BattleButton') battleButton = g_ui.createWidget('BattleButton')
battleButton:setup(creature) battleButton:setup(creature)
@ -373,14 +373,14 @@ function addCreature(creature)
if creature == g_game.getFollowingCreature() then if creature == g_game.getFollowingCreature() then
onFollow(creature) onFollow(creature)
end end
local inserted = false local inserted = false
local nameLower = creature:getName():lower() local nameLower = creature:getName():lower()
local healthPercent = creature:getHealthPercent() local healthPercent = creature:getHealthPercent()
local playerPosition = g_game.getLocalPlayer():getPosition() local playerPosition = g_game.getLocalPlayer():getPosition()
local distance = getDistanceBetween(playerPosition, creature:getPosition()) local distance = getDistanceBetween(playerPosition, creature:getPosition())
local age = creatureAgeList[creatureId] local age = creatureAgeList[creatureId]
local childCount = battlePanel:getChildCount() local childCount = battlePanel:getChildCount()
for i = 1, childCount do for i = 1, childCount do
local child = battlePanel:getChildByIndex(i) local child = battlePanel:getChildByIndex(i)
@ -412,9 +412,9 @@ function addCreature(creature)
break break
elseif healthPercent == childHealth then elseif healthPercent == childHealth then
equal = true equal = true
end end
end end
-- If any other sort type is selected and values are equal, sort it by name also -- If any other sort type is selected and values are equal, sort it by name also
if getSortType() == 'name' or equal then if getSortType() == 'name' or equal then
local length = math.min(childName:len(), nameLower:len()) local length = math.min(childName:len(), nameLower:len())
@ -425,7 +425,7 @@ function addCreature(creature)
break break
elseif (nameLower:byte(j) > childName:byte(j) and isSortAsc()) or (nameLower:byte(j) < childName:byte(j) and isSortDesc()) then elseif (nameLower:byte(j) > childName:byte(j) and isSortAsc()) or (nameLower:byte(j) < childName:byte(j) and isSortDesc()) then
break break
elseif j == nameLower:len() and isSortAsc() then elseif j == nameLower:len() and isSortAsc() then
battlePanel:insertChild(i, battleButton) battlePanel:insertChild(i, battleButton)
inserted = true inserted = true
elseif j == childName:len() and isSortDesc() then elseif j == childName:len() and isSortDesc() then
@ -439,7 +439,7 @@ function addCreature(creature)
break break
end end
end end
-- Insert at the end if no other place is found -- Insert at the end if no other place is found
if not inserted then if not inserted then
battlePanel:insertChild(childCount + 1, battleButton) battlePanel:insertChild(childCount + 1, battleButton)
@ -478,7 +478,7 @@ function onBattleButtonMouseRelease(self, mousePosition, mouseButton)
mouseWidget.cancelNextRelease = false mouseWidget.cancelNextRelease = false
return false return false
end end
if ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) if ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton)
or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
mouseWidget.cancelNextRelease = true mouseWidget.cancelNextRelease = true
g_game.look(self.creature) g_game.look(self.creature)

@ -92,7 +92,7 @@ MiniWindow
height: 20 height: 20
width: 128 width: 128
margin-top: 6 margin-top: 6
ComboBox ComboBox
id: sortTypeBox id: sortTypeBox
width: 74 width: 74
@ -107,7 +107,7 @@ MiniWindow
anchors.top: parent.top anchors.top: parent.top
anchors.left: prev.right anchors.left: prev.right
margin-left: 4 margin-left: 4
Panel Panel
height: 18 height: 18
anchors.top: prev.bottom anchors.top: prev.bottom
@ -132,7 +132,7 @@ MiniWindow
anchors.right: miniwindowScrollBar.left anchors.right: miniwindowScrollBar.left
margin-right: 1 margin-right: 1
margin-top: 11 margin-top: 11
MiniWindowContents MiniWindowContents
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6

@ -23,15 +23,15 @@ function init()
fightOffensiveBox = combatControlsWindow:recursiveGetChildById('fightOffensiveBox') fightOffensiveBox = combatControlsWindow:recursiveGetChildById('fightOffensiveBox')
fightBalancedBox = combatControlsWindow:recursiveGetChildById('fightBalancedBox') fightBalancedBox = combatControlsWindow:recursiveGetChildById('fightBalancedBox')
fightDefensiveBox = combatControlsWindow:recursiveGetChildById('fightDefensiveBox') fightDefensiveBox = combatControlsWindow:recursiveGetChildById('fightDefensiveBox')
chaseModeButton = combatControlsWindow:recursiveGetChildById('chaseModeBox') chaseModeButton = combatControlsWindow:recursiveGetChildById('chaseModeBox')
safeFightButton = combatControlsWindow:recursiveGetChildById('safeFightBox') safeFightButton = combatControlsWindow:recursiveGetChildById('safeFightBox')
mountButton = combatControlsWindow:recursiveGetChildById('mountButton') mountButton = combatControlsWindow:recursiveGetChildById('mountButton')
mountButton.onClick = onMountButtonClick mountButton.onClick = onMountButtonClick
pvpModesPanel = combatControlsWindow:recursiveGetChildById('pvpModesPanel') pvpModesPanel = combatControlsWindow:recursiveGetChildById('pvpModesPanel')
whiteDoveBox = combatControlsWindow:recursiveGetChildById('whiteDoveBox') whiteDoveBox = combatControlsWindow:recursiveGetChildById('whiteDoveBox')
whiteHandBox = combatControlsWindow:recursiveGetChildById('whiteHandBox') whiteHandBox = combatControlsWindow:recursiveGetChildById('whiteHandBox')
yellowHandBox = combatControlsWindow:recursiveGetChildById('yellowHandBox') yellowHandBox = combatControlsWindow:recursiveGetChildById('yellowHandBox')
@ -41,7 +41,7 @@ function init()
fightModeRadioGroup:addWidget(fightOffensiveBox) fightModeRadioGroup:addWidget(fightOffensiveBox)
fightModeRadioGroup:addWidget(fightBalancedBox) fightModeRadioGroup:addWidget(fightBalancedBox)
fightModeRadioGroup:addWidget(fightDefensiveBox) fightModeRadioGroup:addWidget(fightDefensiveBox)
pvpModeRadioGroup = UIRadioGroup.create() pvpModeRadioGroup = UIRadioGroup.create()
pvpModeRadioGroup:addWidget(whiteDoveBox) pvpModeRadioGroup:addWidget(whiteDoveBox)
pvpModeRadioGroup:addWidget(whiteHandBox) pvpModeRadioGroup:addWidget(whiteHandBox)
@ -62,7 +62,7 @@ function init()
onWalk = check, onWalk = check,
onAutoWalk = check onAutoWalk = check
}) })
connect(LocalPlayer, { onOutfitChange = onOutfitChange }) connect(LocalPlayer, { onOutfitChange = onOutfitChange })
if g_game.isOnline() then if g_game.isOnline() then
@ -92,7 +92,7 @@ function terminate()
onWalk = check, onWalk = check,
onAutoWalk = check onAutoWalk = check
}) })
disconnect(LocalPlayer, { onOutfitChange = onOutfitChange }) disconnect(LocalPlayer, { onOutfitChange = onOutfitChange })
end end
@ -111,7 +111,7 @@ function update()
local safeFight = g_game.isSafeFight() local safeFight = g_game.isSafeFight()
safeFightButton:setChecked(not safeFight) safeFightButton:setChecked(not safeFight)
if g_game.getFeature(GamePVPMode) then if g_game.getFeature(GamePVPMode) then
local pvpMode = g_game.getPVPMode() local pvpMode = g_game.getPVPMode()
local pvpWidget = getPVPBoxByMode(pvpMode) local pvpWidget = getPVPBoxByMode(pvpMode)
@ -153,7 +153,7 @@ function online()
else else
mountButton:setVisible(false) mountButton:setVisible(false)
end end
if g_game.getFeature(GamePVPMode) then if g_game.getFeature(GamePVPMode) then
pvpModesPanel:setVisible(true) pvpModesPanel:setVisible(true)
combatControlsWindow:setHeight(combatControlsWindow.extendedControlsHeight) combatControlsWindow:setHeight(combatControlsWindow.extendedControlsHeight)
@ -232,7 +232,7 @@ function onSetPVPMode(self, selectedPVPButton)
if selectedPVPButton == nil then if selectedPVPButton == nil then
return return
end end
local buttonId = selectedPVPButton:getId() local buttonId = selectedPVPButton:getId()
local pvpMode = PVPWhiteDove local pvpMode = PVPWhiteDove
if buttonId == 'whiteDoveBox' then if buttonId == 'whiteDoveBox' then
@ -263,7 +263,7 @@ function onOutfitChange(localPlayer, outfit, oldOutfit)
if outfit.mount == oldOutfit.mount then if outfit.mount == oldOutfit.mount then
return return
end end
mountButton:setChecked(outfit.mount ~= nil and outfit.mount > 0) mountButton:setChecked(outfit.mount ~= nil and outfit.mount > 0)
end end

@ -16,7 +16,7 @@ ChaseModeBox < CombatBox
image-source: /images/game/combatmodes/chasemode image-source: /images/game/combatmodes/chasemode
SafeFightBox < CombatBox SafeFightBox < CombatBox
image-source: /images/game/combatmodes/safefight image-source: /images/game/combatmodes/safefight
MountButton < CombatBox MountButton < CombatBox
image-source: /images/game/combatmodes/mount image-source: /images/game/combatmodes/mount
@ -73,7 +73,7 @@ MiniWindow
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: 20 height: 20
WhiteDoveBox WhiteDoveBox
id: whiteDoveBox id: whiteDoveBox
anchors.left: parent.left anchors.left: parent.left

@ -33,13 +33,13 @@ MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
width: 180 width: 180
Label Label
!text: tr('Ignored Players:') !text: tr('Ignored Players:')
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 10 margin-top: 10
TextList TextList
id: ignoreList id: ignoreList
vertical-scrollbar: ignoreListScrollBar vertical-scrollbar: ignoreListScrollBar
@ -51,14 +51,14 @@ MainWindow
margin-top: 3 margin-top: 3
padding: 1 padding: 1
focusable: false focusable: false
TextEdit TextEdit
id: ignoreNameEdit id: ignoreNameEdit
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: parent.left anchors.left: parent.left
width: 110 width: 110
margin-top: 5 margin-top: 5
Button Button
id: buttonIgnoreAdd id: buttonIgnoreAdd
!text: tr('Add') !text: tr('Add')
@ -67,7 +67,7 @@ MainWindow
margin-left: 5 margin-left: 5
anchors.top: prev.top anchors.top: prev.top
anchors.left: prev.right anchors.left: prev.right
Button Button
id: buttonIgnoreRemove id: buttonIgnoreRemove
!text: tr('Remove') !text: tr('Remove')
@ -90,7 +90,7 @@ MainWindow
anchors.top: prev.bottom anchors.top: prev.bottom
width: 180 width: 180
margin-top: 5 margin-top: 5
CheckBox CheckBox
id: checkboxIgnoreYelling id: checkboxIgnoreYelling
!text: tr('Ignore Yelling') !text: tr('Ignore Yelling')
@ -98,7 +98,7 @@ MainWindow
anchors.top: prev.bottom anchors.top: prev.bottom
width: 180 width: 180
margin-top: 5 margin-top: 5
CheckBox CheckBox
id: checkboxUseWhiteList id: checkboxUseWhiteList
!text: tr('Activate whitelist') !text: tr('Activate whitelist')
@ -106,13 +106,13 @@ MainWindow
anchors.left: ignoreList.right anchors.left: ignoreList.right
margin-left: 20 margin-left: 20
width: 180 width: 180
Label Label
!text: tr('Allowed Players:') !text: tr('Allowed Players:')
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: prev.left anchors.left: prev.left
margin-top: 10 margin-top: 10
TextList TextList
id: whiteList id: whiteList
vertical-scrollbar: whiteListScrollBar vertical-scrollbar: whiteListScrollBar
@ -124,14 +124,14 @@ MainWindow
margin-top: 3 margin-top: 3
padding: 1 padding: 1
focusable: false focusable: false
TextEdit TextEdit
id: whitelistNameEdit id: whitelistNameEdit
anchors.top: prev.bottom anchors.top: prev.bottom
anchors.left: prev.left anchors.left: prev.left
width: 110 width: 110
margin-top: 5 margin-top: 5
Button Button
id: buttonWhitelistAdd id: buttonWhitelistAdd
!text: tr('Add') !text: tr('Add')
@ -140,7 +140,7 @@ MainWindow
margin-left: 5 margin-left: 5
anchors.top: prev.top anchors.top: prev.top
anchors.left: prev.right anchors.left: prev.right
Button Button
id: buttonWhitelistRemove id: buttonWhitelistRemove
!text: tr('Remove') !text: tr('Remove')
@ -149,7 +149,7 @@ MainWindow
margin-left: 5 margin-left: 5
anchors.top: prev.top anchors.top: prev.top
anchors.left: prev.right anchors.left: prev.right
Label Label
!text: tr('Global whitelist settings') !text: tr('Global whitelist settings')
anchors.left: whiteList.left anchors.left: whiteList.left
@ -163,17 +163,17 @@ MainWindow
anchors.top: prev.bottom anchors.top: prev.bottom
width: 180 width: 180
margin-top: 5 margin-top: 5
Panel Panel
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
height: 30 height: 30
Panel Panel
size: 160 30 size: 160 30
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Button Button
id: buttonSave id: buttonSave
!text: tr('Save') !text: tr('Save')
@ -196,7 +196,7 @@ MainWindow
anchors.right: ignoreList.right anchors.right: ignoreList.right
step: 14 step: 14
pixels-scroll: true pixels-scroll: true
VerticalScrollBar VerticalScrollBar
id: whiteListScrollBar id: whiteListScrollBar
anchors.top: whiteList.top anchors.top: whiteList.top

@ -175,7 +175,7 @@ end
function disableChat() function disableChat()
local gameInterface = modules.game_interface local gameInterface = modules.game_interface
consoleTextEdit:setVisible(false) consoleTextEdit:setVisible(false)
consoleTextEdit:setText("") consoleTextEdit:setText("")
@ -220,11 +220,11 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+H') g_keyboard.unbindKeyDown('Ctrl+H')
saveCommunicationSettings() saveCommunicationSettings()
if channelsWindow then if channelsWindow then
channelsWindow:destroy() channelsWindow:destroy()
end end
if communicationWindow then if communicationWindow then
communicationWindow:destroy() communicationWindow:destroy()
end end
@ -232,7 +232,7 @@ function terminate()
if violationWindow then if violationWindow then
violationWindow:destroy() violationWindow:destroy()
end end
consolePanel:destroy() consolePanel:destroy()
ownPrivateName = nil ownPrivateName = nil
@ -363,7 +363,7 @@ function addTab(name, focus)
end end
function removeTab(tab) function removeTab(tab)
if type(tab) == 'string' then if type(tab) == 'string' then
tab = consoleTabBar:getTab(tab) tab = consoleTabBar:getTab(tab)
end end
@ -824,7 +824,7 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
end end
if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end if ignoreNpcMessages and mode == MessageModes.NpcFrom then return end
speaktype = SpeakTypes[mode] speaktype = SpeakTypes[mode]
if not speaktype then if not speaktype then
@ -833,10 +833,10 @@ function onTalk(name, level, mode, message, channelId, creaturePos)
end end
local localPlayer = g_game.getLocalPlayer() local localPlayer = g_game.getLocalPlayer()
if name ~= g_game.getCharacterName() if name ~= g_game.getCharacterName()
and isUsingIgnoreList() and isUsingIgnoreList()
and not(isUsingWhiteList()) or (isUsingWhiteList() and not(isWhitelisted(name)) and not(isAllowingVIPs() and localPlayer:hasVip(name))) then and not(isUsingWhiteList()) or (isUsingWhiteList() and not(isWhitelisted(name)) and not(isAllowingVIPs() and localPlayer:hasVip(name))) then
if mode == MessageModes.Yell and isIgnoringYelling() then if mode == MessageModes.Yell and isIgnoringYelling() then
return return
elseif speaktype.private and isIgnoringPrivate() and mode ~= MessageModes.NpcFrom then elseif speaktype.private and isIgnoringPrivate() and mode ~= MessageModes.NpcFrom then
@ -1042,16 +1042,16 @@ end
function saveCommunicationSettings() function saveCommunicationSettings()
local tmpIgnoreList = {} local tmpIgnoreList = {}
local ignoredPlayers = getIgnoredPlayers() local ignoredPlayers = getIgnoredPlayers()
for i = 1, #ignoredPlayers do for i = 1, #ignoredPlayers do
table.insert(tmpIgnoreList, ignoredPlayers[i]) table.insert(tmpIgnoreList, ignoredPlayers[i])
end end
local tmpWhiteList = {} local tmpWhiteList = {}
local whitelistedPlayers = getWhitelistedPlayers() local whitelistedPlayers = getWhitelistedPlayers()
for i = 1, #whitelistedPlayers do for i = 1, #whitelistedPlayers do
table.insert(tmpWhiteList, whitelistedPlayers[i]) table.insert(tmpWhiteList, whitelistedPlayers[i])
end end
g_settings.set('UseIgnoreList', communicationSettings.useIgnoreList) g_settings.set('UseIgnoreList', communicationSettings.useIgnoreList)
g_settings.set('UseWhiteList', communicationSettings.useWhiteList) g_settings.set('UseWhiteList', communicationSettings.useWhiteList)
g_settings.set('IgnorePrivateMessages', communicationSettings.privateMessages) g_settings.set('IgnorePrivateMessages', communicationSettings.privateMessages)
@ -1119,7 +1119,7 @@ function onClickIgnoreButton()
local ignoreListPanel = communicationWindow:getChildById('ignoreList') local ignoreListPanel = communicationWindow:getChildById('ignoreList')
local whiteListPanel = communicationWindow:getChildById('whiteList') local whiteListPanel = communicationWindow:getChildById('whiteList')
communicationWindow.onDestroy = function() communicationWindow = nil end communicationWindow.onDestroy = function() communicationWindow = nil end
local useIgnoreListBox = communicationWindow:getChildById('checkboxUseIgnoreList') local useIgnoreListBox = communicationWindow:getChildById('checkboxUseIgnoreList')
useIgnoreListBox:setChecked(communicationSettings.useIgnoreList) useIgnoreListBox:setChecked(communicationSettings.useIgnoreList)
local useWhiteListBox = communicationWindow:getChildById('checkboxUseWhiteList') local useWhiteListBox = communicationWindow:getChildById('checkboxUseWhiteList')
@ -1128,8 +1128,8 @@ function onClickIgnoreButton()
local removeIgnoreButton = communicationWindow:getChildById('buttonIgnoreRemove') local removeIgnoreButton = communicationWindow:getChildById('buttonIgnoreRemove')
removeIgnoreButton:disable() removeIgnoreButton:disable()
ignoreListPanel.onChildFocusChange = function() removeIgnoreButton:enable() end ignoreListPanel.onChildFocusChange = function() removeIgnoreButton:enable() end
removeIgnoreButton.onClick = function() removeIgnoreButton.onClick = function()
local selection = ignoreListPanel:getFocusedChild() local selection = ignoreListPanel:getFocusedChild()
if selection then if selection then
ignoreListPanel:removeChild(selection) ignoreListPanel:removeChild(selection)
selection:destroy() selection:destroy()
@ -1140,19 +1140,19 @@ function onClickIgnoreButton()
local removeWhitelistButton = communicationWindow:getChildById('buttonWhitelistRemove') local removeWhitelistButton = communicationWindow:getChildById('buttonWhitelistRemove')
removeWhitelistButton:disable() removeWhitelistButton:disable()
whiteListPanel.onChildFocusChange = function() removeWhitelistButton:enable() end whiteListPanel.onChildFocusChange = function() removeWhitelistButton:enable() end
removeWhitelistButton.onClick = function() removeWhitelistButton.onClick = function()
local selection = whiteListPanel:getFocusedChild() local selection = whiteListPanel:getFocusedChild()
if selection then if selection then
whiteListPanel:removeChild(selection) whiteListPanel:removeChild(selection)
selection:destroy() selection:destroy()
end end
removeWhitelistButton:disable() removeWhitelistButton:disable()
end end
local newlyIgnoredPlayers = {} local newlyIgnoredPlayers = {}
local addIgnoreName = communicationWindow:getChildById('ignoreNameEdit') local addIgnoreName = communicationWindow:getChildById('ignoreNameEdit')
local addIgnoreButton = communicationWindow:getChildById('buttonIgnoreAdd') local addIgnoreButton = communicationWindow:getChildById('buttonIgnoreAdd')
local addIgnoreFunction = function() local addIgnoreFunction = function()
local newEntry = addIgnoreName:getText() local newEntry = addIgnoreName:getText()
if newEntry == '' then return end if newEntry == '' then return end
if table.find(getIgnoredPlayers(), newEntry) then return end if table.find(getIgnoredPlayers(), newEntry) then return end
@ -1186,14 +1186,14 @@ function onClickIgnoreButton()
addIgnoreFunction() addIgnoreFunction()
end end
end end
local ignorePrivateMessageBox = communicationWindow:getChildById('checkboxIgnorePrivateMessages') local ignorePrivateMessageBox = communicationWindow:getChildById('checkboxIgnorePrivateMessages')
ignorePrivateMessageBox:setChecked(communicationSettings.privateMessages) ignorePrivateMessageBox:setChecked(communicationSettings.privateMessages)
local ignoreYellingBox = communicationWindow:getChildById('checkboxIgnoreYelling') local ignoreYellingBox = communicationWindow:getChildById('checkboxIgnoreYelling')
ignoreYellingBox:setChecked(communicationSettings.yelling) ignoreYellingBox:setChecked(communicationSettings.yelling)
local allowVIPsBox = communicationWindow:getChildById('checkboxAllowVIPs') local allowVIPsBox = communicationWindow:getChildById('checkboxAllowVIPs')
allowVIPsBox:setChecked(communicationSettings.allowVIPs) allowVIPsBox:setChecked(communicationSettings.allowVIPs)
local saveButton = communicationWindow:recursiveGetChildById('buttonSave') local saveButton = communicationWindow:recursiveGetChildById('buttonSave')
saveButton.onClick = function() saveButton.onClick = function()
communicationSettings.ignoredPlayers = {} communicationSettings.ignoredPlayers = {}
@ -1205,7 +1205,7 @@ function onClickIgnoreButton()
for i = 1, whiteListPanel:getChildCount() do for i = 1, whiteListPanel:getChildCount() do
addWhitelistedPlayer(whiteListPanel:getChildByIndex(i):getText()) addWhitelistedPlayer(whiteListPanel:getChildByIndex(i):getText())
end end
communicationSettings.useIgnoreList = useIgnoreListBox:isChecked() communicationSettings.useIgnoreList = useIgnoreListBox:isChecked()
communicationSettings.useWhiteList = useWhiteListBox:isChecked() communicationSettings.useWhiteList = useWhiteListBox:isChecked()
communicationSettings.yelling = ignoreYellingBox:isChecked() communicationSettings.yelling = ignoreYellingBox:isChecked()
@ -1213,18 +1213,18 @@ function onClickIgnoreButton()
communicationSettings.allowVIPs = allowVIPsBox:isChecked() communicationSettings.allowVIPs = allowVIPsBox:isChecked()
communicationWindow:destroy() communicationWindow:destroy()
end end
local cancelButton = communicationWindow:recursiveGetChildById('buttonCancel') local cancelButton = communicationWindow:recursiveGetChildById('buttonCancel')
cancelButton.onClick = function() cancelButton.onClick = function()
communicationWindow:destroy() communicationWindow:destroy()
end end
local ignoredPlayers = getIgnoredPlayers() local ignoredPlayers = getIgnoredPlayers()
for i = 1, #ignoredPlayers do for i = 1, #ignoredPlayers do
local label = g_ui.createWidget('IgnoreListLabel', ignoreListPanel) local label = g_ui.createWidget('IgnoreListLabel', ignoreListPanel)
label:setText(ignoredPlayers[i]) label:setText(ignoredPlayers[i])
end end
local whitelistedPlayers = getWhitelistedPlayers() local whitelistedPlayers = getWhitelistedPlayers()
for i = 1, #whitelistedPlayers do for i = 1, #whitelistedPlayers do
local label = g_ui.createWidget('WhiteListLabel', whiteListPanel) local label = g_ui.createWidget('WhiteListLabel', whiteListPanel)

@ -133,7 +133,7 @@ Panel
margin-right: 5 margin-right: 5
margin-top: 6 margin-top: 6
@onClick: onClickIgnoreButton() @onClick: onClickIgnoreButton()
Panel Panel
id: consoleContentPanel id: consoleContentPanel
anchors.top: prev.bottom anchors.top: prev.bottom

@ -20,8 +20,8 @@ function init()
cooldownWindow = g_ui.loadUI('cooldown', modules.game_interface.getRightPanel()) cooldownWindow = g_ui.loadUI('cooldown', modules.game_interface.getRightPanel())
cooldownWindow:disableResize() cooldownWindow:disableResize()
cooldownWindow:setup() cooldownWindow:setup()
contentsPanel = cooldownWindow:getChildById('contentsPanel') contentsPanel = cooldownWindow:getChildById('contentsPanel')
cooldownPanel = contentsPanel:getChildById('cooldownPanel') cooldownPanel = contentsPanel:getChildById('cooldownPanel')
@ -47,10 +47,10 @@ end
function loadIcon(iconId) function loadIcon(iconId)
local spell, profile, spellName = Spells.getSpellByIcon(iconId) local spell, profile, spellName = Spells.getSpellByIcon(iconId)
if not spellName then return end if not spellName then return end
clientIconId = Spells.getClientId(spellName) clientIconId = Spells.getClientId(spellName)
if not clientIconId then return end if not clientIconId then return end
local icon = cooldownPanel:getChildById(iconId) local icon = cooldownPanel:getChildById(iconId)
if not icon then if not icon then
icon = g_ui.createWidget('SpellIcon') icon = g_ui.createWidget('SpellIcon')
@ -109,7 +109,7 @@ function turnOffCooldown(progressRect)
progressRect.icon:setOn(false) progressRect.icon:setOn(false)
progressRect.icon = nil progressRect.icon = nil
end end
-- create particles -- create particles
--[[local particle = g_ui.createWidget('GroupCooldownParticles', progressRect) --[[local particle = g_ui.createWidget('GroupCooldownParticles', progressRect)
particle:fill('parent') particle:fill('parent')
@ -130,7 +130,7 @@ end
function updateCooldown(progressRect, duration) function updateCooldown(progressRect, duration)
progressRect:setPercent(progressRect:getPercent() + 10000/duration) progressRect:setPercent(progressRect:getPercent() + 10000/duration)
if progressRect:getPercent() < 100 then if progressRect:getPercent() < 100 then
removeEvent(progressRect.event) removeEvent(progressRect.event)
progressRect.event = scheduleEvent(function() progressRect.callback[ProgressCallback.update]() end, 100) progressRect.event = scheduleEvent(function() progressRect.callback[ProgressCallback.update]() end, 100)

@ -6,7 +6,7 @@ SpellGroupIcon < UIWidget
margin-top: 3 margin-top: 3
SpellIcon < UIWidget SpellIcon < UIWidget
size: 24 24 size: 24 24
image-size: 24 24 image-size: 24 24
focusable: false focusable: false
@ -20,7 +20,7 @@ SpellProgressRect < UIProgressRect
GroupCooldownParticles < UIParticles GroupCooldownParticles < UIParticles
effect: groupcooldown-effect effect: groupcooldown-effect
MiniWindow MiniWindow
id: cooldownWindow id: cooldownWindow
!text: tr('Spell Cooldowns') !text: tr('Spell Cooldowns')
@ -28,7 +28,7 @@ MiniWindow
icon: /images/topbuttons/cooldowns icon: /images/topbuttons/cooldowns
@onClose: modules.game_cooldown.onMiniWindowClose() @onClose: modules.game_cooldown.onMiniWindowClose()
&save: true &save: true
MiniWindowContents MiniWindowContents
SpellGroupIcon SpellGroupIcon
id: groupIconAttack id: groupIconAttack
@ -97,4 +97,4 @@ MiniWindow
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
background-color: #ffffff11 background-color: #ffffff11

@ -14,7 +14,7 @@ ManaBar < ProgressBar
anchors.right: parent.right anchors.right: parent.right
margin: 1 margin: 1
margin-top: 3 margin-top: 3
ExperienceBar < ProgressBar ExperienceBar < ProgressBar
id: experienceBar id: experienceBar
background-color: #B6E866 background-color: #B6E866

@ -72,7 +72,7 @@ function init()
g_keyboard.bindKeyPress('Down', function() currentHotkeys:focusNextChild(KeyboardFocusReason) end, hotkeysWindow) g_keyboard.bindKeyPress('Down', function() currentHotkeys:focusNextChild(KeyboardFocusReason) end, hotkeysWindow)
g_keyboard.bindKeyPress('Up', function() currentHotkeys:focusPreviousChild(KeyboardFocusReason) end, hotkeysWindow) g_keyboard.bindKeyPress('Up', function() currentHotkeys:focusPreviousChild(KeyboardFocusReason) end, hotkeysWindow)
connect(g_game, { connect(g_game, {
onGameStart = online, onGameStart = online,
onGameEnd = offline onGameEnd = offline
}) })
@ -386,7 +386,7 @@ function doKeyCombo(keyCombo)
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
if item then if item then
g_game.use(item) g_game.use(item)
end end
else else
g_game.useInventoryItem(hotKey.itemId) g_game.useInventoryItem(hotKey.itemId)
end end
@ -395,7 +395,7 @@ function doKeyCombo(keyCombo)
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
if item then if item then
g_game.useWith(item, g_game.getLocalPlayer()) g_game.useWith(item, g_game.getLocalPlayer())
end end
else else
g_game.useInventoryItemWith(hotKey.itemId, g_game.getLocalPlayer()) g_game.useInventoryItemWith(hotKey.itemId, g_game.getLocalPlayer())
end end
@ -418,7 +418,7 @@ function doKeyCombo(keyCombo)
local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) local item = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
if item then if item then
g_game.useWith(item, attackingCreature) g_game.useWith(item, attackingCreature)
end end
else else
g_game.useInventoryItemWith(hotKey.itemId, attackingCreature) g_game.useInventoryItemWith(hotKey.itemId, attackingCreature)
end end
@ -426,7 +426,7 @@ function doKeyCombo(keyCombo)
local item = Item.create(hotKey.itemId) local item = Item.create(hotKey.itemId)
if g_game.getProtocolVersion() < 780 or hotKey.subType then if g_game.getProtocolVersion() < 780 or hotKey.subType then
local tmpItem = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1) local tmpItem = g_game.findPlayerItem(hotKey.itemId, hotKey.subType or -1)
if not tmpItem then return true end if not tmpItem then return true end
item = tmpItem item = tmpItem
end end
modules.game_interface.startUseWith(item) modules.game_interface.startUseWith(item)

@ -42,7 +42,7 @@ function init()
gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel') gameBottomPanel = gameRootPanel:getChildById('gameBottomPanel')
connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange }) connect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'), logoutButton = modules.client_topmenu.addLeftButton('logoutButton', tr('Exit'),
'/images/topbuttons/logout', tryLogout, true) '/images/topbuttons/logout', tryLogout, true)
setupViewMode(0) setupViewMode(0)
@ -158,7 +158,7 @@ end
function hide() function hide()
disconnect(g_app, { onClose = tryExit }) disconnect(g_app, { onClose = tryExit })
logoutButton:setTooltip(tr('Exit')) logoutButton:setTooltip(tr('Exit'))
if logoutWindow then if logoutWindow then
logoutWindow:destroy() logoutWindow:destroy()
logoutWindow = nil logoutWindow = nil
@ -235,7 +235,7 @@ function tryLogout(prompt)
if not g_game.isConnectionOk() then if not g_game.isConnectionOk() then
msg = 'Your connection is failing, if you logout now your character will be still online, do you want to force logout?' msg = 'Your connection is failing, if you logout now your character will be still online, do you want to force logout?'
yesCallback = function() yesCallback = function()
g_game.forceLogout() g_game.forceLogout()
if logoutWindow then if logoutWindow then
logoutWindow:destroy() logoutWindow:destroy()
@ -486,7 +486,7 @@ function createThingMenu(menuPosition, lookThing, useThing, creatureThing)
else else
menu:addOption(tr('Stop Attack'), function() g_game.cancelAttack() end, shortcut) menu:addOption(tr('Stop Attack'), function() g_game.cancelAttack() end, shortcut)
end end
if g_game.getFollowingCreature() ~= creatureThing then if g_game.getFollowingCreature() ~= creatureThing then
menu:addOption(tr('Follow'), function() g_game.follow(creatureThing) end) menu:addOption(tr('Follow'), function() g_game.follow(creatureThing) end)
else else

@ -60,9 +60,9 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
if not self.allowNextRelease then if not self.allowNextRelease then
return true return true
end end
local autoWalkPos = self:getPosition(mousePosition) local autoWalkPos = self:getPosition(mousePosition)
-- happens when clicking outside of map boundaries -- happens when clicking outside of map boundaries
if not autoWalkPos then return false end if not autoWalkPos then return false end
@ -73,7 +73,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
autoWalkPos.y = autoWalkPos.y + dz autoWalkPos.y = autoWalkPos.y + dz
autoWalkPos.z = localPlayerPos.z autoWalkPos.z = localPlayerPos.z
end end
local lookThing local lookThing
local useThing local useThing
local creatureThing local creatureThing
@ -85,8 +85,8 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton)
lookThing = tile:getTopLookThing() lookThing = tile:getTopLookThing()
useThing = tile:getTopUseThing() useThing = tile:getTopUseThing()
creatureThing = tile:getTopCreature() creatureThing = tile:getTopCreature()
end end
local autoWalkTile = g_map.getTile(autoWalkPos) local autoWalkTile = g_map.getTile(autoWalkPos)
if autoWalkTile then if autoWalkTile then
attackCreature = autoWalkTile:getTopCreature() attackCreature = autoWalkTile:getTopCreature()

@ -1,6 +1,6 @@
--[[ --[[
Finalizing Market: Finalizing Market:
Note: Feel free to work on any area and submit Note: Feel free to work on any area and submit
it as a pull request from your git fork. it as a pull request from your git fork.
BeniS's Skype: benjiz69 BeniS's Skype: benjiz69
@ -11,7 +11,7 @@
- Offer History - Offer History
* Clean up the interface building * Clean up the interface building
- Add a new market interface file to handle building? - Add a new market interface file to handle building?
* Add offer table column ordering. * Add offer table column ordering.
- Player Name, Amount, Total Price, Peice Price and Ends At - Player Name, Amount, Total Price, Peice Price and Ends At
@ -251,7 +251,7 @@ local function updateOffers(offers)
-- clear existing offer data -- clear existing offer data
buyOfferTable:clearData() buyOfferTable:clearData()
sellOfferTable:clearData() sellOfferTable:clearData()
sellButton:setEnabled(false) sellButton:setEnabled(false)
buyButton:setEnabled(false) buyButton:setEnabled(false)
@ -431,7 +431,7 @@ local function openAmountWindow(callback, type, actionText)
widget:setText(tostring(value*selectedOffer[type]:getPrice())..'gp') widget:setText(tostring(value*selectedOffer[type]:getPrice())..'gp')
itembox:setText(tostring(value)) itembox:setText(tostring(value))
end end
local okButton = amountWindow:getChildById('buttonOk') local okButton = amountWindow:getChildById('buttonOk')
if actionText ~= '' then if actionText ~= '' then
okButton:setText(actionText) okButton:setText(actionText)
@ -814,7 +814,7 @@ function Market.enableCreateOffer(enable)
local prevAmountButton = marketOffersPanel:recursiveGetChildById('prevAmountButton') local prevAmountButton = marketOffersPanel:recursiveGetChildById('prevAmountButton')
local nextAmountButton = marketOffersPanel:recursiveGetChildById('nextAmountButton') local nextAmountButton = marketOffersPanel:recursiveGetChildById('nextAmountButton')
prevAmountButton:setEnabled(enable) prevAmountButton:setEnabled(enable)
nextAmountButton:setEnabled(enable) nextAmountButton:setEnabled(enable)
end end
@ -1076,7 +1076,7 @@ function Market.onMarketEnter(depotItems, offers, balance, vocation)
Market.clearSelectedItem() Market.clearSelectedItem()
updateBalance(balance) updateBalance(balance)
information.totalOffers = offers information.totalOffers = offers
local player = g_game.getLocalPlayer() local player = g_game.getLocalPlayer()
if player then if player then
@ -1101,7 +1101,7 @@ function Market.onMarketEnter(depotItems, offers, balance, vocation)
else else
Market.refreshItemsWidget() Market.refreshItemsWidget()
end end
if table.empty(currentItems) then if table.empty(currentItems) then
Market.loadMarketItems(MarketCategory.First) Market.loadMarketItems(MarketCategory.First)
end end

@ -8,7 +8,7 @@ FlagButton < CheckBox
icon-size: 11 11 icon-size: 11 11
icon-clip: 0 0 11 11 icon-clip: 0 0 11 11
icon-offset: 2 4 icon-offset: 2 4
text: text:
$!checked: $!checked:
image-clip: 26 0 26 26 image-clip: 26 0 26 26
@ -54,7 +54,7 @@ FlagWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
FlagButton FlagButton
id: flag2 id: flag2
@ -116,7 +116,7 @@ FlagWindow < MainWindow
anchors.left: parent.left anchors.left: parent.left
anchors.top: prev.bottom anchors.top: prev.bottom
margin-top: 6 margin-top: 6
margin-left: 0 margin-left: 0
FlagButton FlagButton
id: flag12 id: flag12

@ -31,15 +31,15 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c
end end
modalDialog = g_ui.createWidget('ModalDialog', rootWidget) modalDialog = g_ui.createWidget('ModalDialog', rootWidget)
local messageLabel = modalDialog:getChildById('messageLabel') local messageLabel = modalDialog:getChildById('messageLabel')
local choiceList = modalDialog:getChildById('choiceList') local choiceList = modalDialog:getChildById('choiceList')
local choiceScrollbar = modalDialog:getChildById('choiceScrollBar') local choiceScrollbar = modalDialog:getChildById('choiceScrollBar')
local buttonList = modalDialog:getChildById('buttonList') local buttonList = modalDialog:getChildById('buttonList')
modalDialog:setText(title) modalDialog:setText(title)
messageLabel:setText(message) messageLabel:setText(message)
local horizontalPadding = modalDialog:getPaddingLeft() + modalDialog:getPaddingRight() local horizontalPadding = modalDialog:getPaddingLeft() + modalDialog:getPaddingRight()
modalDialog:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth))) modalDialog:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth)))
messageLabel:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth)) - horizontalPadding) messageLabel:setWidth(math.min(modalDialog.maximumWidth, math.max(messageLabel:getWidth(), modalDialog.minimumWidth)) - horizontalPadding)
@ -48,7 +48,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c
for i = 1, #choices do for i = 1, #choices do
local choiceId = choices[i][1] local choiceId = choices[i][1]
local choiceName = choices[i][2] local choiceName = choices[i][2]
local label = g_ui.createWidget('ChoiceListLabel', choiceList) local label = g_ui.createWidget('ChoiceListLabel', choiceList)
label.choiceId = choiceId label.choiceId = choiceId
label:setText(choiceName) label:setText(choiceName)
@ -99,7 +99,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c
g_game.answerModalDialog(id, enterButton, choice) g_game.answerModalDialog(id, enterButton, choice)
destroyDialog() destroyDialog()
end end
local escapeFunc = function() local escapeFunc = function()
local focusedChoice = choiceList:getFocusedChild() local focusedChoice = choiceList:getFocusedChild()
local choice = 0xFF local choice = 0xFF
@ -111,7 +111,7 @@ function onModalDialog(id, title, message, buttons, enterButton, escapeButton, c
end end
choiceList.onDoubleClick = enterFunc choiceList.onDoubleClick = enterFunc
modalDialog.onEnter = enterFunc modalDialog.onEnter = enterFunc
modalDialog.onEscape = escapeFunc modalDialog.onEscape = escapeFunc
end end

@ -180,7 +180,7 @@ function itemPopup(self, mousePosition, mouseButton)
menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self:getItem()) end) menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self:getItem()) end)
menu:display(mousePosition) menu:display(mousePosition)
return true return true
elseif ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) elseif ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton)
or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
cancelNextRelease = true cancelNextRelease = true
g_game.inspectNpcTrade(self:getItem()) g_game.inspectNpcTrade(self:getItem())
@ -438,7 +438,7 @@ function onPlayerGoods(money, items)
playerItems[id] = playerItems[id] + item[2] playerItems[id] = playerItems[id] + item[2]
end end
end end
refreshPlayerGoods() refreshPlayerGoods()
end end
@ -480,7 +480,7 @@ end
function checkSellAllTooltip() function checkSellAllTooltip()
sellAllButton:setEnabled(true) sellAllButton:setEnabled(true)
sellAllButton:removeTooltip() sellAllButton:removeTooltip()
local total = 0 local total = 0
local info = '' local info = ''
local first = true local first = true

@ -50,7 +50,7 @@ function create(creatureOutfit, outfitList, creatureMount, mountList)
if outfitWindow and not outfitWindow:isHidden() then if outfitWindow and not outfitWindow:isHidden() then
return return
end end
outfitCreature = creatureOutfit outfitCreature = creatureOutfit
mountCreature = creatureMount mountCreature = creatureMount
outfits = outfitList outfits = outfitList

@ -233,7 +233,7 @@ end
function checkExpSpeed() function checkExpSpeed()
local player = g_game.getLocalPlayer() local player = g_game.getLocalPlayer()
if not player then return end if not player then return end
local currentExp = player:getExperience() local currentExp = player:getExperience()
local currentTime = g_clock.seconds() local currentTime = g_clock.seconds()
if player.lastExps ~= nil then if player.lastExps ~= nil then

@ -53,8 +53,8 @@ FILTER_GROUP_SUPPORT = 3
local filters = { local filters = {
level = false, level = false,
vocation = false, vocation = false,
vocationId = FILTER_VOCATION_ANY, vocationId = FILTER_VOCATION_ANY,
premium = FILTER_PREMIUM_ANY, premium = FILTER_PREMIUM_ANY,
groupId = FILTER_GROUP_ANY groupId = FILTER_GROUP_ANY
} }
@ -65,7 +65,7 @@ end
function setSpelllistProfile(name) function setSpelllistProfile(name)
if SpelllistProfile == name then return end if SpelllistProfile == name then return end
if SpelllistSettings[name] and SpellInfo[name] then if SpelllistSettings[name] and SpellInfo[name] then
local oldProfile = SpelllistProfile local oldProfile = SpelllistProfile
SpelllistProfile = name SpelllistProfile = name
@ -95,13 +95,13 @@ end
function init() function init()
connect(g_game, { onGameStart = online, connect(g_game, { onGameStart = online,
onGameEnd = offline }) onGameEnd = offline })
spelllistWindow = g_ui.displayUI('spelllist', modules.game_interface.getRightPanel()) spelllistWindow = g_ui.displayUI('spelllist', modules.game_interface.getRightPanel())
spelllistWindow:hide() spelllistWindow:hide()
spelllistButton = modules.client_topmenu.addRightGameToggleButton('spelllistButton', tr('Spell List'), '/images/topbuttons/spelllist', toggle) spelllistButton = modules.client_topmenu.addRightGameToggleButton('spelllistButton', tr('Spell List'), '/images/topbuttons/spelllist', toggle)
spelllistButton:setOn(false) spelllistButton:setOn(false)
nameValueLabel = spelllistWindow:getChildById('labelNameValue') nameValueLabel = spelllistWindow:getChildById('labelNameValue')
formulaValueLabel = spelllistWindow:getChildById('labelFormulaValue') formulaValueLabel = spelllistWindow:getChildById('labelFormulaValue')
vocationValueLabel = spelllistWindow:getChildById('labelVocationValue') vocationValueLabel = spelllistWindow:getChildById('labelVocationValue')
@ -112,18 +112,18 @@ function init()
manaValueLabel = spelllistWindow:getChildById('labelManaValue') manaValueLabel = spelllistWindow:getChildById('labelManaValue')
premiumValueLabel = spelllistWindow:getChildById('labelPremiumValue') premiumValueLabel = spelllistWindow:getChildById('labelPremiumValue')
descriptionValueLabel = spelllistWindow:getChildById('labelDescriptionValue') descriptionValueLabel = spelllistWindow:getChildById('labelDescriptionValue')
vocationBoxAny = spelllistWindow:getChildById('vocationBoxAny') vocationBoxAny = spelllistWindow:getChildById('vocationBoxAny')
vocationBoxSorcerer = spelllistWindow:getChildById('vocationBoxSorcerer') vocationBoxSorcerer = spelllistWindow:getChildById('vocationBoxSorcerer')
vocationBoxDruid = spelllistWindow:getChildById('vocationBoxDruid') vocationBoxDruid = spelllistWindow:getChildById('vocationBoxDruid')
vocationBoxPaladin = spelllistWindow:getChildById('vocationBoxPaladin') vocationBoxPaladin = spelllistWindow:getChildById('vocationBoxPaladin')
vocationBoxKnight = spelllistWindow:getChildById('vocationBoxKnight') vocationBoxKnight = spelllistWindow:getChildById('vocationBoxKnight')
groupBoxAny = spelllistWindow:getChildById('groupBoxAny') groupBoxAny = spelllistWindow:getChildById('groupBoxAny')
groupBoxAttack = spelllistWindow:getChildById('groupBoxAttack') groupBoxAttack = spelllistWindow:getChildById('groupBoxAttack')
groupBoxHealing = spelllistWindow:getChildById('groupBoxHealing') groupBoxHealing = spelllistWindow:getChildById('groupBoxHealing')
groupBoxSupport = spelllistWindow:getChildById('groupBoxSupport') groupBoxSupport = spelllistWindow:getChildById('groupBoxSupport')
premiumBoxAny = spelllistWindow:getChildById('premiumBoxAny') premiumBoxAny = spelllistWindow:getChildById('premiumBoxAny')
premiumBoxYes = spelllistWindow:getChildById('premiumBoxYes') premiumBoxYes = spelllistWindow:getChildById('premiumBoxYes')
premiumBoxNo = spelllistWindow:getChildById('premiumBoxNo') premiumBoxNo = spelllistWindow:getChildById('premiumBoxNo')
@ -134,32 +134,32 @@ function init()
vocationRadioGroup:addWidget(vocationBoxDruid) vocationRadioGroup:addWidget(vocationBoxDruid)
vocationRadioGroup:addWidget(vocationBoxPaladin) vocationRadioGroup:addWidget(vocationBoxPaladin)
vocationRadioGroup:addWidget(vocationBoxKnight) vocationRadioGroup:addWidget(vocationBoxKnight)
groupRadioGroup = UIRadioGroup.create() groupRadioGroup = UIRadioGroup.create()
groupRadioGroup:addWidget(groupBoxAny) groupRadioGroup:addWidget(groupBoxAny)
groupRadioGroup:addWidget(groupBoxAttack) groupRadioGroup:addWidget(groupBoxAttack)
groupRadioGroup:addWidget(groupBoxHealing) groupRadioGroup:addWidget(groupBoxHealing)
groupRadioGroup:addWidget(groupBoxSupport) groupRadioGroup:addWidget(groupBoxSupport)
premiumRadioGroup = UIRadioGroup.create() premiumRadioGroup = UIRadioGroup.create()
premiumRadioGroup:addWidget(premiumBoxAny) premiumRadioGroup:addWidget(premiumBoxAny)
premiumRadioGroup:addWidget(premiumBoxYes) premiumRadioGroup:addWidget(premiumBoxYes)
premiumRadioGroup:addWidget(premiumBoxNo) premiumRadioGroup:addWidget(premiumBoxNo)
premiumRadioGroup:selectWidget(premiumBoxAny) premiumRadioGroup:selectWidget(premiumBoxAny)
vocationRadioGroup:selectWidget(vocationBoxAny) vocationRadioGroup:selectWidget(vocationBoxAny)
groupRadioGroup:selectWidget(groupBoxAny) groupRadioGroup:selectWidget(groupBoxAny)
vocationRadioGroup.onSelectionChange = toggleFilter vocationRadioGroup.onSelectionChange = toggleFilter
groupRadioGroup.onSelectionChange = toggleFilter groupRadioGroup.onSelectionChange = toggleFilter
premiumRadioGroup.onSelectionChange = toggleFilter premiumRadioGroup.onSelectionChange = toggleFilter
spellList = spelllistWindow:getChildById('spellList') spellList = spelllistWindow:getChildById('spellList')
g_keyboard.bindKeyPress('Down', function() spellList:focusNextChild(KeyboardFocusReason) end, spelllistWindow) g_keyboard.bindKeyPress('Down', function() spellList:focusNextChild(KeyboardFocusReason) end, spelllistWindow)
g_keyboard.bindKeyPress('Up', function() spellList:focusPreviousChild(KeyboardFocusReason) end, spelllistWindow) g_keyboard.bindKeyPress('Up', function() spellList:focusPreviousChild(KeyboardFocusReason) end, spelllistWindow)
initialiseSpelllist() initialiseSpelllist()
resizeWindow() resizeWindow()
if g_game.isOnline() then if g_game.isOnline() then
@ -174,11 +174,11 @@ function terminate()
disconnect(spellList, { onChildFocusChange = function(self, focusedChild) disconnect(spellList, { onChildFocusChange = function(self, focusedChild)
if focusedChild == nil then return end if focusedChild == nil then return end
updateSpellInformation(focusedChild) updateSpellInformation(focusedChild)
end }) end })
spelllistWindow:destroy() spelllistWindow:destroy()
spelllistButton:destroy() spelllistButton:destroy()
vocationRadioGroup:destroy() vocationRadioGroup:destroy()
groupRadioGroup:destroy() groupRadioGroup:destroy()
premiumRadioGroup:destroy() premiumRadioGroup:destroy()
@ -188,21 +188,21 @@ function initialiseSpelllist()
for i = 1, #SpelllistSettings[SpelllistProfile].spellOrder do for i = 1, #SpelllistSettings[SpelllistProfile].spellOrder do
local spell = SpelllistSettings[SpelllistProfile].spellOrder[i] local spell = SpelllistSettings[SpelllistProfile].spellOrder[i]
local info = SpellInfo[SpelllistProfile][spell] local info = SpellInfo[SpelllistProfile][spell]
local tmpLabel = g_ui.createWidget('SpellListLabel', spellList) local tmpLabel = g_ui.createWidget('SpellListLabel', spellList)
tmpLabel:setId(spell) tmpLabel:setId(spell)
tmpLabel:setText(spell .. '\n\'' .. info.words .. '\'') tmpLabel:setText(spell .. '\n\'' .. info.words .. '\'')
tmpLabel:setPhantom(false) tmpLabel:setPhantom(false)
local iconId = tonumber(info.icon) local iconId = tonumber(info.icon)
if not iconId and SpellIcons[info.icon] then if not iconId and SpellIcons[info.icon] then
iconId = SpellIcons[info.icon][1] iconId = SpellIcons[info.icon][1]
end end
if not(iconId) then if not(iconId) then
perror('Spell icon \'' .. info.icon .. '\' not found.') perror('Spell icon \'' .. info.icon .. '\' not found.')
end end
tmpLabel:setHeight(SpelllistSettings[SpelllistProfile].iconSize.height + 4) tmpLabel:setHeight(SpelllistSettings[SpelllistProfile].iconSize.height + 4)
tmpLabel:setTextOffset(topoint((SpelllistSettings[SpelllistProfile].iconSize.width + 10) .. ' ' .. (SpelllistSettings[SpelllistProfile].iconSize.height - 32)/2 + 3)) tmpLabel:setTextOffset(topoint((SpelllistSettings[SpelllistProfile].iconSize.width + 10) .. ' ' .. (SpelllistSettings[SpelllistProfile].iconSize.height - 32)/2 + 3))
tmpLabel:setImageSource(SpelllistSettings[SpelllistProfile].iconFile) tmpLabel:setImageSource(SpelllistSettings[SpelllistProfile].iconFile)
@ -210,11 +210,11 @@ function initialiseSpelllist()
tmpLabel:setImageSize(tosize(SpelllistSettings[SpelllistProfile].iconSize.width .. ' ' .. SpelllistSettings[SpelllistProfile].iconSize.height)) tmpLabel:setImageSize(tosize(SpelllistSettings[SpelllistProfile].iconSize.width .. ' ' .. SpelllistSettings[SpelllistProfile].iconSize.height))
tmpLabel.onClick = updateSpellInformation tmpLabel.onClick = updateSpellInformation
end end
connect(spellList, { onChildFocusChange = function(self, focusedChild) connect(spellList, { onChildFocusChange = function(self, focusedChild)
if focusedChild == nil then return end if focusedChild == nil then return end
updateSpellInformation(focusedChild) updateSpellInformation(focusedChild)
end }) end })
end end
function changeSpelllistProfile(oldProfile) function changeSpelllistProfile(oldProfile)
@ -222,10 +222,10 @@ function changeSpelllistProfile(oldProfile)
for i = 1, #SpelllistSettings[oldProfile].spellOrder do for i = 1, #SpelllistSettings[oldProfile].spellOrder do
local spell = SpelllistSettings[oldProfile].spellOrder[i] local spell = SpelllistSettings[oldProfile].spellOrder[i]
local tmpLabel = spellList:getChildById(spell) local tmpLabel = spellList:getChildById(spell)
tmpLabel:destroy() tmpLabel:destroy()
end end
-- Create new spelllist and ajust window -- Create new spelllist and ajust window
initialiseSpelllist() initialiseSpelllist()
setOptions() setOptions()
@ -238,7 +238,7 @@ function updateSpelllist()
local spell = SpelllistSettings[SpelllistProfile].spellOrder[i] local spell = SpelllistSettings[SpelllistProfile].spellOrder[i]
local info = SpellInfo[SpelllistProfile][spell] local info = SpellInfo[SpelllistProfile][spell]
local tmpLabel = spellList:getChildById(spell) local tmpLabel = spellList:getChildById(spell)
local localPlayer = g_game.getLocalPlayer() local localPlayer = g_game.getLocalPlayer()
if (not(filters.level) or info.level <= localPlayer:getLevel()) and (not(filters.vocation) or table.find(info.vocations, localPlayer:getVocation())) and (filters.vocationId == FILTER_VOCATION_ANY or table.find(info.vocations, filters.vocationId) or table.find(info.vocations, filters.vocationId+4)) and (filters.groupId == FILTER_GROUP_ANY or info.group[filters.groupId]) and (filters.premium == FILTER_PREMIUM_ANY or (info.premium and filters.premium == FILTER_PREMIUM_YES) or (not(info.premium) and filters.premium == FILTER_PREMIUM_NO)) then if (not(filters.level) or info.level <= localPlayer:getLevel()) and (not(filters.vocation) or table.find(info.vocations, localPlayer:getVocation())) and (filters.vocationId == FILTER_VOCATION_ANY or table.find(info.vocations, filters.vocationId) or table.find(info.vocations, filters.vocationId+4)) and (filters.groupId == FILTER_GROUP_ANY or info.group[filters.groupId]) and (filters.premium == FILTER_PREMIUM_ANY or (info.premium and filters.premium == FILTER_PREMIUM_YES) or (not(info.premium) and filters.premium == FILTER_PREMIUM_NO)) then
tmpLabel:setVisible(true) tmpLabel:setVisible(true)
@ -250,7 +250,7 @@ end
function updateSpellInformation(widget) function updateSpellInformation(widget)
local spell = widget:getId() local spell = widget:getId()
local name = '' local name = ''
local formula = '' local formula = ''
local vocation = '' local vocation = ''
@ -261,10 +261,10 @@ function updateSpellInformation(widget)
local mana = '' local mana = ''
local premium = '' local premium = ''
local description = '' local description = ''
if SpellInfo[SpelllistProfile][spell] then if SpellInfo[SpelllistProfile][spell] then
local info = SpellInfo[SpelllistProfile][spell] local info = SpellInfo[SpelllistProfile][spell]
name = spell name = spell
formula = info.words formula = info.words
@ -274,7 +274,7 @@ function updateSpellInformation(widget)
vocation = vocation .. (vocation:len() == 0 and '' or ', ') .. VocationNames[vocationId] vocation = vocation .. (vocation:len() == 0 and '' or ', ') .. VocationNames[vocationId]
end end
end end
cooldown = (info.exhaustion / 1000) .. 's' cooldown = (info.exhaustion / 1000) .. 's'
for groupId, groupName in ipairs(SpellGroups) do for groupId, groupName in ipairs(SpellGroups) do
if info.group[groupId] then if info.group[groupId] then
@ -282,14 +282,14 @@ function updateSpellInformation(widget)
cooldown = cooldown .. ' / ' .. (info.group[groupId] / 1000) .. 's' cooldown = cooldown .. ' / ' .. (info.group[groupId] / 1000) .. 's'
end end
end end
type = info.type type = info.type
level = info.level level = info.level
mana = info.mana .. ' / ' .. info.soul mana = info.mana .. ' / ' .. info.soul
premium = (info.premium and 'yes' or 'no') premium = (info.premium and 'yes' or 'no')
description = info.description or '-' description = info.description or '-'
end end
nameValueLabel:setText(name) nameValueLabel:setText(name)
formulaValueLabel:setText(formula) formulaValueLabel:setText(formula)
vocationValueLabel:setText(vocation) vocationValueLabel:setText(vocation)
@ -356,7 +356,7 @@ function toggleFilter(widget, selectedWidget)
widget:setOn(filters.vocation) widget:setOn(filters.vocation)
end end
end end
updateSpelllist() updateSpelllist()
end end
@ -372,16 +372,16 @@ function resetWindow()
-- Resetting filters -- Resetting filters
filters.level = false filters.level = false
filters.vocation = false filters.vocation = false
local buttonFilterLevel = spelllistWindow:getChildById('buttonFilterLevel') local buttonFilterLevel = spelllistWindow:getChildById('buttonFilterLevel')
buttonFilterLevel:setOn(filters.level) buttonFilterLevel:setOn(filters.level)
local buttonFilterVocation = spelllistWindow:getChildById('buttonFilterVocation') local buttonFilterVocation = spelllistWindow:getChildById('buttonFilterVocation')
buttonFilterVocation:setOn(filters.vocation) buttonFilterVocation:setOn(filters.vocation)
vocationRadioGroup:selectWidget(vocationBoxAny) vocationRadioGroup:selectWidget(vocationBoxAny)
groupRadioGroup:selectWidget(groupBoxAny) groupRadioGroup:selectWidget(groupBoxAny)
premiumRadioGroup:selectWidget(premiumBoxAny) premiumRadioGroup:selectWidget(premiumBoxAny)
updateSpelllist() updateSpelllist()
end end

@ -99,7 +99,7 @@ MainWindow
IconButton IconButton
id: icon6 id: icon6
icon-clip: 72 0 12 12 icon-clip: 72 0 12 12
IconButton IconButton
id: icon7 id: icon7
icon-clip: 84 0 12 12 icon-clip: 84 0 12 12

@ -289,7 +289,7 @@ function onAddVip(id, name, state, description, iconId, notify)
local nameLower = name:lower() local nameLower = name:lower()
local childrenCount = vipList:getChildCount() local childrenCount = vipList:getChildCount()
for i=1,childrenCount do for i=1,childrenCount do
local child = vipList:getChildByIndex(i) local child = vipList:getChildByIndex(i)
if (state == VipState.Online and child.vipState ~= VipState.Online and getSortedBy() == 'status') if (state == VipState.Online and child.vipState ~= VipState.Online and getSortedBy() == 'status')
@ -300,7 +300,7 @@ function onAddVip(id, name, state, description, iconId, notify)
if (((state ~= VipState.Online and child.vipState ~= VipState.Online) or (state == VipState.Online and child.vipState == VipState.Online)) and getSortedBy() == 'status') if (((state ~= VipState.Online and child.vipState ~= VipState.Online) or (state == VipState.Online and child.vipState == VipState.Online)) and getSortedBy() == 'status')
or (label.iconId == child.iconId and getSortedBy() == 'type') or getSortedBy() == 'name' then or (label.iconId == child.iconId and getSortedBy() == 'type') or getSortedBy() == 'name' then
local childText = child:getText():lower() local childText = child:getText():lower()
local length = math.min(childText:len(), nameLower:len()) local length = math.min(childText:len(), nameLower:len())
@ -351,11 +351,11 @@ function onVipListMousePress(widget, mousePos, mouseButton)
else else
menu:addOption(tr('Show Offline'), function() hideOffline(false) end) menu:addOption(tr('Show Offline'), function() hideOffline(false) end)
end end
if not(getSortedBy() == 'name') then if not(getSortedBy() == 'name') then
menu:addOption(tr('Sort by name'), function() sortBy('name') end) menu:addOption(tr('Sort by name'), function() sortBy('name') end)
end end
if not(getSortedBy() == 'status') then if not(getSortedBy() == 'status') then
menu:addOption(tr('Sort by status'), function() sortBy('status') end) menu:addOption(tr('Sort by status'), function() sortBy('status') end)
end end
@ -380,7 +380,7 @@ function onVipListLabelMousePress(widget, mousePos, mouseButton)
menu:addOption(tr('Edit %s', widget:getText()), function() if widget then createEditWindow(widget) end end) menu:addOption(tr('Edit %s', widget:getText()), function() if widget then createEditWindow(widget) end end)
menu:addOption(tr('Remove %s', widget:getText()), function() if widget then removeVip(widget) end end) menu:addOption(tr('Remove %s', widget:getText()), function() if widget then removeVip(widget) end end)
menu:addSeparator() menu:addSeparator()
menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(widget:getText()) end) menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(widget:getText()) end)
if modules.game_console.getOwnPrivateTab() then if modules.game_console.getOwnPrivateTab() then
menu:addSeparator() menu:addSeparator()
@ -393,15 +393,15 @@ function onVipListLabelMousePress(widget, mousePos, mouseButton)
else else
menu:addOption(tr('Show Offline'), function() hideOffline(false) end) menu:addOption(tr('Show Offline'), function() hideOffline(false) end)
end end
if not(getSortedBy() == 'name') then if not(getSortedBy() == 'name') then
menu:addOption(tr('Sort by name'), function() sortBy('name') end) menu:addOption(tr('Sort by name'), function() sortBy('name') end)
end end
if not(getSortedBy() == 'status') then if not(getSortedBy() == 'status') then
menu:addOption(tr('Sort by status'), function() sortBy('status') end) menu:addOption(tr('Sort by status'), function() sortBy('status') end)
end end
menu:display(mousePos) menu:display(mousePos)
return true return true

@ -14,7 +14,7 @@ function g_game.findPlayerItem(itemId, subType)
end end
end end
end end
return g_game.findItemInContainers(itemId, subType) return g_game.findItemInContainers(itemId, subType)
end end

@ -19,5 +19,5 @@ Module
dofile 'market' dofile 'market'
dofile 'thing' dofile 'thing'
dofile 'spells' dofile 'spells'
dofiles 'ui' dofiles 'ui'

@ -154,7 +154,7 @@ function Player:hasState(_state, states)
for i = 1, 32 do for i = 1, 32 do
local pow = math.pow(2, i-1) local pow = math.pow(2, i-1)
if pow > states then break end if pow > states then break end
local states = bit32.band(states, pow) local states = bit32.band(states, pow)
if states == _state then if states == _state then
return true return true

@ -57,7 +57,7 @@ function ProtocolLogin:sendLoginPacket()
msg:addU32(xteaKey[3]) msg:addU32(xteaKey[3])
msg:addU32(xteaKey[4]) msg:addU32(xteaKey[4])
end end
if g_game.getFeature(GameAccountNames) then if g_game.getFeature(GameAccountNames) then
msg:addString(self.accountName) msg:addString(self.accountName)
else else
@ -77,7 +77,7 @@ function ProtocolLogin:sendLoginPacket()
if g_game.getProtocolVersion() >= 770 then if g_game.getProtocolVersion() >= 770 then
msg:encryptRsa() msg:encryptRsa()
end end
if g_game.getFeature(GameProtocolChecksum) then if g_game.getFeature(GameProtocolChecksum) then
self:enableChecksum() self:enableChecksum()
end end
@ -137,7 +137,7 @@ function ProtocolLogin:parseCharacterList(msg)
local worldsCount = msg:getU8() local worldsCount = msg:getU8()
for i=1, worldsCount do for i=1, worldsCount do
local world = {} local world = {}
local worldId = msg:getU8() local worldId = msg:getU8()
world.worldName = msg:getString() world.worldName = msg:getString()
world.worldIp = msg:getString() world.worldIp = msg:getString()
world.worldPort = msg:getU16() world.worldPort = msg:getU16()

@ -1,14 +1,14 @@
SpelllistSettings = { SpelllistSettings = {
['Default'] = { ['Default'] = {
iconFile = '/images/game/spells/defaultspells', iconFile = '/images/game/spells/defaultspells',
iconSize = {width = 32, height = 32}, iconSize = {width = 32, height = 32},
spellListWidth = 210, spellListWidth = 210,
spellWindowWidth = 550, spellWindowWidth = 550,
spellOrder = {'Animate Dead', 'Annihilation', 'Avalanche', 'Berserk', 'Blood Rage', 'Brutal Strike', 'Cancel Invisibility', 'Challenge', 'Chameleon', 'Charge', 'Conjure Arrow', 'Conjure Bolt', 'Conjure Explosive Arrow', 'Conjure Piercing Bolt', 'Conjure Poisoned Arrow', 'Conjure Power Bolt', 'Conjure Sniper Arrow', 'Convince Creature', 'Creature Illusion', 'Cure Bleeding', 'Cure Burning', 'Cure Curse', 'Cure Electrification', 'Cure Poison', 'Cure Poison Rune', 'Curse', 'Death Strike', 'Desintegrate', 'Destroy Field', 'Divine Caldera', 'Divine Healing', 'Divine Missile', 'Electrify', 'Enchant Party', 'Enchant Spear', 'Enchant Staff', 'Energy Beam', 'Energy Field', 'Energy Strike', 'Energy Wall', 'Energy Wave', 'Energybomb', 'Envenom', 'Eternal Winter', 'Ethereal Spear', 'Explosion', 'Fierce Berserk', 'Find Person', 'Fire Field', 'Fire Wall', 'Fire Wave', 'Fireball', 'Firebomb', 'Flame Strike', 'Food', 'Front Sweep', 'Great Energy Beam', 'Great Fireball', 'Great Light', 'Groundshaker', 'Haste', 'Heal Friend', 'Heal Party', 'Heavy Magic Missile', 'Hells Core', 'Holy Flash', 'Holy Missile', 'Ice Strike', 'Ice Wave', 'Icicle', 'Ignite', 'Inflict Wound', 'Intense Healing', 'Intense Healing Rune', 'Intense Recovery', 'Intense Wound Cleansing', 'Invisibility', 'Levitate', 'Light', 'Light Healing', 'Light Magic Missile', 'Lightning', 'Magic Rope', 'Magic Shield', 'Magic Wall', 'Mass Healing', 'Paralyze', 'Physical Strike', 'Poison Bomb', 'Poison Field', 'Poison Wall', 'Protect Party', 'Protector', 'Rage of the Skies', 'Recovery', 'Salvation', 'Sharpshooter', 'Soulfire', 'Stalagmite', 'Stone Shower', 'Strong Energy Strike', 'Strong Ethereal Spear', 'Strong Flame Strike', 'Strong Haste', 'Strong Ice Strike', 'Strong Ice Wave', 'Strong Terra Strike', 'Sudden Death', 'Summon Creature', 'Swift Foot', 'Terra Strike', 'Terra Wave', 'Thunderstorm', 'Train Party', 'Ultimate Energy Strike', 'Ultimate Flame Strike', 'Ultimate Healing', 'Ultimate Healing Rune', 'Ultimate Ice Strike', 'Ultimate Light', 'Ultimate Terra Strike', 'Whirlwind Throw', 'Wild Growth', 'Wound Cleansing', 'Wrath of Nature'} spellOrder = {'Animate Dead', 'Annihilation', 'Avalanche', 'Berserk', 'Blood Rage', 'Brutal Strike', 'Cancel Invisibility', 'Challenge', 'Chameleon', 'Charge', 'Conjure Arrow', 'Conjure Bolt', 'Conjure Explosive Arrow', 'Conjure Piercing Bolt', 'Conjure Poisoned Arrow', 'Conjure Power Bolt', 'Conjure Sniper Arrow', 'Convince Creature', 'Creature Illusion', 'Cure Bleeding', 'Cure Burning', 'Cure Curse', 'Cure Electrification', 'Cure Poison', 'Cure Poison Rune', 'Curse', 'Death Strike', 'Desintegrate', 'Destroy Field', 'Divine Caldera', 'Divine Healing', 'Divine Missile', 'Electrify', 'Enchant Party', 'Enchant Spear', 'Enchant Staff', 'Energy Beam', 'Energy Field', 'Energy Strike', 'Energy Wall', 'Energy Wave', 'Energybomb', 'Envenom', 'Eternal Winter', 'Ethereal Spear', 'Explosion', 'Fierce Berserk', 'Find Person', 'Fire Field', 'Fire Wall', 'Fire Wave', 'Fireball', 'Firebomb', 'Flame Strike', 'Food', 'Front Sweep', 'Great Energy Beam', 'Great Fireball', 'Great Light', 'Groundshaker', 'Haste', 'Heal Friend', 'Heal Party', 'Heavy Magic Missile', 'Hells Core', 'Holy Flash', 'Holy Missile', 'Ice Strike', 'Ice Wave', 'Icicle', 'Ignite', 'Inflict Wound', 'Intense Healing', 'Intense Healing Rune', 'Intense Recovery', 'Intense Wound Cleansing', 'Invisibility', 'Levitate', 'Light', 'Light Healing', 'Light Magic Missile', 'Lightning', 'Magic Rope', 'Magic Shield', 'Magic Wall', 'Mass Healing', 'Paralyze', 'Physical Strike', 'Poison Bomb', 'Poison Field', 'Poison Wall', 'Protect Party', 'Protector', 'Rage of the Skies', 'Recovery', 'Salvation', 'Sharpshooter', 'Soulfire', 'Stalagmite', 'Stone Shower', 'Strong Energy Strike', 'Strong Ethereal Spear', 'Strong Flame Strike', 'Strong Haste', 'Strong Ice Strike', 'Strong Ice Wave', 'Strong Terra Strike', 'Sudden Death', 'Summon Creature', 'Swift Foot', 'Terra Strike', 'Terra Wave', 'Thunderstorm', 'Train Party', 'Ultimate Energy Strike', 'Ultimate Flame Strike', 'Ultimate Healing', 'Ultimate Healing Rune', 'Ultimate Ice Strike', 'Ultimate Light', 'Ultimate Terra Strike', 'Whirlwind Throw', 'Wild Growth', 'Wound Cleansing', 'Wrath of Nature'}
}--[[, }--[[,
['Sample'] = { ['Sample'] = {
iconFile = '/images/game/spells/sample', iconFile = '/images/game/spells/sample',
iconSize = {width = 64, height = 64}, iconSize = {width = 64, height = 64},
spellOrder = {'Critical Strike', 'Firefly', 'Fire Breath', 'Moonglaives', 'Wind Walk'} spellOrder = {'Critical Strike', 'Firefly', 'Fire Breath', 'Moonglaives', 'Wind Walk'}
}]] }]]
@ -142,7 +142,7 @@ SpellInfo = {
['Thunderstorm'] = {id = 117, words = 'adori mas vis', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'thunderstorm', mana = 430, level = 28, soul = 3, group = {[3] = 2000}, vocations = {1, 5}}, ['Thunderstorm'] = {id = 117, words = 'adori mas vis', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'thunderstorm', mana = 430, level = 28, soul = 3, group = {[3] = 2000}, vocations = {1, 5}},
['Holy Missile'] = {id = 130, words = 'adori san', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'holymissile', mana = 350, level = 27, soul = 3, group = {[3] = 2000}, vocations = {3, 7}} ['Holy Missile'] = {id = 130, words = 'adori san', exhaustion = 2000, premium = false, type = 'Conjure', icon = 'holymissile', mana = 350, level = 27, soul = 3, group = {[3] = 2000}, vocations = {3, 7}}
}, },
['Sample'] = { ['Sample'] = {
['Wind Walk'] = {id = 1, words = 'windwalk', description = 'Run at enormous speed.', exhaustion = 2000, premium = false, type = 'Instant', icon = 1, mana = 50, level = 10, soul = 0, group = {[3] = 2000}, vocations = {1, 2}}, ['Wind Walk'] = {id = 1, words = 'windwalk', description = 'Run at enormous speed.', exhaustion = 2000, premium = false, type = 'Instant', icon = 1, mana = 50, level = 10, soul = 0, group = {[3] = 2000}, vocations = {1, 2}},
['Fire Breath'] = {id = 2, words = 'firebreath', description = 'A strong firewave.', exhaustion = 2000, premium = false, type = 'Instant', icon = 2, mana = 350, level = 27, soul = 0, group = {[1] = 2000}, vocations = {4, 8}}, ['Fire Breath'] = {id = 2, words = 'firebreath', description = 'A strong firewave.', exhaustion = 2000, premium = false, type = 'Instant', icon = 2, mana = 350, level = 27, soul = 0, group = {[1] = 2000}, vocations = {4, 8}},
@ -209,89 +209,89 @@ SpellIcons = {
['sniperarrow'] = {112, 108}, ['sniperarrow'] = {112, 108},
['whirlwindthrow'] = {19, 107}, ['whirlwindthrow'] = {19, 107},
['groundshaker'] = {25, 106}, ['groundshaker'] = {25, 106},
['fierceberserk'] = {22, 105}, ['fierceberserk'] = {22, 105},
-- [[ 96 - 104 Unknown ]] -- [[ 96 - 104 Unknown ]]
['powerbolt'] = {108, 95}, ['powerbolt'] = {108, 95},
['wildgrowth'] = {61, 94}, ['wildgrowth'] = {61, 94},
['challenge'] = {97, 93}, ['challenge'] = {97, 93},
['enchantstaff'] = {103, 92}, ['enchantstaff'] = {103, 92},
['poisonbomb'] = {70, 91}, ['poisonbomb'] = {70, 91},
['cancelinvisibility'] = {95, 90}, ['cancelinvisibility'] = {95, 90},
['flamestrike'] = {26, 89}, ['flamestrike'] = {26, 89},
['energystrike'] = {29, 88}, ['energystrike'] = {29, 88},
['deathstrike'] = {38, 87}, ['deathstrike'] = {38, 87},
['magicwall'] = {72, 86}, ['magicwall'] = {72, 86},
['healfriend'] = {8, 84}, ['healfriend'] = {8, 84},
['animatedead'] = {93, 83}, ['animatedead'] = {93, 83},
['masshealing'] = {9, 82}, ['masshealing'] = {9, 82},
['levitate'] = {125, 81}, ['levitate'] = {125, 81},
['berserk'] = {21, 80}, ['berserk'] = {21, 80},
['conjurebolt'] = {107, 79}, ['conjurebolt'] = {107, 79},
['desintegrate'] = {88, 78}, ['desintegrate'] = {88, 78},
['stalagmite'] = {66, 77}, ['stalagmite'] = {66, 77},
['magicrope'] = {105, 76}, ['magicrope'] = {105, 76},
['ultimatelight'] = {115, 75}, ['ultimatelight'] = {115, 75},
-- [[ 71 - 64 TFS House Commands ]] -- [[ 71 - 64 TFS House Commands ]]
-- [[ 63 - 70 Unknown ]] -- [[ 63 - 70 Unknown ]]
['annihilation'] = {24, 62}, ['annihilation'] = {24, 62},
['brutalstrike'] = {23, 61}, ['brutalstrike'] = {23, 61},
-- [[ 60 Unknown ]] -- [[ 60 Unknown ]]
['frontsweep'] = {20, 59}, ['frontsweep'] = {20, 59},
-- [[ 58 Unknown ]] -- [[ 58 Unknown ]]
['strongetherealspear'] = {59, 57}, ['strongetherealspear'] = {59, 57},
['wrathofnature'] = {48, 56}, ['wrathofnature'] = {48, 56},
['energybomb'] = {86, 55}, ['energybomb'] = {86, 55},
['paralyze'] = {71, 54}, ['paralyze'] = {71, 54},
-- [[ 53 Unknown ]] -- [[ 53 Unknown ]]
-- [[ 52 TFS Retrieve Friend ]] -- [[ 52 TFS Retrieve Friend ]]
['conjurearrow'] = {106, 51}, ['conjurearrow'] = {106, 51},
['soulfire'] = {67, 50}, ['soulfire'] = {67, 50},
['explosivearrow'] = {109, 49}, ['explosivearrow'] = {109, 49},
['poisonedarrow'] = {111, 48}, ['poisonedarrow'] = {111, 48},
-- [[ 46 / 47 Unknown ]] -- [[ 46 / 47 Unknown ]]
['invisible'] = {94, 45}, ['invisible'] = {94, 45},
['magicshield'] = {124, 44}, ['magicshield'] = {124, 44},
['strongicewave'] = {46, 43}, ['strongicewave'] = {46, 43},
['food'] = {99, 42}, ['food'] = {99, 42},
-- [[ 40 / 41 Unknown ]] -- [[ 40 / 41 Unknown ]]
['stronghaste'] = {102, 39}, ['stronghaste'] = {102, 39},
['creatureillusion'] = {100, 38}, ['creatureillusion'] = {100, 38},
-- [[ 37 TFS Move ]] -- [[ 37 TFS Move ]]
['salvation'] = {60, 36}, ['salvation'] = {60, 36},
-- [[ 34 / 35 Unknown ]] -- [[ 34 / 35 Unknown ]]
['energywall'] = {84, 33}, ['energywall'] = {84, 33},
['poisonwall'] = {68, 32}, ['poisonwall'] = {68, 32},
['antidote'] = {10, 31}, ['antidote'] = {10, 31},
['destroyfield'] = {87, 30}, ['destroyfield'] = {87, 30},
['curepoison'] = {10, 29}, ['curepoison'] = {10, 29},
['firewall'] = {80, 28}, ['firewall'] = {80, 28},
['energyfield'] = {85, 27}, ['energyfield'] = {85, 27},
['poisonfield'] = {69, 26}, ['poisonfield'] = {69, 26},
['firefield'] = {81, 25}, ['firefield'] = {81, 25},
['hellscore'] = {49, 24}, ['hellscore'] = {49, 24},
['greatenergybeam'] = {42, 23}, ['greatenergybeam'] = {42, 23},
['energybeam'] = {41, 22}, ['energybeam'] = {41, 22},
['suddendeath'] = {64, 21}, ['suddendeath'] = {64, 21},
['findperson'] = {114, 20}, ['findperson'] = {114, 20},
['firewave'] = {44, 19}, ['firewave'] = {44, 19},
['explosion'] = {83, 18}, ['explosion'] = {83, 18},
['firebomb'] = {82, 17}, ['firebomb'] = {82, 17},
['greatfireball'] = {78, 16}, ['greatfireball'] = {78, 16},
['fireball'] = {79, 15}, ['fireball'] = {79, 15},
['chameleon'] = {91, 14}, ['chameleon'] = {91, 14},
['energywave'] = {43, 13}, ['energywave'] = {43, 13},
['convincecreature'] = {90, 12}, ['convincecreature'] = {90, 12},
['greatlight'] = {116, 11}, ['greatlight'] = {116, 11},
['light'] = {117, 10}, ['light'] = {117, 10},
['summoncreature'] = {118, 9}, ['summoncreature'] = {118, 9},
['heavymagicmissile'] = {77, 8}, ['heavymagicmissile'] = {77, 8},
['lightmagicmissile'] = {73, 7}, ['lightmagicmissile'] = {73, 7},
['haste'] = {101, 6}, ['haste'] = {101, 6},
['ultimatehealingrune'] = {62, 5}, ['ultimatehealingrune'] = {62, 5},
['intensehealingrune'] = {74, 4}, ['intensehealingrune'] = {74, 4},
['ultimatehealing'] = {1, 3}, ['ultimatehealing'] = {1, 3},
['intensehealing'] = {7, 2}, ['intensehealing'] = {7, 2},
['lighthealing'] = {6, 1} ['lighthealing'] = {6, 1}
} }
VocationNames = { VocationNames = {

@ -43,17 +43,17 @@ end
function UICreatureButton:setup(creature) function UICreatureButton:setup(creature)
self.creature = creature self.creature = creature
local creatureWidget = self:getChildById('creature') local creatureWidget = self:getChildById('creature')
local labelWidget = self:getChildById('label') local labelWidget = self:getChildById('label')
local lifeBarWidget = self:getChildById('lifeBar') local lifeBarWidget = self:getChildById('lifeBar')
labelWidget:setText(creature:getName()) labelWidget:setText(creature:getName())
creatureWidget:setCreature(creature) creatureWidget:setCreature(creature)
self:setId('CreatureButton_' .. creature:getName():gsub('%s','_')) self:setId('CreatureButton_' .. creature:getName():gsub('%s','_'))
self:setLifeBarPercent(creature:getHealthPercent()) self:setLifeBarPercent(creature:getHealthPercent())
self:updateSkull(creature:getSkull()) self:updateSkull(creature:getSkull())
self:updateEmblem(creature:getEmblem()) self:updateEmblem(creature:getEmblem())
end end

@ -273,18 +273,18 @@ function UIMinimap:createFlagWindow(pos)
flagRadioGroup:selectWidget(flagRadioGroup:getFirstWidget()) flagRadioGroup:selectWidget(flagRadioGroup:getFirstWidget())
local successFunc = function() local successFunc = function()
self:addFlag(pos, flagRadioGroup:getSelectedWidget().icon, description:getText()) self:addFlag(pos, flagRadioGroup:getSelectedWidget().icon, description:getText())
self:destroyFlagWindow() self:destroyFlagWindow()
end end
local cancelFunc = function() local cancelFunc = function()
self:destroyFlagWindow() self:destroyFlagWindow()
end end
okButton.onClick = successFunc okButton.onClick = successFunc
cancelButton.onClick = cancelFunc cancelButton.onClick = cancelFunc
self.flagWindow.onEnter = successFunc self.flagWindow.onEnter = successFunc
self.flagWindow.onEscape = cancelFunc self.flagWindow.onEscape = cancelFunc

@ -100,7 +100,7 @@ public:
HouseList getHouseList() { return m_houses; } HouseList getHouseList() { return m_houses; }
HouseList filterHouses(uint32 townId); HouseList filterHouses(uint32 townId);
private: private:
HouseList m_houses; HouseList m_houses;
protected: protected:

@ -87,7 +87,7 @@ void MapView::draw(const Rect& rect)
int drawFlags = 0; int drawFlags = 0;
// First branch: // First branch:
// This is unlikely to be false because a lot of us // This is unlikely to be false because a lot of us
// don't wanna hear their GPU fan while playing a // don't wanna hear their GPU fan while playing a
// 2D game. // 2D game.
// //
// Second & Third branch: // Second & Third branch:

@ -412,7 +412,7 @@ void Minimap::saveOtmm(const std::string& fileName)
fin->write(compressBuffer.data(), len); fin->write(compressBuffer.data(), len);
} }
} }
// end of file // end of file
Position invalidPos; Position invalidPos;
fin->addU16(invalidPos.x); fin->addU16(invalidPos.x);

@ -161,7 +161,7 @@ void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *
if(drawFlags & Otc::DrawOnTop) if(drawFlags & Otc::DrawOnTop)
for(const ThingPtr& thing : m_things) for(const ThingPtr& thing : m_things)
if(thing->isOnTop()) if(thing->isOnTop())
thing->draw(dest, scaleFactor, animate, lightView); thing->draw(dest, scaleFactor, animate, lightView);
// draw translucent light (for tiles beneath holes) // draw translucent light (for tiles beneath holes)
if(hasTranslucentLight() && lightView) { if(hasTranslucentLight() && lightView) {
@ -482,7 +482,7 @@ ThingPtr Tile::getTopMultiUseThing()
if(thing->isForceUse()) if(thing->isForceUse())
return thing; return thing;
} }
for(uint i = 0; i < m_things.size(); ++i) { for(uint i = 0; i < m_things.size(); ++i) {
ThingPtr thing = m_things[i]; ThingPtr thing = m_things[i];
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop()) { if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop()) {

@ -65,7 +65,7 @@ bool UIMinimap::setZoom(int zoom)
else else
m_scale = 1; m_scale = 1;
m_layout->update(); m_layout->update();
onZoomChange(zoom, oldZoom); onZoomChange(zoom, oldZoom);
return true; return true;
} }

@ -237,7 +237,7 @@ set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS}
${LUA_INCLUDE_DIR} ${LUA_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR} ${PHYSFS_INCLUDE_DIR}
${OpenSSL_INCLUDE_DIR} ${OpenSSL_INCLUDE_DIR}
${framework_INCLUDE_DIRS} ${framework_INCLUDE_DIRS}
) )
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")

@ -18,15 +18,15 @@
if(WIN32) # The only platform it makes sense to check for DirectX SDK if(WIN32) # The only platform it makes sense to check for DirectX SDK
include(FindPkgMacros) include(FindPkgMacros)
findpkg_begin(DirectX) findpkg_begin(DirectX)
# Get path, convert backslashes as ${ENV_DXSDK_DIR} # Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR) getenv_path(DXSDK_DIR)
getenv_path(DIRECTX_HOME) getenv_path(DIRECTX_HOME)
getenv_path(DIRECTX_ROOT) getenv_path(DIRECTX_ROOT)
getenv_path(DIRECTX_BASE) getenv_path(DIRECTX_BASE)
# construct search paths # construct search paths
set(DirectX_PREFIX_PATH set(DirectX_PREFIX_PATH
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}" "${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}" "${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}" "${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
@ -43,7 +43,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
DirectX_LIBRARY DirectX_LIBRARY
DirectX_INCLUDE_DIR DirectX_INCLUDE_DIR
) )
find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH}) find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH})
# dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86 # dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86
# lib files are in DirectX_ROOT_DIR/Lib/x64|x86 # lib files are in DirectX_ROOT_DIR/Lib/x64|x86
@ -61,7 +61,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
# look for dxgi (needed by both 10 and 11) # look for dxgi (needed by both 10 and 11)
find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
# look for d3dcompiler (needed by 11) # look for d3dcompiler (needed by 11)
find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
@ -83,7 +83,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH) get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}") message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY) if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
set(DirectX_D3D11_FOUND TRUE) set(DirectX_D3D11_FOUND TRUE)
set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR}) set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR})
@ -93,10 +93,10 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
${DirectX_DXGI_LIBRARY} ${DirectX_DXGI_LIBRARY}
${DirectX_DXERR_LIBRARY} ${DirectX_DXERR_LIBRARY}
${DirectX_DXGUID_LIBRARY} ${DirectX_DXGUID_LIBRARY}
${DirectX_D3DCOMPILER_LIBRARY} ${DirectX_D3DCOMPILER_LIBRARY}
) )
endif () endif ()
mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY) mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY)
endif () endif ()
endif(WIN32) endif(WIN32)

@ -93,7 +93,7 @@ macro(get_debug_names PREFIX)
endforeach(i) endforeach(i)
endmacro(get_debug_names) endmacro(get_debug_names)
# Add the parent dir from DIR to VAR # Add the parent dir from DIR to VAR
macro(add_parent_dir VAR DIR) macro(add_parent_dir VAR DIR)
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE) get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
set(${VAR} ${${VAR}} ${${DIR}_TEMP}) set(${VAR} ${${VAR}} ${${DIR}_TEMP})

@ -275,7 +275,7 @@ std::string Platform::getOSName()
else else
if(osvi.wProductType == VER_NT_WORKSTATION && osvi.dwMinorVersion == 2) if(osvi.wProductType == VER_NT_WORKSTATION && osvi.dwMinorVersion == 2)
ret += "Windows 8 "; ret += "Windows 8 ";
else else
ret += "Windows Server 2008 R2 "; ret += "Windows Server 2008 R2 ";
} }

@ -242,7 +242,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename)
m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr {
stdext::timer a; stdext::timer a;
try { try {
return SoundFile::loadSoundFile(filename); return SoundFile::loadSoundFile(filename);
} catch(std::exception& e) { } catch(std::exception& e) {
g_logger.error(e.what()); g_logger.error(e.what());
return nullptr; return nullptr;
@ -256,7 +256,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename)
combinedSource->addSource(streamSource); combinedSource->addSource(streamSource);
m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr {
try { try {
return SoundFile::loadSoundFile(filename); return SoundFile::loadSoundFile(filename);
} catch(std::exception& e) { } catch(std::exception& e) {
g_logger.error(e.what()); g_logger.error(e.what());
return nullptr; return nullptr;
@ -268,7 +268,7 @@ SoundSourcePtr SoundManager::createSoundSource(const std::string& filename)
StreamSoundSourcePtr streamSource(new StreamSoundSource); StreamSoundSourcePtr streamSource(new StreamSoundSource);
m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr { m_streamFiles[streamSource] = g_asyncDispatcher.schedule([=]() -> SoundFilePtr {
try { try {
return SoundFile::loadSoundFile(filename); return SoundFile::loadSoundFile(filename);
} catch(std::exception& e) { } catch(std::exception& e) {
g_logger.error(e.what()); g_logger.error(e.what());
return nullptr; return nullptr;

@ -66,7 +66,7 @@ public:
typedef T element_type; typedef T element_type;
shared_object_ptr(): px(nullptr) { } shared_object_ptr(): px(nullptr) { }
shared_object_ptr(T* p, bool add_ref = true) : px(p) { shared_object_ptr(T* p, bool add_ref = true) : px(p) {
static_assert(std::is_base_of<shared_object, T>::value, "classes using shared_object_ptr must be a derived of stdext::shared_object"); static_assert(std::is_base_of<shared_object, T>::value, "classes using shared_object_ptr must be a derived of stdext::shared_object");
if(px != nullptr && add_ref) if(px != nullptr && add_ref)
this->add_ref(); this->add_ref();

@ -50,7 +50,7 @@ public:
~shared_base() { } ~shared_base() { }
void add_ref() { ++refs; } void add_ref() { ++refs; }
void dec_ref() { void dec_ref() {
if(--refs == 0) { if(--refs == 0) {
delete px; delete px;
px = nullptr; px = nullptr;
@ -116,7 +116,7 @@ public:
T& operator*() const { assert(base != nullptr); return *base->get(); } T& operator*() const { assert(base != nullptr); return *base->get(); }
T* operator->() const { assert(base != nullptr); return base->get(); } T* operator->() const { assert(base != nullptr); return base->get(); }
template<class U> template<class U>
shared_ptr& operator=(shared_ptr<U> const& rhs) { shared_ptr(rhs).swap(*this); return *this; } shared_ptr& operator=(shared_ptr<U> const& rhs) { shared_ptr(rhs).swap(*this); return *this; }
shared_ptr& operator=(shared_ptr const& rhs) { shared_ptr(rhs).swap(*this); return *this; } shared_ptr& operator=(shared_ptr const& rhs) { shared_ptr(rhs).swap(*this); return *this; }
shared_ptr& operator=(T* rhs) { shared_ptr(rhs).swap(*this); return *this; } shared_ptr& operator=(T* rhs) { shared_ptr(rhs).swap(*this); return *this; }

@ -3,7 +3,7 @@ index cd479e4..8d46b23 100644
--- a/const.h --- a/const.h
+++ b/const.h +++ b/const.h
@@ -21,9 +21,12 @@ @@ -21,9 +21,12 @@
enum OperatingSystem_t enum OperatingSystem_t
{ {
- CLIENTOS_LINUX = 0x01, - CLIENTOS_LINUX = 0x01,
@ -16,7 +16,7 @@ index cd479e4..8d46b23 100644
+ CLIENTOS_OTCLIENT_WINDOWS = 0x0B, + CLIENTOS_OTCLIENT_WINDOWS = 0x0B,
+ CLIENTOS_OTCLIENT_MAC = 0x0C, + CLIENTOS_OTCLIENT_MAC = 0x0C,
}; };
enum ChannelEvent_t enum ChannelEvent_t
diff --git a/creatureevent.cpp b/creatureevent.cpp diff --git a/creatureevent.cpp b/creatureevent.cpp
index 842b237..e9b2200 100644 index 842b237..e9b2200 100644
@ -28,7 +28,7 @@ index 842b237..e9b2200 100644
_type = CREATURE_EVENT_PREPAREDEATH; _type = CREATURE_EVENT_PREPAREDEATH;
+ else if(type == "extendedopcode") + else if(type == "extendedopcode")
+ _type = CREATURE_EVENT_EXTENDED_OPCODE; + _type = CREATURE_EVENT_EXTENDED_OPCODE;
return _type; return _type;
} }
@@ -330,6 +332,8 @@ std::string CreatureEvent::getScriptEventName() const @@ -330,6 +332,8 @@ std::string CreatureEvent::getScriptEventName() const
@ -119,7 +119,7 @@ index f1ff4b2..cc5171c 100644
+ CREATURE_EVENT_PREPAREDEATH, + CREATURE_EVENT_PREPAREDEATH,
+ CREATURE_EVENT_EXTENDED_OPCODE // otclient additional network opcodes + CREATURE_EVENT_EXTENDED_OPCODE // otclient additional network opcodes
}; };
enum StatsChange_t enum StatsChange_t
@@ -150,6 +151,7 @@ class CreatureEvent : public Event @@ -150,6 +151,7 @@ class CreatureEvent : public Event
uint32_t executeKill(Creature* creature, Creature* target, const DeathEntry& entry); uint32_t executeKill(Creature* creature, Creature* target, const DeathEntry& entry);
@ -127,14 +127,14 @@ index f1ff4b2..cc5171c 100644
uint32_t executePrepareDeath(Creature* creature, DeathList deathList); uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
+ uint32_t executeExtendedOpcode(Creature* creature, uint8_t opcode, const std::string& buffer); + uint32_t executeExtendedOpcode(Creature* creature, uint8_t opcode, const std::string& buffer);
// //
protected: protected:
diff --git a/data/creaturescripts/creaturescripts.xml b/data/creaturescripts/creaturescripts.xml diff --git a/data/creaturescripts/creaturescripts.xml b/data/creaturescripts/creaturescripts.xml
index 363c62b..c706f10 100644 index 363c62b..c706f10 100644
--- a/data/creaturescripts/creaturescripts.xml --- a/data/creaturescripts/creaturescripts.xml
+++ b/data/creaturescripts/creaturescripts.xml +++ b/data/creaturescripts/creaturescripts.xml
@@ -14,4 +14,6 @@ @@ -14,4 +14,6 @@
<event type="think" name="Idle" event="script" value="idle.lua"/> <event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/> <event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
+ +
@ -164,7 +164,7 @@ index 2e4dc2c..7508591 100644
--- a/game.cpp --- a/game.cpp
+++ b/game.cpp +++ b/game.cpp
@@ -6951,3 +6951,12 @@ void Game::checkExpiredMarketOffers() @@ -6951,3 +6951,12 @@ void Game::checkExpiredMarketOffers()
Scheduler::getInstance().addEvent(createSchedulerTask(checkExpiredMarketOffersEachMinutes * 60 * 1000, boost::bind(&Game::checkExpiredMarketOffers, this))); Scheduler::getInstance().addEvent(createSchedulerTask(checkExpiredMarketOffersEachMinutes * 60 * 1000, boost::bind(&Game::checkExpiredMarketOffers, this)));
} }
+ +
@ -185,7 +185,7 @@ index 51fa397..7192549 100644
@@ -646,6 +646,8 @@ class Game @@ -646,6 +646,8 @@ class Game
std::map<Item*, int32_t> grounds; std::map<Item*, int32_t> grounds;
#endif #endif
+ void parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer); + void parsePlayerExtendedOpcode(uint32_t playerId, uint8_t opcode, const std::string& buffer);
+ +
protected: protected:
@ -198,7 +198,7 @@ index 4cb8c8d..4ed9391 100644
@@ -2476,6 +2476,12 @@ void LuaInterface::registerFunctions() @@ -2476,6 +2476,12 @@ void LuaInterface::registerFunctions()
//getConfigFile() //getConfigFile()
lua_register(m_luaState, "getConfigFile", LuaInterface::luaGetConfigFile); lua_register(m_luaState, "getConfigFile", LuaInterface::luaGetConfigFile);
+ //isPlayerUsingOtclient(cid) + //isPlayerUsingOtclient(cid)
+ lua_register(m_luaState, "isPlayerUsingOtclient", LuaInterface::luaIsPlayerUsingOtclient); + lua_register(m_luaState, "isPlayerUsingOtclient", LuaInterface::luaIsPlayerUsingOtclient);
+ +
@ -207,11 +207,11 @@ index 4cb8c8d..4ed9391 100644
+ +
//getConfigValue(key) //getConfigValue(key)
lua_register(m_luaState, "getConfigValue", LuaInterface::luaGetConfigValue); lua_register(m_luaState, "getConfigValue", LuaInterface::luaGetConfigValue);
@@ -9471,6 +9477,32 @@ int32_t LuaInterface::luaGetMountInfo(lua_State* L) @@ -9471,6 +9477,32 @@ int32_t LuaInterface::luaGetMountInfo(lua_State* L)
return 1; return 1;
} }
+int32_t LuaInterface::luaIsPlayerUsingOtclient(lua_State* L) +int32_t LuaInterface::luaIsPlayerUsingOtclient(lua_State* L)
+{ +{
+ //isPlayerUsingOtclient(cid) + //isPlayerUsingOtclient(cid)
@ -248,7 +248,7 @@ index 234091a..0a0046f 100644
@@ -697,6 +697,9 @@ class LuaInterface @@ -697,6 +697,9 @@ class LuaInterface
static int32_t luaDoPlayerSetMounted(lua_State* L); static int32_t luaDoPlayerSetMounted(lua_State* L);
static int32_t luaGetMountInfo(lua_State* L); static int32_t luaGetMountInfo(lua_State* L);
+ static int32_t luaIsPlayerUsingOtclient(lua_State* L); + static int32_t luaIsPlayerUsingOtclient(lua_State* L);
+ static int32_t luaDoSendPlayerExtendedOpcode(lua_State* L); + static int32_t luaDoSendPlayerExtendedOpcode(lua_State* L);
+ +
@ -262,7 +262,7 @@ index 917e36a..3671750 100644
@@ -171,16 +171,16 @@ Position NetworkMessage::getPosition() @@ -171,16 +171,16 @@ Position NetworkMessage::getPosition()
return pos; return pos;
} }
-void NetworkMessage::putString(const char* value, bool addSize/* = true*/) -void NetworkMessage::putString(const char* value, bool addSize/* = true*/)
+void NetworkMessage::putString(const char* value, int length, bool addSize/* = true*/) +void NetworkMessage::putString(const char* value, int length, bool addSize/* = true*/)
{ {
@ -270,10 +270,10 @@ index 917e36a..3671750 100644
+ uint32_t size = (uint32_t)length; + uint32_t size = (uint32_t)length;
if(!hasSpace(size + (addSize ? 2 : 0)) || size > 8192) if(!hasSpace(size + (addSize ? 2 : 0)) || size > 8192)
return; return;
if(addSize) if(addSize)
put<uint16_t>(size); put<uint16_t>(size);
- strcpy((char*)(m_buffer + m_position), value); - strcpy((char*)(m_buffer + m_position), value);
+ memcpy((char*)(m_buffer + m_position), value, length); + memcpy((char*)(m_buffer + m_position), value, length);
m_position += size; m_position += size;
@ -286,14 +286,14 @@ index 6cf8ee1..615f094 100644
@@ -80,8 +80,8 @@ class NetworkMessage @@ -80,8 +80,8 @@ class NetworkMessage
m_size += sizeof(T); m_size += sizeof(T);
} }
- void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), addSize);} - void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), addSize);}
- void putString(const char* value, bool addSize = true); - void putString(const char* value, bool addSize = true);
+ void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), value.length(), addSize);} + void putString(const std::string& value, bool addSize = true) {putString(value.c_str(), value.length(), addSize);}
+ void putString(const char* value, int length, bool addSize = true); + void putString(const char* value, int length, bool addSize = true);
void putPadding(uint32_t amount); void putPadding(uint32_t amount);
diff --git a/player.h b/player.h diff --git a/player.h b/player.h
index 63e9183..7cb8313 100644 index 63e9183..7cb8313 100644
--- a/player.h --- a/player.h
@ -301,7 +301,7 @@ index 63e9183..7cb8313 100644
@@ -228,6 +228,7 @@ class Player : public Creature, public Cylinder @@ -228,6 +228,7 @@ class Player : public Creature, public Cylinder
bool hasPVPBlessing() const {return pvpBlessing;} bool hasPVPBlessing() const {return pvpBlessing;}
uint16_t getBlessings() const; uint16_t getBlessings() const;
+ bool isUsingOtclient() const { return operatingSystem >= CLIENTOS_OTCLIENT_LINUX; } + bool isUsingOtclient() const { return operatingSystem >= CLIENTOS_OTCLIENT_LINUX; }
OperatingSystem_t getOperatingSystem() const {return operatingSystem;} OperatingSystem_t getOperatingSystem() const {return operatingSystem;}
void setOperatingSystem(OperatingSystem_t os) {operatingSystem = os;} void setOperatingSystem(OperatingSystem_t os) {operatingSystem = os;}
@ -309,7 +309,7 @@ index 63e9183..7cb8313 100644
@@ -580,6 +581,9 @@ class Player : public Creature, public Cylinder @@ -580,6 +581,9 @@ class Player : public Creature, public Cylinder
void sendSpellGroupCooldown(SpellGroup_t groupId, uint32_t cooldown) void sendSpellGroupCooldown(SpellGroup_t groupId, uint32_t cooldown)
{if(client) client->sendSpellGroupCooldown(groupId, cooldown);} {if(client) client->sendSpellGroupCooldown(groupId, cooldown);}
+ void sendExtendedOpcode(uint8_t opcode, const std::string& buffer) + void sendExtendedOpcode(uint8_t opcode, const std::string& buffer)
+ {if(client) client->sendExtendedOpcode(opcode, buffer);} + {if(client) client->sendExtendedOpcode(opcode, buffer);}
+ +
@ -323,7 +323,7 @@ index b980be0..7a84f61 100644
@@ -263,6 +263,11 @@ bool ProtocolGame::login(const std::string& name, uint32_t id, const std::string @@ -263,6 +263,11 @@ bool ProtocolGame::login(const std::string& name, uint32_t id, const std::string
return false; return false;
} }
+ if(player->isUsingOtclient()) + if(player->isUsingOtclient())
+ { + {
+ player->registerCreatureEvent("ExtendedOpcode"); + player->registerCreatureEvent("ExtendedOpcode");
@ -335,18 +335,18 @@ index b980be0..7a84f61 100644
@@ -427,6 +432,10 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage& msg) @@ -427,6 +432,10 @@ void ProtocolGame::onRecvFirstMessage(NetworkMessage& msg)
enableXTEAEncryption(); enableXTEAEncryption();
setXTEAKey(key); setXTEAKey(key);
+ // notifies to otclient that this server can receive extended game protocol opcodes + // notifies to otclient that this server can receive extended game protocol opcodes
+ if(operatingSystem >= CLIENTOS_OTCLIENT_LINUX) + if(operatingSystem >= CLIENTOS_OTCLIENT_LINUX)
+ sendExtendedOpcode(0x00, std::string()); + sendExtendedOpcode(0x00, std::string());
+ +
bool gamemaster = (msg.get<char>() != (char)0); bool gamemaster = (msg.get<char>() != (char)0);
std::string name = msg.getString(), character = msg.getString(), password = msg.getString(); std::string name = msg.getString(), character = msg.getString(), password = msg.getString();
@@ -578,6 +587,10 @@ void ProtocolGame::parsePacket(NetworkMessage &msg) @@ -578,6 +587,10 @@ void ProtocolGame::parsePacket(NetworkMessage &msg)
parseReceivePing(msg); parseReceivePing(msg);
break; break;
+ case 0x32: // otclient extended opcode + case 0x32: // otclient extended opcode
+ parseExtendedOpcode(msg); + parseExtendedOpcode(msg);
+ break; + break;
@ -390,7 +390,7 @@ index 7691174..48b9bf1 100644
@@ -326,6 +326,9 @@ class ProtocolGame : public Protocol @@ -326,6 +326,9 @@ class ProtocolGame : public Protocol
//shop //shop
void AddShopItem(NetworkMessage_ptr msg, const ShopInfo& item); void AddShopItem(NetworkMessage_ptr msg, const ShopInfo& item);
+ void parseExtendedOpcode(NetworkMessage& msg); + void parseExtendedOpcode(NetworkMessage& msg);
+ void sendExtendedOpcode(uint8_t opcode, const std::string& buffer); + void sendExtendedOpcode(uint8_t opcode, const std::string& buffer);
+ +

Loading…
Cancel
Save