Ivaar / Windower-addons

FFXI Windower addons
71 stars 108 forks source link

AutoGEO cannot entrust to trusts #25

Closed xurion closed 4 years ago

xurion commented 4 years ago

Attempting to use //geo entrust kupipi refresh displays the "Entrust: Kupipi: [Indi-Refresh]" in the display box as expected. However, it never entrusts on to a trust NPC.

Investigation shows the main reason is because of the valid_target function returns false for all trusts, as they are considered charmed targets.

Changing:

if type(member) == 'table' and member.mob and member.mob.name:lower() == targ:lower() and math.sqrt(member.mob.distance) < dst and not member.mob.charmed and member.mob.hpp > 0 then

to:

if type(member) == 'table' and member.mob and member.mob.name:lower() == targ:lower() and math.sqrt(member.mob.distance) < dst and (not member.mob.charmed and not member.mob.is_npc or members.mob.charmed and member.mob.is_npc) and member.mob.hpp > 0 then

Specifically not member.mob.charmed to (not member.mob.charmed and not member.mob.is_npc or members.mob.charmed and member.mob.is_npc)

seems to function ok in my brief testing.

I can put this into PR if you like. Wanted to at least run this past you here first as I'm not sure what kind of edge cases this could produce when considering things such as automatons, wyverns, avatars etc.

Thanks.

xurion commented 4 years ago

Tested this for a while and it seems to eventually give up on doing refresh and haste for some reason :(

Edit: It's sporadic. Sometimes it waits minutes before reapplying buffs. Not sure if this is an existing issue.

Ivaar commented 4 years ago

Since were iterating the party member list, I think (member.mob.is_npc or not member.mob.charmed) will work as trusts are the only npcs that are considered party members.

I have not heard of any issues with haste/refresh, aside from not recognizing dispelled effects. Are you using default recast settings?

xurion commented 4 years ago

Yeah I've only set who the spells should be applied to. I'll test your snippet and keep an eye on refresh/haste.

Ivaar commented 4 years ago

Do you think it could it be the distance check? I could make that a tad more accurate.

xurion commented 4 years ago

I'm not sure - my new pocket geo was on follow the whole time.

xurion commented 4 years ago

Ok so this took some time to figure out, but I now have a reliable way to reproduce.

The fixing of the Entrust to a Trust party member uncovers a otherwise hidden bug where the magic Refresh/Haste are somehow locked behind the cooldown of Entrust. Basically the addon will wait until Entrust is ready for use before it will reapply the spells. Oddly it seems to apply the spells twice then stops. Here's a log of what happened in order:

//geo on
Geo-Haste -> GEO
Indi-Acumen -> GEO
Entrust + Indi-Refresh -> TRUST
Magic Haste -> MAIN
Magic Refresh -> GEO

Magic Refresh -> GEO (second application here is fine)
Magic Haste -> MAIN
Indi-Acumen -> GEO
Geo-Haste -> GEO

Magic Refresh wears from GEO (wears off here and is not reapplied)
Magic Haste wears from MAIN

Indi-Acumen -> GEO
Geo-Haste -> GEO

Indi-Acumen -> GEO

Entrust comes off cooldown
Entrust + Indi-Refresh -> TRUST
Magic Haste -> MAIN (starts applying again here having used Entrust)
Magic Refresh -> GEO

Geo-Haste -> GEO

Magic Haste -> MAIN (second application again here, repeats the same pattern indefinitely)
Magic Refresh -> GEO
Ivaar commented 4 years ago

Well I can't explain the placement of this atm https://github.com/Ivaar/Windower-addons/blob/5c495d0e75dcb422bf4b096aabcdecfdee42afec/AutoGEO/AutoGEO.lua#L211

Try removing it and placing returns here and I will look over the code again today

if buffs.entrust then
    use_MA(entrust.en,settings.entrust.target)
    return
elseif abil_recasts[93] <= 0 then
    use_JA('Entrust','<me>')
    return
end
xurion commented 4 years ago

Sorry for the lack of comms - I'm gonna test this out tonight. If it works, I'll throw up a quick PR.