Bug fixes for imbuing
BIN
data/images/game/imbuing/100percent.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
data/images/game/imbuing/clear.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
data/images/game/imbuing/imbue_empty.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
data/images/game/imbuing/imbue_green.png
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
data/images/game/imbuing/slot.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
data/images/game/imbuing/slot_disabled.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
data/images/game/imbuing/slot_inactive.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
@ -1,39 +0,0 @@
|
|||||||
function init()
|
|
||||||
connect(g_game, {
|
|
||||||
onImbuementWindow = onImbuementWindow,
|
|
||||||
onCloseImbuementWindow = onCloseImbuementWindow
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
function terminate()
|
|
||||||
disconnect(g_game, {
|
|
||||||
onImbuementWindow = onImbuementWindow,
|
|
||||||
onCloseImbuementWindow = onCloseImbuementWindow
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
function onImbuementWindow(itemId, slots, activeSlots, imbuements, needItems)
|
|
||||||
print("window " .. slots)
|
|
||||||
for i, slot in pairs(activeSlots) do
|
|
||||||
local duration = slot.duration
|
|
||||||
local removalCost = slot.removalCost
|
|
||||||
local imbuement = slot.imbuement
|
|
||||||
for i, source in pairs(imbuement.sources) do
|
|
||||||
print(source.description, source.item:getId(), source.item:getCount())
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
for i, imbuement in ipairs(imbuements) do
|
|
||||||
for i, source in pairs(imbuement.sources) do
|
|
||||||
print(source.description, source.item:getId(), source.item:getCount())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for i, item in ipairs(needItems) do
|
|
||||||
print(item:getId(), item:getCount())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function onCloseImbuementWindow()
|
|
||||||
print("close")
|
|
||||||
end
|
|
@ -1,9 +0,0 @@
|
|||||||
Module
|
|
||||||
name: game_imbuement
|
|
||||||
description: Imbuement
|
|
||||||
author: otclient.ovh
|
|
||||||
website: http://otclient.ovh
|
|
||||||
sandboxed: true
|
|
||||||
scripts: [ imbuement ]
|
|
||||||
@onLoad: init()
|
|
||||||
@onUnload: terminate()
|
|
@ -1,199 +0,0 @@
|
|||||||
PreySelectionLabel < Label
|
|
||||||
font: verdana-11px-monochrome
|
|
||||||
background-color: alpha
|
|
||||||
text-offset: 34 0
|
|
||||||
margin-right: 5
|
|
||||||
text-align: center
|
|
||||||
text-wrap: true
|
|
||||||
focusable: true
|
|
||||||
height: 34
|
|
||||||
|
|
||||||
$focus:
|
|
||||||
background-color: #00000055
|
|
||||||
color: #ffffff
|
|
||||||
|
|
||||||
UICreature
|
|
||||||
id: creature
|
|
||||||
size: 32 32
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
margin-top: 1
|
|
||||||
|
|
||||||
PreySlot < Panel
|
|
||||||
width: 190
|
|
||||||
height: 280
|
|
||||||
border: 1 black
|
|
||||||
padding: 5
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: title
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
text-align: center
|
|
||||||
!text: tr("Prey Inactive")
|
|
||||||
|
|
||||||
TextList
|
|
||||||
id: list
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-top: 15
|
|
||||||
margin-right: 10
|
|
||||||
vertical-scrollbar: listScrollbar
|
|
||||||
height: 150
|
|
||||||
visible: false
|
|
||||||
focusable: false
|
|
||||||
|
|
||||||
VerticalScrollBar
|
|
||||||
id: listScrollbar
|
|
||||||
anchors.top: prev.top
|
|
||||||
anchors.bottom: prev.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
pixels-scroll: true
|
|
||||||
visible: false
|
|
||||||
step: 10
|
|
||||||
|
|
||||||
UICreature
|
|
||||||
id: creature
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
margin-top: 40
|
|
||||||
height: 64
|
|
||||||
width: 64
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: description
|
|
||||||
margin-top: 30
|
|
||||||
margin-left: 5
|
|
||||||
margin-right: 5
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
text-auto-resize: true
|
|
||||||
text-align: center
|
|
||||||
text-wrap: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: bonuses
|
|
||||||
margin-top: 5
|
|
||||||
margin-left: 5
|
|
||||||
margin-right: 5
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
text-auto-resize: true
|
|
||||||
text-align: center
|
|
||||||
text-wrap: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: button
|
|
||||||
margin-top: 5
|
|
||||||
anchors.top: prev.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-left: 10
|
|
||||||
margin-right: 10
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: bottomLabel
|
|
||||||
margin-left: 5
|
|
||||||
margin-right: 5
|
|
||||||
margin-bottom: 5
|
|
||||||
anchors.bottom: next.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
text-auto-resize: true
|
|
||||||
text-align: center
|
|
||||||
text-wrap: true
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: bottomButton
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-left: 10
|
|
||||||
margin-right: 10
|
|
||||||
text: 11
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
$hidden:
|
|
||||||
height: 0
|
|
||||||
|
|
||||||
$!hidden:
|
|
||||||
height: 22
|
|
||||||
|
|
||||||
MainWindow
|
|
||||||
id: preyWindow
|
|
||||||
!text: tr('Preys')
|
|
||||||
size: 600 405
|
|
||||||
background-color: #AAAAAA
|
|
||||||
@onEscape: modules.game_prey.hide()
|
|
||||||
|
|
||||||
PreySlot
|
|
||||||
id: slot1
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.top: parent.top
|
|
||||||
|
|
||||||
PreySlot
|
|
||||||
id: slot2
|
|
||||||
anchors.left: prev.right
|
|
||||||
anchors.top: prev.top
|
|
||||||
|
|
||||||
PreySlot
|
|
||||||
id: slot3
|
|
||||||
anchors.left: prev.right
|
|
||||||
anchors.top: prev.top
|
|
||||||
|
|
||||||
HorizontalSeparator
|
|
||||||
id: mainSeparator
|
|
||||||
anchors.top: slot3.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-top: 5
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: rerollPrice
|
|
||||||
anchors.top: mainSeparator.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
margin-top: 5
|
|
||||||
width: 190
|
|
||||||
height: 30
|
|
||||||
text-align: center
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: balance
|
|
||||||
anchors.top: mainSeparator.bottom
|
|
||||||
anchors.left: prev.right
|
|
||||||
margin-top: 5
|
|
||||||
width: 190
|
|
||||||
height: 30
|
|
||||||
text-align: center
|
|
||||||
|
|
||||||
Label
|
|
||||||
id: bonusRerolls
|
|
||||||
anchors.top: mainSeparator.bottom
|
|
||||||
anchors.left: prev.right
|
|
||||||
margin-top: 5
|
|
||||||
width: 190
|
|
||||||
height: 30
|
|
||||||
text-align: center
|
|
||||||
|
|
||||||
HorizontalSeparator
|
|
||||||
anchors.bottom: buttonCancel.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
margin-bottom: 5
|
|
||||||
|
|
||||||
Button
|
|
||||||
id: buttonCancel
|
|
||||||
!text: tr('Close')
|
|
||||||
width: 64
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
@onClick: modules.game_prey.hide()
|
|
304
modules/game_imbuing/imbuing.lua
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
local imbuingWindow
|
||||||
|
local bankGold = 0
|
||||||
|
local inventoryGold = 0
|
||||||
|
local itemImbuements = {}
|
||||||
|
local emptyImbue
|
||||||
|
local groupsCombo
|
||||||
|
local imbueLevelsCombo
|
||||||
|
local protectionBtn
|
||||||
|
local clearImbue
|
||||||
|
local selectedImbue
|
||||||
|
local imbueItems = {}
|
||||||
|
local protection = false
|
||||||
|
local clearConfirmWindow
|
||||||
|
local imbueConfirmWindow
|
||||||
|
|
||||||
|
function init()
|
||||||
|
connect(g_game, {
|
||||||
|
onGameEnd = hide,
|
||||||
|
onResourceBalance = onResourceBalance,
|
||||||
|
onImbuementWindow = onImbuementWindow,
|
||||||
|
onCloseImbuementWindow = onCloseImbuementWindow
|
||||||
|
})
|
||||||
|
|
||||||
|
imbuingWindow = g_ui.displayUI('imbuing')
|
||||||
|
emptyImbue = imbuingWindow.emptyImbue
|
||||||
|
groupsCombo = emptyImbue.groups
|
||||||
|
imbueLevelsCombo = emptyImbue.imbuement
|
||||||
|
protectionBtn = emptyImbue.protection
|
||||||
|
clearImbue = imbuingWindow.clearImbue
|
||||||
|
imbuingWindow:hide()
|
||||||
|
|
||||||
|
groupsCombo.onOptionChange = function(widget)
|
||||||
|
imbueLevelsCombo:clear()
|
||||||
|
if itemImbuements ~= nil then
|
||||||
|
local selectedGroup = widget:getCurrentOption()["text"]
|
||||||
|
selectedImbue = itemImbuements[widget.currentIndex]
|
||||||
|
for _,imbuement in ipairs(itemImbuements) do
|
||||||
|
if imbuement["group"] == selectedGroup then
|
||||||
|
emptyImbue.imbuement:addOption(imbuement["name"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
imbueLevelsCombo.onOptionChange = function(widget)
|
||||||
|
setProtection(false)
|
||||||
|
for _,imbuement in ipairs(itemImbuements) do
|
||||||
|
if imbuement["group"] == selectedImbue["group"] then
|
||||||
|
if #imbuement["sources"] == widget.currentIndex then
|
||||||
|
selectedImbue = imbuement
|
||||||
|
for i,source in ipairs(imbuement["sources"]) do
|
||||||
|
for _,item in ipairs(imbueItems) do
|
||||||
|
if item:getId() == source["item"]:getId() then
|
||||||
|
if item:getCount() >= source["item"]:getCount() then
|
||||||
|
emptyImbue.imbue:setImageSource("/images/game/imbuing/imbue_green")
|
||||||
|
emptyImbue.imbue:setEnabled(true)
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).count:setColor("white")
|
||||||
|
end
|
||||||
|
if item:getCount() < source["item"]:getCount() then
|
||||||
|
emptyImbue.imbue:setEnabled(false)
|
||||||
|
emptyImbue.imbue:setImageSource("/images/game/imbuing/imbue_empty")
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).count:setColor("red")
|
||||||
|
end
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).count:setText(item:getCount() .. "/" .. source["item"]:getCount())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).item:setItemId(source["item"]:getId())
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).item:setTooltip("The imbuement requires " .. source["description"] .. ".")
|
||||||
|
end
|
||||||
|
for i = 3, widget.currentIndex + 1, -1 do
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).count:setText("")
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).item:setItemId(0)
|
||||||
|
emptyImbue.requiredItems:getChildByIndex(i).item:setTooltip("")
|
||||||
|
end
|
||||||
|
emptyImbue.protectionCost:setText(imbuement["protectionCost"])
|
||||||
|
emptyImbue.cost:setText(imbuement["cost"])
|
||||||
|
if not protection and (bankGold + inventoryGold) < imbuement["cost"] then
|
||||||
|
emptyImbue.imbue:setEnabled(false)
|
||||||
|
emptyImbue.imbue:setImageSource("/images/game/imbuing/imbue_empty")
|
||||||
|
emptyImbue.cost:setColor("red")
|
||||||
|
end
|
||||||
|
if not protection and (bankGold + inventoryGold) >= imbuement["cost"] then
|
||||||
|
emptyImbue.cost:setColor("white")
|
||||||
|
end
|
||||||
|
if protection and (bankGold + inventoryGold) < (imbuement["cost"] + imbuement["protectionCost"]) then
|
||||||
|
emptyImbue.imbue:setEnabled(false)
|
||||||
|
emptyImbue.imbue:setImageSource("/images/game/imbuing/imbue_empty")
|
||||||
|
emptyImbue.cost:setColor("red")
|
||||||
|
end
|
||||||
|
if protection and (bankGold + inventoryGold) >= (imbuement["cost"] + imbuement["protectionCost"]) then
|
||||||
|
emptyImbue.cost:setColor("white")
|
||||||
|
end
|
||||||
|
emptyImbue.successRate:setText(imbuement["successRate"] .. "%")
|
||||||
|
if selectedImbue["successRate"] > 50 then
|
||||||
|
emptyImbue.successRate:setColor("white")
|
||||||
|
else
|
||||||
|
emptyImbue.successRate:setColor("red")
|
||||||
|
end
|
||||||
|
emptyImbue.description:setText(imbuement["description"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
protectionBtn.onClick = function()
|
||||||
|
setProtection(not protection)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function setProtection(value)
|
||||||
|
protection = value
|
||||||
|
if protection then
|
||||||
|
emptyImbue.successRate:setText("100%")
|
||||||
|
emptyImbue.successRate:setColor("green")
|
||||||
|
protectionBtn:setImageClip(torect("66 0 66 66"))
|
||||||
|
else
|
||||||
|
if selectedImbue then
|
||||||
|
emptyImbue.successRate:setText(selectedImbue["successRate"] .. "%")
|
||||||
|
if selectedImbue["successRate"] > 50 then
|
||||||
|
emptyImbue.successRate:setColor("white")
|
||||||
|
else
|
||||||
|
emptyImbue.successRate:setColor("red")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
protectionBtn:setImageClip(torect("0 0 66 66"))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function terminate()
|
||||||
|
disconnect(g_game, {
|
||||||
|
onGameEnd = hide,
|
||||||
|
onResourceBalance = onResourceBalance,
|
||||||
|
onImbuementWindow = onImbuementWindow,
|
||||||
|
onCloseImbuementWindow = onCloseImbuementWindow
|
||||||
|
})
|
||||||
|
|
||||||
|
imbuingWindow:destroy()
|
||||||
|
end
|
||||||
|
|
||||||
|
function resetSlots()
|
||||||
|
emptyImbue:setVisible(false)
|
||||||
|
clearImbue:setVisible(false)
|
||||||
|
for i=1,3 do
|
||||||
|
imbuingWindow.itemInfo.slots:getChildByIndex(i):setText("Slot " .. i)
|
||||||
|
imbuingWindow.itemInfo.slots:getChildByIndex(i):setEnabled(false)
|
||||||
|
imbuingWindow.itemInfo.slots:getChildByIndex(i):setTooltip("Items can have up to three imbuements slots. This slot is not available for this item.")
|
||||||
|
imbuingWindow.itemInfo.slots:getChildByIndex(i).onClick = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function selectSlot(widget, slotId, activeSlot)
|
||||||
|
if activeSlot then
|
||||||
|
emptyImbue:setVisible(false)
|
||||||
|
widget:setText(activeSlot[1]["name"])
|
||||||
|
clearImbue.title:setText('Clear Imbuement "' .. activeSlot[1]["name"] .. '"')
|
||||||
|
clearImbue.groups:clear()
|
||||||
|
clearImbue.groups:addOption(activeSlot[1]["group"])
|
||||||
|
clearImbue.imbuement:clear()
|
||||||
|
clearImbue.imbuement:addOption(activeSlot[1]["name"])
|
||||||
|
clearImbue.description:setText(activeSlot[1]["description"])
|
||||||
|
|
||||||
|
hours = string.format("%02.f", math.floor(activeSlot[2]/3600))
|
||||||
|
mins = string.format("%02.f", math.floor(activeSlot[2]/60 - (hours*60)))
|
||||||
|
clearImbue.time.timeRemaining:setText(hours..":"..mins.."h")
|
||||||
|
|
||||||
|
clearImbue.cost:setText(activeSlot[3])
|
||||||
|
if (bankGold + inventoryGold) < activeSlot[3] then
|
||||||
|
emptyImbue.clear:setEnabled(false)
|
||||||
|
emptyImbue.clear:setImageSource("/images/game/imbuing/imbue_empty")
|
||||||
|
emptyImbue.cost:setColor("red")
|
||||||
|
end
|
||||||
|
|
||||||
|
local yesCallback = function()
|
||||||
|
g_game.clearImbuement(slotId)
|
||||||
|
widget:setText("Slot " .. (slotId + 1))
|
||||||
|
if clearConfirmWindow then
|
||||||
|
clearConfirmWindow:destroy()
|
||||||
|
clearConfirmWindow=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local noCallback = function()
|
||||||
|
imbuingWindow:show()
|
||||||
|
if clearConfirmWindow then
|
||||||
|
clearConfirmWindow:destroy()
|
||||||
|
clearConfirmWindow=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
clearImbue.clear.onClick = function()
|
||||||
|
imbuingWindow:hide()
|
||||||
|
clearConfirmWindow = displayGeneralBox(tr('Confirm Clearing'), tr('Do you wish to spend ' .. activeSlot[3] .. ' gold coins to clear the imbuement "' .. activeSlot[1]["name"] .. '" from your item?'), {
|
||||||
|
{ text=tr('Yes'), callback=yesCallback },
|
||||||
|
{ text=tr('No'), callback=noCallback },
|
||||||
|
anchor=AnchorHorizontalCenter}, yesCallback, noCallback)
|
||||||
|
end
|
||||||
|
|
||||||
|
clearImbue:setVisible(true)
|
||||||
|
else
|
||||||
|
emptyImbue:setVisible(true)
|
||||||
|
clearImbue:setVisible(false)
|
||||||
|
|
||||||
|
local yesCallback = function()
|
||||||
|
g_game.applyImbuement(slotId, selectedImbue["id"], protection)
|
||||||
|
if clearConfirmWindow then
|
||||||
|
clearConfirmWindow:destroy()
|
||||||
|
clearConfirmWindow=nil
|
||||||
|
end
|
||||||
|
widget:setText(selectedImbue["name"])
|
||||||
|
imbuingWindow:show()
|
||||||
|
end
|
||||||
|
local noCallback = function()
|
||||||
|
imbuingWindow:show()
|
||||||
|
if clearConfirmWindow then
|
||||||
|
clearConfirmWindow:destroy()
|
||||||
|
clearConfirmWindow=nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
emptyImbue.imbue.onClick = function()
|
||||||
|
imbuingWindow:hide()
|
||||||
|
clearConfirmWindow = displayGeneralBox(tr('Confirm Imbuing Attempt'), tr('You are about to imbue your item with "' .. selectedImbue["name"] .. '".\nYour chance to succeed is ' .. selectedImbue["successRate"] .. '. It will consume the required astral sources and '.. selectedImbue["cost"]..' gold coins.\nDo you wish to proceed?'), {
|
||||||
|
{ text=tr('Yes'), callback=yesCallback },
|
||||||
|
{ text=tr('No'), callback=noCallback },
|
||||||
|
anchor=AnchorHorizontalCenter}, yesCallback, noCallback)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function onImbuementWindow(itemId, slots, activeSlots, imbuements, needItems)
|
||||||
|
if not itemId then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
resetSlots()
|
||||||
|
imbueItems = table.copy(needItems)
|
||||||
|
imbuingWindow.itemInfo.item:setItemId(itemId)
|
||||||
|
|
||||||
|
for i=1, slots do
|
||||||
|
local slot = imbuingWindow.itemInfo.slots:getChildByIndex(i)
|
||||||
|
slot.onClick = function(widget)
|
||||||
|
selectSlot(widget, i - 1)
|
||||||
|
end
|
||||||
|
slot:setTooltip("Use this slot to imbue your item. Depending on the item you can have up to three different imbuements.")
|
||||||
|
slot:setEnabled(true)
|
||||||
|
|
||||||
|
if slot:getId() == "slot0" then
|
||||||
|
selectSlot(slot, i - 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, slot in pairs(activeSlots) do
|
||||||
|
local activeSlotBtn = imbuingWindow.itemInfo.slots:getChildById("slot" .. i)
|
||||||
|
activeSlotBtn.onClick = function(widget)
|
||||||
|
selectSlot(widget, i, slot)
|
||||||
|
end
|
||||||
|
if activeSlotBtn:getId() == "slot0" then
|
||||||
|
selectSlot(activeSlotBtn, i, slot)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if imbuements ~= nil then
|
||||||
|
groupsCombo:clear()
|
||||||
|
imbueLevelsCombo:clear()
|
||||||
|
itemImbuements = table.copy(imbuements)
|
||||||
|
for _,imbuement in ipairs(itemImbuements) do
|
||||||
|
if not groupsCombo:isOption(imbuement["group"]) then
|
||||||
|
groupsCombo:addOption(imbuement["group"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
show()
|
||||||
|
end
|
||||||
|
|
||||||
|
function onResourceBalance(type, balance)
|
||||||
|
if type == 0 then
|
||||||
|
bankGold = balance
|
||||||
|
elseif type == 1 then
|
||||||
|
inventoryGold = balance
|
||||||
|
end
|
||||||
|
if type == 0 or type == 1 then
|
||||||
|
imbuingWindow.balance:setText(tr("Balance") .. ":\n" .. (bankGold + inventoryGold))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function onCloseImbuementWindow()
|
||||||
|
resetSlots()
|
||||||
|
end
|
||||||
|
|
||||||
|
function hide()
|
||||||
|
g_game.closeImbuingWindow()
|
||||||
|
imbuingWindow:hide()
|
||||||
|
end
|
||||||
|
|
||||||
|
function show()
|
||||||
|
imbuingWindow:show()
|
||||||
|
imbuingWindow:raise()
|
||||||
|
imbuingWindow:focus()
|
||||||
|
end
|
||||||
|
|
||||||
|
function toggle()
|
||||||
|
if imbuingWindow:isVisible() then
|
||||||
|
return hide()
|
||||||
|
end
|
||||||
|
show()
|
||||||
|
end
|
9
modules/game_imbuing/imbuing.otmod
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Module
|
||||||
|
name: game_imbuing
|
||||||
|
description: imbuing
|
||||||
|
author: Vincent#1766 on discord
|
||||||
|
website: http://otclient.ovh
|
||||||
|
sandboxed: true
|
||||||
|
scripts: [ imbuing ]
|
||||||
|
@onLoad: init()
|
||||||
|
@onUnload: terminate()
|
346
modules/game_imbuing/imbuing.otui
Normal file
@ -0,0 +1,346 @@
|
|||||||
|
Slot < Button
|
||||||
|
width: 70
|
||||||
|
height: 66
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
enabled: false
|
||||||
|
text-wrap: true
|
||||||
|
!tooltip: tr('Items can have up to three imbuements slots. This slot is not available for this item.')
|
||||||
|
|
||||||
|
RequiredItem < Panel
|
||||||
|
width: 66
|
||||||
|
height: 90
|
||||||
|
|
||||||
|
UIItem
|
||||||
|
id: item
|
||||||
|
height: 66
|
||||||
|
width: 66
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
FlatLabel
|
||||||
|
id: count
|
||||||
|
margin-top: 5
|
||||||
|
text-align: center
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: prev.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
|
||||||
|
ItemInformation < Panel
|
||||||
|
height: 100
|
||||||
|
border: 1 black
|
||||||
|
padding: 5
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: title
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
text-align: center
|
||||||
|
!text: tr("Item Information")
|
||||||
|
|
||||||
|
UIItem
|
||||||
|
id: item
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.VerticalCenter: parent.VerticalCenter
|
||||||
|
margin-left: 10
|
||||||
|
margin-top: 5
|
||||||
|
height: 64
|
||||||
|
width: 64
|
||||||
|
|
||||||
|
Panel
|
||||||
|
id: slots
|
||||||
|
width: 240
|
||||||
|
height: 66
|
||||||
|
margin-top: 5
|
||||||
|
anchors.VerticalCenter: parent.VerticalCenter
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
Slot
|
||||||
|
id: slot0
|
||||||
|
!text: tr("Slot 1")
|
||||||
|
text-align: center
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
Slot
|
||||||
|
id: slot1
|
||||||
|
!text: tr("Slot 2")
|
||||||
|
text-align: center
|
||||||
|
margin-left: 10
|
||||||
|
anchors.left: prev.right
|
||||||
|
|
||||||
|
Slot
|
||||||
|
id: slot2
|
||||||
|
!text: tr("Slot 3")
|
||||||
|
text-align: center
|
||||||
|
margin-left: 10
|
||||||
|
anchors.left: prev.right
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: selectSlot
|
||||||
|
margin-right: 15
|
||||||
|
anchors.right: slots.left
|
||||||
|
anchors.VerticalCenter: parent.VerticalCenter
|
||||||
|
!text: tr("Select Slot:")
|
||||||
|
|
||||||
|
EmptyImbue < Panel
|
||||||
|
height: 240
|
||||||
|
border: 1 black
|
||||||
|
padding: 5
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: title
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
text-align: center
|
||||||
|
!text: tr("Imbue Empty Slot")
|
||||||
|
|
||||||
|
ComboBox
|
||||||
|
id: groups
|
||||||
|
anchors.top: title.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.HorizontalCenter
|
||||||
|
margin-right: 3
|
||||||
|
margin-top: 5
|
||||||
|
isdisabled: true
|
||||||
|
|
||||||
|
ComboBox
|
||||||
|
id: imbuement
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: groups.right
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-left: 3
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: description
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-top: 10
|
||||||
|
height: 85
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: info
|
||||||
|
anchors.bottom: prev.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
!text: tr('Requires the following astral sources:')
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: successRate
|
||||||
|
anchors.top: info.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
width: 35
|
||||||
|
text-align: right
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: successRateTitle
|
||||||
|
anchors.top: info.top
|
||||||
|
anchors.right: successRate.left
|
||||||
|
margin-right: 15
|
||||||
|
!text: tr('Success Rate:')
|
||||||
|
|
||||||
|
Panel
|
||||||
|
id: requiredItems
|
||||||
|
width: 210
|
||||||
|
height: 90
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
RequiredItem
|
||||||
|
id: item1
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
RequiredItem
|
||||||
|
id: item2
|
||||||
|
margin-left: 10
|
||||||
|
anchors.left: prev.right
|
||||||
|
|
||||||
|
RequiredItem
|
||||||
|
id: item3
|
||||||
|
margin-left: 10
|
||||||
|
anchors.left: prev.right
|
||||||
|
|
||||||
|
UIButton
|
||||||
|
id: protection
|
||||||
|
width: 66
|
||||||
|
height: 66
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: prev.right
|
||||||
|
image-source: /images/game/imbuing/100percent
|
||||||
|
image-clip: 0 0 66 66
|
||||||
|
margin-left: 15
|
||||||
|
!tooltip: ("Bribe the fates! Click here to raise your chance to 100%. For guaranteed success use gold.")
|
||||||
|
|
||||||
|
FlatLabel
|
||||||
|
id: protectionCost
|
||||||
|
margin-top: 5
|
||||||
|
text-align: center
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: prev.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
|
||||||
|
UIWidget
|
||||||
|
id: horizontalArrow
|
||||||
|
anchors.left: prev.right
|
||||||
|
anchors.verticalCenter: requiredItems.verticalCenter
|
||||||
|
margin-left: 45
|
||||||
|
width: 12
|
||||||
|
height: 21
|
||||||
|
image-source: /images/ui/arrow_horizontal
|
||||||
|
image-rect: 0 0 12 21
|
||||||
|
image-clip: 12 0 12 21
|
||||||
|
phantom: false
|
||||||
|
|
||||||
|
UIButton
|
||||||
|
id: imbue
|
||||||
|
width: 128
|
||||||
|
height: 66
|
||||||
|
anchors.top: requiredItems.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
image-source: /images/game/imbuing/imbue_empty
|
||||||
|
image-clip: 0 0 128 66
|
||||||
|
margin-left: 15
|
||||||
|
!tooltip: tr("Click here to carry out the selected imbuement. This will consume the required astral sources and gold.")
|
||||||
|
|
||||||
|
$pressed:
|
||||||
|
image-clip: 0 66 128 66
|
||||||
|
|
||||||
|
FlatLabel
|
||||||
|
id: cost
|
||||||
|
margin-top: 5
|
||||||
|
text-align: center
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: prev.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
|
||||||
|
ClearImbue < Panel
|
||||||
|
height: 240
|
||||||
|
border: 1 black
|
||||||
|
padding: 5
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: title
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
text-align: center
|
||||||
|
!text: tr("Clear Imbuement")
|
||||||
|
|
||||||
|
ComboBox
|
||||||
|
id: groups
|
||||||
|
anchors.top: title.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.HorizontalCenter
|
||||||
|
margin-right: 3
|
||||||
|
margin-top: 5
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
ComboBox
|
||||||
|
id: imbuement
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.left: groups.right
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-left: 3
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: description
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-top: 10
|
||||||
|
height: 85
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: info
|
||||||
|
anchors.bottom: prev.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
!text: tr('Time remaining:')
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: clearImbuementTitle
|
||||||
|
anchors.top: info.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
!text: tr('Clear imbuement:')
|
||||||
|
|
||||||
|
Panel
|
||||||
|
id: time
|
||||||
|
width: 210
|
||||||
|
height: 90
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
FlatLabel
|
||||||
|
id: timeRemaining
|
||||||
|
size: 86 25
|
||||||
|
margin-bottom: 20
|
||||||
|
text-align: center
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
|
UIButton
|
||||||
|
id: clear
|
||||||
|
width: 128
|
||||||
|
height: 66
|
||||||
|
anchors.top: time.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
image-source: /images/game/imbuing/clear
|
||||||
|
image-clip: 0 0 128 66
|
||||||
|
margin-left: 15
|
||||||
|
!tooltip: tr("Your needs have changed? Click here to clear the imbuement from your item for a fee.")
|
||||||
|
|
||||||
|
$pressed:
|
||||||
|
image-clip: 0 66 128 66
|
||||||
|
|
||||||
|
FlatLabel
|
||||||
|
id: cost
|
||||||
|
margin-top: 5
|
||||||
|
text-align: center
|
||||||
|
anchors.left: prev.left
|
||||||
|
anchors.right: prev.right
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
|
||||||
|
|
||||||
|
MainWindow
|
||||||
|
id: imbuingWindow
|
||||||
|
!text: tr('Imbue Item')
|
||||||
|
size: 550 430
|
||||||
|
background-color: #AAAAAA
|
||||||
|
@onEscape: modules.game_imbuing.hide()
|
||||||
|
|
||||||
|
ItemInformation
|
||||||
|
id: itemInfo
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
EmptyImbue
|
||||||
|
id: emptyImbue
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: prev.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
|
margin-top: 5
|
||||||
|
|
||||||
|
ClearImbue
|
||||||
|
id: clearImbue
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: emptyImbue.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
|
||||||
|
Button
|
||||||
|
id: close
|
||||||
|
!text: tr('Close')
|
||||||
|
width: 50
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
@onClick: modules.game_imbuing.hide()
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: balance
|
||||||
|
height: 25
|
||||||
|
anchors.right: prev.left
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
@ -36,7 +36,7 @@ Module
|
|||||||
- game_textedit
|
- game_textedit
|
||||||
- game_actionbar
|
- game_actionbar
|
||||||
- game_prey
|
- game_prey
|
||||||
- game_imbuement
|
- game_imbuing
|
||||||
- game_bot
|
- game_bot
|
||||||
@onLoad: init()
|
@onLoad: init()
|
||||||
@onUnload: terminate()
|
@onUnload: terminate()
|
||||||
|