Skip to content

Commit

Permalink
Merge branch 'main' into fix-next-walk-event
Browse files Browse the repository at this point in the history
  • Loading branch information
Nottinghster authored Jan 14, 2025
2 parents cde710e + 262d238 commit 8d039b0
Show file tree
Hide file tree
Showing 28 changed files with 222 additions and 357 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ Beyond of it's flexibility with scripts, otclient comes with tons of other featu
##### 💸 Sponsored (Features)
- Bot V8 ([@luanluciano93](https://github.com/luanluciano93), [@SkullzOTS](https://github.com/SkullzOTS), [@kokekanon](https://github.com/kokekanon), [@FranciskoKing](https://github.com/FranciskoKing), [@Kizuno18](https://github.com/Kizuno18))
- Is adapted in 85%
- To enable it, it is necessary to remove/off the BOT_PROTECTION flag.
- [VS Solution](https://github.com/mehah/otclient/blob/68e4e1b94c2041bd235441244156e6477058250c/vc17/settings.props#L9) / [CMAKE](https://github.com/mehah/otclient/blob/68e4e1b94c2041bd235441244156e6477058250c/src/CMakeLists.txt#L13)
- Shader with Framebuffer ([@SkullzOTS](https://github.com/SkullzOTS), [@Mryukiimaru](https://github.com/Mryukiimaru), [@JeanTheOne](https://github.com/JeanTheOne), [@KizaruHere](https://github.com/KizaruHere))
Expand Down
7 changes: 4 additions & 3 deletions data/styles/10-scrollbars.otui
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ VerticalScrollBar < UIScrollBar

UIButton
id: decrementButton
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.left: parent.left
image-source: /images/ui/scrollbar
image-clip: 0 0 13 13
Expand All @@ -45,7 +45,7 @@ VerticalScrollBar < UIScrollBar

UIButton
id: incrementButton
anchors.verticalCenter: parent.verticalCenter
anchors.bottom: parent.bottom
anchors.right: parent.right
size: 13 13
image-source: /images/ui/scrollbar
Expand Down Expand Up @@ -150,6 +150,7 @@ VerticalQtScrollBar < UIScrollBar
HorizontalScrollBarQtSlider < UIButton
id: sliderButton
anchors.centerIn: parent
margin-top: 1
size: 44 12
image-source: /images/ui/scrollbar_new_horizontal
image-clip: 34 22 44 12
Expand Down Expand Up @@ -177,7 +178,7 @@ HorizontalQtScrollBar < UIScrollBar

UIButton
id: incrementButton
anchors.bottom: parent.bottom
anchors.top: parent.top
anchors.right: parent.right
size: 12 12
image-source: /images/ui/scrollbar_new_horizontal
Expand Down
4 changes: 0 additions & 4 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ local function loadModules()
g_modules.autoLoadModules(9999)
g_modules.ensureModuleLoaded('client_mods')

if not g_game.isEnabledBotProtection() then
g_modules.ensureModuleLoaded('game_bot')
end

local script = '/' .. g_app.getCompactName() .. 'rc.lua'

if g_resources.fileExists(script) then
Expand Down
13 changes: 3 additions & 10 deletions meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -582,14 +582,12 @@ function g_map.getMinimapColor(pos) end
---@return boolean
function g_map.isSightClear(fromPos, toPos) end

---* BOT_PROTECTION
---@param start Position | string
---@param maxDistance integer
---@param params table<string, string>
---@return table<string, [integer, integer, integer, string]>
function g_map.findEveryPath(start, maxDistance, params) end

---* BOT_PROTECTION
---@param centerPos Position | string
---@param pattern string
---@param direction integer
Expand Down Expand Up @@ -700,7 +698,9 @@ g_game = {}
---@param characterName string
---@param authenticatorToken string
---@param sessionKey string
function g_game.loginWorld(account, password, worldName, worldHost, worldPort, characterName, authenticatorToken, sessionKey) end
function g_game.loginWorld(account, password, worldName, worldHost, worldPort, characterName, authenticatorToken,
sessionKey)
end

function g_game.cancelLogin() end

Expand Down Expand Up @@ -1158,9 +1158,6 @@ function g_game.enableTileThingLuaCallback(value) end
---@return boolean
function g_game.isTileThingLuaCallbackEnabled() end

---@return boolean
function g_game.isEnabledBotProtection() end

---@param itemId integer
---@param count number
---@param stackpos boolean
Expand Down Expand Up @@ -1854,19 +1851,15 @@ function Creature:isFullHealth() end
---@return boolean
function Creature:isCovered() end

---* !BOT_PROTECTION
---@param text string
---@param color Color | string
function Creature:setText(text, color) end

---* !BOT_PROTECTION
---@return string
function Creature:getText() end

---* !BOT_PROTECTION
function Creature:clearText() end

---* !BOT_PROTECTION
---@param distance integer
---@return boolean
function Creature:canShoot(distance) end
Expand Down
1 change: 1 addition & 0 deletions mods/client_mods/mods.otmod
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Module
- game_buttons
- game_itemselector
- client_textedit
- game_bot
97 changes: 47 additions & 50 deletions modules/client_options/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ panels = {
keybindsPanel = nil
}
-- LuaFormatter off
local buttons = {{
local buttons = { {

text = "Controls",
icon = "/images/icons/icon_controls",
open = "generalPanel",
subCategories = {{
subCategories = { {
text = "General Hotkeys",
open = "keybindsPanel"
}}
} }
}, {
text = "Interface",
icon = "/images/icons/icon_interface",
open = "interface",
subCategories = {{
subCategories = { {
text = "HUD",
open = "interfaceHUD"
}, {
text = "Console",
open = "interfaceConsole"
}}
} }
}, {
text = "Graphics",
icon = "/images/icons/icon_graphics",
open = "graphicsPanel",
subCategories = {{
subCategories = { {
text = "Effects",
open = "graphicsEffectsPanel"
}}
} }
}, {
text = "Sound",
icon = "/images/icons/icon_sound",
Expand All @@ -64,8 +64,8 @@ local buttons = {{
}, ]] {
text = "Help",
open = "miscHelp"
}}
}}
} }
} }

-- LuaFormatter on
local extraWidgets = {
Expand Down Expand Up @@ -137,16 +137,14 @@ local function setupComboBox()
setOption('framesRarity', comboBox:getCurrentOption().data)
end

if not g_game.isEnabledBotProtection() then
local profileCombobox = panels.misc:recursiveGetChildById('profile')
local profileCombobox = panels.misc:recursiveGetChildById('profile')

for i = 1, 10 do
profileCombobox:addOption(tostring(i), i)
end
for i = 1, 10 do
profileCombobox:addOption(tostring(i), i)
end

profileCombobox.onOptionChange = function(comboBox, option)
setOption('profile', comboBox:getCurrentOption().data)
end
profileCombobox.onOptionChange = function(comboBox, option)
setOption('profile', comboBox:getCurrentOption().data)
end

for _, preset in ipairs(Keybind.presets) do
Expand Down Expand Up @@ -192,28 +190,28 @@ function controller:onInit()

extraWidgets.audioButton = modules.client_topmenu.addTopRightToggleButton('audioButton', tr('Audio'),
'/images/topbuttons/button_mute_up', function() toggleOption('enableAudio') end)

extraWidgets.optionsButton = modules.client_topmenu.addTopRightToggleButton('optionsButton', tr('Options'),
'/images/topbuttons/button_options', toggle)

extraWidgets.logoutButton = modules.client_topmenu.addTopRightToggleButton('logoutButton', tr('Exit'),
'/images/topbuttons/logout', toggle)

panels.generalPanel = g_ui.loadUI('styles/controls/general',controller.ui.optionsTabContent)
panels.keybindsPanel = g_ui.loadUI('styles/controls/keybinds',controller.ui.optionsTabContent)

panels.graphicsPanel = g_ui.loadUI('styles/graphics/graphics',controller.ui.optionsTabContent)
panels.graphicsEffectsPanel = g_ui.loadUI('styles/graphics/effects',controller.ui.optionsTabContent)
panels.interface = g_ui.loadUI('styles/interface/interface',controller.ui.optionsTabContent)
panels.interfaceConsole = g_ui.loadUI('styles/interface/console',controller.ui.optionsTabContent)
panels.interfaceHUD = g_ui.loadUI('styles/interface/HUD',controller.ui.optionsTabContent)

panels.soundPanel = g_ui.loadUI('styles/sound/audio',controller.ui.optionsTabContent)
panels.misc = g_ui.loadUI('styles/misc/misc',controller.ui.optionsTabContent)
panels.miscHelp = g_ui.loadUI('styles/misc/help',controller.ui.optionsTabContent)
'/images/topbuttons/logout', toggle)

panels.generalPanel = g_ui.loadUI('styles/controls/general', controller.ui.optionsTabContent)
panels.keybindsPanel = g_ui.loadUI('styles/controls/keybinds', controller.ui.optionsTabContent)

panels.graphicsPanel = g_ui.loadUI('styles/graphics/graphics', controller.ui.optionsTabContent)
panels.graphicsEffectsPanel = g_ui.loadUI('styles/graphics/effects', controller.ui.optionsTabContent)

panels.interface = g_ui.loadUI('styles/interface/interface', controller.ui.optionsTabContent)
panels.interfaceConsole = g_ui.loadUI('styles/interface/console', controller.ui.optionsTabContent)
panels.interfaceHUD = g_ui.loadUI('styles/interface/HUD', controller.ui.optionsTabContent)

panels.soundPanel = g_ui.loadUI('styles/sound/audio', controller.ui.optionsTabContent)

panels.misc = g_ui.loadUI('styles/misc/misc', controller.ui.optionsTabContent)
panels.miscHelp = g_ui.loadUI('styles/misc/help', controller.ui.optionsTabContent)

self.ui:hide()

configureCharacterCategories()
Expand All @@ -222,34 +220,34 @@ function controller:onInit()

Keybind.new("UI", "Toggle Fullscreen", "Ctrl+Shift+F", "")
Keybind.bind("UI", "Toggle Fullscreen", {
{
type = KEY_DOWN,
callback = function() toggleOption('fullscreen') end,
}
{
type = KEY_DOWN,
callback = function() toggleOption('fullscreen') end,
}
})
Keybind.new("UI", "Show/hide FPS / lag indicator", "", "")
Keybind.bind("UI", "Show/hide FPS / lag indicator", {{
Keybind.bind("UI", "Show/hide FPS / lag indicator", { {
type = KEY_DOWN,
callback = function()
toggleOption('showPing')
toggleOption('showFps')
end
}})
} })

Keybind.new("UI", "Show/hide Creature Names and Bars", "Ctrl+N", "")
Keybind.bind("UI", "Show/hide Creature Names and Bars", {
{
type = KEY_DOWN,
callback = toggleDisplays,
}
{
type = KEY_DOWN,
callback = toggleDisplays,
}
})

Keybind.new("Sound", "Mute/unmute", "", "")
Keybind.bind("Sound", "Mute/unmute", {
{
type = KEY_DOWN,
callback = function() toggleOption('enableAudio') end,
}
{
type = KEY_DOWN,
callback = function() toggleOption('enableAudio') end,
}
})
end

Expand Down Expand Up @@ -485,7 +483,6 @@ function configureCharacterCategories()
end

close(oldOpen)

end

if parent.subCategoriesSize then
Expand Down
3 changes: 0 additions & 3 deletions modules/client_options/styles/misc/misc.otui
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ UIWidget
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom

@onSetup: |
self:getParent():setVisible(not g_game.isEnabledBotProtection())
22 changes: 8 additions & 14 deletions modules/corelib/ui/uiminiwindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ function UIMiniWindow:setup()
end

self:getChildById('minimizeButton').onClick = function()

if self:isOn() then
self:maximize()
else
Expand All @@ -87,7 +86,6 @@ function UIMiniWindow:setup()
end

self:getChildById('lockButton').onClick = function()

if self:isDraggable() then
self:lock()
else
Expand Down Expand Up @@ -118,7 +116,6 @@ function UIMiniWindow:setupOnStart()
settings = {
[char] = {}
}

elseif not settings[char] then
-- if there are no settings for this character, we'll copy the settings from
-- another one, so we'll have something better than all the windows randomly positioned
Expand All @@ -127,7 +124,6 @@ function UIMiniWindow:setupOnStart()
g_settings.setNode('CharMiniWindows', settings)
break
end

end

local selfSettings = settings[char][self:getId()]
Expand All @@ -143,7 +139,6 @@ function UIMiniWindow:setupOnStart()
self:setParent(parent, true)
self:setPosition(topoint(selfSettings.position))
newParentSet = true

end
end
end
Expand Down Expand Up @@ -190,13 +185,13 @@ function UIMiniWindow:setupOnStart()
end

self:fitOnParent()
if not g_game.isEnabledBotProtection() and self:getId() == "botWindow" then
if self:getId() == "botWindow" then
local parent = self:getParent()
local parentId = parent:getId()
if parentId == "gameLeftPanel" or
parentId == "gameLeftExtraPanel" or
parentId == "gameRightExtraPanel" then

if parentId == "gameLeftPanel" or
parentId == "gameLeftExtraPanel" or
parentId == "gameRightExtraPanel" then
if parent:isVisible() then
parent:setWidth(190)
end
Expand Down Expand Up @@ -420,7 +415,6 @@ function UIMiniWindow:saveParent(parent)
self:saveParentPosition(parent:getId(), self:getPosition())
end
end

end

function UIMiniWindow:saveParentPosition(parentId, position)
Expand Down Expand Up @@ -469,7 +463,7 @@ end
function UIMiniWindow:setContentHeight(height)
local contentsPanel = self:getChildById('contentsPanel')
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() +
contentsPanel:getPaddingBottom()
contentsPanel:getPaddingBottom()

local resizeBorder = self:getChildById('bottomResizeBorder')
resizeBorder:setParentSize(minHeight + height)
Expand All @@ -478,7 +472,7 @@ end
function UIMiniWindow:setContentMinimumHeight(height)
local contentsPanel = self:getChildById('contentsPanel')
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() +
contentsPanel:getPaddingBottom()
contentsPanel:getPaddingBottom()

local resizeBorder = self:getChildById('bottomResizeBorder')
resizeBorder:setMinimum(minHeight + height)
Expand All @@ -487,7 +481,7 @@ end
function UIMiniWindow:setContentMaximumHeight(height)
local contentsPanel = self:getChildById('contentsPanel')
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() +
contentsPanel:getPaddingBottom()
contentsPanel:getPaddingBottom()

local resizeBorder = self:getChildById('bottomResizeBorder')
resizeBorder:setMaximum(minHeight + height)
Expand Down
Loading

0 comments on commit 8d039b0

Please sign in to comment.