diff --git a/modules/client_options/options.otmod b/modules/client_options/options.otmod index bd6835b9..7361c42f 100644 --- a/modules/client_options/options.otmod +++ b/modules/client_options/options.otmod @@ -1,7 +1,7 @@ Module name: client_options description: Create the options window - author: edubart + author: edubart, BeniS website: www.otclient.info dependencies: diff --git a/modules/client_topmenu/topmenu.lua b/modules/client_topmenu/topmenu.lua index c1052890..8d203591 100644 --- a/modules/client_topmenu/topmenu.lua +++ b/modules/client_topmenu/topmenu.lua @@ -4,7 +4,8 @@ TopMenu = {} local topMenu local leftButtonsPanel local rightButtonsPanel -local gameButtonsPanel +local leftGameButtonsPanel +local rightGameButtonsPanel -- private functions local function addButton(id, description, icon, callback, panel, toggle) @@ -32,10 +33,12 @@ function TopMenu.init() leftButtonsPanel = topMenu:getChildById('leftButtonsPanel') rightButtonsPanel = topMenu:getChildById('rightButtonsPanel') - gameButtonsPanel = topMenu:getChildById('gameButtonsPanel') + leftGameButtonsPanel = topMenu:getChildById('leftGameButtonsPanel') + rightGameButtonsPanel = topMenu:getChildById('rightGameButtonsPanel') if g_game.isOnline() then - gameButtonsPanel:show() + leftGameButtonsPanel:show() + rightGameButtonsPanel:show() end end @@ -45,7 +48,8 @@ function TopMenu.terminate() leftButtonsPanel = nil rightButtonsPanel = nil - gameButtonsPanel = nil + leftGameButtonsPanel = nil + rightGameButtonsPanel = nil topMenu:destroy() topMenu = nil @@ -69,20 +73,30 @@ function TopMenu.addRightToggleButton(id, description, icon, callback, right) return addButton(id, description, icon, callback, rightButtonsPanel, true) end -function TopMenu.addGameButton(id, description, icon, callback) - return addButton(id, description, icon, callback, gameButtonsPanel, false) +function TopMenu.addLeftGameButton(id, description, icon, callback) + return addButton(id, description, icon, callback, leftGameButtonsPanel, false) end -function TopMenu.addGameToggleButton(id, description, icon, callback, right) - return addButton(id, description, icon, callback, gameButtonsPanel, true) +function TopMenu.addLeftGameToggleButton(id, description, icon, callback, right) + return addButton(id, description, icon, callback, leftGameButtonsPanel, true) +end + +function TopMenu.addRightGameButton(id, description, icon, callback) + return addButton(id, description, icon, callback, rightGameButtonsPanel, false) +end + +function TopMenu.addRightGameToggleButton(id, description, icon, callback, right) + return addButton(id, description, icon, callback, rightGameButtonsPanel, true) end function TopMenu.hideGameButtons() - gameButtonsPanel:hide() + leftGameButtonsPanel:hide() + rightGameButtonsPanel:hide() end function TopMenu.showGameButtons() - gameButtonsPanel:show() + leftGameButtonsPanel:show() + rightGameButtonsPanel:show() end function TopMenu.getButton(id) diff --git a/modules/client_topmenu/topmenu.otui b/modules/client_topmenu/topmenu.otui index 03178c67..dcdbfbd2 100644 --- a/modules/client_topmenu/topmenu.otui +++ b/modules/client_topmenu/topmenu.otui @@ -57,18 +57,12 @@ TopPanel anchors.left: parent.left TopMenuButtonsPanel - id: gameButtonsPanel + id: leftGameButtonsPanel anchors.top: parent.top anchors.bottom: parent.bottom anchors.left: prev.right visible: false - - TopMenuButtonsPanel - id: rightButtonsPanel - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - + UILabel id: frameCounter text-align: right @@ -76,7 +70,7 @@ TopPanel color: white id: frameCounter anchors.top: parent.top - anchors.right: prev.left + anchors.left: prev.right margin-top: 8 margin-right: 5 @onSetup: | @@ -88,3 +82,16 @@ TopPanel --print(text) end end, 250) + + TopMenuButtonsPanel + id: rightButtonsPanel + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + + TopMenuButtonsPanel + id: rightGameButtonsPanel + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: prev.left + visible: false diff --git a/modules/corelib/table.lua b/modules/corelib/table.lua index 4759ccd2..aea858c7 100644 --- a/modules/corelib/table.lua +++ b/modules/corelib/table.lua @@ -57,3 +57,10 @@ function table.compare(t, other) end return true end + +function table.empty(t) + if(t) then + return next(t) == nil + end + return true +end \ No newline at end of file diff --git a/modules/game/game.otmod b/modules/game/game.otmod index 00a49fbb..3657c795 100644 --- a/modules/game/game.otmod +++ b/modules/game/game.otmod @@ -16,7 +16,7 @@ Module - game_textmessage - game_console - game_outfit - - game_healthbar + - game_healthinfo - game_skills - game_inventory - game_combatcontrols diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index 899b6c89..225eb859 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -37,7 +37,7 @@ table.insert(lifeBarColors, {percentAbove = -1, color = '#4F0000' } ) -- public functions function Battle.init() battleWindow = g_ui.loadUI('battle.otui', GameInterface.getRightPanel()) - battleButton = TopMenu.addGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', 'battle.png', Battle.toggle) + battleButton = TopMenu.addRightGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', 'battle.png', Battle.toggle) battleButton:setOn(true) g_keyboard.bindKeyDown('Ctrl+B', Battle.toggle) diff --git a/modules/game_battle/battle.otmod b/modules/game_battle/battle.otmod index dfc181e9..c2c5d5de 100644 --- a/modules/game_battle/battle.otmod +++ b/modules/game_battle/battle.otmod @@ -1,7 +1,7 @@ Module name: game_battle description: Manage battle window - author: andrefaramir + author: andrefaramir, BeniS website: www.otclient.info icon: battle.png diff --git a/modules/game_battle/battle.otui b/modules/game_battle/battle.otui index e7bd547e..aeaac4fa 100644 --- a/modules/game_battle/battle.otui +++ b/modules/game_battle/battle.otui @@ -98,4 +98,3 @@ MiniWindow type: verticalBox fit-children: true - diff --git a/modules/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua index 1f2e9f4e..505f967d 100644 --- a/modules/game_combatcontrols/combatcontrols.lua +++ b/modules/game_combatcontrols/combatcontrols.lua @@ -41,7 +41,7 @@ end -- public functions function CombatControls.init() - combatControlsButton = TopMenu.addGameToggleButton('combatControlsButton', tr('Combat Controls'), 'combatcontrols.png', CombatControls.toggle) + combatControlsButton = TopMenu.addRightGameToggleButton('combatControlsButton', tr('Combat Controls'), 'combatcontrols.png', CombatControls.toggle) combatControlsButton:setOn(true) combatControlsWindow = g_ui.loadUI('combatcontrols.otui', GameInterface.getRightPanel()) @@ -131,11 +131,43 @@ function CombatControls.check() end function CombatControls.online() + local player = g_game.getLocalPlayer() + if(player) then + local char = player:getName() + + local lastCombatControls = g_settings.getNode('LastCombatControls') + + if(not table.empty(lastCombatControls)) then + if(lastCombatControls[char]) then + g_game.setFightMode(lastCombatControls[char].fightMode) + g_game.setChaseMode(lastCombatControls[char].chaseMode) + g_game.setSafeFight(lastCombatControls[char].safeFight) + end + end + end + combatControlsWindow:setVisible(combatControlsButton:isOn()) CombatControls.update() end function CombatControls.offline() + local lastCombatControls = g_settings.getNode('LastCombatControls') + if(not lastCombatControls) then + lastCombatControls = {} + end + + local player = g_game.getLocalPlayer() + if(player) then + local char = player:getName() + lastCombatControls[char] = { + fightMode = g_game.getFightMode(), + chaseMode = g_game.getChaseMode(), + safeFight = g_game.isSafeFight() + } + + -- save last combat control settings + g_settings.setNode('LastCombatControls', lastCombatControls) + end end function CombatControls.toggle() diff --git a/modules/game_combatcontrols/combatcontrols.otmod b/modules/game_combatcontrols/combatcontrols.otmod index e6846ed3..002a7d83 100644 --- a/modules/game_combatcontrols/combatcontrols.otmod +++ b/modules/game_combatcontrols/combatcontrols.otmod @@ -1,7 +1,7 @@ Module name: game_combatcontrols description: Combat controls window - author: edubart + author: edubart, BeniS website: www.otclient.info dependencies: diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index b93ff201..88ea66c4 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -185,12 +185,76 @@ local function onChannelList(channelList) end local function onGameStart() + -- open last channels + local player = g_game.getLocalPlayer() + if(player) then + local char = player:getName() + + local lastChannelsOpen = g_settings.getNode('LastChannelsOpen') + + if(not table.empty(lastChannelsOpen) and lastChannelsOpen[char]) then + for channelName, channelId in ipairs(lastChannelsOpen[char]) do + if(not table.find(channels, channelId)) then g_game.joinChannel(channelId) end + end + end + end + local tab = Console.getTab(tr('Default')) if tab then - addEvent(function() consoleTabBar:selectTab(tab) end, false) + --[[ + Known Issue: The server is calling to open channels after + onGameStart is executed causing it to focus the last tab opened. + + Fix: Don't save channels to the settings that are opened by the server. + ]] + addEvent(function() consoleTabBar:selectTab(tab) end, true) + end +end + +function Console.onTabChange(tabBar, tab) + if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then + consolePanel:getChildById('closeChannelButton'):disable() + else + consolePanel:getChildById('closeChannelButton'):enable() + end +end + +function Console.clear() + local lastChannelsOpen = {} + + local player = g_game.getLocalPlayer() + if(player) then + local char = player:getName() + lastChannelsOpen[char] = {} + + for channelId, channelName in pairs(channels) do + table.insert(lastChannelsOpen[char], channelId) + end end - for _, channelId in ipairs(g_settings.getList('last-channels')) do - g_game.joinChannel(channelId) + + -- save last open channels + g_settings.setNode('LastChannelsOpen', lastChannelsOpen) + + for _, channelName in pairs(channels) do + local tab = consoleTabBar:getTab(channelName) + consoleTabBar:removeTab(tab) + end + + channels = {} + + consoleTabBar:getTab(tr('Default')).tabPanel:getChildById('consoleBuffer'):destroyChildren() + consoleTabBar:getTab(tr('Server Log')).tabPanel:getChildById('consoleBuffer'):destroyChildren() + + local npcTab = consoleTabBar:getTab('NPCs') + if npcTab then + consoleTabBar:removeTab(npcTab) + end + + consoleTextEdit:clearText() + + if channelsWindow then + channelsWindow:destroy() + channelsWindow = nil end end @@ -270,33 +334,6 @@ function Console.terminate() Console = nil end -function Console.clear() - local lastChannels = {} - for channelid, channelname in pairs(channels) do - table.insert(lastChannels, channelid) - local tab = consoleTabBar:getTab(channelname) - consoleTabBar:removeTab(tab) - end - - g_settings.setList('last-channels', lastChannels) - channels = {} - - consoleTabBar:getTab(tr('Default')).tabPanel:getChildById('consoleBuffer'):destroyChildren() - consoleTabBar:getTab(tr('Server Log')).tabPanel:getChildById('consoleBuffer'):destroyChildren() - - local npcTab = consoleTabBar:getTab('NPCs') - if npcTab then - consoleTabBar:removeTab(npcTab) - end - - consoleTextEdit:clearText() - - if channelsWindow then - channelsWindow:destroy() - channelsWindow = nil - end -end - function Console.setTextEditText(text) consoleTextEdit:setText(text) end @@ -320,14 +357,6 @@ function Console.addTab(name, focus) return tab end -function Console.onTabChange(tabBar, tab) - if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then - consolePanel:getChildById('closeChannelButton'):disable() - else - consolePanel:getChildById('closeChannelButton'):enable() - end -end - function Console.removeCurrentTab() local tab = consoleTabBar:getCurrentTab() if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then return end @@ -549,4 +578,4 @@ end function Console.ignoreNpcMessages(ignore) ignoreNpcMessages = ignore -end \ No newline at end of file +end diff --git a/modules/game_console/console.otmod b/modules/game_console/console.otmod index 0247fad1..e26f19b1 100644 --- a/modules/game_console/console.otmod +++ b/modules/game_console/console.otmod @@ -1,7 +1,7 @@ Module name: game_console description: Manage chat window - author: edubart, andrefaramir, baxnie, sn4ake + author: edubart, andrefaramir, baxnie, sn4ake, BeniS website: www.otclient.info dependencies: diff --git a/modules/game_containers/containers.lua b/modules/game_containers/containers.lua index 3208bc66..79adc3ef 100644 --- a/modules/game_containers/containers.lua +++ b/modules/game_containers/containers.lua @@ -108,7 +108,7 @@ function Containers.clean() if container.window then container.window:destroy() container.window = nil - container.itemsPnale = nil + container.itemsPanel = nil end end end diff --git a/modules/game_healthbar/healthbar.lua b/modules/game_healthbar/healthbar.lua deleted file mode 100644 index 15ce17a9..00000000 --- a/modules/game_healthbar/healthbar.lua +++ /dev/null @@ -1,150 +0,0 @@ -HealthBar = {} - --- constants -local Icons = {} -Icons[1] = { tooltip = tr('You are poisoned'), path = '/game_healthbar/icons/poisoned.png', id = 'condition_poisoned' } -Icons[2] = { tooltip = tr('You are burning'), path = '/game_healthbar/icons/burning.png', id = 'condition_burning' } -Icons[4] = { tooltip = tr('You are electrified'), path = '/game_healthbar/icons/electrified.png', id = 'condition_electrified' } -Icons[8] = { tooltip = tr('You are freezing'), path = '/game_healthbar/icons/drunk.png', id = 'condition_drunk' } -Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/game_healthbar/icons/magic_shield.png', id = 'condition_magic_shield' } -Icons[32] = { tooltip = tr('You are paralysed'), path = '/game_healthbar/icons/slowed.png', id = 'condition_slowed' } -Icons[64] = { tooltip = tr('You are hasted'), path = '/game_healthbar/icons/haste.png', id = 'condition_haste' } -Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/game_healthbar/icons/logout_block.png', id = 'condition_logout_block' } -Icons[256] = { tooltip = tr('You are drowing'), path = '/game_healthbar/icons/drowning.png', id = 'condition_drowning' } -Icons[512] = { tooltip = tr('You are freezing'), path = '/game_healthbar/icons/freezing.png', id = 'condition_freezing' } -Icons[1024] = { tooltip = tr('You are dazzled'), path = '/game_healthbar/icons/dazzled.png', id = 'condition_dazzled' } -Icons[2048] = { tooltip = tr('You are cursed'), path = '/game_healthbar/icons/cursed.png', id = 'condition_cursed' } -Icons[4096] = { tooltip = tr('You are strengthened'), path = '/game_healthbar/icons/strengthened.png', id = 'condition_strengthened' } -Icons[8192] = { tooltip = tr('You may not logout or enter a protection zone'), path = '/game_healthbar/icons/protection_zone_block.png', id = 'condition_protection_zone_block' } -Icons[16384] = { tooltip = tr('You are within a protection zone'), path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' } -Icons[32768] = { tooltip = tr('You are bleeding'), path = '/game_healthbar/icons/bleeding.png', id = 'condition_bleeding' } -Icons[65536] = { tooltip = tr('You are hungry'), path = '/game_healthbar/icons/hungry.png', id = 'condition_hungry' } - --- private variables -local healthBarWindow -local healthBar -local manaBar -local healthLabel -local manaLabel - -local soulLabel -local soulPoints - --- public functions -function HealthBar.init() - connect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange, - onManaChange = HealthBar.onManaChange, - onStatesChange = HealthBar.onStatesChange, - onSoulChange = HealthBar.onSoulChange }) - - connect(g_game, { onGameEnd = HealthBar.offline }) - - healthBarWindow = g_ui.loadUI('healthbar.otui', GameInterface.getRightPanel()) - healthBarButton = TopMenu.addGameToggleButton('healthBarButton', tr('Health Bar'), 'healthbar.png', HealthBar.toggle) - healthBarButton:setOn(true) - healthBar = healthBarWindow:recursiveGetChildById('healthBar') - manaBar = healthBarWindow:recursiveGetChildById('manaBar') - healthLabel = healthBarWindow:recursiveGetChildById('healthLabel') - manaLabel = healthBarWindow:recursiveGetChildById('manaLabel') - - soulLabel = healthBarWindow:recursiveGetChildById('soulLabel') - - if g_game.isOnline() then - local localPlayer = g_game.getLocalPlayer() - HealthBar.onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth()) - HealthBar.onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana()) - HealthBar.onStatesChange(localPlayer, localPlayer:getStates(), 0) - HealthBar.onSoulChange(localPlayer, localPlayer:getSoul()) - end -end - -function HealthBar.terminate() - disconnect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange, - onManaChange = HealthBar.onManaChange, - onStatesChange = HealthBar.onStatesChange, - onSoulChange = HealthBar.onSoulChange }) - - disconnect(g_game, { onGameEnd = HealthBar.offline }) - - healthBarWindow:destroy() - healthBarButton:destroy() - healthBarWindow = nil - healthBarButton = nil - healthBar = nil - manaBar = nil - healthLabel = nil - manaLabel = nil - - soulLabel = nil - - HealthBar = nil -end - -function HealthBar.toggle() - if healthBarButton:isOn() then - healthBarWindow:close() - healthBarButton:setOn(false) - else - healthBarWindow:open() - healthBarButton:setOn(true) - end -end - -function HealthBar.onMiniWindowClose() - healthBarButton:setOn(false) -end - -function HealthBar.offline() - healthBarWindow:recursiveGetChildById('conditionPanel'):destroyChildren() -end - --- hooked events -function HealthBar.onHealthChange(localPlayer, health, maxHealth) - healthLabel:setText(health .. ' / ' .. maxHealth) - healthBar:setPercent(health / maxHealth * 100) -end - -function HealthBar.onManaChange(localPlayer, mana, maxMana) - manaLabel:setText(mana .. ' / ' .. maxMana) - - local percent - if maxMana == 0 then - percent = 100 - else - percent = (mana * 100)/maxMana - end - manaBar:setPercent(percent) -end - -function HealthBar.onStatesChange(localPlayer, now, old) - if now == old then return end - - local bitsChanged = bit32.bxor(now, old) - for i = 1, 32 do - local pow = math.pow(2, i-1) - if pow > bitsChanged then break end - local bitChanged = bit32.band(bitsChanged, pow) - if bitChanged ~= 0 then - HealthBar.toggleIcon(bitChanged) - end - end -end - -function HealthBar.onSoulChange(localPlayer, soul) - soulLabel:setText('Soul: '.. soul) -end - -function HealthBar.toggleIcon(bitChanged) - local content = healthBarWindow:recursiveGetChildById('conditionPanel') - - local icon = content:getChildById(Icons[bitChanged].id) - if icon then - icon:destroy() - else - icon = g_ui.createWidget('ConditionWidget', content) - icon:setId(Icons[bitChanged].id) - icon:setImageSource(Icons[bitChanged].path) - icon:setTooltip(Icons[bitChanged].tooltip) - end -end - diff --git a/modules/game_healthbar/healthbar.otmod b/modules/game_healthbar/healthbar.otmod deleted file mode 100644 index 13a55972..00000000 --- a/modules/game_healthbar/healthbar.otmod +++ /dev/null @@ -1,15 +0,0 @@ -Module - name: game_healthbar - description: Displays health and mana points - author: edubart - website: www.otclient.info - - dependencies: - - game_interface - - @onLoad: | - dofile 'healthbar' - HealthBar.init() - - @onUnload: | - HealthBar.terminate() diff --git a/modules/game_healthinfo/healthinfo.lua b/modules/game_healthinfo/healthinfo.lua new file mode 100644 index 00000000..9fd1eda1 --- /dev/null +++ b/modules/game_healthinfo/healthinfo.lua @@ -0,0 +1,151 @@ +HealthInfo = {} + +-- constants +local Icons = {} +Icons[1] = { tooltip = tr('You are poisoned'), path = '/game_healthinfo/icons/poisoned.png', id = 'condition_poisoned' } +Icons[2] = { tooltip = tr('You are burning'), path = '/game_healthinfo/icons/burning.png', id = 'condition_burning' } +Icons[4] = { tooltip = tr('You are electrified'), path = '/game_healthinfo/icons/electrified.png', id = 'condition_electrified' } +Icons[8] = { tooltip = tr('You are freezing'), path = '/game_healthinfo/icons/drunk.png', id = 'condition_drunk' } +Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/game_healthinfo/icons/magic_shield.png', id = 'condition_magic_shield' } +Icons[32] = { tooltip = tr('You are paralysed'), path = '/game_healthinfo/icons/slowed.png', id = 'condition_slowed' } +Icons[64] = { tooltip = tr('You are hasted'), path = '/game_healthinfo/icons/haste.png', id = 'condition_haste' } +Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/game_healthinfo/icons/logout_block.png', id = 'condition_logout_block' } +Icons[256] = { tooltip = tr('You are drowing'), path = '/game_healthinfo/icons/drowning.png', id = 'condition_drowning' } +Icons[512] = { tooltip = tr('You are freezing'), path = '/game_healthinfo/icons/freezing.png', id = 'condition_freezing' } +Icons[1024] = { tooltip = tr('You are dazzled'), path = '/game_healthinfo/icons/dazzled.png', id = 'condition_dazzled' } +Icons[2048] = { tooltip = tr('You are cursed'), path = '/game_healthinfo/icons/cursed.png', id = 'condition_cursed' } +Icons[4096] = { tooltip = tr('You are strengthened'), path = '/game_healthinfo/icons/strengthened.png', id = 'condition_strengthened' } +Icons[8192] = { tooltip = tr('You may not logout or enter a protection zone'), path = '/game_healthinfo/icons/protection_zone_block.png', id = 'condition_protection_zone_block' } +Icons[16384] = { tooltip = tr('You are within a protection zone'), path = '/game_healthinfo/icons/protection_zone.png', id = 'condition_protection_zone' } +Icons[32768] = { tooltip = tr('You are bleeding'), path = '/game_healthinfo/icons/bleeding.png', id = 'condition_bleeding' } +Icons[65536] = { tooltip = tr('You are hungry'), path = '/game_healthinfo/icons/hungry.png', id = 'condition_hungry' } + +-- private variables +local healthInfoWindow +local healthBar +local manaBar +local soulBar +local healthLabel +local manaLabel +local soulLabel + +-- public functions +function HealthInfo.init() + connect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange, + onManaChange = HealthInfo.onManaChange, + onStatesChange = HealthInfo.onStatesChange, + onSoulChange = HealthInfo.onSoulChange }) + + connect(g_game, { onGameEnd = HealthInfo.offline }) + + healthInfoWindow = g_ui.loadUI('healthinfo.otui', GameInterface.getRightPanel()) + healthInfoButton = TopMenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), 'healthinfo.png', HealthInfo.toggle) + healthInfoButton:setOn(true) + healthBar = healthInfoWindow:recursiveGetChildById('healthBar') + manaBar = healthInfoWindow:recursiveGetChildById('manaBar') + healthLabel = healthInfoWindow:recursiveGetChildById('healthLabel') + manaLabel = healthInfoWindow:recursiveGetChildById('manaLabel') + soulBar = healthInfoWindow:recursiveGetChildById('soulBar') + soulLabel = healthInfoWindow:recursiveGetChildById('soulLabel') + + if g_game.isOnline() then + local localPlayer = g_game.getLocalPlayer() + HealthInfo.onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth()) + HealthInfo.onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana()) + HealthInfo.onStatesChange(localPlayer, localPlayer:getStates(), 0) + HealthInfo.onSoulChange(localPlayer, localPlayer:getSoul()) + end +end + +function HealthInfo.terminate() + disconnect(LocalPlayer, { onHealthChange = HealthInfo.onHealthChange, + onManaChange = HealthInfo.onManaChange, + onStatesChange = HealthInfo.onStatesChange, + onSoulChange = HealthInfo.onSoulChange }) + + disconnect(g_game, { onGameEnd = HealthInfo.offline }) + + healthInfoWindow:destroy() + healthInfoButton:destroy() + healthInfoWindow = nil + healthInfoButton = nil + + healthBar = nil + manaBar = nil + soulBar = nil + + healthLabel = nil + manaLabel = nil + soulLabel = nil + + HealthInfo = nil +end + +function HealthInfo.toggle() + if healthInfoButton:isOn() then + healthInfoWindow:close() + healthInfoButton:setOn(false) + else + healthInfoWindow:open() + healthInfoButton:setOn(true) + end +end + +function HealthInfo.onMiniWindowClose() + healthInfoButton:setOn(false) +end + +function HealthInfo.offline() + healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren() +end + +-- hooked events +function HealthInfo.onHealthChange(localPlayer, health, maxHealth) + healthLabel:setText(health .. ' / ' .. maxHealth) + healthBar:setPercent(health / maxHealth * 100) +end + +function HealthInfo.onManaChange(localPlayer, mana, maxMana) + manaLabel:setText(mana .. ' / ' .. maxMana) + + local percent + if maxMana == 0 then + percent = 100 + else + percent = (mana * 100)/maxMana + end + manaBar:setPercent(percent) +end + +function HealthInfo.onSoulChange(localPlayer, soul) + soulLabel:setText('Soul: ' .. soul) +end + +function HealthInfo.onStatesChange(localPlayer, now, old) + if now == old then return end + + local bitsChanged = bit32.bxor(now, old) + for i = 1, 32 do + local pow = math.pow(2, i-1) + if pow > bitsChanged then break end + local bitChanged = bit32.band(bitsChanged, pow) + if bitChanged ~= 0 then + HealthInfo.toggleIcon(bitChanged) + end + end +end + +function HealthInfo.toggleIcon(bitChanged) + local content = healthInfoWindow:recursiveGetChildById('conditionPanel') + + local icon = content:getChildById(Icons[bitChanged].id) + if icon then + icon:destroy() + else + icon = g_ui.createWidget('ConditionWidget', content) + icon:setId(Icons[bitChanged].id) + icon:setImageSource(Icons[bitChanged].path) + icon:setTooltip(Icons[bitChanged].tooltip) + end +end + diff --git a/modules/game_healthinfo/healthinfo.otmod b/modules/game_healthinfo/healthinfo.otmod new file mode 100644 index 00000000..e0a9c139 --- /dev/null +++ b/modules/game_healthinfo/healthinfo.otmod @@ -0,0 +1,15 @@ +Module + name: game_healthinfo + description: Displays health, mana points, soul points, and conditions + author: edubart, BeniS + website: www.otclient.info + + dependencies: + - game_interface + + @onLoad: | + dofile 'healthinfo' + HealthInfo.init() + + @onUnload: | + HealthInfo.terminate() diff --git a/modules/game_healthbar/healthbar.otui b/modules/game_healthinfo/healthinfo.otui similarity index 91% rename from modules/game_healthbar/healthbar.otui rename to modules/game_healthinfo/healthinfo.otui index 2c86d04e..0c95ba3f 100644 --- a/modules/game_healthbar/healthbar.otui +++ b/modules/game_healthinfo/healthinfo.otui @@ -33,7 +33,7 @@ ManaLabel < GameLabel anchors.fill: manaBar margin-top: 2 text: 0 / 0 - + SoulLabel < GameLabel id: soulLabel color: white @@ -52,11 +52,11 @@ ConditionWidget < UIWidget margin-left: 5 MiniWindow - icon: healthbar.png - id: healthBarWindow - !text: tr('Health Bar') + icon: healthinfo.png + id: healthInfoWindow + !text: tr('Health Info') height: 102 - @onClose: HealthBar.onMiniWindowClose() + @onClose: HealthInfo.onMiniWindowClose() &save: true MiniWindowContents diff --git a/modules/game_healthbar/healthbar.png b/modules/game_healthinfo/healthinfo.png similarity index 100% rename from modules/game_healthbar/healthbar.png rename to modules/game_healthinfo/healthinfo.png diff --git a/modules/game_healthbar/icons/bleeding.png b/modules/game_healthinfo/icons/bleeding.png similarity index 100% rename from modules/game_healthbar/icons/bleeding.png rename to modules/game_healthinfo/icons/bleeding.png diff --git a/modules/game_healthbar/icons/burning.png b/modules/game_healthinfo/icons/burning.png similarity index 100% rename from modules/game_healthbar/icons/burning.png rename to modules/game_healthinfo/icons/burning.png diff --git a/modules/game_healthbar/icons/cursed.png b/modules/game_healthinfo/icons/cursed.png similarity index 100% rename from modules/game_healthbar/icons/cursed.png rename to modules/game_healthinfo/icons/cursed.png diff --git a/modules/game_healthbar/icons/dazzled.png b/modules/game_healthinfo/icons/dazzled.png similarity index 100% rename from modules/game_healthbar/icons/dazzled.png rename to modules/game_healthinfo/icons/dazzled.png diff --git a/modules/game_healthbar/icons/drowning.png b/modules/game_healthinfo/icons/drowning.png similarity index 100% rename from modules/game_healthbar/icons/drowning.png rename to modules/game_healthinfo/icons/drowning.png diff --git a/modules/game_healthbar/icons/drunk.png b/modules/game_healthinfo/icons/drunk.png similarity index 100% rename from modules/game_healthbar/icons/drunk.png rename to modules/game_healthinfo/icons/drunk.png diff --git a/modules/game_healthbar/icons/electrified.png b/modules/game_healthinfo/icons/electrified.png similarity index 100% rename from modules/game_healthbar/icons/electrified.png rename to modules/game_healthinfo/icons/electrified.png diff --git a/modules/game_healthbar/icons/freezing.png b/modules/game_healthinfo/icons/freezing.png similarity index 100% rename from modules/game_healthbar/icons/freezing.png rename to modules/game_healthinfo/icons/freezing.png diff --git a/modules/game_healthbar/icons/haste.png b/modules/game_healthinfo/icons/haste.png similarity index 100% rename from modules/game_healthbar/icons/haste.png rename to modules/game_healthinfo/icons/haste.png diff --git a/modules/game_healthbar/icons/hungry.png b/modules/game_healthinfo/icons/hungry.png similarity index 100% rename from modules/game_healthbar/icons/hungry.png rename to modules/game_healthinfo/icons/hungry.png diff --git a/modules/game_healthbar/icons/logout_block.png b/modules/game_healthinfo/icons/logout_block.png similarity index 100% rename from modules/game_healthbar/icons/logout_block.png rename to modules/game_healthinfo/icons/logout_block.png diff --git a/modules/game_healthbar/icons/magic_shield.png b/modules/game_healthinfo/icons/magic_shield.png similarity index 100% rename from modules/game_healthbar/icons/magic_shield.png rename to modules/game_healthinfo/icons/magic_shield.png diff --git a/modules/game_healthbar/icons/poisoned.png b/modules/game_healthinfo/icons/poisoned.png similarity index 100% rename from modules/game_healthbar/icons/poisoned.png rename to modules/game_healthinfo/icons/poisoned.png diff --git a/modules/game_healthbar/icons/protection_zone.png b/modules/game_healthinfo/icons/protection_zone.png similarity index 100% rename from modules/game_healthbar/icons/protection_zone.png rename to modules/game_healthinfo/icons/protection_zone.png diff --git a/modules/game_healthbar/icons/protection_zone_block.png b/modules/game_healthinfo/icons/protection_zone_block.png similarity index 100% rename from modules/game_healthbar/icons/protection_zone_block.png rename to modules/game_healthinfo/icons/protection_zone_block.png diff --git a/modules/game_healthbar/icons/slowed.png b/modules/game_healthinfo/icons/slowed.png similarity index 100% rename from modules/game_healthbar/icons/slowed.png rename to modules/game_healthinfo/icons/slowed.png diff --git a/modules/game_healthbar/icons/strengthened.png b/modules/game_healthinfo/icons/strengthened.png similarity index 100% rename from modules/game_healthbar/icons/strengthened.png rename to modules/game_healthinfo/icons/strengthened.png diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 78768bac..53c59386 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -38,7 +38,7 @@ function HotkeysManager.init() local hotkeyListPanel = hotkeysWindow:getChildById('currentHotkeys') hotkeysWindow:setVisible(false) - hotkeysButton = TopMenu.addGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/game_hotkeys/icon.png', HotkeysManager.toggle) + hotkeysButton = TopMenu.addLeftGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/game_hotkeys/icon.png', HotkeysManager.toggle) g_keyboard.bindKeyDown('Ctrl+K', HotkeysManager.toggle) g_keyboard.bindKeyPress('Down', function() hotkeyListPanel:focusNextChild(KeyboardFocusReason) end, hotkeysWindow) g_keyboard.bindKeyPress('Up', function() hotkeyListPanel:focusPreviousChild(KeyboardFocusReason) end, hotkeysWindow) diff --git a/modules/game_hotkeys/hotkeys_manager.otmod b/modules/game_hotkeys/hotkeys_manager.otmod index 614df919..c6a48c58 100644 --- a/modules/game_hotkeys/hotkeys_manager.otmod +++ b/modules/game_hotkeys/hotkeys_manager.otmod @@ -1,7 +1,7 @@ Module name: game_hotkeys description: Manage client hotkeys - author: andrefaramir + author: andrefaramir, BeniS website: www.otclient.info dependencies: diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 92f2e28d..5754a9b6 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -20,6 +20,8 @@ end function GameInterface.init() g_ui.importStyle('styles/countwindow.otui') + g_ui.importStyle('styles/logoutwindow.otui') + g_ui.importStyle('styles/exitwindow.otui') connect(g_game, { onGameStart = GameInterface.show }, true) connect(g_game, { onGameEnd = GameInterface.hide }, true) @@ -63,8 +65,8 @@ function GameInterface.init() g_keyboard.bindKeyPress('Escape', function() g_game.cancelAttackAndFollow() end, gameRootPanel, WALK_AUTO_REPEAT_DELAY) g_keyboard.bindKeyPress('Ctrl+=', function() gameMapPanel:zoomIn() end, gameRootPanel, 250) g_keyboard.bindKeyPress('Ctrl+-', function() gameMapPanel:zoomOut() end, gameRootPanel, 250) - g_keyboard.bindKeyDown('Ctrl+Q', GameInterface.tryLogout, gameRootPanel) - g_keyboard.bindKeyDown('Ctrl+L', GameInterface.tryLogout, gameRootPanel) + g_keyboard.bindKeyDown('Ctrl+Q', GameInterface.logout, gameRootPanel) + g_keyboard.bindKeyDown('Ctrl+L', GameInterface.logout, gameRootPanel) g_keyboard.bindKeyDown('Ctrl+W', function() g_map.cleanTexts() TextMessage.clearMessages() end, gameRootPanel) g_keyboard.bindKeyDown('Ctrl+.', function() @@ -114,7 +116,7 @@ function GameInterface.hide() g_app.onClose = nil end -function GameInterface.tryExit() +function GameInterface.exit() if g_game.isOnline() then g_game.forceLogout() scheduleEvent(exit, 10) @@ -122,13 +124,47 @@ function GameInterface.tryExit() end end -function GameInterface.tryLogout() +function GameInterface.tryExit() + local exitWindow = g_ui.createWidget('ExitWindow', rootWidget) + local exitButton = exitWindow:getChildById('buttonExit') + local logoutButton = exitWindow:getChildById('buttonLogout') + + local exitFunc = function() + GameInterface.exit() + exitButton:getParent():destroy() + end + + local logoutFunc = function() + GameInterface.logout() + logoutButton:getParent():destroy() + end + + exitWindow.onEnter = logoutFunc + exitButton.onClick = exitFunc + logoutButton.onClick = logoutFunc + return true -- signal closing +end + +function GameInterface.logout() if g_game.isOnline() then g_game.safeLogout() return true end end +function GameInterface.tryLogout() + local logoutWindow = g_ui.createWidget('LogoutWindow', rootWidget) + local yesButton = logoutWindow:getChildById('buttonYes') + + local logoutFunc = function() + GameInterface.logout() + yesButton:getParent():destroy() + end + + logoutWindow.onEnter = logoutFunc + yesButton.onClick = logoutFunc +end + function GameInterface.onMouseGrabberRelease(self, mousePosition, mouseButton) if GameInterface.selectedThing == nil then return false end if mouseButton == MouseLeftButton then diff --git a/modules/game_interface/styles/exitwindow.otui b/modules/game_interface/styles/exitwindow.otui new file mode 100644 index 00000000..a1affa38 --- /dev/null +++ b/modules/game_interface/styles/exitwindow.otui @@ -0,0 +1,54 @@ +ExitWindow < MainWindow + id: exitWindow + !text: tr('Exit') + size: 550 135 + @onEscape: self:destroy() + + Label + !text: tr('If you shut down the program, you character might stay in the game.') + width: 550 + anchors.left: parent.left + anchors.top: parent.top + margin-left: 10 + margin-top: 2 + + Label + !text: tr('Click on "Logout" to ensure that you character leaves the game property.') + width: 550 + anchors.left: parent.left + anchors.top: prev.bottom + margin-left: 10 + margin-top: 2 + + Label + !text: tr('Click on "Exit" if you want to exit the program without logging out your character.') + width: 550 + anchors.left: parent.left + anchors.top: prev.bottom + margin-left: 10 + margin-top: 2 + + Button + id: buttonExit + !text: tr('Exit') + width: 64 + anchors.left: parent.left + anchors.bottom: parent.bottom + margin-left: 155 + + Button + id: buttonLogout + !text: tr('Logout') + width: 64 + anchors.left: prev.right + anchors.bottom: parent.bottom + margin-left: 5 + + Button + id: buttonCancel + !text: tr('Cancel') + width: 64 + anchors.left: prev.right + anchors.bottom: parent.bottom + margin-left: 5 + @onClick: self:getParent():destroy() diff --git a/modules/game_interface/styles/logoutwindow.otui b/modules/game_interface/styles/logoutwindow.otui new file mode 100644 index 00000000..5be1be5f --- /dev/null +++ b/modules/game_interface/styles/logoutwindow.otui @@ -0,0 +1,30 @@ +LogoutWindow < MainWindow + id: logoutWindow + !text: tr('Logout') + size: 300 100 + @onEscape: self:destroy() + + Label + !text: tr('Are you sure you want to logout?') + width: 300 + anchors.left: parent.left + anchors.top: parent.top + margin-left: 30 + margin-top: 2 + + Button + id: buttonYes + !text: tr('Yes') + width: 64 + anchors.left: parent.left + anchors.bottom: parent.bottom + margin-left: 65 + + Button + id: buttonNo + !text: tr('No') + width: 64 + anchors.left: prev.right + anchors.bottom: parent.bottom + margin-left: 5 + @onClick: self:getParent():destroy() diff --git a/modules/game_interface/widgets/uigamemap.lua b/modules/game_interface/widgets/uigamemap.lua index 2c234589..f3a1c376 100644 --- a/modules/game_interface/widgets/uigamemap.lua +++ b/modules/game_interface/widgets/uigamemap.lua @@ -35,8 +35,8 @@ function UIGameMap:onDrop(widget, mousePos) local thing = widget.currentDragThing local toPos = tile:getPosition() - local itemPos = thing:getPosition() - if itemPos.x == toPos.x and itemPos.y == toPos.y and itemPos.z == toPos.z then return false end + local thingPos = thing:getPosition() + if thingPos.x == toPos.x and thingPos.y == toPos.y and thingPos.z == toPos.z then return false end if thing:asItem() and thing:getCount() > 1 then GameInterface.moveStackableItem(thing, toPos) diff --git a/modules/game_interface/widgets/uiitem.lua b/modules/game_interface/widgets/uiitem.lua index dc1b20e1..22dfeb44 100644 --- a/modules/game_interface/widgets/uiitem.lua +++ b/modules/game_interface/widgets/uiitem.lua @@ -27,7 +27,7 @@ function UIItem:onDrop(widget, mousePos) local toPos = self.position local itemPos = item:getPosition() - if itemPos.x == self.position.x and itemPos.y == self.position.y and itemPos.z == self.position.z then return false end + if itemPos.x == toPos.x and itemPos.y == toPos.y and itemPos.z == toPos.z then return false end if item:getCount() > 1 then GameInterface.moveStackableItem(item, toPos) diff --git a/modules/game_inventory/inventory.lua b/modules/game_inventory/inventory.lua index 434ed6f7..90f4a475 100644 --- a/modules/game_inventory/inventory.lua +++ b/modules/game_inventory/inventory.lua @@ -29,7 +29,7 @@ function Inventory.init() inventoryWindow = g_ui.loadUI('inventory.otui', GameInterface.getRightPanel()) inventoryPanel = inventoryWindow:getChildById('contentsPanel') - inventoryButton = TopMenu.addGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', Inventory.toggle) + inventoryButton = TopMenu.addRightGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', Inventory.toggle) inventoryButton:setOn(true) Inventory.refresh() diff --git a/modules/game_inventory/inventory.otmod b/modules/game_inventory/inventory.otmod index 72912535..260906b6 100644 --- a/modules/game_inventory/inventory.otmod +++ b/modules/game_inventory/inventory.otmod @@ -1,7 +1,7 @@ Module name: game_inventory description: View local player equipments window - author: baxnie, edubart + author: baxnie, edubart, BeniS website: www.otclient.info dependencies: diff --git a/modules/game_inventory/inventory.otui b/modules/game_inventory/inventory.otui index 42019a6f..3de83a48 100644 --- a/modules/game_inventory/inventory.otui +++ b/modules/game_inventory/inventory.otui @@ -127,13 +127,3 @@ MiniWindow margin-top: 5 text-align: center text-auto-resize: true - - GameLabel - id: soul - height: 30 - anchors.top: slot9.bottom - anchors.left: slot9.left - margin-top: 5 - text-align: center - text-auto-resize: true - diff --git a/modules/game_minimap/minimap.lua b/modules/game_minimap/minimap.lua index 3ad4abeb..f4aec99d 100644 --- a/modules/game_minimap/minimap.lua +++ b/modules/game_minimap/minimap.lua @@ -42,7 +42,7 @@ function Minimap.init() g_keyboard.bindKeyDown('Ctrl+M', Minimap.toggle) - minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle) + minimapButton = TopMenu.addRightGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle) minimapButton:setOn(true) minimapWindow = g_ui.loadUI('minimap.otui', GameInterface.getRightPanel()) @@ -137,11 +137,11 @@ function Minimap.onButtonClick(id) minimapWidget:setZoom(math.max(minimapWidget:getMaxZoomIn(), minimapWidget:getZoom()-15)) elseif id == "zoomOut" then minimapWidget:setZoom(math.min(minimapWidget:getMaxZoomOut(), minimapWidget:getZoom()+15)) - elseif id == "levelUp" then + elseif id == "floorUp" then local pos = minimapWidget:getCameraPosition() pos.z = pos.z - 1 minimapWidget:setCameraPosition(pos) - elseif id == "levelDown" then + elseif id == "floorDown" then local pos = minimapWidget:getCameraPosition() pos.z = pos.z + 1 minimapWidget:setCameraPosition(pos) diff --git a/modules/game_minimap/minimap.otmod b/modules/game_minimap/minimap.otmod index e67e9bc4..55c98685 100644 --- a/modules/game_minimap/minimap.otmod +++ b/modules/game_minimap/minimap.otmod @@ -1,7 +1,7 @@ Module name: game_minimap description: Manage minimap - author: edubart + author: edubart, BeniS website: www.otclient.info dependencies: diff --git a/modules/game_minimap/minimap.otui b/modules/game_minimap/minimap.otui index a1308aef..cd06b3b4 100644 --- a/modules/game_minimap/minimap.otui +++ b/modules/game_minimap/minimap.otui @@ -76,42 +76,42 @@ MiniWindow $disabled: image-color: #ffffff88 - - Button - id: zoomOut - text: - - font: terminus-14px-bold - size: 16 16 + + FloorUpControl + id: floorUp anchors.left: minimap.right anchors.top: compass.bottom margin-top: 10 - margin-left: 10 + margin-left: 15 enabled: true @onClick: Minimap.onButtonClick(self:getId()) - Button - id: zoomIn - text: + - size: 16 16 - anchors.left: zoomOut.left - anchors.top: zoomOut.bottom + FloorDownControl + id: floorDown + anchors.left: floorUp.left + anchors.top: floorUp.bottom margin-top: 4 enabled: true @onClick: Minimap.onButtonClick(self:getId()) - FloorUpControl - id: levelUp - anchors.left: zoomOut.right - anchors.top: zoomOut.top - margin-left: 15 + Button + id: zoomIn + text: + + size: 16 16 + anchors.left: floorUp.right + anchors.top: floorUp.top + margin-left: 10 enabled: true @onClick: Minimap.onButtonClick(self:getId()) - FloorDownControl - id: levelDown - anchors.left: zoomIn.right - anchors.top: zoomIn.top - margin-left: 15 + Button + id: zoomOut + text: - + font: terminus-14px-bold + size: 16 16 + anchors.left: floorDown.right + anchors.top: floorDown.top + margin-left: 10 enabled: true @onClick: Minimap.onButtonClick(self:getId()) diff --git a/modules/game_questlog/questlog.lua b/modules/game_questlog/questlog.lua index d151cb03..bb3a110c 100644 --- a/modules/game_questlog/questlog.lua +++ b/modules/game_questlog/questlog.lua @@ -58,7 +58,7 @@ function QuestLog.init() g_ui.importStyle('questlogwindow.otui') g_ui.importStyle('questlinewindow.otui') - questLogButton = TopMenu.addGameButton('questLogButton', tr('Quest Log'), 'questlog.png', function() g_game.requestQuestLog() end) + questLogButton = TopMenu.addLeftGameButton('questLogButton', tr('Quest Log'), 'questlog.png', function() g_game.requestQuestLog() end) connect(g_game, { onQuestLog = onGameQuestLog }) connect(g_game, { onQuestLine= onGameQuestLine }) diff --git a/modules/game_skills/skills.lua b/modules/game_skills/skills.lua index 1dbe7f07..ecaec384 100644 --- a/modules/game_skills/skills.lua +++ b/modules/game_skills/skills.lua @@ -36,7 +36,7 @@ function Skills.init() }) skillsWindow = g_ui.loadUI('skills.otui', GameInterface.getRightPanel()) - skillsButton = TopMenu.addGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', 'skills.png', Skills.toggle) + skillsButton = TopMenu.addRightGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', 'skills.png', Skills.toggle) skillsButton:setOn(true) g_keyboard.bindKeyDown('Ctrl+S', Skills.toggle) diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index 13dc4ef1..ce05afcd 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -15,7 +15,7 @@ function VipList.init() g_keyboard.bindKeyDown('Ctrl+P', VipList.toggle) vipWindow = g_ui.loadUI('viplist.otui', GameInterface.getRightPanel()) - vipButton = TopMenu.addGameToggleButton('vipListButton', tr('VIP list') .. ' (Ctrl+P)', 'viplist.png', VipList.toggle) + vipButton = TopMenu.addRightGameToggleButton('vipListButton', tr('VIP list') .. ' (Ctrl+P)', 'viplist.png', VipList.toggle) vipButton:setOn(true) VipList.refresh() diff --git a/src/otclient/core/creature.cpp b/src/otclient/core/creature.cpp index 616761e5..b5496b16 100644 --- a/src/otclient/core/creature.cpp +++ b/src/otclient/core/creature.cpp @@ -189,6 +189,9 @@ void Creature::drawOutfit(const Rect& destRect, bool resize) void Creature::drawInformation(const Point& point, bool useGray, const Rect& parentRect) { + if(m_healthPercent < 1) // creature is dead + return; + Color fillColor = Color(96, 96, 96); if(!useGray) diff --git a/src/otclient/ui/uimap.cpp b/src/otclient/ui/uimap.cpp index 9f90191e..fcda0d7a 100644 --- a/src/otclient/ui/uimap.cpp +++ b/src/otclient/ui/uimap.cpp @@ -118,6 +118,11 @@ void UIMap::setKeepAspectRatio(bool enable) TilePtr UIMap::getTile(const Point& mousePos) { + /* + * Known Issue: If you move a container widget into the map rect + * if you move an item onto itself it will allow this to execute + * still dropping the item on the ground. + */ if(!m_mapRect.contains(mousePos)) return nullptr;