mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 03:54:54 +02:00
Market item filtering improvements and other some minor improvements
* Can now filter market items by vocation, level, slot type, and depot items. * Added new bitwise lib for handling flag operations. * Can now get/set local player vocation/premium (TODO: spell list).
This commit is contained in:
17
modules/corelib/bitwise.lua
Normal file
17
modules/corelib/bitwise.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
Bit = {}
|
||||
|
||||
function Bit.bit(p)
|
||||
return 2 ^ p
|
||||
end
|
||||
|
||||
function Bit.hasBit(x, p)
|
||||
return x % (p + p) >= p
|
||||
end
|
||||
|
||||
function Bit.setbit(x, p)
|
||||
return Bit.hasBit(x, p) and x or x + p
|
||||
end
|
||||
|
||||
function Bit.clearbit(x, p)
|
||||
return Bit.hasBit(x, p) and x - p or x
|
||||
end
|
@@ -9,6 +9,7 @@ Module
|
||||
dofile 'math'
|
||||
dofile 'string'
|
||||
dofile 'table'
|
||||
dofile 'bitwise'
|
||||
|
||||
dofile 'const'
|
||||
dofile 'util'
|
||||
|
@@ -8,6 +8,12 @@ function UIComboBox.create()
|
||||
return combobox
|
||||
end
|
||||
|
||||
function UIComboBox:clearOptions()
|
||||
self.options = {}
|
||||
self.currentIndex = -1
|
||||
self:clearText()
|
||||
end
|
||||
|
||||
function UIComboBox:setCurrentOption(text)
|
||||
if not self.options then return end
|
||||
for i,v in ipairs(self.options) do
|
||||
@@ -29,6 +35,12 @@ function UIComboBox:setCurrentIndex(index)
|
||||
end
|
||||
end
|
||||
|
||||
function UIComboBox:getCurrentOption()
|
||||
if table.hasKey(self.options, self.currentIndex) then
|
||||
return self.options[self.currentIndex]
|
||||
end
|
||||
end
|
||||
|
||||
function UIComboBox:addOption(text, data)
|
||||
table.insert(self.options, { text = text, data = data })
|
||||
local index = #self.options
|
||||
|
Reference in New Issue
Block a user