More work on Market functionality and UI
* Now loads all market items. * Can filter market items. * Will load market offers on items. * Edited some UI images.
This commit is contained in:
parent
49f4c1c94b
commit
483487ab09
|
@ -84,7 +84,7 @@ function EnterGame.init()
|
||||||
enterGame:getChildById('accountNameTextEdit'):focus()
|
enterGame:getChildById('accountNameTextEdit'):focus()
|
||||||
|
|
||||||
protocolBox = enterGame:getChildById('protocolComboBox')
|
protocolBox = enterGame:getChildById('protocolComboBox')
|
||||||
for _i,proto in pairs(g_game.getSupportedProtocols()) do
|
for _i, proto in pairs(g_game.getSupportedProtocols()) do
|
||||||
protocolBox:addOption(proto)
|
protocolBox:addOption(proto)
|
||||||
end
|
end
|
||||||
protocolBox:setCurrentOption(protocol)
|
protocolBox:setCurrentOption(protocol)
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 415 B |
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
|
@ -21,7 +21,7 @@ Button < UIButton
|
||||||
|
|
||||||
TabButton < UIButton
|
TabButton < UIButton
|
||||||
size: 20 20
|
size: 20 20
|
||||||
image-source: /images/tabbutton.png
|
image-source: /images/tabbutton_rounded.png
|
||||||
image-color: white
|
image-color: white
|
||||||
image-clip: 0 0 20 20
|
image-clip: 0 0 20 20
|
||||||
image-border: 2
|
image-border: 2
|
||||||
|
|
|
@ -45,7 +45,7 @@ ButtonBox < UICheckBox
|
||||||
size: 106 22
|
size: 106 22
|
||||||
text-offset: 0 0
|
text-offset: 0 0
|
||||||
text-align: center
|
text-align: center
|
||||||
image-source: /images/tabbutton.png
|
image-source: /images/tabbutton_rounded.png
|
||||||
image-color: white
|
image-color: white
|
||||||
image-clip: 0 0 20 20
|
image-clip: 0 0 20 20
|
||||||
image-border: 2
|
image-border: 2
|
||||||
|
|
|
@ -14,14 +14,14 @@ ComboBoxPopupMenuButton < UIButton
|
||||||
color: #555555
|
color: #555555
|
||||||
|
|
||||||
ComboBoxPopupMenuSeparator < UIWidget
|
ComboBoxPopupMenuSeparator < UIWidget
|
||||||
image-source: /images/combobox.png
|
image-source: /images/combobox_square.png
|
||||||
image-repeated: true
|
image-repeated: true
|
||||||
image-clip: 1 59 89 1
|
image-clip: 1 59 89 1
|
||||||
height: 1
|
height: 1
|
||||||
phantom: true
|
phantom: true
|
||||||
|
|
||||||
ComboBoxPopupMenu < UIPopupMenu
|
ComboBoxPopupMenu < UIPopupMenu
|
||||||
image-source: /images/combobox.png
|
image-source: /images/combobox_square.png
|
||||||
image-clip: 0 60 89 20
|
image-clip: 0 60 89 20
|
||||||
image-border: 1
|
image-border: 1
|
||||||
image-border-top: 0
|
image-border-top: 0
|
||||||
|
@ -33,7 +33,7 @@ ComboBox < UIComboBox
|
||||||
size: 86 20
|
size: 86 20
|
||||||
text-offset: 3 0
|
text-offset: 3 0
|
||||||
text-align: left
|
text-align: left
|
||||||
image-source: /images/combobox.png
|
image-source: /images/combobox_square.png
|
||||||
image-border: 1
|
image-border: 1
|
||||||
image-border-right: 17
|
image-border-right: 17
|
||||||
image-clip: 0 0 89 20
|
image-clip: 0 0 89 20
|
||||||
|
|
|
@ -3,7 +3,7 @@ TabBar < UITabBar
|
||||||
TabBarPanel < Panel
|
TabBarPanel < Panel
|
||||||
TabBarButton < UIButton
|
TabBarButton < UIButton
|
||||||
size: 20 20
|
size: 20 20
|
||||||
image-source: /images/tabbutton.png
|
image-source: /images/tabbutton_rounded.png
|
||||||
image-color: white
|
image-color: white
|
||||||
image-clip: 0 0 20 20
|
image-clip: 0 0 20 20
|
||||||
image-border: 2
|
image-border: 2
|
||||||
|
|
|
@ -41,6 +41,10 @@ function table.find(t, value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.contains(t, value)
|
||||||
|
return table.find(t, value) ~= nil
|
||||||
|
end
|
||||||
|
|
||||||
function table.findKey(t, key)
|
function table.findKey(t, key)
|
||||||
if t and type(t) == 'table' then
|
if t and type(t) == 'table' then
|
||||||
for k,v in pairs(t) do
|
for k,v in pairs(t) do
|
||||||
|
|
|
@ -3,6 +3,7 @@ Market = {}
|
||||||
g_ui.importStyle('market.otui')
|
g_ui.importStyle('market.otui')
|
||||||
g_ui.importStyle('ui/general/markettabs.otui')
|
g_ui.importStyle('ui/general/markettabs.otui')
|
||||||
g_ui.importStyle('ui/general/marketbuttons.otui')
|
g_ui.importStyle('ui/general/marketbuttons.otui')
|
||||||
|
g_ui.importStyle('ui/general/marketcombobox.otui')
|
||||||
|
|
||||||
local marketWindow
|
local marketWindow
|
||||||
local mainTabBar
|
local mainTabBar
|
||||||
|
@ -23,25 +24,62 @@ local currentOffersPanel
|
||||||
local offerHistoryPanel
|
local offerHistoryPanel
|
||||||
|
|
||||||
local marketOffers = {}
|
local marketOffers = {}
|
||||||
|
local marketItems = {}
|
||||||
local depot = {}
|
local depot = {}
|
||||||
local information ={}
|
local information ={}
|
||||||
local selectedItem
|
local selectedItem
|
||||||
local nameLabel
|
local nameLabel
|
||||||
|
|
||||||
|
local currentItems = {}
|
||||||
local itemsPanel
|
local itemsPanel
|
||||||
local radioItems
|
local radioItemSet
|
||||||
|
local filterBox
|
||||||
|
|
||||||
local function clearSelectedItem()
|
local function getMarketCategoryName(category)
|
||||||
if selectedItem then
|
if table.hasKey(MarketCategoryStrings, category) then
|
||||||
nameLabel:clearText()
|
return MarketCategoryStrings[category]
|
||||||
radioItems:selectWidget(nil)
|
|
||||||
selectedItem.setItem(nil)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function loadMarketItems()
|
local function getMarketCategoryId(name)
|
||||||
itemsPanel = marketWindow:recursiveGetChildById('itemsPanel')
|
local id = table.find(MarketCategoryStrings, name)
|
||||||
|
if id then
|
||||||
|
return id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function clearSelectedItem()
|
||||||
|
if selectedItem and selectedItem.item.ptr then
|
||||||
|
Market.updateOffers({})
|
||||||
|
radioItemSet:selectWidget(nil)
|
||||||
|
nameLabel:clearText()
|
||||||
|
selectedItem:setItem(nil)
|
||||||
|
selectedItem.item = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function initMarketItems()
|
||||||
|
-- populate all market items
|
||||||
|
marketItems = {}
|
||||||
|
local types = g_things.findThingTypeByAttr(ThingAttrMarket)
|
||||||
|
for k,t in pairs(types) do
|
||||||
|
local newItem = Item.create(t:getId())
|
||||||
|
if newItem then
|
||||||
|
local item = {
|
||||||
|
ptr = newItem,
|
||||||
|
marketData = t:getMarketData()
|
||||||
|
}
|
||||||
|
table.insert(marketItems, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function updateItemsWidget()
|
||||||
|
if table.empty(currentItems) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
itemsPanel = marketWindow:recursiveGetChildById('itemsPanel')
|
||||||
local layout = itemsPanel:getLayout()
|
local layout = itemsPanel:getLayout()
|
||||||
layout:disableUpdates()
|
layout:disableUpdates()
|
||||||
|
|
||||||
|
@ -53,8 +91,15 @@ local function loadMarketItems()
|
||||||
end
|
end
|
||||||
radioItemSet = UIRadioGroup.create()
|
radioItemSet = UIRadioGroup.create()
|
||||||
|
|
||||||
-- TODO: populate with dat items
|
for _, item in pairs(currentItems) do
|
||||||
|
local itemBox = g_ui.createWidget('MarketItemBox', itemsPanel)
|
||||||
|
local itemWidget = itemBox:getChildById('item')
|
||||||
|
|
||||||
|
itemBox.item = item
|
||||||
|
itemWidget:setItem(item.ptr)
|
||||||
|
|
||||||
|
radioItemSet:addWidget(itemBox)
|
||||||
|
end
|
||||||
|
|
||||||
layout:enableUpdates()
|
layout:enableUpdates()
|
||||||
layout:update()
|
layout:update()
|
||||||
|
@ -84,7 +129,7 @@ function Market.init()
|
||||||
marketWindow = g_ui.createWidget('MarketWindow', rootWidget)
|
marketWindow = g_ui.createWidget('MarketWindow', rootWidget)
|
||||||
marketWindow:hide()
|
marketWindow:hide()
|
||||||
|
|
||||||
nameLabel = marketWindow:recursiveGetChildById('nameLabel')
|
initMarketItems()
|
||||||
|
|
||||||
-- TODO: clean this up into functions
|
-- TODO: clean this up into functions
|
||||||
-- setup main tabs
|
-- setup main tabs
|
||||||
|
@ -128,6 +173,20 @@ function Market.init()
|
||||||
|
|
||||||
offerHistoryPanel = g_ui.loadUI('ui/myoffers/offerhistory.otui')
|
offerHistoryPanel = g_ui.loadUI('ui/myoffers/offerhistory.otui')
|
||||||
offersTabBar:addTab(tr('Offer History'), offerHistoryPanel)
|
offersTabBar:addTab(tr('Offer History'), offerHistoryPanel)
|
||||||
|
|
||||||
|
nameLabel = marketWindow:recursiveGetChildById('nameLabel')
|
||||||
|
selectedItem = marketWindow:recursiveGetChildById('selectedItem')
|
||||||
|
selectedItem.item = {}
|
||||||
|
|
||||||
|
filterBox = browsePanel:getChildById('filterComboBox')
|
||||||
|
for i = MarketCategory.First, MarketCategory.Last do
|
||||||
|
filterBox:addOption(getMarketCategoryName(i))
|
||||||
|
end
|
||||||
|
filterBox:setCurrentOption(getMarketCategoryName(MarketCategory.First))
|
||||||
|
|
||||||
|
filterBox.onOptionChange = function(combobox, option)
|
||||||
|
Market.loadMarketItems(getMarketCategoryId(option))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Market.terminate()
|
function Market.terminate()
|
||||||
|
@ -150,66 +209,101 @@ function Market.terminate()
|
||||||
currentOffersPanel = nil
|
currentOffersPanel = nil
|
||||||
offerHistoryPanel = nil
|
offerHistoryPanel = nil
|
||||||
marketOffers = {}
|
marketOffers = {}
|
||||||
|
marketItems = {}
|
||||||
depotItems = {}
|
depotItems = {}
|
||||||
information = {}
|
information = {}
|
||||||
|
currentItems = {}
|
||||||
itemsPanel = nil
|
itemsPanel = nil
|
||||||
nameLabel = nil
|
nameLabel = nil
|
||||||
radioItems = nil
|
radioItemSet = nil
|
||||||
selectedItem = nil
|
selectedItem = nil
|
||||||
|
filterBox = nil
|
||||||
|
|
||||||
Market = nil
|
Market = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Market.loadMarketItems(_category)
|
||||||
|
if table.empty(marketItems) then
|
||||||
|
initMarketItems()
|
||||||
|
end
|
||||||
|
|
||||||
|
currentItems = {}
|
||||||
|
for _, item in pairs(marketItems) do
|
||||||
|
-- filter items here
|
||||||
|
local category = item.marketData.category
|
||||||
|
if category == _category or _category == MarketCategory[0] then
|
||||||
|
table.insert(currentItems, item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
updateItemsWidget()
|
||||||
|
end
|
||||||
|
|
||||||
function Market.updateOffers(offers)
|
function Market.updateOffers(offers)
|
||||||
|
marketOffers[MarketAction.Buy] = {}
|
||||||
|
marketOffers[MarketAction.Sell] = {}
|
||||||
|
|
||||||
|
local buyOfferList = marketWindow:recursiveGetChildById('buyingList')
|
||||||
|
buyOfferList:destroyChildren()
|
||||||
|
|
||||||
|
local sellOfferList = marketWindow:recursiveGetChildById('sellingList')
|
||||||
|
sellOfferList:destroyChildren()
|
||||||
|
|
||||||
for k, offer in pairs(offers) do
|
for k, offer in pairs(offers) do
|
||||||
if offer and offer:getAction() == MarketAction.Buy then
|
if offer and offer:getAction() == MarketAction.Buy then
|
||||||
|
local label = g_ui.createWidget('OfferListLabel', buyOfferList)
|
||||||
|
label:setText(offer:getPlayer()..' '..offer:getAmount()..' '..(offer:getPrice()*offer:getAmount())..' '..offer:getPrice()..' '..offer:getTimeStamp())
|
||||||
table.insert(marketOffers[MarketAction.Buy], offer)
|
table.insert(marketOffers[MarketAction.Buy], offer)
|
||||||
else
|
else
|
||||||
|
local label = g_ui.createWidget('OfferListLabel', sellOfferList)
|
||||||
|
label:setText(offer:getPlayer()..' '..offer:getAmount()..' '..(offer:getPrice()*offer:getAmount())..' '..offer:getPrice()..' '..offer:getTimeStamp())
|
||||||
table.insert(marketOffers[MarketAction.Sell], offer)
|
table.insert(marketOffers[MarketAction.Sell], offer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, offers in pairs(marketOffers) do
|
|
||||||
for _, offer in pairs(offers) do
|
|
||||||
print(' counter: '..offer:getCounter()..' | timestamp: '..offer:getTimeStamp()..' | item: '..offer:getItem():getId()..' | action: '..offer:getAction()..' | amount: '..offer:getAmount()..' | price: '..offer:getPrice()..' | player: '..offer:getPlayer()..' | state: '..offer:getState())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- TODO: refresh all widget windows
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Market.updateDetails(itemId, descriptions, purchaseStats, saleStats)
|
function Market.updateDetails(itemId, descriptions, purchaseStats, saleStats)
|
||||||
-- TODO: refresh all widget windows
|
if not selectedItem then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
selectedItem.item.details = {
|
||||||
|
serverItemId = itemId,
|
||||||
|
descriptions = descriptions,
|
||||||
|
purchaseStats = purchaseStats,
|
||||||
|
saleStats = saleStats
|
||||||
|
}
|
||||||
|
|
||||||
|
-- TODO: refresh all widget windows
|
||||||
end
|
end
|
||||||
|
|
||||||
function Market.updateSelectedItem(newItem)
|
function Market.updateSelectedItem(newItem)
|
||||||
local itemDisplay = marketWindow:recursiveGetChildById('selectedItem')
|
selectedItem.item = newItem
|
||||||
local itemName = marketWindow:recursiveGetChildById('nameLabel')
|
if selectedItem and not table.empty(selectedItem.item) then
|
||||||
selectedItem = newItem
|
if selectedItem.item.ptr then
|
||||||
if not table.empty(selectedItem) then
|
selectedItem:setItem(selectedItem.item.ptr)
|
||||||
if selectedItem.ptr then
|
nameLabel:setText(selectedItem.item.marketData.name)
|
||||||
itemDisplay:setItem(selectedItem.ptr)
|
MarketProtocol.sendMarketBrowse(selectedItem.item.ptr:getId()) -- send sprite id browsed
|
||||||
itemName:setText(tr(selectedItem.name))
|
|
||||||
MarketProtocol.sendMarketBrowse(selectedItem.ptr:getId()) -- send sprite id browsed
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
itemDisplay:setItem(nil)
|
selectedItem:setItem(nil)
|
||||||
itemName:setText(tr('No item selected.'))
|
nameLabel:setText(tr('No item selected.'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Market.onMarketEnter(depotItems, offers, balance)
|
function Market.onMarketEnter(depotItems, offers, balance)
|
||||||
-- TODO: populate market?
|
|
||||||
if marketWindow:isVisible() then
|
if marketWindow:isVisible() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
marketWindow:lock()
|
||||||
marketOffers[MarketAction.Buy] = {}
|
marketOffers[MarketAction.Buy] = {}
|
||||||
marketOffers[MarketAction.Sell] = {}
|
marketOffers[MarketAction.Sell] = {}
|
||||||
|
|
||||||
information.balance = balance
|
information.balance = balance
|
||||||
information.totalOffers = offers
|
information.totalOffers = offers
|
||||||
|
|
||||||
loadMarketItems()
|
if table.empty(currentItems) then
|
||||||
|
Market.loadMarketItems(MarketCategory.First)
|
||||||
|
end
|
||||||
loadDepotItems(depotItems)
|
loadDepotItems(depotItems)
|
||||||
|
|
||||||
-- TODO: if you are already viewing an item on market enter it must recheck the current item
|
-- TODO: if you are already viewing an item on market enter it must recheck the current item
|
||||||
|
@ -217,7 +311,6 @@ function Market.onMarketEnter(depotItems, offers, balance)
|
||||||
selectedItem:setChecked(false)
|
selectedItem:setChecked(false)
|
||||||
selectedItem:setChecked(true)
|
selectedItem:setChecked(true)
|
||||||
end
|
end
|
||||||
--MarketProtocol.sendMarketBrowse(645)
|
|
||||||
marketWindow:show()
|
marketWindow:show()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
MarketWindow < MainWindow
|
MarketWindow < MainWindow
|
||||||
id: marketWindow
|
id: marketWindow
|
||||||
!text: tr('Market')
|
!text: tr('Market')
|
||||||
size: 680 460
|
size: 700 510
|
||||||
|
|
||||||
@onEnter: self:hide()
|
@onEnter: self:hide() self:unlock()
|
||||||
@onEscape: self:hide()
|
@onEscape: self:hide() self:unlock()
|
||||||
|
|
||||||
// Main Panel Window
|
// Main Panel Window
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ local protocol
|
||||||
local function send(msg)
|
local function send(msg)
|
||||||
if protocol then
|
if protocol then
|
||||||
print(msg:getMessageSize())
|
print(msg:getMessageSize())
|
||||||
--protocol:safeSend(msg)
|
|
||||||
protocol:send(msg)
|
protocol:send(msg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -53,7 +52,7 @@ local function parseMarketEnter(msg)
|
||||||
table.insert(depotItems, {itemId, itemCount})
|
table.insert(depotItems, {itemId, itemCount})
|
||||||
end
|
end
|
||||||
|
|
||||||
Market.onMarketEnter(depotItems, offers, balance)
|
signalcall(Market.onMarketEnter, depotItems, offers, balance)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@ local function parseMarketDetail(msg)
|
||||||
local highestPrice = msg:getU32() -- highest price
|
local highestPrice = msg:getU32() -- highest price
|
||||||
local lowestPrice = msg: getU32() -- lowest price
|
local lowestPrice = msg: getU32() -- lowest price
|
||||||
|
|
||||||
table.insert(purchaseStats, {transaction, totalPrice, highestPrice, lowestPrice})
|
table.insert(purchaseStats, {transactions, totalPrice, highestPrice, lowestPrice})
|
||||||
end
|
end
|
||||||
|
|
||||||
local saleStats = {}
|
local saleStats = {}
|
||||||
|
@ -91,10 +90,10 @@ local function parseMarketDetail(msg)
|
||||||
local highestPrice = msg:getU32() -- highest price
|
local highestPrice = msg:getU32() -- highest price
|
||||||
local lowestPrice = msg: getU32() -- lowest price
|
local lowestPrice = msg: getU32() -- lowest price
|
||||||
|
|
||||||
table.insert(saleStats, {transaction, totalPrice, highestPrice, lowestPrice})
|
table.insert(saleStats, {transactions, totalPrice, highestPrice, lowestPrice})
|
||||||
end
|
end
|
||||||
|
|
||||||
Market.onMarketDetail(itemId, descriptions, purchaseStats, saleStats)
|
signalcall(Market.onMarketDetail, itemId, descriptions, purchaseStats, saleStats)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -112,7 +111,7 @@ local function parseMarketBrowse(msg)
|
||||||
table.insert(offers, readMarketOffer(msg, MarketAction.Sell, var))
|
table.insert(offers, readMarketOffer(msg, MarketAction.Sell, var))
|
||||||
end
|
end
|
||||||
|
|
||||||
Market.onMarketBrowse(offers)
|
signalcall(Market.onMarketBrowse, offers)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
MarketButtonBox < UICheckBox
|
MarketButtonBox < UICheckBox
|
||||||
font: verdana-11px-antialised
|
font: verdana-11px-antialised
|
||||||
color: #ffffffff
|
color: #f55e5ecc
|
||||||
size: 106 22
|
size: 106 22
|
||||||
text-offset: 0 0
|
text-offset: 0 0
|
||||||
text-align: center
|
text-align: center
|
||||||
image-source: /images/tabbutton.png
|
image-source: /images/tabbutton_rounded.png
|
||||||
image-clip: 0 0 20 20
|
image-clip: 0 0 20 20
|
||||||
image-border: 2
|
image-border: 2
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
MarketComboBoxPopupMenuButton < UIButton
|
||||||
|
height: 18
|
||||||
|
font: verdana-11px-antialised
|
||||||
|
text-align: left
|
||||||
|
text-offset: 2 0
|
||||||
|
color: #aaaaaa
|
||||||
|
background-color: alpha
|
||||||
|
|
||||||
|
$hover !disabled:
|
||||||
|
color: #ffffff
|
||||||
|
background-color: #ffffff44
|
||||||
|
|
||||||
|
$disabled:
|
||||||
|
color: #555555
|
||||||
|
|
||||||
|
MarketComboBoxPopupMenuSeparator < UIWidget
|
||||||
|
image-source: /images/combobox_rounded.png
|
||||||
|
image-repeated: true
|
||||||
|
image-clip: 1 59 89 1
|
||||||
|
height: 1
|
||||||
|
phantom: true
|
||||||
|
|
||||||
|
MarketComboBoxPopupMenu < UIPopupMenu
|
||||||
|
image-source: /images/combobox_rounded.png
|
||||||
|
image-clip: 0 60 89 20
|
||||||
|
image-border: 1
|
||||||
|
image-border-top: 0
|
||||||
|
padding: 1
|
||||||
|
|
||||||
|
MarketComboBox < UIComboBox
|
||||||
|
font: verdana-11px-antialised
|
||||||
|
color: #aaaaaa
|
||||||
|
size: 86 20
|
||||||
|
text-offset: 3 0
|
||||||
|
text-align: left
|
||||||
|
image-source: /images/combobox_rounded.png
|
||||||
|
image-border: 1
|
||||||
|
image-border-right: 17
|
||||||
|
image-clip: 0 0 89 20
|
||||||
|
|
||||||
|
$hover !disabled:
|
||||||
|
image-clip: 0 20 89 20
|
||||||
|
|
||||||
|
$on:
|
||||||
|
image-clip: 0 40 89 20
|
|
@ -3,7 +3,7 @@ MarketTabBar < UITabBar
|
||||||
MarketTabBarPanel < Panel
|
MarketTabBarPanel < Panel
|
||||||
MarketTabBarButton < UIButton
|
MarketTabBarButton < UIButton
|
||||||
size: 20 25
|
size: 20 25
|
||||||
image-source: /images/tabbutton.png
|
image-source: /images/tabbutton_square.png
|
||||||
image-clip: 0 0 20 20
|
image-clip: 0 0 20 20
|
||||||
image-border: 2
|
image-border: 2
|
||||||
icon-color: white
|
icon-color: white
|
||||||
|
|
|
@ -33,17 +33,22 @@ Panel
|
||||||
border-width: 1
|
border-width: 1
|
||||||
border-color: #000000
|
border-color: #000000
|
||||||
|
|
||||||
Item
|
UIItem
|
||||||
id: selectedItem
|
id: selectedItem
|
||||||
phantom: true
|
phantom: true
|
||||||
|
size: 34 34
|
||||||
|
padding: 1
|
||||||
|
font: verdana-11px-rounded
|
||||||
|
border-color: white
|
||||||
anchors.top: rightTabBar.bottom
|
anchors.top: rightTabBar.bottom
|
||||||
anchors.left: rightTabContent.left
|
anchors.left: rightTabContent.left
|
||||||
margin-top: 3
|
margin-top: 6
|
||||||
margin-left: 3
|
margin-left: 6
|
||||||
|
|
||||||
Label
|
Label
|
||||||
id: nameLabel
|
id: nameLabel
|
||||||
!text: tr('No item selected.')
|
!text: tr('No item selected.')
|
||||||
anchors.top: prev.top
|
anchors.top: prev.top
|
||||||
anchors.left: prev.right
|
anchors.left: prev.right
|
||||||
|
anchors.right: parent.right
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
|
|
|
@ -11,7 +11,7 @@ MarketItemBox < UICheckBox
|
||||||
phantom: true
|
phantom: true
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
margin-top: 5
|
margin: 1
|
||||||
|
|
||||||
$checked:
|
$checked:
|
||||||
border-color: #ffffff
|
border-color: #ffffff
|
||||||
|
@ -27,7 +27,7 @@ Panel
|
||||||
background-color: #22283399
|
background-color: #22283399
|
||||||
margin: 1
|
margin: 1
|
||||||
|
|
||||||
ComboBox
|
MarketComboBox
|
||||||
id: filterComboBox
|
id: filterComboBox
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -36,7 +36,7 @@ Panel
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
|
|
||||||
ComboBox
|
MarketComboBox
|
||||||
id: weaponComboBox
|
id: weaponComboBox
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -72,7 +72,7 @@ Panel
|
||||||
height: 20
|
height: 20
|
||||||
//@onClick: Market.filterMatchVocation()
|
//@onClick: Market.filterMatchVocation()
|
||||||
|
|
||||||
ComboBox
|
MarketComboBox
|
||||||
id: typeComboBox
|
id: typeComboBox
|
||||||
anchors.top: prev.top
|
anchors.top: prev.top
|
||||||
anchors.left: prev.right
|
anchors.left: prev.right
|
||||||
|
@ -88,7 +88,7 @@ Panel
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
margin-top: 3
|
margin-top: 6
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
//@onClick: Market.setDisplayDepot()
|
//@onClick: Market.setDisplayDepot()
|
||||||
|
@ -100,7 +100,7 @@ Panel
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
margin-top: 10
|
margin-top: 10
|
||||||
margin-left: 3
|
margin-left: 3
|
||||||
margin-bottom: 10
|
margin-bottom: 5
|
||||||
margin-right: 3
|
margin-right: 3
|
||||||
|
|
||||||
VerticalScrollBar
|
VerticalScrollBar
|
||||||
|
@ -108,7 +108,7 @@ Panel
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
step: 16
|
step: 28
|
||||||
pixels-scroll: true
|
pixels-scroll: true
|
||||||
|
|
||||||
ScrollablePanel
|
ScrollablePanel
|
||||||
|
@ -120,6 +120,6 @@ Panel
|
||||||
vertical-scrollbar: itemsPanelListScrollBar
|
vertical-scrollbar: itemsPanelListScrollBar
|
||||||
layout:
|
layout:
|
||||||
type: grid
|
type: grid
|
||||||
cell-size: 34 34
|
cell-size: 36 36
|
||||||
flow: true
|
flow: true
|
||||||
auto-spacing: true
|
auto-spacing: true
|
|
@ -1,10 +1,87 @@
|
||||||
|
OfferListLabel < Label
|
||||||
|
font: verdana-11px-monochrome
|
||||||
|
background-color: alpha
|
||||||
|
text-offset: 2 0
|
||||||
|
focusable: true
|
||||||
|
color: #cccccc
|
||||||
|
|
||||||
|
$focus:
|
||||||
|
background-color: #294f6d
|
||||||
|
color: #ffffff
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
background-color: #22283399
|
background-color: #22283399
|
||||||
margin: 1
|
margin: 1
|
||||||
|
|
||||||
|
Button
|
||||||
|
!text: tr('Buy Now')
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: next.bottom
|
||||||
|
margin-right: 6
|
||||||
|
width: 80
|
||||||
|
//@onClick: g_game.closeNpcTrade()
|
||||||
|
|
||||||
Label
|
Label
|
||||||
!text: tr('Item Offers')
|
!text: tr('Sell Offers')
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
margin-top: 45
|
margin-top: 44
|
||||||
margin-left: 3
|
margin-left: 6
|
||||||
|
|
||||||
|
TextList
|
||||||
|
id: sellingList
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: 120
|
||||||
|
margin-top: 5
|
||||||
|
margin-bottom: 5
|
||||||
|
margin-right: 6
|
||||||
|
padding: 1
|
||||||
|
focusable: false
|
||||||
|
vertical-scrollbar: sellingListScrollBar
|
||||||
|
|
||||||
|
VerticalScrollBar
|
||||||
|
id: sellingListScrollBar
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.bottom: prev.bottom
|
||||||
|
anchors.right: prev.right
|
||||||
|
step: 28
|
||||||
|
pixels-scroll: true
|
||||||
|
|
||||||
|
Button
|
||||||
|
!text: tr('Sell Now')
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
margin-top: 5
|
||||||
|
margin-right: 6
|
||||||
|
width: 80
|
||||||
|
//@onClick: g_game.closeNpcTrade()
|
||||||
|
|
||||||
|
Label
|
||||||
|
!text: tr('Buy Offers')
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
margin-top: 9
|
||||||
|
margin-left: 6
|
||||||
|
|
||||||
|
TextList
|
||||||
|
id: buyingList
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-top: 5
|
||||||
|
margin-bottom: 5
|
||||||
|
margin-right: 6
|
||||||
|
height: 120
|
||||||
|
padding: 1
|
||||||
|
focusable: false
|
||||||
|
vertical-scrollbar: buyingListScrollBar
|
||||||
|
|
||||||
|
VerticalScrollBar
|
||||||
|
id: buyingListScrollBar
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.bottom: prev.bottom
|
||||||
|
anchors.right: prev.right
|
||||||
|
step: 28
|
||||||
|
pixels-scroll: true
|
|
@ -18,3 +18,4 @@ Module
|
||||||
dofile 'creature'
|
dofile 'creature'
|
||||||
dofile 'player'
|
dofile 'player'
|
||||||
dofile 'market'
|
dofile 'market'
|
||||||
|
dofile 'thing'
|
||||||
|
|
|
@ -1,3 +1,60 @@
|
||||||
|
MarketCategory = {
|
||||||
|
All = 0,
|
||||||
|
Armors = 1,
|
||||||
|
Amulets = 2,
|
||||||
|
Boots = 3,
|
||||||
|
Containers = 4,
|
||||||
|
Decoration = 5,
|
||||||
|
Food = 6,
|
||||||
|
HelmetsHats = 7,
|
||||||
|
Legs = 8,
|
||||||
|
Others = 9,
|
||||||
|
Potions = 10,
|
||||||
|
Rings = 11,
|
||||||
|
Runes = 12,
|
||||||
|
Shields = 13,
|
||||||
|
Tools = 14,
|
||||||
|
Valuables = 15,
|
||||||
|
Ammunition = 16,
|
||||||
|
Axes = 17,
|
||||||
|
Clubs = 18,
|
||||||
|
DistanceWeapons = 19,
|
||||||
|
Swords = 20,
|
||||||
|
WandsRods = 21,
|
||||||
|
PremiumScrolls = 22,
|
||||||
|
MetaWeapons = 255
|
||||||
|
}
|
||||||
|
|
||||||
|
MarketCategory.First = MarketCategory.Armors
|
||||||
|
MarketCategory.Last = MarketCategory.PremiumScrolls
|
||||||
|
|
||||||
|
MarketCategoryStrings = {
|
||||||
|
[0] = 'All',
|
||||||
|
[1] = 'Armors',
|
||||||
|
[2] = 'Amulets',
|
||||||
|
[3] = 'Boots',
|
||||||
|
[4] = 'Containers',
|
||||||
|
[5] = 'Decoration',
|
||||||
|
[6] = 'Food',
|
||||||
|
[7] = 'Helmets and Hats',
|
||||||
|
[8] = 'Legs',
|
||||||
|
[9] = 'Others',
|
||||||
|
[10] = 'Potions',
|
||||||
|
[11] = 'Rings',
|
||||||
|
[12] = 'Runes',
|
||||||
|
[13] = 'Shields',
|
||||||
|
[14] = 'Tools',
|
||||||
|
[15] = 'Valuables',
|
||||||
|
[16] = 'Ammunition',
|
||||||
|
[17] = 'Axes',
|
||||||
|
[18] = 'Clubs',
|
||||||
|
[19] = 'Distance Weapons',
|
||||||
|
[20] = 'Swords',
|
||||||
|
[21] = 'Wands and Rods',
|
||||||
|
[22] = 'Premium Scrolls',
|
||||||
|
[255] = 'Meta Weapons'
|
||||||
|
}
|
||||||
|
|
||||||
MarketAction = {
|
MarketAction = {
|
||||||
Buy = 0,
|
Buy = 0,
|
||||||
Sell = 1
|
Sell = 1
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
ThingCategoryItem = 0
|
||||||
|
ThingCategoryCreature = 1
|
||||||
|
ThingCategoryEffect = 2
|
||||||
|
ThingCategoryMissile = 3
|
||||||
|
ThingInvalidCategory = 4
|
||||||
|
ThingLastCategory = ThingInvalidCategory
|
||||||
|
|
||||||
|
ThingAttrGround = 0
|
||||||
|
ThingAttrGroundBorder = 1
|
||||||
|
ThingAttrOnBottom = 2
|
||||||
|
ThingAttrOnTop = 3
|
||||||
|
ThingAttrContainer = 4
|
||||||
|
ThingAttrStackable = 5
|
||||||
|
ThingAttrForceUse = 6
|
||||||
|
ThingAttrMultiUse = 7
|
||||||
|
ThingAttrWritable = 8
|
||||||
|
ThingAttrWritableOnce = 9
|
||||||
|
ThingAttrFluidContainer = 10
|
||||||
|
ThingAttrSplash = 11
|
||||||
|
ThingAttrNotWalkable = 12
|
||||||
|
ThingAttrNotMoveable = 13
|
||||||
|
ThingAttrBlockProjectile = 14
|
||||||
|
ThingAttrNotPathable = 15
|
||||||
|
ThingAttrPickupable = 16
|
||||||
|
ThingAttrHangable = 17
|
||||||
|
ThingAttrHookSouth = 18
|
||||||
|
ThingAttrHookEast = 19
|
||||||
|
ThingAttrRotateable = 20
|
||||||
|
ThingAttrLight = 21
|
||||||
|
ThingAttrDontHide = 22
|
||||||
|
ThingAttrTranslucent = 23
|
||||||
|
ThingAttrDisplacement = 24
|
||||||
|
ThingAttrElevation = 25
|
||||||
|
ThingAttrLyingCorpse = 26
|
||||||
|
ThingAttrAnimateAlways = 27
|
||||||
|
ThingAttrMinimapColor = 28
|
||||||
|
ThingAttrLensHelp = 29
|
||||||
|
ThingAttrFullGround = 30
|
||||||
|
ThingAttrLook = 31
|
||||||
|
ThingAttrCloth = 32
|
||||||
|
ThingAttrMarket = 33
|
||||||
|
ThingAttrChargeable = 254 -- deprecated
|
||||||
|
ThingLastAttr = 255
|
||||||
|
|
||||||
|
SpriteMaskRed = 1
|
||||||
|
SpriteMaskGreen = 2
|
||||||
|
SpriteMaskBlue = 3
|
||||||
|
SpriteMaskYellow = 4
|
|
@ -338,6 +338,7 @@ void OTClient::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<ItemType>("getClientId", &ItemType::getClientId);
|
g_lua.bindClassMemberFunction<ItemType>("getClientId", &ItemType::getClientId);
|
||||||
|
|
||||||
g_lua.registerClass<ThingType>();
|
g_lua.registerClass<ThingType>();
|
||||||
|
g_lua.bindClassMemberFunction<ThingType>("getId", &ThingType::getId);
|
||||||
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
|
g_lua.bindClassMemberFunction<ThingType>("getMarketData", &ThingType::getMarketData);
|
||||||
|
|
||||||
g_lua.registerClass<Item, Thing>();
|
g_lua.registerClass<Item, Thing>();
|
||||||
|
|
Loading…
Reference in New Issue