lucasmonstrox / PyTibia

🤖 Fastest Tibia PixelBot. A great bot for Auto, Cavebot, Healing, Macro, Refill, Targeting and Training!
MIT License
261 stars 60 forks source link

[BUG] - Is not possible to get the target on creature when it goes to the edges of the hud #40

Closed mathiconical closed 1 year ago

mathiconical commented 1 year ago

Describe the bug When the creature goes to out of bounds of HUD the bot cant keep find them.

To Reproduce Steps to reproduce the behavior:

  1. Go to some monster that have is ranged attack and which run with low life, like lizard in Chor.
  2. Let some with low life.
  3. Wait they goes through the HUD.
  4. See the error.

Screenshots q2 q1

Desktop (please complete the following information):

lucasmonstrox commented 1 year ago

Looks like I need to calculate like I did to get the correctly monster bar. Going to fix it this weekend.

lucasmonstrox commented 1 year ago

@mathiconical

[BOTTOM/RIGHT EDGES]

When trying to get target creature by right/bottom edge, looks like the creature do not appear in battle list and the creature bar isnt in hud anymore it means, there is no way to have this bug in right/bottom edge. So the final decision by PyTibia will be "you are not attacking monsters", you can see below:

right_edge bottom_edge

[LEFT EDGE]

When creature is almost crossing limit, I think PyTibia can parse since the count of red border around monster should be 50+, so in below image example, everything will works fine:

left_edge_almost_limit

Sandcrawler

When cross is more deep like image below, I think PyTibia can take target creature by horizontal borders since the sum of red horizontal borders could be (64(border size) 4(gap)) 2(lines) = 512pixels for 1080p resolution and (32(border size) 2(gap)) 2(lines) = 128pixels for 720p resolution.

screenshot Sandcrawler

A more deep cross. You can see images and response by PyTibia, still possible to take target creature:

screenshot Sandcrawler

[('Sandcrawler', 'monster',  True, [0, 2], [33269, 32291,     7], [248, 180])]

A 2x more deep cross. You can see images and response by PyTibia, still possible to take target creature:

screenshot Sandcrawler

[('Sandcrawler', 'monster',  True, [0, 2], [33269, 32291,     7], [248, 180])]

A 3x more deep cross. You can see images and response by PyTibia, still possible to take target creature:

screenshot Sandcrawler

[('Sandcrawler', 'monster',  True, [0, 2], [33268, 32291,     7], [248, 180])]

The last example is a rare exception, will occurs only when:

[Conclusion]

Sometimes will fail because a tree or any object can hide the "red border around monster" and there is nothing to do, you can see examples below:

monster_hidden_by_tree

[Solutions]

mathiconical commented 1 year ago

@lucasmonstro Very useful solutions, working perfectly now.

lucasmonstrox commented 1 year ago

@mathiconical I'm going to: -- calculate with fewer pixels for 720p resolutions -- since creature is in the edge, I need to check all monsters to reduce pixels count

lucasmonstrox commented 1 year ago

Done!