bind lua functions for questlog/npc trade/trade/channels/text edit/list edit/containers

This commit is contained in:
Eduardo Bart
2012-02-09 01:45:19 -02:00
parent 55fbb5f1a6
commit a8c9980a5c
16 changed files with 679 additions and 365 deletions

View File

@@ -54,7 +54,7 @@ function Containers.onOpenContainer(containerId, itemId, name, capacity, hasPare
m_containers[containerId] = container
end
function Containers.onContainerClose(containerId)
function Containers.onCloseContainer(containerId)
local container = m_containers[containerId]
if container then
g_game.gameRightPanel:removeChild(container)
@@ -131,7 +131,7 @@ end
connect(g_game, { onGameStart = Containers.clean,
onGameEnd = Containers.clean,
onOpenContainer = Containers.onOpenContainer,
onContainerClose = Containers.onContainerClose,
onCloseContainer = Containers.onCloseContainer,
onContainerAddItem = Containers.onContainerAddItem,
onContainerUpdateItem = Containers.onContainerUpdateItem,
onContainerRemoveItem = Containers.onContainerRemoveItem })

View File

@@ -36,12 +36,12 @@ function HealthBar.toggle()
end
-- hooked events
function HealthBar.onHealthChange(health, maxHealth)
function HealthBar.onHealthChange(localPlayer, health, maxHealth)
healthLabel:setText(health .. ' / ' .. maxHealth)
healthBar:setPercent(health / maxHealth * 100)
end
function HealthBar.onManaChange(mana, maxMana)
function HealthBar.onManaChange(localPlayer, mana, maxMana)
manaLabel:setText(mana .. ' / ' .. maxMana)
local percent
@@ -54,6 +54,6 @@ function HealthBar.onManaChange(mana, maxMana)
end
connect(g_game, { onGameStart = HealthBar.create,
onGameEnd = HealthBar.destroy,
onHealthChange = HealthBar.onHealthChange,
onManaChange = HealthBar.onManaChange })
onGameEnd = HealthBar.destroy })
connect(LocalPlayer, { onHealthChange = HealthBar.onHealthChange,
onManaChange = HealthBar.onManaChange })

View File

@@ -75,32 +75,32 @@ function Skills.onSkillButtonClick(button)
end
-- hooked events
function Skills.onExperienceChange(value)
function Skills.onExperienceChange(localPlayer, value)
setSkillValue('experience', getNumberString(value))
end
function Skills.onLevelChange(value, percent)
function Skills.onLevelChange(localPlayer, value, percent)
setSkillValue('level', getNumberString(value))
setSkillPercent('level', percent, 'You have ' .. (100 - percent) .. ' percent to go')
end
function Skills.onHealthChange(health, maxHealth)
function Skills.onHealthChange(localPlayer, health, maxHealth)
setSkillValue('health', getNumberString(health))
end
function Skills.onManaChange(mana, maxMana)
function Skills.onManaChange(localPlayer, mana, maxMana)
setSkillValue('mana', getNumberString(mana))
end
function Skills.onSoulChange(soul)
function Skills.onSoulChange(localPlayer, soul)
setSkillValue('soul', soul)
end
function Skills.onFreeCapacityChange(freeCapacity)
function Skills.onFreeCapacityChange(localPlayer, freeCapacity)
setSkillValue('capacity', freeCapacity)
end
function Skills.onStaminaChange(stamina)
function Skills.onStaminaChange(localPlayer, stamina)
local hours = math.floor(stamina / 60)
local minutes = stamina % 60
if minutes < 10 then
@@ -112,18 +112,20 @@ function Skills.onStaminaChange(stamina)
setSkillPercent('stamina', percent, 'You have ' .. percent .. ' percent')
end
function Skills.onMagicLevelChange(value, percent)
function Skills.onMagicLevelChange(localPlayer, value, percent)
setSkillValue('magiclevel', value)
setSkillPercent('magiclevel', percent, 'You have ' .. (100 - percent) .. ' percent to go')
end
function Skills.onSkillChange(id, level, percent)
function Skills.onSkillChange(localPlayer, id, level, percent)
setSkillValue('skillId' .. id, level)
setSkillPercent('skillId' .. id, percent, 'You have ' .. (100 - percent) .. ' percent to go')
end
connect(g_game, { onGameStart = Skills.create,
onGameEnd = Skills.destroy,
onGameEnd = Skills.destroy })
connect(LocalPlayer, {
onExperienceChange = Skills.onExperienceChange,
onLevelChange = Skills.onLevelChange,
onHealthChange = Skills.onHealthChange,