fixes on battle and buff condition tooltip

This commit is contained in:
AndreFaramir 2012-03-30 01:10:55 -03:00
parent 959d9a87b0
commit 20e32ad2a0
2 changed files with 15 additions and 4 deletions

View File

@ -57,7 +57,8 @@ function Battle.init()
onEmblemChange = Battle.checkCreatureEmblem } ) onEmblemChange = Battle.checkCreatureEmblem } )
connect(g_game, { onAttackingCreatureChange = Battle.onAttack, connect(g_game, { onAttackingCreatureChange = Battle.onAttack,
onFollowingCreatureChange = Battle.onFollow } ) onFollowingCreatureChange = Battle.onFollow,
onGameEnd = Battle.removeAllCreatures } )
addEvent(Battle.addAllCreatures) addEvent(Battle.addAllCreatures)
checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 200) checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 200)
@ -132,7 +133,7 @@ function Battle.doCreatureFitFilters(creature)
return true return true
end end
function Battle.checkCreatures() function Battle.checkCreatures(forceRecheck)
local player = g_game.getLocalPlayer() local player = g_game.getLocalPlayer()
if player then if player then
local spectators = {} local spectators = {}
@ -169,8 +170,10 @@ function Battle.checkCreatures()
Battle.removeCreature(v) Battle.removeCreature(v)
end end
end end
if not forceRecheck then
checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 500) checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 500)
end end
end
function Battle.addCreature(creature) function Battle.addCreature(creature)
local creatureId = creature:getId() local creatureId = creature:getId()
@ -263,6 +266,12 @@ function Battle.onMouseRelease(self, mousePosition, mouseButton)
end end
end end
function Battle.removeAllCreatures()
for i, v in pairs(battleButtonsByCreaturesList) do
Battle.removeCreature(v.creature)
end
end
function Battle.removeCreature(creature) function Battle.removeCreature(creature)
local creatureId = creature:getId() local creatureId = creature:getId()
@ -303,6 +312,7 @@ function Battle.onbattleButtonHoverChange(widget, hovered)
end end
function Battle.onAttack(creature) function Battle.onAttack(creature)
Battle.checkCreatures(true) --Force recheck
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
if battleButton then if battleButton then
battleButton.isTarget = creature and true or false battleButton.isTarget = creature and true or false
@ -311,6 +321,7 @@ function Battle.onAttack(creature)
end end
function Battle.onFollow(creature) function Battle.onFollow(creature)
Battle.checkCreatures(true) --Force recheck
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
if battleButton then if battleButton then
battleButton.isFollowed = creature and true or false battleButton.isFollowed = creature and true or false

View File

@ -14,7 +14,7 @@ Icons[256] = { tooltip = 'You are drowing', path = '/game_healthbar/icons/drowni
Icons[512] = { tooltip = 'You are freezing', path = '/game_healthbar/icons/freezing.png', id = 'condition_freezing' } Icons[512] = { tooltip = 'You are freezing', path = '/game_healthbar/icons/freezing.png', id = 'condition_freezing' }
Icons[1024] = { tooltip = 'You are dazzled', path = '/game_healthbar/icons/dazzled.png', id = 'condition_dazzled' } Icons[1024] = { tooltip = 'You are dazzled', path = '/game_healthbar/icons/dazzled.png', id = 'condition_dazzled' }
Icons[2048] = { tooltip = 'You are cursed', path = '/game_healthbar/icons/cursed.png', id = 'condition_cursed' } Icons[2048] = { tooltip = 'You are cursed', path = '/game_healthbar/icons/cursed.png', id = 'condition_cursed' }
Icons[4096] = { tooltip = 'You are strenghtened', path = '/game_healthbar/icons/strengthened.png', id = 'condition_strengthened' } Icons[4096] = { tooltip = 'You are strengthened', path = '/game_healthbar/icons/strengthened.png', id = 'condition_strengthened' }
Icons[8192] = { tooltip = 'You may not logout or enter a protection zone', path = '/game_healthbar/icons/protection_zone_block.png', id = 'condition_protection_zone_block' } Icons[8192] = { tooltip = 'You may not logout or enter a protection zone', path = '/game_healthbar/icons/protection_zone_block.png', id = 'condition_protection_zone_block' }
Icons[16384] = { tooltip = 'You are within a protection zone', path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' } Icons[16384] = { tooltip = 'You are within a protection zone', path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' }