From fc55c6b5241b743c97b4ef5df76cfb62db5e9fb6 Mon Sep 17 00:00:00 2001 From: BeniS Date: Thu, 3 Jan 2013 21:24:07 +1300 Subject: [PATCH] Interface edits, additions, and fixes: * Added a new module for exiting the client (client_exit). * Added tab spacing to the UITabBar class. * Added tab popup menus for things like channel tabs. * Impelemented channel tab popup menus (still need to be finished). * Fixed UITabBar tab draging (will now change after dragged half way over the next tab, not 2 pixels). * Fixes to the client_options module. * Edited some UI settings. * Changed game_cooldown and game_spelllist menu button icons. * Fixed some typos. --- modules/client/client.otmod | 1 + modules/client_exit/exit.lua | 59 ++++++++++++++++++ modules/client_exit/exit.otmod | 16 +++++ modules/client_exit/exit.otui | 0 modules/client_exit/exit.png | Bin 0 -> 733 bytes modules/client_options/options.lua | 19 ++++-- .../skins/default/styles/tabbars.otui | 3 +- .../client_topmenu/images/top_game_button.png | Bin 426 -> 223 bytes modules/corelib/ui/uitabbar.lua | 27 +++++--- modules/game_console/console.lua | 44 ++++++++++++- modules/game_console/console.otui | 16 ++--- modules/game_cooldown/cooldown.png | Bin 675 -> 910 bytes modules/game_spelllist/spelllist.png | Bin 860 -> 706 bytes modules/game_textwindow/textwindow.lua | 2 + src/otclient/const.h | 2 +- src/otclient/map.cpp | 8 ++- 16 files changed, 168 insertions(+), 29 deletions(-) create mode 100644 modules/client_exit/exit.lua create mode 100644 modules/client_exit/exit.otmod create mode 100644 modules/client_exit/exit.otui create mode 100644 modules/client_exit/exit.png diff --git a/modules/client/client.otmod b/modules/client/client.otmod index 41fa3a57..ee107b4e 100644 --- a/modules/client/client.otmod +++ b/modules/client/client.otmod @@ -15,6 +15,7 @@ Module - client_options - client_terminal - client_modulemanager + - client_exit //- client_stats @onLoad: | diff --git a/modules/client_exit/exit.lua b/modules/client_exit/exit.lua new file mode 100644 index 00000000..0208038b --- /dev/null +++ b/modules/client_exit/exit.lua @@ -0,0 +1,59 @@ +Exit = {} + +local exitWindow +local exitButton + +function Exit.init() + exitButton = TopMenu.addRightButton('exitButton', tr('Exit Client'), 'exit.png', Exit.tryExit) + + connect(g_game, { + onGameStart = Exit.hide, + onGameEnd = Exit.show + }) +end + +function Exit.terminate() + disconnect(g_game, { + onGameStart = Exit.hide, + onGameEnd = Exit.show + }) + + if exitWindow then + exitWindow:destroy() + exitWindow = nil + end + + if exitButton then + exitButton:destroy() + exitButton = nil + end + + Exit = nil +end + +function Exit.hide() + if exitWindow then + exitWindow:destroy() + end + exitButton:hide() +end + +function Exit.show() + exitButton:show() +end + +function Exit.tryExit() + if exitWindow then + return true + end + + local yesFunc = function() scheduleEvent(exit, 10) end + local noFunc = function() exitWindow:destroy() exitWindow = nil end + + exitWindow = displayGeneralBox('Exit', tr("Do you really want to exit?"), + { { text='Yes', callback=yesFunc }, + { text='No', callback=noFunc }, + anchor=AnchorHorizontalCenter }, yesFunc, noFunc) + + return true +end diff --git a/modules/client_exit/exit.otmod b/modules/client_exit/exit.otmod new file mode 100644 index 00000000..80afc3b8 --- /dev/null +++ b/modules/client_exit/exit.otmod @@ -0,0 +1,16 @@ +Module + name: client_exit + description: Handles the exit exit of the client (for cases of fullscreen) + author: BeniS + website: www.otclient.info + + dependencies: + - client_topmenu + - client_entergame + + @onLoad: | + dofile 'exit' + Exit.init() + + @onUnload: | + Exit.terminate() diff --git a/modules/client_exit/exit.otui b/modules/client_exit/exit.otui new file mode 100644 index 00000000..e69de29b diff --git a/modules/client_exit/exit.png b/modules/client_exit/exit.png new file mode 100644 index 0000000000000000000000000000000000000000..1512fab2091955c6e79debbcde155bbb333397d9 GIT binary patch literal 733 zcmV<30wVp1P)- z`EU-0pRlPuKKi0&RYU|;{jV=ZAuC9M$x4)xBd5+uxfuu)yn5&m);YZQ#29hj;;kbD zM{thdEPq|S0>Bnv*maE8*ZJtwhupuj=DB?@VSU5rUw*}d_YGOye}Jpk{vq5P0bn)* zu3ym=%CuKfEY|4qkSQ5o8Q3wTSl-SkCvF6LcR(p=rnfN0&>JpLRTb0G7%7BpMW3=z z+VL&Cb$17hBxaK-hJw24A)++12}qA}SRh4-wU(}Hw*q^P?NP-ro{lIhL%$v%BFx4& z=~Y5qmKbB0wNrwdpCJDS_P(`SB@36{{(*CAuVbwxr9euFS#ac#@maw&jK&QozWZA? zY%nPbzFs@SqbHu`kH+$+&Fp&W8Lo#&)7!y#;U1n`eV*17jQ<@iA3OHAYJzAJIVHaN z^#gufJI&ssFY|_7Vr6*=?|yR56fE@zEcR=V2^TMain^Av6nu&Z z75za)Dd08Y?*M})aOKi<@P>qN;Mo;?Eu1|4E$^-DqM8O4TE}9!jbVab>*#lhp$l8T z@X(vPb#>n(TsZ$b2Pc7iXH`waq(DX!sKBJLeD?E=jbVx@bK(4NyfSjcoJlB>m7EPp z0utvbjS*s+&ujoR!O8va;;qA{i0@|1>^yyK*I-?uZ98K0l--Pj53Ak=X;EE4AvW7I P00000NkvXXu0mjfB*9k# literal 0 HcmV?d00001 diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index b38a6d6d..99836cd5 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -68,7 +68,7 @@ function displayWarning(widget, warning) if warningWindow and warningWindow:isVisible() then return end - if g_game.isOfficialTibia() and widget:isChecked() then + if widget:isChecked() then local yesCallback = function() warningWindow:destroy() warningWindow=nil end local noCallback = function() widget:setChecked(false) warningWindow:destroy() warningWindow=nil end @@ -109,10 +109,12 @@ function Options.init() graphicsPanel = g_ui.loadUI('graphics.otui') optionsTabBar:addTab(tr('Graphics'), graphicsPanel) - local optionWalkBooster = gamePanel:getChildById('walkBooster') - optionWalkBooster.onCheckChange = function(widget) - displayWarning(widget, "This feature could be detectable by official Tibia servers. Would like to continue?") - Options.setOption(widget:getId(), widget:isChecked()) + if g_game.isOfficialTibia() then + local optionWalkBooster = gamePanel:getChildById('walkBooster') + optionWalkBooster.onCheckChange = function(widget) + displayWarning(widget, "This feature could be detectable by official Tibia servers. Would like to continue?") + Options.setOption(widget:getId(), widget:isChecked()) + end end setupGraphicsEngines() @@ -151,7 +153,12 @@ function Options.hide() end function Options.toggleOption(key) - Options.setOption(key, not Options.getOption(key)) + local optionWidget = optionsWindow:recursiveGetChildById(key) + if optionWidget then + optionWidget:setChecked(not Options.getOption(key)) + else + Options.setOption(key, not Options.getOption(key)) + end end function Options.setOption(key, value) diff --git a/modules/client_skins/skins/default/styles/tabbars.otui b/modules/client_skins/skins/default/styles/tabbars.otui index e0abd3ec..b937f412 100644 --- a/modules/client_skins/skins/default/styles/tabbars.otui +++ b/modules/client_skins/skins/default/styles/tabbars.otui @@ -13,7 +13,6 @@ TabBarButton < UIButton padding: 5 anchors.left: parent.left - $hover !checked: image-clip: 0 20 20 20 color: white @@ -24,7 +23,7 @@ TabBarButton < UIButton $checked: image-clip: 0 40 20 20 - color: #80c7f8 + color: #D8E7F0 $on !checked: color: #F55E5E diff --git a/modules/client_topmenu/images/top_game_button.png b/modules/client_topmenu/images/top_game_button.png index 7820d506c1c4d132935c214b4f66a0fe915ad86d..c6f115f6ba841a69ee1710e8e3ecaa52ad6dce87 100644 GIT binary patch delta 195 zcmZ3*e4lZGNyi8e``MaJa1-jSycANzgOS8 zXr9mbeLMBkfij!@k5iw$*z13DGZx^prw85kJYlDyqr7(^K?8N~W@PaFn{a29w(7Bet#3xhBt z!>lC~?lu%}vcK0dg4_oQqNuOHxx5$}>wc z6x=<115)%-*%=rZ89iMbLn02py}7XKu!D$O{X^qc)t*^59FD$NrNg52Nvlxsvybw# zLZww^0xSA7t{ijKd9!8(=TvV!?uYZ(XUwmec>T#7&C`?i8Xucb%$5)-#_(#F*j>rv zf(}orx9Og4Dm=$nP#d%9$ceW#<_!0$8JswjtPS0m4bB@g-xR_ z{re>-`Rhl$O`-Mu-tY4Soa*f6D_Mtz3MQL;wz*s?d)Z{;y4UNZuSLyTrnvM-XY)4m zTfb+ww@&tZC;~<%t-%%`bQ!`G@dI&p{9mEL)%rX8TGT~z{%W~5zvG^?FPRco5XAm6 hcM=4DXa21}TRrwzQuS1IU@&nqc)I$ztaD0e0svCMp~e6J diff --git a/modules/corelib/ui/uitabbar.lua b/modules/corelib/ui/uitabbar.lua index 1350e4f9..1dbe1367 100644 --- a/modules/corelib/ui/uitabbar.lua +++ b/modules/corelib/ui/uitabbar.lua @@ -14,7 +14,7 @@ local function updateMargins(tabBar) if i == 1 then tabBar.tabs[i]:setMarginLeft(0) else - tabBar.tabs[i]:setMarginLeft(5 * (i - 1) + currentMargin) + tabBar.tabs[i]:setMarginLeft(tabBar.tabSpacing * (i - 1) + currentMargin) end currentMargin = currentMargin + tabBar.tabs[i]:getWidth() end @@ -23,16 +23,18 @@ end local function onTabMousePress(tab, mousePos, mouseButton) if mouseButton == MouseLeftButton and tab.tabBar.tabsMoveable then tab.tabBar.selected = tab + elseif mouseButton == MouseRightButton then + if tab.menuCallback then tab.menuCallback(tab, mousePos, mouseButton) end end end local function onTabMouseRelease(tab, mousePos, mouseButton) local tabs = tab.tabBar.tabs if tab.tabBar.selected then - local lastMargin = -5 + local lastMargin = -tab.tabBar.tabSpacing for i = 1, #tabs do - local nextMargin = tabs[i + 1] and (tabs[i + 1] == tab and (tabs[i]:getMarginLeft() + tabs[i]:getWidth() + 5) or tabs[i + 1]:getMarginLeft()) or tab.tabBar:getWidth() - if tab:getMarginLeft() >= lastMargin and tab:getMarginLeft() < nextMargin then + local nextMargin = tabs[i + 1] and (tabs[i + 1] == tab and (tabs[i]:getMarginLeft() + tabs[i]:getWidth() + tab.tabBar.tabSpacing) or tabs[i + 1]:getMarginLeft()) or tab.tabBar:getWidth() + if (tab:getMarginLeft()+(tabs[i]:getWidth()/2)) >= lastMargin and (tab:getMarginLeft()+(tabs[i]:getWidth()/2)) < nextMargin then if tabs[i] ~= tab then local newIndex = table.find(tab.tabBar.tabs, tab.tabBar.tabs[i]) table.remove(tab.tabBar.tabs, table.find(tab.tabBar.tabs, tab)) @@ -44,7 +46,7 @@ local function onTabMouseRelease(tab, mousePos, mouseButton) break end end - lastMargin = tab.tabBar.tabs[i]:getMarginLeft() == 0 and -5 or tab.tabBar.tabs[i]:getMarginLeft() + lastMargin = tab.tabBar.tabs[i]:getMarginLeft() == 0 and -tab.tabBar.tabSpacing or tab.tabBar.tabs[i]:getMarginLeft() end end @@ -54,7 +56,7 @@ end local function onTabMouseMove(tab, mousePos, mouseMoved) if tab == tab.tabBar.selected then local newMargin = tab:getMarginLeft() + mouseMoved.x - if newMargin >= -5 and newMargin < tab.tabBar:getWidth() - tab:getWidth() then + if newMargin >= -tab.tabBar.tabSpacing and newMargin < tab.tabBar:getWidth() - tab:getWidth() then tab:setMarginLeft(newMargin) end end @@ -72,6 +74,7 @@ function UITabBar.create() tabbar:setFocusable(false) tabbar.tabs = {} tabbar.selected = nil -- dragged tab + tabbar.tabSpacing = 5 tabsMoveable = false return tabbar end @@ -83,7 +86,12 @@ function UITabBar:setContentWidget(widget) end end -function UITabBar:addTab(text, panel) +function UITabBar:setTabSpacing(tabSpacing) + self.tabSpacing = tabSpacing + updateMargins(self) +end + +function UITabBar:addTab(text, panel, menuCallback) if panel == nil then panel = g_ui.createWidget(self:getStyleName() .. 'Panel') panel:setId('tabPanel') @@ -96,6 +104,7 @@ function UITabBar:addTab(text, panel) tab:setId('tab') tab:setText(text) tab:setWidth(tab:getTextSize().width + tab:getPaddingLeft() + tab:getPaddingRight()) + tab.menuCallback = menuCallback or nil tab.onClick = onTabClick tab.onMousePress = onTabMousePress tab.onMouseRelease = onTabMouseRelease @@ -107,7 +116,7 @@ function UITabBar:addTab(text, panel) self:selectTab(tab) tab:setMarginLeft(0) else - local newMargin = 5 * (#self.tabs - 1) + local newMargin = self.tabSpacing * (#self.tabs - 1) for i = 1, #self.tabs - 1 do newMargin = newMargin + self.tabs[i]:getWidth() end @@ -221,4 +230,4 @@ end function UITabBar:getCurrentTab() return self.currentTab -end \ No newline at end of file +end diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 26687a5e..43163c13 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -77,6 +77,7 @@ function init() consoleContentPanel = consolePanel:getChildById('consoleContentPanel') consoleTabBar = consolePanel:getChildById('consoleTabBar') consoleTabBar:setContentWidget(consoleContentPanel) + consoleTabBar:setTabSpacing(0) channels = {} defaultTab = addTab(tr('Default'), true) @@ -182,6 +183,11 @@ function clear() end end +function clearChannel(consoleTabBar) + consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBuffer'):destroyChildren() + consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBufferHighlight'):destroyChildren() +end + function setTextEditText(text) consoleTextEdit:setText(text) end @@ -195,7 +201,7 @@ function addTab(name, focus) if tab then -- is channel already open if not focus then focus = true end else - tab = consoleTabBar:addTab(name) + tab = consoleTabBar:addTab(name, nil, processChannelTabMenu) end if focus then consoleTabBar:selectTab(tab) @@ -205,6 +211,23 @@ function addTab(name, focus) return tab end +function removeTab(name) + local tab = consoleTabBar:getTab(name) + if tab == defaultTab or tab == serverTab then return end + + -- notificate the server that we are leaving the channel + if tab.channelId then + for k, v in pairs(channels) do + if (k == tab.channelId) then channels[k] = nil end + end + g_game.leaveChannel(tab.channelId) + elseif tab:getText() == "NPCs" then + g_game.closeNpcChannel() + end + + consoleTabBar:removeTab(tab) +end + function removeCurrentTab() local tab = consoleTabBar:getCurrentTab() if tab == defaultTab or tab == serverTab then return end @@ -371,7 +394,7 @@ function addTabText(text, speaktype, tab, creatureName) labelHighlight:setText("") end - label.onMouseRelease = function (self, mousePos, mouseButton) popupMenu(mousePos, mouseButton, creatureName, text) end + label.onMouseRelease = function (self, mousePos, mouseButton) processMessageMenu(mousePos, mouseButton, creatureName, text) end if consoleBuffer:getChildCount() > MAX_LINES then consoleBuffer:getFirstChild():destroy() @@ -382,7 +405,22 @@ function addTabText(text, speaktype, tab, creatureName) end end -function popupMenu(mousePos, mouseButton, creatureName, text) +function processChannelTabMenu(tab, mousePos, mouseButton) + local menu = g_ui.createWidget('PopupMenu') + + channelName = tab:getText() + if tab ~= defaultTab and tab ~= serverTab then + menu:addOption(tr('Close'), function() removeTab(channelName) end) + --menu:addOption(tr('Show Server Messages'), function() --[[TODO]] end) + menu:addSeparator() + end + menu:addOption(tr('Clear Messages'), function() clearChannel(consoleTabBar) end) + --menu:addOption(tr('Save Messages'), function() --[[TODO]] end) + + menu:display(mousePos) +end + +function processMessageMenu(mousePos, mouseButton, creatureName, text) if mouseButton == MouseRightButton then local menu = g_ui.createWidget('PopupMenu') if creatureName then diff --git a/modules/game_console/console.otui b/modules/game_console/console.otui index 86cc7fcf..59b5acd5 100644 --- a/modules/game_console/console.otui +++ b/modules/game_console/console.otui @@ -6,8 +6,8 @@ ConsoleLabel < UILabel text-wrap: true text-auto-resize: true -ConsoleTabBar < TabBarRounded -ConsoleTabBarPanel < TabBarRoundedPanel +ConsoleTabBar < TabBar +ConsoleTabBarPanel < TabBarPanel id: consoleTab ScrollablePanel @@ -57,7 +57,9 @@ ConsoleTabBarPanel < TabBarRoundedPanel step: 14 pixels-scroll: true -ConsoleTabBarButton < TabBarRoundedButton +ConsoleTabBarButton < TabBarButton + height: 28 + padding: 15 Panel id: consolePanel @@ -73,11 +75,12 @@ Panel ConsoleTabBar id: consoleTabBar - height: 20 + height: 28 anchors.left: prev.right - anchors.top: prev.top + anchors.top: parent.top anchors.right: next.left margin-left: 5 + margin-top: 3 moveable: true TabButton @@ -109,8 +112,7 @@ Panel margin-top: 6 @onClick: | local consoleTabBar = self:getParent():getChildById('consoleTabBar') - consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBuffer'):destroyChildren() - consoleTabBar:getCurrentTab().tabPanel:getChildById('consoleBufferHighlight'):destroyChildren() + clearChannel(consoleTabBar) TabButton id: channelsButton diff --git a/modules/game_cooldown/cooldown.png b/modules/game_cooldown/cooldown.png index 802aaf379e68b02f51494c0b7c4e797a32a0d9ea..0e66ccf1a73ca183d681a42c7164f984aaf9babf 100644 GIT binary patch delta 887 zcmV--1Bm>i1&#-hB!2{RLP=Bz2nYy#2xN!=00TuyL_t(IjU~*zZyRL*z~SG$_xgPP zIDa&;T_<(wrj1;waR~(kMYL5wAjHCi5TXM^Cnh!)28R9vAedMfkRU=rpdt_~d=ynd zMNtt6ad6tYPF&k@Z6|lmam;*FsD)5bqS~%X1$Nwwh=uS z$rLG+!Wgufu77_?RT(7aikw)UC1mL||2{$6tXwuU{da z2qLUFvlnM+?K@OGpG{wpnvLPCeZlmf+q|@z;Dh%slS_sXXo%v;V_bW4h30;r&p#=X zSSX-*g4$1Q3?;c=8xl=PG|!`1>GRn~w^%NwdG%rrGZ;X;_GE!fAi>(l+t^2G#5l+J zuR~}K=zk4-cE4)SI~2@ceH{_buZ{O@v%x5_sjUdAlNoC8y^g@h=F2U{t)cOdK zusAHuBdQ(BYhM#RnVrN)#ZK^$& zs&d$i*l2~wyowKlgfWO(c1R!T7 zabU?$;ujzzBr`G3zylE2!U;Kvg#@ABfry3GuFcGJ&vf6ax_=HVu|o`BSSlTT-+}*_ z0Py_VZ@xcFS5I6=q6BcqN`_)Q`lA0Gj{sydd{GuvHg_K7ufG27Sp~4&T|DWcK9(?2 zG(&+pR+Lcq^0W9@^Gqb8%Z}wZF`*W8n(1 zzmc?MJYMta&3~uVA^-@0+YDstRM@P0+OB2Qtq@>)eMOQFpK6Jp-h4upBH>?vT*zu1 z=ZvI=u3tmRnC>{=WbQw>ON>1~yzVK|5t|JbP5>ZK0`A~NNcBKk-9hSs{cg|YpMUV; zbtJVd{rNpg{D`dKbb=8O>bfV@4fsT;g#PveK7RO=AAf%xKq}hdjB0gGY&S?u{3Edt zpct-4@-ae86d8$K%gdh){v~iY}N&JZ4HYl2&WxqvAFbT#3PvU^fnmgQ_x3d*;I)T_z+f zw4LA>*?$&Xjjlf07ufJCB6JZd<(8+Xy+^dI)54>K{^+Zs43@2Wgk^* z_7u;$2-ZpAX19NyExTf8%U(;NKC~z z`=*VL)3c-&=I{cC`*&}Q3h3Dd_`YE&T|f|^lmaQJIjEU>aGu3`eKa>8<;qGw#XMoCR6WzZ$h&Td(g6p#j z5JD1(hL9LM&yXChrLON2?U$Z$Vf;PIwH2h=>rql*1A*gcB4MWpD0r64`UW=8gruVL z;!l>IbmPw*qW{0r`9ZCAUm8fD)FHl7BEZZvjY-#7K_BsA+6v_Hr}C zp=stjK47dR6mlrIUeO>|@G$u-uIK-;^Tk!kqq=rl7FOvRp2WC@XouWB) zwODJ5fa&E;&Lvh*O()3d5T@P&mTbWgb`<+mH6>x6c!gv=lf`%jf7?_8{MyL(zMe{r zUK{MBGG4c*Kth1E0ZK`7Zorr6c`}*JVwvFYjU!Z2;M-si)L2G$3iV(44fS;Z)@eON Q@c;k-07*qoM6N<$f+V9yrT_o{ delta 837 zcmV-L1G@ae1>6RZB!32COGiWi{{a60|De66lK=n!32;bRa{vGa>;M1;>;WEiI5hwO z00(qQO+^RX3I+=g2h&iVLJZo2MxknfvL@0YiH^`p<8aufux!=*`s(-6{QT7qN8dmA_Q%1Cw~VqY2v&&9 z3V{jn#*vXyn3_@-SZb6JbQGfFfKN9}Vf4F{%wN;%R!k-f@CE(tHl2+Qg{`@|tT{XR zmpKbEU*JUuB!8xqinZQr%Y`z_>E&2f4{=H~>` zBvFb|mEb*s0_7D|Ra3eQ-+-0f1KRhWu)4C(#@;H2hllioZ5$pY0ilUe2+o5+6n7t{ zTpS1Necq_jek&Bi;1F;MLp;E`GlR$*EILL z*wdW(%OSPPX*63jbdSBQN6fA(mSmV(5le)13L_pWEa%yf*MHuy*2r;}*R_to9vd+XoO!{)}G&C$0dQ%G#>U)+EU%!p;U#dJx1%0ST_-w zGN{Ld1T1wyQRI}Ch*&Haq(w^i zlYN3ljA%_ASIkZ>$j3{%Ydykpj`3g=3PV7oB06f771bc9h5z1NGD-TlhQ21JZ7PgIf#Nt2S^xlVdv%lYH4O_zlvF~ P00000NkvXXu0mjfCE%9u diff --git a/modules/game_textwindow/textwindow.lua b/modules/game_textwindow/textwindow.lua index 081527f8..3258da8f 100644 --- a/modules/game_textwindow/textwindow.lua +++ b/modules/game_textwindow/textwindow.lua @@ -1,3 +1,5 @@ +local textWindow = nil + function init() g_ui.importStyle('textwindow.otui') diff --git a/src/otclient/const.h b/src/otclient/const.h index 5034fd32..a77d9c48 100644 --- a/src/otclient/const.h +++ b/src/otclient/const.h @@ -348,7 +348,7 @@ namespace Otc }; enum PathFindResult { - PathFineResultOk = 0, + PathFindResultOk = 0, PathFindResultSamePosition, PathFindResultImpossible, PathFindResultTooFar, diff --git a/src/otclient/map.cpp b/src/otclient/map.cpp index 00beb579..a2dc1de8 100644 --- a/src/otclient/map.cpp +++ b/src/otclient/map.cpp @@ -507,6 +507,12 @@ std::tuple, Otc::PathFindResult> Map::findPath(const const TilePtr& tile = getTile(neighborPos); if(neighborPos != goalPos) { + /* + Known Issue with Otc::PathFindAllowNullTiles flag: + If you are above ground floor this will attempt to path over null + tiles, need to rework this for "fly servers" and blank map click, + but it is breaking normal path finding. + */ if(!(flags & Otc::PathFindAllowNullTiles) && !tile) continue; if(tile) { @@ -568,7 +574,7 @@ std::tuple, Otc::PathFindResult> Map::findPath(const } dirs.pop_back(); std::reverse(dirs.begin(), dirs.end()); - result = Otc::PathFineResultOk; + result = Otc::PathFindResultOk; } for(auto it : nodes)