lenonk / Timers

Timers addon for Ashita v4. Visually displays recast, buff, and debuff timers
7 stars 6 forks source link

Negative time on debuffs #5

Open pogramos opened 2 years ago

pogramos commented 2 years ago

Problem

Everytime I cast a ninjutsu on a monster for the first time, it starts with the normal time till zero and then it keeps going...

Should it behave like this?

I tested with other debuffs like "Dia" and it worked normally

image

lenonk commented 2 years ago

No, it shouldn't, but it's because the duration library that it depends on is still beta and incomplete. I haven't looked at the code to make sure of that, but I'm all but certain that's the case, since this code doesn't handle any durations at all.

Edit: At least, it was beta and incomplete the last time I talked to the owner about it. I haven't been able to play FFXI in months, so I haven't heard much about it. We'll let him weigh in here.

ThornyFFXI commented 2 years ago

By the sounds of it, the correct time is displayrd and its failing to clear at 0. I would guess ninjutsu uses a different action message to notify you it wore off and the addon isn't recognizing it, so it isn't cleared when it wears. This is almost certainly not related to duration lib, but if you are unable to look into it I can probably do so in the next week.

lenonk commented 2 years ago

@ThornyFFXI You're probably right. The last time I saw this exact problem it was because the duration of the ability was reported incorrectly (too short) by the duration lib, but if you're sure those are correct, then the wear off message isn't being handled appropriately. Should be an easy fix, but I've got my hands full writing Suricata modules 16 hours a day at the moment. It's probably a 5 minute fix though. I'll see if I can find some time to look into it on Saturday, unless you get to it first.

lenonk commented 2 years ago

@ThornyFFXI If it is a missing action message, the code in question is:

`local function HandleActionMessage(data) local message = {} message.target_id = struct.unpack('I', data, 0x09) message.param_1 = struct.unpack('I', data, 0x0D) message.message_id = struct.unpack('H', data, 0x19) % 32768

local db_target = debuffs.debuffs[message.target_id] or nil

-- Target died
if T{6, 20, 113, 406, 605, 646}:hasval(message.message_id) then
    debuffs.debuffs[message.target_id] = nil

-- Debuff expired
elseif T{64, 204, 206, 350, 531}:hasval(message.message_id) then
    if db_target and db_target.effects[message.param_1] then
        db_target.effects[message.param_1].duration = -1
        db_target.effects[message.param_1].o_time = ashita.time.clock()['ms']
    end
end

end`

The appropriate message ID just needs to be added in the elseif above, which is line 162 in debuffs.lua.

ThornyFFXI commented 2 years ago

I looked into this. Huton doesn't display a visible action message upon expiration, it's just elemental resistance-. It seems that you're using a default debuff image, and your code does not actually clear debuffs unless a message is received? This is nothing to do with my lib, and I did not sign up to manage someone else's code.