From 20e32ad2a00c4842d825f49a57983fc51bb0cf98 Mon Sep 17 00:00:00 2001 From: AndreFaramir Date: Fri, 30 Mar 2012 01:10:55 -0300 Subject: [PATCH] fixes on battle and buff condition tooltip --- modules/game_battle/battle.lua | 17 ++++++++++++++--- modules/game_healthbar/healthbar.lua | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index a730e825..5c25bdc7 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -57,7 +57,8 @@ function Battle.init() onEmblemChange = Battle.checkCreatureEmblem } ) connect(g_game, { onAttackingCreatureChange = Battle.onAttack, - onFollowingCreatureChange = Battle.onFollow } ) + onFollowingCreatureChange = Battle.onFollow, + onGameEnd = Battle.removeAllCreatures } ) addEvent(Battle.addAllCreatures) checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 200) @@ -132,7 +133,7 @@ function Battle.doCreatureFitFilters(creature) return true end -function Battle.checkCreatures() +function Battle.checkCreatures(forceRecheck) local player = g_game.getLocalPlayer() if player then local spectators = {} @@ -169,7 +170,9 @@ function Battle.checkCreatures() Battle.removeCreature(v) end end - checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 500) + if not forceRecheck then + checkCreaturesEvent = scheduleEvent(Battle.checkCreatures, 500) + end end function Battle.addCreature(creature) @@ -263,6 +266,12 @@ function Battle.onMouseRelease(self, mousePosition, mouseButton) end end +function Battle.removeAllCreatures() + for i, v in pairs(battleButtonsByCreaturesList) do + Battle.removeCreature(v.creature) + end +end + function Battle.removeCreature(creature) local creatureId = creature:getId() @@ -303,6 +312,7 @@ function Battle.onbattleButtonHoverChange(widget, hovered) end function Battle.onAttack(creature) + Battle.checkCreatures(true) --Force recheck local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched if battleButton then battleButton.isTarget = creature and true or false @@ -311,6 +321,7 @@ function Battle.onAttack(creature) end function Battle.onFollow(creature) + Battle.checkCreatures(true) --Force recheck local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched if battleButton then battleButton.isFollowed = creature and true or false diff --git a/modules/game_healthbar/healthbar.lua b/modules/game_healthbar/healthbar.lua index 2e32ed0c..7a0ce495 100644 --- a/modules/game_healthbar/healthbar.lua +++ b/modules/game_healthbar/healthbar.lua @@ -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[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[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[16384] = { tooltip = 'You are within a protection zone', path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' }