From fda3ae68099a25c5a86cec07ec5ae9fe446ce558 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Sun, 3 Jun 2012 17:05:35 -0300 Subject: [PATCH] fix scroll, container item size, tradewindow scroll, questlog window alignment, stop attacking same creature --- BUGS | 1 - modules/core_lib/widgets/uiscrollbar.lua | 4 +- modules/game_containers/container.otui | 6 +-- modules/game_playertrade/tradewindow.otui | 47 ++++++++++++++++------- modules/game_questlog/questlogwindow.otui | 16 ++++---- src/otclient/core/game.cpp | 9 ++++- 6 files changed, 55 insertions(+), 28 deletions(-) diff --git a/BUGS b/BUGS index 5f6fa26b..4018afa8 100644 --- a/BUGS +++ b/BUGS @@ -28,4 +28,3 @@ hotkeys works while windows are locked, it shouldn't skulls is rendering outside map bounds party options does not work when re-logging inside a party sometimes we can still view hits from above/bottom floors from a fight that is not visible -scroll does not follow characerlist selection when changing focus with up/down arrows diff --git a/modules/core_lib/widgets/uiscrollbar.lua b/modules/core_lib/widgets/uiscrollbar.lua index 3d5bedb5..eed4a662 100644 --- a/modules/core_lib/widgets/uiscrollbar.lua +++ b/modules/core_lib/widgets/uiscrollbar.lua @@ -128,12 +128,12 @@ end function UIScrollBar:decrement(count) count = count or self.step - self:setValue(self.value - self.step) + self:setValue(self.value - count) end function UIScrollBar:increment(count) count = count or self.step - self:setValue(self.value + self.step) + self:setValue(self.value + count) end function UIScrollBar:setMaximum(maximum) diff --git a/modules/game_containers/container.otui b/modules/game_containers/container.otui index 324be73d..534b031d 100644 --- a/modules/game_containers/container.otui +++ b/modules/game_containers/container.otui @@ -5,11 +5,11 @@ ContainerWindow < MiniWindow id: containerItemWidget virtual: true item-id: 3253 - size: 32 32 + size: 16 16 anchors.top: parent.top anchors.left: parent.left - margin-top: -6 - margin-left: -6 + margin-top: 4 + margin-left: 4 UIButton id: upButton diff --git a/modules/game_playertrade/tradewindow.otui b/modules/game_playertrade/tradewindow.otui index ddd65b9a..733a21f9 100644 --- a/modules/game_playertrade/tradewindow.otui +++ b/modules/game_playertrade/tradewindow.otui @@ -6,49 +6,70 @@ TradeWindow < MiniWindow id: tradeItem virtual: true item-id: 3253 - size: 32 32 + size: 16 16 anchors.top: parent.top anchors.left: parent.left - margin-top: -6 - margin-left: -6 + margin-top: 4 + margin-left: 4 MiniWindowContents padding: 6 ScrollableFlatPanel id: ownTradeContainer + anchors.top: parent.top + anchors.bottom: acceptButton.top anchors.left: parent.left - anchors.top: tradeScrollBar.top - anchors.right: tradeScrollBar.left - anchors.bottom: tradeScrollBar.bottom + anchors.right: ownTradeScrollBar.left + margin-top: 14 + margin-bottom: 4 + padding: 2 layout: type: grid cell-size: 36 36 flow: true cell-spacing: 0 - vertical-scrollbar: tradeScrollBar + vertical-scrollbar: ownTradeScrollBar + + VerticalScrollBar + id: ownTradeScrollBar + anchors.top: parent.top + anchors.bottom: acceptButton.top + anchors.right: counterTradeContainer.left + margin-top: 14 + margin-bottom: 4 + step: 14 + pixels-scroll: true + $disabled: + width: 0 ScrollableFlatPanel id: counterTradeContainer - anchors.right: parent.right - anchors.top: tradeScrollBar.top - anchors.left: tradeScrollBar.right - anchors.bottom: tradeScrollBar.bottom + anchors.top: parent.top + anchors.bottom: acceptButton.top + anchors.left: parent.horizontalCenter + anchors.right: counterTradeScrollBar.left + margin-top: 14 + margin-bottom: 4 + padding: 2 layout: type: grid cell-size: 36 36 flow: true cell-spacing: 0 + vertical-scrollbar: counterTradeScrollBar VerticalScrollBar - id: tradeScrollBar + id: counterTradeScrollBar anchors.top: parent.top anchors.bottom: acceptButton.top - anchors.horizontalCenter: parent.horizontalCenter + anchors.right: parent.right margin-top: 14 margin-bottom: 4 step: 14 pixels-scroll: true + $disabled: + width: 0 Label id: ownTradeLabel diff --git a/modules/game_questlog/questlogwindow.otui b/modules/game_questlog/questlogwindow.otui index 0f7225fa..25a6cf2d 100644 --- a/modules/game_questlog/questlogwindow.otui +++ b/modules/game_questlog/questlogwindow.otui @@ -26,19 +26,21 @@ QuestLogWindow < MainWindow TextList id: questList - anchors.fill: parent - width: 190 + anchors.top: parent.top + anchors.bottom: closeButton.top + anchors.left: parent.left + anchors.right: questListScrollBar.left + margin-bottom: 10 padding: 1 focusable: false - margin-bottom: 30 - margin-right: 20 vertical-scrollbar: questListScrollBar VerticalScrollBar id: questListScrollBar - anchors.top: questList.top - anchors.bottom: questList.bottom - anchors.left: questList.right + anchors.top: parent.top + anchors.bottom: closeButton.top + anchors.right: parent.right + margin-bottom: 10 step: 14 pixels-scroll: true diff --git a/src/otclient/core/game.cpp b/src/otclient/core/game.cpp index 2df6cfa6..664596e3 100644 --- a/src/otclient/core/game.cpp +++ b/src/otclient/core/game.cpp @@ -691,9 +691,14 @@ void Game::refreshContainer() void Game::attack(const CreaturePtr& creature) { - if(!canPerformGameAction() || creature == m_localPlayer || creature == m_attackingCreature) + if(!canPerformGameAction() || creature == m_localPlayer) return; + if(creature == m_attackingCreature) { + cancelAttack(); + return; + } + m_localPlayer->lockWalk(); if(creature && isFollowing()) @@ -1106,4 +1111,4 @@ void Game::setFollowingCreature(const CreaturePtr& creature) m_followingCreature = creature; g_lua.callGlobalField("g_game", "onFollowingCreatureChange", creature, oldCreature); -} \ No newline at end of file +}