2012-02-09 06:27:29 +01:00
|
|
|
--TODO
|
|
|
|
--onCreatureAppears onCreatureHealthChange onCreatureDisappears
|
|
|
|
--reloadable/disconnects
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
battleWindow = nil
|
|
|
|
battleButton = nil
|
|
|
|
battlePanel = nil
|
|
|
|
lastBattleButtonSwitched = nil
|
|
|
|
checkCreaturesEvent = nil
|
|
|
|
battleButtonsByCreaturesList = {}
|
2012-02-09 06:27:29 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
mouseWidget = nil
|
2012-02-09 06:27:29 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
hidePlayersButton = nil
|
|
|
|
hideNPCsButton = nil
|
|
|
|
hideMonstersButton = nil
|
|
|
|
hideSkullsButton = nil
|
|
|
|
hidePartyButton = nil
|
2012-02-09 06:27:29 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
BattleButtonColors = {
|
2012-02-09 06:27:29 +01:00
|
|
|
onIdle = {notHovered = '#888888', hovered = '#FFFFFF' },
|
|
|
|
onTargeted = {notHovered = '#FF0000', hovered = '#FF8888' },
|
|
|
|
onFollowed = {notHovered = '#00FF00', hovered = '#88FF88' }
|
|
|
|
}
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
LifeBarColors = {} --Must be sorted by percentAbose
|
|
|
|
table.insert(LifeBarColors, {percentAbove = 92, color = '#00BC00' } )
|
|
|
|
table.insert(LifeBarColors, {percentAbove = 60, color = '#50A150' } )
|
|
|
|
table.insert(LifeBarColors, {percentAbove = 30, color = '#A1A100' } )
|
|
|
|
table.insert(LifeBarColors, {percentAbove = 8, color = '#3C2727' } )
|
|
|
|
table.insert(LifeBarColors, {percentAbove = 3, color = '#3C0000' } )
|
|
|
|
table.insert(LifeBarColors, {percentAbove = -1, color = '#4F0000' } )
|
|
|
|
|
|
|
|
function init()
|
|
|
|
battleWindow = g_ui.loadUI('battle.otui', modules.game_interface.getRightPanel())
|
|
|
|
battleButton = TopMenu.addRightGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', 'battle.png', toggle)
|
2012-03-28 16:10:21 +02:00
|
|
|
battleButton:setOn(true)
|
2012-07-24 07:30:08 +02:00
|
|
|
g_keyboard.bindKeyDown('Ctrl+B', toggle)
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-03-28 16:10:21 +02:00
|
|
|
battlePanel = battleWindow:recursiveGetChildById('battlePanel')
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-03-28 16:10:21 +02:00
|
|
|
hidePlayersButton = battleWindow:recursiveGetChildById('hidePlayers')
|
|
|
|
hideNPCsButton = battleWindow:recursiveGetChildById('hideNPCs')
|
|
|
|
hideMonstersButton = battleWindow:recursiveGetChildById('hideMonsters')
|
|
|
|
hideSkullsButton = battleWindow:recursiveGetChildById('hideSkulls')
|
|
|
|
hidePartyButton = battleWindow:recursiveGetChildById('hideParty')
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-06-26 00:13:30 +02:00
|
|
|
mouseWidget = g_ui.createWidget('UIButton')
|
2012-02-09 06:27:29 +01:00
|
|
|
mouseWidget:setVisible(false)
|
2012-02-20 03:27:08 +01:00
|
|
|
mouseWidget:setFocusable(false)
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
connect(Creature, { onSkullChange = checkCreatureSkull,
|
|
|
|
onEmblemChange = checkCreatureEmblem } )
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
connect(g_game, { onAttackingCreatureChange = onAttack,
|
|
|
|
onFollowingCreatureChange = onFollow,
|
|
|
|
onGameEnd = removeAllCreatures } )
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
addEvent(addAllCreatures)
|
|
|
|
checkCreaturesEvent = scheduleEvent(checkCreatures, 200)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function terminate()
|
2012-06-26 00:13:30 +02:00
|
|
|
g_keyboard.unbindKeyDown('Ctrl+B')
|
2012-02-09 06:27:29 +01:00
|
|
|
battleButtonsByCreaturesList = {}
|
|
|
|
removeEvent(checkCreaturesEvent)
|
|
|
|
battleButton:destroy()
|
|
|
|
battleWindow:destroy()
|
2012-04-27 06:54:14 +02:00
|
|
|
mouseWidget:destroy()
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
disconnect(Creature, { onSkullChange = checkCreatureSkull,
|
|
|
|
onEmblemChange = checkCreatureEmblem } )
|
2012-04-27 06:54:14 +02:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
disconnect(g_game, { onAttackingCreatureChange = onAttack } )
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function toggle()
|
2012-06-21 21:31:22 +02:00
|
|
|
if battleButton:isOn() then
|
|
|
|
battleWindow:close()
|
|
|
|
battleButton:setOn(false)
|
|
|
|
else
|
|
|
|
battleWindow:open()
|
|
|
|
battleButton:setOn(true)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function onMiniWindowClose()
|
2012-06-21 21:31:22 +02:00
|
|
|
battleButton:setOn(false)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function addAllCreatures()
|
2012-02-20 03:27:08 +01:00
|
|
|
local spectators = {}
|
2012-03-28 16:10:21 +02:00
|
|
|
local player = g_game.getLocalPlayer()
|
2012-07-26 08:10:28 +02:00
|
|
|
if g_game.isOnline() then
|
2012-03-28 16:10:21 +02:00
|
|
|
creatures = g_map.getSpectators(player:getPosition(), false)
|
|
|
|
for i, creature in ipairs(creatures) do
|
2012-07-24 07:30:08 +02:00
|
|
|
if creature ~= player and doCreatureFitFilters(creature) then
|
2012-03-28 16:10:21 +02:00
|
|
|
table.insert(spectators, creature)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
for i, v in pairs(spectators) do
|
2012-07-24 07:30:08 +02:00
|
|
|
addCreature(v)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function doCreatureFitFilters(creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
local hidePlayers = hidePlayersButton:isChecked()
|
|
|
|
local hideNPCs = hideNPCsButton:isChecked()
|
|
|
|
local hideMonsters = hideMonstersButton:isChecked()
|
|
|
|
local hideSkulls = hideSkullsButton:isChecked()
|
|
|
|
local hideParty = hidePartyButton:isChecked()
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-07-09 13:37:47 +02:00
|
|
|
if hidePlayers and creature:asPlayer() then
|
2012-02-09 06:27:29 +01:00
|
|
|
return false
|
|
|
|
elseif hideNPCs and creature:asNpc() then
|
|
|
|
return false
|
|
|
|
elseif hideMonsters and creature:asMonster() then
|
|
|
|
return false
|
2012-07-09 13:37:47 +02:00
|
|
|
elseif hideSkulls and creature:asPlayer() and creature:getSkull() == SkullNone then
|
2012-02-09 06:27:29 +01:00
|
|
|
return false
|
|
|
|
elseif hideParty and creature:getShield() > ShieldWhiteBlue then
|
|
|
|
return false
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function checkCreatures(forceRecheck)
|
2012-02-09 06:27:29 +01:00
|
|
|
local player = g_game.getLocalPlayer()
|
2012-07-26 08:10:28 +02:00
|
|
|
if g_game.isOnline() then
|
2012-02-09 06:27:29 +01:00
|
|
|
local spectators = {}
|
|
|
|
|
|
|
|
-- reloading list of spectators
|
2012-02-20 03:27:08 +01:00
|
|
|
local creaturesAppeared = {}
|
2012-02-09 06:27:29 +01:00
|
|
|
creatures = g_map.getSpectators(player:getPosition(), false)
|
|
|
|
for i, creature in ipairs(creatures) do
|
2012-07-24 07:30:08 +02:00
|
|
|
if creature ~= player and doCreatureFitFilters(creature) then
|
2012-02-09 06:27:29 +01:00
|
|
|
-- searching for creatures that appeared on battle list
|
|
|
|
local battleButton = battleButtonsByCreaturesList[creature:getId()]
|
|
|
|
if battleButton == nil then
|
2012-02-20 03:27:08 +01:00
|
|
|
table.insert(creaturesAppeared, creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
else
|
2012-07-24 07:30:08 +02:00
|
|
|
setLifeBarPercent(battleButton, creature:getHealthPercent())
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
spectators[creature:getId()] = creature
|
|
|
|
end
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
for i, v in pairs(creaturesAppeared) do
|
2012-07-24 07:30:08 +02:00
|
|
|
addCreature(v)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
-- searching for creatures that disappeared from battle list
|
|
|
|
local creaturesDisappeared = {}
|
|
|
|
for i, creature in pairs(battleButtonsByCreaturesList) do
|
|
|
|
if spectators[creature.creatureId] == nil then
|
|
|
|
table.insert(creaturesDisappeared, creature.creature)
|
|
|
|
end
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
for i, v in pairs(creaturesDisappeared) do
|
2012-07-24 07:30:08 +02:00
|
|
|
removeCreature(v)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
2012-03-30 06:10:55 +02:00
|
|
|
if not forceRecheck then
|
2012-07-24 07:30:08 +02:00
|
|
|
checkCreaturesEvent = scheduleEvent(checkCreatures, 500)
|
2012-03-30 06:10:55 +02:00
|
|
|
end
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function addCreature(creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
local creatureId = creature:getId()
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButtonsByCreaturesList[creatureId] == nil then
|
2012-07-15 13:49:28 +02:00
|
|
|
local battleButton = g_ui.loadUI('battlebutton.otui', battlePanel)
|
2012-02-09 06:27:29 +01:00
|
|
|
local creatureWidget = battleButton:getChildById('creature')
|
|
|
|
local labelWidget = battleButton:getChildById('label')
|
|
|
|
local lifeBarWidget = battleButton:getChildById('lifeBar')
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
battleButton:setId('BattleButton_' .. creature:getName():gsub('%s','_'))
|
|
|
|
battleButton.creatureId = creatureId
|
|
|
|
battleButton.creature = creature
|
|
|
|
battleButton.isHovered = false
|
|
|
|
battleButton.isTarget = false
|
|
|
|
battleButton.isFollowed = false
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
labelWidget:setText(creature:getName())
|
2012-02-20 03:27:08 +01:00
|
|
|
creatureWidget:setCreature(creature)
|
2012-07-24 07:30:08 +02:00
|
|
|
setLifeBarPercent(battleButton, creature:getHealthPercent())
|
2012-02-09 06:27:29 +01:00
|
|
|
|
|
|
|
battleButtonsByCreaturesList[creatureId] = battleButton
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
checkCreatureSkull(battleButton.creature)
|
|
|
|
checkCreatureEmblem(battleButton.creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function checkCreatureSkull(creature, skullId)
|
2012-02-09 06:27:29 +01:00
|
|
|
local battleButton = battleButtonsByCreaturesList[creature:getId()]
|
|
|
|
if battleButton then
|
|
|
|
local skullWidget = battleButton:getChildById('skull')
|
|
|
|
local labelWidget = battleButton:getChildById('label')
|
|
|
|
local creature = battleButton.creature
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
if creature:getSkull() ~= SkullNone then
|
|
|
|
skullWidget:setWidth(skullWidget:getHeight())
|
|
|
|
local imagePath = getSkullImagePath(creature:getSkull())
|
2012-07-18 01:49:21 +02:00
|
|
|
skullWidget:setImageSource(imagePath)
|
2012-02-09 06:27:29 +01:00
|
|
|
labelWidget:setMarginLeft(5)
|
|
|
|
else
|
|
|
|
skullWidget:setWidth(0)
|
|
|
|
if creature:getEmblem() == EmblemNone then
|
|
|
|
labelWidget:setMarginLeft(2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function checkCreatureEmblem(creature, emblemId)
|
2012-02-09 06:27:29 +01:00
|
|
|
local battleButton = battleButtonsByCreaturesList[creature:getId()]
|
|
|
|
if battleButton then
|
|
|
|
local emblemId = emblemId or creature:getEmblem()
|
|
|
|
local emblemWidget = battleButton:getChildById('emblem')
|
|
|
|
local labelWidget = battleButton:getChildById('label')
|
|
|
|
local creature = battleButton.creature
|
|
|
|
|
|
|
|
if emblemId ~= EmblemNone then
|
|
|
|
emblemWidget:setWidth(emblemWidget:getHeight())
|
|
|
|
local imagePath = getEmblemImagePath(emblemId)
|
2012-07-18 01:49:21 +02:00
|
|
|
emblemWidget:setImageSource(imagePath)
|
2012-02-09 06:27:29 +01:00
|
|
|
emblemWidget:setMarginLeft(5)
|
|
|
|
labelWidget:setMarginLeft(5)
|
|
|
|
else
|
|
|
|
emblemWidget:setWidth(0)
|
|
|
|
emblemWidget:setMarginLeft(0)
|
|
|
|
if creature:getSkull() == SkullNone then
|
|
|
|
labelWidget:setMarginLeft(2)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function onMouseRelease(self, mousePosition, mouseButton)
|
2012-02-09 06:27:29 +01:00
|
|
|
if mouseButton == MouseRightButton then
|
2012-07-24 07:30:08 +02:00
|
|
|
modules.game_interface.createThingMenu(mousePosition, nil, nil, self.creature)
|
2012-02-09 08:26:52 +01:00
|
|
|
return true
|
|
|
|
elseif mouseButton == MouseLeftButton then
|
2012-06-26 00:13:30 +02:00
|
|
|
if g_keyboard.isShiftPressed() then
|
2012-02-09 08:26:52 +01:00
|
|
|
g_game.look(self.creature)
|
|
|
|
else
|
|
|
|
if self.isTarget then
|
|
|
|
g_game.cancelAttack()
|
|
|
|
else
|
|
|
|
g_game.attack(self.creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
2012-02-09 08:26:52 +01:00
|
|
|
return true
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function removeAllCreatures()
|
2012-03-30 06:10:55 +02:00
|
|
|
for i, v in pairs(battleButtonsByCreaturesList) do
|
2012-07-24 07:30:08 +02:00
|
|
|
removeCreature(v.creature)
|
2012-03-30 06:10:55 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function removeCreature(creature)
|
2012-02-09 06:27:29 +01:00
|
|
|
local creatureId = creature:getId()
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButtonsByCreaturesList[creatureId] ~= nil then
|
|
|
|
if lastBattleButtonSwitched == battleButtonsByCreaturesList[creatureId] then
|
|
|
|
lastBattleButtonSwitched = nil
|
|
|
|
end
|
2012-03-30 12:06:33 +02:00
|
|
|
|
2012-02-09 08:26:52 +01:00
|
|
|
battleButtonsByCreaturesList[creatureId].creature:hideStaticSquare()
|
2012-02-09 06:27:29 +01:00
|
|
|
battleButtonsByCreaturesList[creatureId]:destroy()
|
|
|
|
battleButtonsByCreaturesList[creatureId] = nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function setLifeBarPercent(battleButton, percent)
|
2012-02-09 06:27:29 +01:00
|
|
|
local lifeBarWidget = battleButton:getChildById('lifeBar')
|
|
|
|
lifeBarWidget:setPercent(percent)
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
local color
|
2012-07-24 07:30:08 +02:00
|
|
|
for i, v in pairs(LifeBarColors) do
|
2012-02-09 06:27:29 +01:00
|
|
|
if percent > v.percentAbove then
|
|
|
|
color = v.color
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
lifeBarWidget:setBackgroundColor(color)
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function onbattleButtonHoverChange(widget, hovered)
|
2012-02-20 03:27:08 +01:00
|
|
|
if widget.isBattleButton then
|
2012-02-09 08:26:52 +01:00
|
|
|
widget.isHovered = hovered
|
2012-07-24 07:30:08 +02:00
|
|
|
checkBattleButton(widget)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function onAttack(creature)
|
|
|
|
checkCreatures(true) --Force recheck
|
2012-02-20 03:27:08 +01:00
|
|
|
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButton then
|
|
|
|
battleButton.isTarget = creature and true or false
|
2012-07-24 07:30:08 +02:00
|
|
|
checkBattleButton(battleButton)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function onFollow(creature)
|
|
|
|
checkCreatures(true) --Force recheck
|
2012-02-20 03:27:08 +01:00
|
|
|
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButton then
|
|
|
|
battleButton.isFollowed = creature and true or false
|
2012-07-24 07:30:08 +02:00
|
|
|
checkBattleButton(battleButton)
|
2012-02-20 03:27:08 +01:00
|
|
|
end
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
|
2012-07-24 07:30:08 +02:00
|
|
|
function checkBattleButton(battleButton)
|
|
|
|
local color = BattleButtonColors.onIdle
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButton.isTarget then
|
2012-07-24 07:30:08 +02:00
|
|
|
color = BattleButtonColors.onTargeted
|
2012-02-09 06:27:29 +01:00
|
|
|
elseif battleButton.isFollowed then
|
2012-07-24 07:30:08 +02:00
|
|
|
color = BattleButtonColors.onFollowed
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
color = battleButton.isHovered and color.hovered or color.notHovered
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButton.isHovered or battleButton.isTarget or battleButton.isFollowed then
|
|
|
|
battleButton.creature:showStaticSquare(color)
|
|
|
|
battleButton:getChildById('creature'):setBorderWidth(1)
|
|
|
|
battleButton:getChildById('creature'):setBorderColor(color)
|
2012-02-20 03:27:08 +01:00
|
|
|
battleButton:getChildById('label'):setColor(color)
|
|
|
|
else
|
2012-02-09 06:27:29 +01:00
|
|
|
battleButton.creature:hideStaticSquare()
|
|
|
|
battleButton:getChildById('creature'):setBorderWidth(0)
|
2012-02-20 03:27:08 +01:00
|
|
|
battleButton:getChildById('label'):setColor(color)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
2012-02-20 03:27:08 +01:00
|
|
|
|
2012-02-09 06:27:29 +01:00
|
|
|
if battleButton.isTarget or battleButton.isFollowed then
|
2012-07-09 13:37:47 +02:00
|
|
|
-- set new last battle button switched
|
2012-02-09 06:27:29 +01:00
|
|
|
if lastBattleButtonSwitched and lastBattleButtonSwitched ~= battleButton then
|
|
|
|
lastBattleButtonSwitched.isTarget = false
|
|
|
|
lastBattleButtonSwitched.isFollowed = false
|
2012-07-24 07:30:08 +02:00
|
|
|
checkBattleButton(lastBattleButtonSwitched)
|
2012-02-09 06:27:29 +01:00
|
|
|
end
|
|
|
|
lastBattleButtonSwitched = battleButton
|
|
|
|
end
|
|
|
|
end
|