mirror of
https://github.com/edubart/otclient.git
synced 2025-10-17 04:53:27 +02:00
Fix some issues in battle
This commit is contained in:
@@ -179,8 +179,8 @@ function addCreature(creature)
|
||||
battleButton.creatureId = creatureId
|
||||
battleButton.creature = creature
|
||||
battleButton.isHovered = false
|
||||
battleButton.isTarget = (g_game.getAttackingCreature() == creature)
|
||||
battleButton.isFollowed = (g_game.getFollowingCreature() == creature)
|
||||
battleButton.isTarget = false
|
||||
battleButton.isFollowed = false
|
||||
|
||||
labelWidget:setText(creature:getName())
|
||||
creatureWidget:setCreature(creature)
|
||||
@@ -190,6 +190,14 @@ function addCreature(creature)
|
||||
|
||||
checkCreatureSkull(battleButton.creature)
|
||||
checkCreatureEmblem(battleButton.creature)
|
||||
|
||||
if creature == g_game.getAttackingCreature() then
|
||||
onAttack(creature)
|
||||
end
|
||||
|
||||
if creature == g_game.getFollowingCreature() then
|
||||
onFollow(creature)
|
||||
end
|
||||
else
|
||||
setLifeBarPercent(battleButton, creature:getHealthPercent())
|
||||
end
|
||||
@@ -301,7 +309,6 @@ function onbattleButtonHoverChange(widget, hovered)
|
||||
end
|
||||
|
||||
function onAttack(creature)
|
||||
checkCreatures(true) --Force recheck
|
||||
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
|
||||
if battleButton then
|
||||
battleButton.isTarget = creature and true or false
|
||||
@@ -310,7 +317,6 @@ function onAttack(creature)
|
||||
end
|
||||
|
||||
function onFollow(creature)
|
||||
checkCreatures(true) --Force recheck
|
||||
local battleButton = creature and battleButtonsByCreaturesList[creature:getId()] or lastBattleButtonSwitched
|
||||
if battleButton then
|
||||
battleButton.isFollowed = creature and true or false
|
||||
|
@@ -52,6 +52,7 @@ MiniWindow
|
||||
anchors.right: next.left
|
||||
margin-right: 5
|
||||
margin-top: 3
|
||||
@onCheckChange: modules.game_battle.checkCreatures()
|
||||
|
||||
BattleNPCs
|
||||
id: hideNPCs
|
||||
@@ -60,6 +61,7 @@ MiniWindow
|
||||
anchors.right: next.left
|
||||
margin-right: 5
|
||||
margin-top: 3
|
||||
@onCheckChange: modules.game_battle.checkCreatures()
|
||||
|
||||
BattleMonsters
|
||||
id: hideMonsters
|
||||
@@ -67,6 +69,7 @@ MiniWindow
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
margin-top: 3
|
||||
@onCheckChange: modules.game_battle.checkCreatures()
|
||||
|
||||
BattleSkulls
|
||||
id: hideSkulls
|
||||
@@ -74,6 +77,7 @@ MiniWindow
|
||||
anchors.top: prev.top
|
||||
anchors.left: prev.right
|
||||
margin-left: 5
|
||||
@onCheckChange: modules.game_battle.checkCreatures()
|
||||
|
||||
BattleParty
|
||||
id: hideParty
|
||||
@@ -81,6 +85,7 @@ MiniWindow
|
||||
anchors.top: prev.top
|
||||
anchors.left: prev.right
|
||||
margin-left: 5
|
||||
@onCheckChange: modules.game_battle.checkCreatures()
|
||||
|
||||
HorizontalSeparator
|
||||
anchors.top: prev.bottom
|
||||
|
@@ -1,7 +1,7 @@
|
||||
BattleButton < UIButton
|
||||
height: 20
|
||||
margin-top: 5
|
||||
fixed-size: true
|
||||
margin-right: 4
|
||||
&isBattleButton: true
|
||||
|
||||
UICreature
|
||||
|
Reference in New Issue
Block a user