- 0
8.5 Module OTClient [Help]
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 41 respostas
- 11956 visualizações
-
- 51 respostas
- 16137 visualizações
-
- 79 respostas
- 29625 visualizações
-
- 83 respostas
- 26926 visualizações
-
- 2 respostas
- 914 visualizações
-
Pergunta
Nibelins 132
Boa novas a todos
Estou precisando muito de uma mãozinha como Remover a imagem de fundo de um modulo que estou editando já fiz de tudo mais não consegui fazer isso
então vim aqui tenta acha alguma ajuda entre os menbros mais experiencte pois ainda sou novato em OTClient faz poucos dias que comecei a mexe tentei
todo fórum mais não encontrei nada parecido vamos la:
Imagem da Module a ser removida, module padrão que vem em todo os module usando MiniWindow
Module que estou criando, não consegui remover a imagem do module do fundo
usei como base da edição o Module game_skills, codigo do module:
Skills.lua
skillsWindow = nil
skillsButton = nil
local healthBar = nil
local pbs = {}
function init()
connect(LocalPlayer, {
onExperienceChange = onExperienceChange,
onLevelChange = onLevelChange,
onHealthChange = onHealthChange,
})
connect(g_game, {
onGameStart = refresh,
onGameEnd = offline
})
connect(g_game, 'onTextMessage', getSex)
skillsButton = modules.client_topmenu.addRightGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', '/images/topbuttons/skills', toggle)
skillsButton:setOn(true)
skillsWindow = g_ui.loadUI('skills', modules.game_interface.getRightPanel())
skillsWindow:disableResize()
healthBar = skillsWindow:recursiveGetChildById("healthBar")
g_keyboard.bindKeyDown('Ctrl+S', toggle)
refresh()
skillsWindow:setup()
end
function terminate()
disconnect(LocalPlayer, {
onExperienceChange = onExperienceChange,
onLevelChange = onLevelChange,
onHealthChange = onHealthChange,
})
disconnect(g_game, {
onGameStart = refresh,
onGameEnd = offline
})
disconnect(g_game, 'onTextMessage', getSex)
g_keyboard.unbindKeyDown('Ctrl+S')
skillsWindow:destroy()
skillsButton:destroy()
end
function expForLevel(level)
return math.floor((50*level*level*level)/3 - 100*level*level + (850*level)/3 - 200)
end
function expToAdvance(currentLevel, currentExp)
return expForLevel(currentLevel+1) - currentExp
end
function resetSkillColor(id)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('value')
widget:setColor('#bbbbbb')
end
function setSkillBase(id, value, baseValue)
if baseValue <= 0 or value < 0 then
return
end
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('value')
if value > baseValue then
widget:setColor('#008b00') -- green
skill:setTooltip(baseValue .. ' +' .. (value - baseValue))
elseif value < baseValue then
widget:setColor('#b22222') -- red
skill:setTooltip(baseValue .. ' ' .. (value - baseValue))
else
widget:setColor('#bbbbbb') -- default
skill:removeTooltip()
end
end
function setSkillValue(id, value)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('value')
widget:setText(value)
end
function setSkillColor(id, value)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('value')
widget:setColor(value)
end
function setSkillTooltip(id, value)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('value')
widget:setTooltip(value)
end
function setSkillPercent(id, percent, tooltip)
local skill = skillsWindow:recursiveGetChildById(id)
local widget = skill:getChildById('percent')
widget:setPercent(math.floor(percent))
if tooltip then
widget:setTooltip(tooltip)
end
end
function checkAlert(id, value, maxValue, threshold, greaterThan)
if greaterThan == nil then greaterThan = false end
local alert = false
-- maxValue can be set to false to check value and threshold
-- used for regeneration checking
if type(maxValue) == 'boolean' then
if maxValue then
return
end
if greaterThan then
if value > threshold then
alert = true
end
else
if value < threshold then
alert = true
end
end
elseif type(maxValue) == 'number' then
if maxValue < 0 then
return
end
local percent = math.floor((value / maxValue) * 100)
if greaterThan then
if percent > threshold then
alert = true
end
else
if percent < threshold then
alert = true
end
end
end
if alert then
setSkillColor(id, '#b22222') -- red
else
resetSkillColor(id)
end
end
function update()
end
function refresh()
local player = g_game.getLocalPlayer()
if not player then return end
if expSpeedEvent then expSpeedEvent:cancel() end
expSpeedEvent = cycleEvent(checkExpSpeed, 30*1000)
onExperienceChange(player, player:getExperience())
onLevelChange(player, player:getLevel(), player:getLevelPercent())
onHealthChange(player, player:getHealth(), player:getMaxHealth())
update()
local contentsPanel = skillsWindow:getChildById('contentsPanel')
skillsWindow:setContentMinimumHeight(44)
skillsWindow:setContentMaximumHeight(390)
end
function offline()
if expSpeedEvent then expSpeedEvent:cancel() expSpeedEvent = nil end
end
function toggle()
if skillsButton:isOn() then
skillsWindow:close()
skillsButton:setOn(false)
else
skillsWindow:open()
skillsButton:setOn(true)
end
end
function checkExpSpeed()
local player = g_game.getLocalPlayer()
if not player then return end
local currentExp = player:getExperience()
local currentTime = g_clock.seconds()
if player.lastExps ~= nil then
player.expSpeed = (currentExp - player.lastExps[1][1])/(currentTime - player.lastExps[1][2])
onLevelChange(player, player:getLevel(), player:getLevelPercent())
else
player.lastExps = {}
end
table.insert(player.lastExps, {currentExp, currentTime})
if #player.lastExps > 30 then
table.remove(player.lastExps, 1)
end
end
function onMiniWindowClose()
skillsButton:setOn(false)
end
function onSkillButtonClick(button)
local percentBar = button:getChildById('percent')
if percentBar then
percentBar:setVisible(not percentBar:isVisible())
if percentBar:isVisible() then
button:setHeight(21)
else
button:setHeight(21 - 6)
end
end
end
function onExperienceChange(localPlayer, value)
setSkillValue('experience', localPlayer:getName())
setSkillValue('level', value)
end
function onLevelChange(localPlayer, value, percent)
setSkillValue('level', value)
local text = tr('You have %s percent to go', 100 - percent) .. '\n' ..
tr('%s of experience left', expToAdvance(localPlayer:getLevel(), localPlayer:getExperience()))
if localPlayer.expSpeed ~= nil then
local expPerHour = math.floor(localPlayer.expSpeed * 3600)
if expPerHour > 0 then
local nextLevelExp = expForLevel(localPlayer:getLevel()+1)
local hoursLeft = (nextLevelExp - localPlayer:getExperience()) / expPerHour
local minutesLeft = math.floor((hoursLeft - math.floor(hoursLeft))*60)
hoursLeft = math.floor(hoursLeft)
text = text .. '\n' .. tr('%d of experience per hour', expPerHour)
text = text .. '\n' .. tr('Next level in %d hours and %d minutes', hoursLeft, minutesLeft)
end
end
local ExpTo = skillsWindow:recursiveGetChildById("playericon")
ExpTo:setTooltip(text)
-- setSkillPercent('level', percent, text)
end
function onHealthChange(localPlayer, health, maxHealth)
setSkillValue('health', health)
checkAlert('health', health, maxHealth, 30)
healthBar:setText(health .. ' / ' .. maxHealth)
skillsWindow:recursiveGetChildById("healthIcon"):setTooltip(healthTooltip, health, maxHealth)
healthBar:setValue(health, 0, maxHealth)
end
function getSex(mode, text)
if not g_game.isOnline() then return end
if mode == MessageModes.Failure then
if text:find("#sex#") then
local t = string.explode(text, ",")
local ftplayer = t[2]
playerft = skillsWindow:recursiveGetChildById('playericon')
playerft:setImageSource('img/'..ftplayer..'.png')
end
end
end
skills.otui
SkillFirstWidget < UIWidget
SkillButton < UIButton
height: 21
margin-bottom: 9
&onClick: onSkillButtonClick
SkillNameLabel < GameLabel
font: verdana-11px-monochrome
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
SkillValueLabel < GameLabel
id: value
font: verdana-11px-monochrome
text-align: topright
color: #00FF00
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: prev.left
SkillPercentPanel < ProgressBar
id: percent
background-color: green
height: 16
margin-top: 15
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
phantom: false
HealthBar < ProgressBar
id: healthBar
width: 218
height: 15
!text: '0 / 0'
font: verdana-11px-rounded
color: #FFFFFF
background-color: #00FF00
anchors.top: parent.top
anchors.right: parent.right
margin-top: 135
margin-right: 30
opacity: 0.9
HealthIcon < UIButton
id: healthIcon
width: 322
height: 97
image-source: img/barra2.png
image-color: white
focusable: false
anchors.top: parent.top
anchors.right: parent.right
margin-top: 84
margin-right: 10
PlayerIcon < UIButton
id: playericon
image-source: img/barra3.png
size: 300 190
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
margin-top: 50
margin-left: -20
pbButtonIni < UIButton
id: playericon
image-source: img/pb_apagada
size: 10 9
anchors.top: parent.top
anchors.left: parent.left
margin-top: 53
margin-left: 15
pbButton < pbButtonIni
anchors.left: prev.right
margin-left: 2
MiniWindow
id: skillWindow
!text: tr('')
width: 350
@onClose: modules.game_skills.onMiniWindowClose()
&save: true
HealthBar
HealthIcon
PlayerIcon
MiniWindowContents
padding-left: 240
padding-right: 30
layout: verticalBox
SkillButton
margin-top: 140
id: level
height: 15
SkillNameLabel
!text: tr('Level')
color: #00FF00
SkillValueLabel
SkillButton
margin-top: -67
id: experience
margin-left: 60
!text: tr('')
color: #00BFFF
SkillValueLabel
SkillPercentPanel
visible: false
SkillButton
id: health
height: 15
SkillNameLabel
!text: tr('Vida')
color: #00FF00
SkillValueLabel
color: #00FF00
SkillPercentPanel
visible: false
skills.otmod
Module
name: game_skills
description: Manage skills window
author: baxnie, edubart
website: www.otclient.info
sandboxed: true
scripts: [ skills ]
@onLoad: init()
@onUnload: terminate()
dependencies:
- game_interface
Ta ai desde ja gostaria de agradecer a atenção de todos
Estou ancioso pra aprende muito sobre OTClient
Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados