mirror of
https://github.com/OTCv8/otclientv8.git
synced 2025-04-29 18:59:20 +02:00
Updated to OTCv8 3.0 rev 12
This commit is contained in:
parent
ee51c4d7b7
commit
a26109ce3f
7
mods/game_healthbars/healthbars.lua
Normal file
7
mods/game_healthbars/healthbars.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
function init()
|
||||||
|
g_healthBars.addHealthBackground("/images/bars/health1", -2, -2, 0, 2, 4)
|
||||||
|
g_healthBars.addManaBackground("/images/bars/mana1", -2, -2, 0, 2, 4)
|
||||||
|
end
|
||||||
|
|
||||||
|
function terminate()
|
||||||
|
end
|
10
mods/game_healthbars/healthbars.otmod
Normal file
10
mods/game_healthbars/healthbars.otmod
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Module
|
||||||
|
name: game_healthbars
|
||||||
|
description: Load health and mana bars
|
||||||
|
author: Oen44
|
||||||
|
website: http://otclient.ovh
|
||||||
|
scripts: [ healthbars ]
|
||||||
|
autoload: false
|
||||||
|
sandboxed: true
|
||||||
|
@onLoad: init()
|
||||||
|
@onUnload: terminate()
|
@ -1,11 +1,11 @@
|
|||||||
ADDON_SETS = {
|
ADDON_SETS = {
|
||||||
[1] = { 1 },
|
[1] = {1},
|
||||||
[2] = { 2 },
|
[2] = {2},
|
||||||
[3] = { 1, 2 },
|
[3] = {1, 2},
|
||||||
[4] = { 3 },
|
[4] = {3},
|
||||||
[5] = { 1, 3 },
|
[5] = {1, 3},
|
||||||
[6] = { 2, 3 },
|
[6] = {2, 3},
|
||||||
[7] = { 1, 2, 3 }
|
[7] = {1, 2, 3}
|
||||||
}
|
}
|
||||||
|
|
||||||
outfitWindow = nil
|
outfitWindow = nil
|
||||||
@ -26,17 +26,23 @@ currentMount = 1
|
|||||||
ignoreNextOutfitWindow = 0
|
ignoreNextOutfitWindow = 0
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
connect(g_game, {
|
connect(
|
||||||
onOpenOutfitWindow = create,
|
g_game,
|
||||||
onGameEnd = destroy
|
{
|
||||||
})
|
onOpenOutfitWindow = create,
|
||||||
|
onGameEnd = destroy
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function terminate()
|
function terminate()
|
||||||
disconnect(g_game, {
|
disconnect(
|
||||||
onOpenOutfitWindow = create,
|
g_game,
|
||||||
onGameEnd = destroy
|
{
|
||||||
})
|
onOpenOutfitWindow = create,
|
||||||
|
onGameEnd = destroy
|
||||||
|
}
|
||||||
|
)
|
||||||
destroy()
|
destroy()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -44,7 +50,7 @@ function updateMount()
|
|||||||
if table.empty(mounts) or not mount then
|
if table.empty(mounts) or not mount then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local nameMountWidget = outfitWindow:getChildById('mountName')
|
local nameMountWidget = outfitWindow:getChildById("mountName")
|
||||||
nameMountWidget:setText(mounts[currentMount][2])
|
nameMountWidget:setText(mounts[currentMount][2])
|
||||||
|
|
||||||
mount.type = mounts[currentMount][1]
|
mount.type = mounts[currentMount][1]
|
||||||
@ -53,9 +59,14 @@ end
|
|||||||
|
|
||||||
function setupSelector(widget, id, outfit, list)
|
function setupSelector(widget, id, outfit, list)
|
||||||
widget:setId(id)
|
widget:setId(id)
|
||||||
widget.title:setText(id:gsub("^%l", string.upper))
|
if id == "healthBar" or id == "manaBar" then
|
||||||
if id ~= "type" or #list == 0 then
|
widget.title:setText(id == "healthBar" and "Health Bar" or "Mana Bar")
|
||||||
table.insert(list, 1, {0, "-"})
|
table.insert(list, 1, {0, "-"})
|
||||||
|
else
|
||||||
|
widget.title:setText(id:gsub("^%l", string.upper))
|
||||||
|
if id ~= "type" or #list == 0 then
|
||||||
|
table.insert(list, 1, {0, "-"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local pos = 1
|
local pos = 1
|
||||||
@ -67,54 +78,110 @@ function setupSelector(widget, id, outfit, list)
|
|||||||
if list[pos] then
|
if list[pos] then
|
||||||
widget.outfit = list[pos]
|
widget.outfit = list[pos]
|
||||||
if id == "shader" then
|
if id == "shader" then
|
||||||
widget.creature:setOutfit({
|
widget.creature:setOutfit(
|
||||||
shader = list[pos][2]
|
{
|
||||||
})
|
shader = list[pos][2]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
elseif id == "healthBar" then
|
||||||
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getHealthBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
widget.bar.selected = pos - 1
|
||||||
|
elseif id == "manaBar" then
|
||||||
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getManaBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
widget.bar.selected = pos - 1
|
||||||
else
|
else
|
||||||
widget.creature:setOutfit({
|
widget.creature:setOutfit(
|
||||||
type = list[pos][1]
|
{
|
||||||
})
|
type = list[pos][1]
|
||||||
|
}
|
||||||
|
)
|
||||||
end
|
end
|
||||||
widget.label:setText(list[pos][2])
|
widget.label:setText(list[pos][2])
|
||||||
end
|
end
|
||||||
|
|
||||||
widget.prevButton.onClick = function()
|
widget.prevButton.onClick = function()
|
||||||
if pos == 1 then
|
if pos == 1 then
|
||||||
pos = #list
|
pos = #list
|
||||||
else
|
else
|
||||||
pos = pos - 1
|
pos = pos - 1
|
||||||
end
|
end
|
||||||
local outfit = widget.creature:getOutfit()
|
if id == "healthBar" or id == "manaBar" then
|
||||||
if id == "shader" then
|
if id == "healthBar" then
|
||||||
outfit.shader = list[pos][2]
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getHealthBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
elseif id == "manaBar" then
|
||||||
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getManaBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
widget.bar.selected = pos - 1
|
||||||
|
widget.label:setText(list[pos][2])
|
||||||
else
|
else
|
||||||
outfit.type = list[pos][1]
|
local outfit = widget.creature:getOutfit()
|
||||||
|
if id == "shader" then
|
||||||
|
outfit.shader = list[pos][2]
|
||||||
|
else
|
||||||
|
outfit.type = list[pos][1]
|
||||||
|
end
|
||||||
|
widget.outfit = list[pos]
|
||||||
|
widget.creature:setOutfit(outfit)
|
||||||
|
widget.label:setText(list[pos][2])
|
||||||
|
updateOutfit()
|
||||||
end
|
end
|
||||||
widget.outfit = list[pos]
|
|
||||||
widget.creature:setOutfit(outfit)
|
|
||||||
widget.label:setText(list[pos][2])
|
|
||||||
updateOutfit()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
widget.nextButton.onClick = function()
|
widget.nextButton.onClick = function()
|
||||||
if pos == #list then
|
if pos == #list then
|
||||||
pos = 1
|
pos = 1
|
||||||
else
|
else
|
||||||
pos = pos + 1
|
pos = pos + 1
|
||||||
end
|
end
|
||||||
local outfit = widget.creature:getOutfit()
|
if id == "healthBar" or id == "manaBar" then
|
||||||
if id == "shader" then
|
if id == "healthBar" then
|
||||||
outfit.shader = list[pos][2]
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getHealthBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
elseif id == "manaBar" then
|
||||||
|
if pos ~= 1 then
|
||||||
|
widget.bar:setImageSource(g_healthBars.getManaBarPath(pos - 1))
|
||||||
|
else
|
||||||
|
widget.bar:setImageSource("")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
widget.bar.selected = pos - 1
|
||||||
|
widget.label:setText(list[pos][2])
|
||||||
else
|
else
|
||||||
outfit.type = list[pos][1]
|
local outfit = widget.creature:getOutfit()
|
||||||
|
if id == "shader" then
|
||||||
|
outfit.shader = list[pos][2]
|
||||||
|
else
|
||||||
|
outfit.type = list[pos][1]
|
||||||
|
end
|
||||||
|
widget.outfit = list[pos]
|
||||||
|
widget.creature:setOutfit(outfit)
|
||||||
|
widget.label:setText(list[pos][2])
|
||||||
|
updateOutfit()
|
||||||
end
|
end
|
||||||
widget.outfit = list[pos]
|
|
||||||
widget.creature:setOutfit(outfit)
|
|
||||||
widget.label:setText(list[pos][2])
|
|
||||||
updateOutfit()
|
|
||||||
end
|
end
|
||||||
return widget
|
return widget
|
||||||
end
|
end
|
||||||
|
|
||||||
function create(currentOutfit, outfitList, mountList, wingList, auraList, shaderList)
|
function create(currentOutfit, outfitList, mountList, wingList, auraList, shaderList, hpBarList, manaBarList)
|
||||||
if ignoreNextOutfitWindow and g_clock.millis() < ignoreNextOutfitWindow + 1000 then
|
if ignoreNextOutfitWindow and g_clock.millis() < ignoreNextOutfitWindow + 1000 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -124,7 +191,7 @@ function create(currentOutfit, outfitList, mountList, wingList, auraList, shader
|
|||||||
|
|
||||||
destroy()
|
destroy()
|
||||||
|
|
||||||
outfitWindow = g_ui.displayUI('outfitwindow')
|
outfitWindow = g_ui.displayUI("outfitwindow")
|
||||||
|
|
||||||
setupSelector(outfitWindow.type, "type", currentOutfit, outfitList)
|
setupSelector(outfitWindow.type, "type", currentOutfit, outfitList)
|
||||||
|
|
||||||
@ -136,46 +203,53 @@ function create(currentOutfit, outfitList, mountList, wingList, auraList, shader
|
|||||||
outfitWindow.type.creature:setOutfit(outfit)
|
outfitWindow.type.creature:setOutfit(outfit)
|
||||||
|
|
||||||
if g_game.getFeature(GamePlayerMounts) then
|
if g_game.getFeature(GamePlayerMounts) then
|
||||||
setupSelector(g_ui.createWidget('OutfitSelectorPanel', outfitWindow.extensions), "mount", currentOutfit, mountList)
|
setupSelector(g_ui.createWidget("OutfitSelectorPanel", outfitWindow.extensions), "mount", currentOutfit, mountList)
|
||||||
end
|
end
|
||||||
if g_game.getFeature(GameWingsAndAura) then
|
if g_game.getFeature(GameWingsAndAura) then
|
||||||
setupSelector(g_ui.createWidget('OutfitSelectorPanel', outfitWindow.extensions), "wings", currentOutfit, wingList)
|
setupSelector(g_ui.createWidget("OutfitSelectorPanel", outfitWindow.extensions), "wings", currentOutfit, wingList)
|
||||||
setupSelector(g_ui.createWidget('OutfitSelectorPanel', outfitWindow.extensions), "aura", currentOutfit, auraList)
|
setupSelector(g_ui.createWidget("OutfitSelectorPanel", outfitWindow.extensions), "aura", currentOutfit, auraList)
|
||||||
end
|
end
|
||||||
if g_game.getFeature(GameOutfitShaders) then
|
if g_game.getFeature(GameOutfitShaders) then
|
||||||
setupSelector(g_ui.createWidget('OutfitSelectorPanel', outfitWindow.extensions), "shader", currentOutfit, shaderList)
|
setupSelector(g_ui.createWidget("OutfitSelectorPanel", outfitWindow.extensions), "shader", currentOutfit, shaderList)
|
||||||
|
end
|
||||||
|
|
||||||
|
if g_game.getFeature(GameHealthInfoBackground) then
|
||||||
|
setupSelector(g_ui.createWidget("BarSelectorPanel", outfitWindow.extensions), "healthBar", currentOutfit, hpBarList)
|
||||||
|
setupSelector(g_ui.createWidget("BarSelectorPanel", outfitWindow.extensions), "manaBar", currentOutfit, manaBarList)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not outfitWindow.extensions:getFirstChild() then
|
if not outfitWindow.extensions:getFirstChild() then
|
||||||
outfitWindow:setHeight(outfitWindow:getHeight() - 128)
|
outfitWindow:setHeight(outfitWindow:getHeight() - 128)
|
||||||
end
|
end
|
||||||
|
|
||||||
for j=0,6 do
|
for j = 0, 6 do
|
||||||
for i=0,18 do
|
for i = 0, 18 do
|
||||||
local colorBox = g_ui.createWidget('ColorBox', outfitWindow.colorBoxPanel)
|
local colorBox = g_ui.createWidget("ColorBox", outfitWindow.colorBoxPanel)
|
||||||
local outfitColor = getOutfitColor(j*19 + i)
|
local outfitColor = getOutfitColor(j * 19 + i)
|
||||||
colorBox:setImageColor(outfitColor)
|
colorBox:setImageColor(outfitColor)
|
||||||
colorBox:setId('colorBox' .. j*19+i)
|
colorBox:setId("colorBox" .. j * 19 + i)
|
||||||
colorBox.colorId = j*19 + i
|
colorBox.colorId = j * 19 + i
|
||||||
|
|
||||||
if j*19 + i == currentOutfit.head then
|
if j * 19 + i == currentOutfit.head then
|
||||||
currentColorBox = colorBox
|
currentColorBox = colorBox
|
||||||
colorBox:setChecked(true)
|
colorBox:setChecked(true)
|
||||||
end
|
end
|
||||||
colorBox.onCheckChange = onColorCheckChange
|
colorBox.onCheckChange = onColorCheckChange
|
||||||
colorBoxes[#colorBoxes+1] = colorBox
|
colorBoxes[#colorBoxes + 1] = colorBox
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set addons
|
-- set addons
|
||||||
addons = {
|
addons = {
|
||||||
[1] = {widget = outfitWindow:getChildById('addon1'), value = 1},
|
[1] = {widget = outfitWindow:getChildById("addon1"), value = 1},
|
||||||
[2] = {widget = outfitWindow:getChildById('addon2'), value = 2},
|
[2] = {widget = outfitWindow:getChildById("addon2"), value = 2},
|
||||||
[3] = {widget = outfitWindow:getChildById('addon3'), value = 4}
|
[3] = {widget = outfitWindow:getChildById("addon3"), value = 4}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, addon in pairs(addons) do
|
for _, addon in pairs(addons) do
|
||||||
addon.widget.onCheckChange = function(self) onAddonCheckChange(self, addon.value) end
|
addon.widget.onCheckChange = function(self)
|
||||||
|
onAddonCheckChange(self, addon.value)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if currentOutfit.addons and currentOutfit.addons > 0 then
|
if currentOutfit.addons and currentOutfit.addons > 0 then
|
||||||
@ -224,11 +298,15 @@ end
|
|||||||
function accept()
|
function accept()
|
||||||
local outfit = outfitWindow.type.creature:getOutfit()
|
local outfit = outfitWindow.type.creature:getOutfit()
|
||||||
for i, child in pairs(outfitWindow.extensions:getChildren()) do
|
for i, child in pairs(outfitWindow.extensions:getChildren()) do
|
||||||
if child.creature:getCreature() then
|
if child:getId() == "healthBar" or child:getId() == "manaBar" then
|
||||||
if child:getId() == "shader" then
|
outfit[child:getId()] = child.bar.selected
|
||||||
outfit[child:getId()] = child.creature:getOutfit().shader
|
else
|
||||||
else
|
if child.creature:getCreature() then
|
||||||
outfit[child:getId()] = child.creature:getOutfit().type
|
if child:getId() == "shader" then
|
||||||
|
outfit[child:getId()] = child.creature:getOutfit().shader
|
||||||
|
else
|
||||||
|
outfit[child:getId()] = child.creature:getOutfit().type
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -262,13 +340,13 @@ function onColorCheckChange(colorBox)
|
|||||||
|
|
||||||
currentColorBox = colorBox
|
currentColorBox = colorBox
|
||||||
|
|
||||||
if currentClotheButtonBox:getId() == 'head' then
|
if currentClotheButtonBox:getId() == "head" then
|
||||||
outfit.head = currentColorBox.colorId
|
outfit.head = currentColorBox.colorId
|
||||||
elseif currentClotheButtonBox:getId() == 'primary' then
|
elseif currentClotheButtonBox:getId() == "primary" then
|
||||||
outfit.body = currentColorBox.colorId
|
outfit.body = currentColorBox.colorId
|
||||||
elseif currentClotheButtonBox:getId() == 'secondary' then
|
elseif currentClotheButtonBox:getId() == "secondary" then
|
||||||
outfit.legs = currentColorBox.colorId
|
outfit.legs = currentColorBox.colorId
|
||||||
elseif currentClotheButtonBox:getId() == 'detail' then
|
elseif currentClotheButtonBox:getId() == "detail" then
|
||||||
outfit.feet = currentColorBox.colorId
|
outfit.feet = currentColorBox.colorId
|
||||||
end
|
end
|
||||||
outfitWindow.type.creature:setOutfit(outfit)
|
outfitWindow.type.creature:setOutfit(outfit)
|
||||||
@ -289,22 +367,24 @@ function onClotheCheckChange(clotheButtonBox)
|
|||||||
currentClotheButtonBox = clotheButtonBox
|
currentClotheButtonBox = clotheButtonBox
|
||||||
|
|
||||||
local colorId = 0
|
local colorId = 0
|
||||||
if currentClotheButtonBox:getId() == 'head' then
|
if currentClotheButtonBox:getId() == "head" then
|
||||||
colorId = outfit.head
|
colorId = outfit.head
|
||||||
elseif currentClotheButtonBox:getId() == 'primary' then
|
elseif currentClotheButtonBox:getId() == "primary" then
|
||||||
colorId = outfit.body
|
colorId = outfit.body
|
||||||
elseif currentClotheButtonBox:getId() == 'secondary' then
|
elseif currentClotheButtonBox:getId() == "secondary" then
|
||||||
colorId = outfit.legs
|
colorId = outfit.legs
|
||||||
elseif currentClotheButtonBox:getId() == 'detail' then
|
elseif currentClotheButtonBox:getId() == "detail" then
|
||||||
colorId = outfit.feet
|
colorId = outfit.feet
|
||||||
end
|
end
|
||||||
outfitWindow:recursiveGetChildById('colorBox' .. colorId):setChecked(true)
|
outfitWindow:recursiveGetChildById("colorBox" .. colorId):setChecked(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function updateOutfit()
|
function updateOutfit()
|
||||||
local currentSelection = outfitWindow.type.outfit
|
local currentSelection = outfitWindow.type.outfit
|
||||||
if not currentSelection then return end
|
if not currentSelection then
|
||||||
|
return
|
||||||
|
end
|
||||||
local outfit = outfitWindow.type.creature:getOutfit()
|
local outfit = outfitWindow.type.creature:getOutfit()
|
||||||
|
|
||||||
local availableAddons = currentSelection[3]
|
local availableAddons = currentSelection[3]
|
||||||
@ -333,4 +413,3 @@ function updateOutfit()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,6 +44,43 @@ OutfitSelectorPanel < Panel
|
|||||||
image-border: 2
|
image-border: 2
|
||||||
text: -
|
text: -
|
||||||
|
|
||||||
|
BarSelectorPanel < Panel
|
||||||
|
size: 125 120
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: title
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
text-align: center
|
||||||
|
|
||||||
|
UIWidget
|
||||||
|
id: bar
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
PreviousButton
|
||||||
|
id: prevButton
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
NextButton
|
||||||
|
id: nextButton
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
|
||||||
|
Label
|
||||||
|
id: label
|
||||||
|
text: -
|
||||||
|
text-align: center
|
||||||
|
anchors.left: prevButton.right
|
||||||
|
anchors.right: nextButton.left
|
||||||
|
anchors.top: prevButton.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
margin-left: 2
|
||||||
|
margin-right: 2
|
||||||
|
image-source: /images/ui/panel_flat
|
||||||
|
image-border: 2
|
||||||
|
|
||||||
MainWindow
|
MainWindow
|
||||||
!text: tr('Select Outfit')
|
!text: tr('Select Outfit')
|
||||||
size: 560 330
|
size: 560 330
|
||||||
|
@ -197,6 +197,7 @@ GamePacketSizeU32 = 110
|
|||||||
GamePacketCompression = 111
|
GamePacketCompression = 111
|
||||||
|
|
||||||
GameOldInformationBar = 112
|
GameOldInformationBar = 112
|
||||||
|
GameHealthInfoBackground = 113
|
||||||
|
|
||||||
LastGameFeature = 130
|
LastGameFeature = 130
|
||||||
|
|
||||||
|
BIN
otclient_dx.exe
BIN
otclient_dx.exe
Binary file not shown.
BIN
otclient_gl.exe
BIN
otclient_gl.exe
Binary file not shown.
BIN
otclientv8.apk
BIN
otclientv8.apk
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user