kakysha / HonorSpy

World of Warcraft: Classic HonorSpy addon
57 stars 49 forks source link

Bracket 14 In-Bracket Estimates not functional #137

Closed abitlegacy closed 4 years ago

abitlegacy commented 4 years ago

Root cause of the issue is this block of code:

for i = 2,14 do
        if (standing > brk[i]) then
            inside_br_progress = (brk[i-1] - standing)/(brk[i-1] - brk[i])
            break
        end;
        bracket = i;
    end
    if (bracket == 14 and standing == 1) then inside_br_progress = 1 end;
    for i = 3,14 do
        RP[i] = (i-2) * 1000;
        Ranks[i] = (i-2) * 5000;
    end

When you're in bracket 14, the if statement never passes true - which results in inside_br_progress being 0, causing the in bracket estimate to default to top of BR13 RP Reward (12,000).

abitlegacy commented 4 years ago

Also - this formula (based off of standing) is incorrect entirely and doesn't account for bracket stacking. You should be looking at the honor at the cutoffs and your % of honor between those two and determining the inside_br_progress based off of that.

IE: If Bracket 14 has 6 players @ 750k honor, and 1 player @ 650k honor, the 6 will all get 13,000 RP and the 1 will get 12,001 RP. With your formula, this isn't accounted for at all.

abitlegacy commented 4 years ago
        local bracket = 1;
    local top_bracket = 14;
    local inside_br_progress = 0;
    local brk = self:GetBrackets(pool_size)

    for i = 2,14 do
        if (standing > brk[i]) then
            break
        end
        bracket = i;
    end

    for i = 2,14 do
        if (brk[i] == 0) then
            top_bracket = i
        end
    end

    local btm_break_point_honor = t[brk[bracket]][3]
    local top_break_point_honor = 0

    if bracket ~= top_bracket then
        top_break_point_honor = t[brk[bracket + 1]][3]
    else
        top_break_point_honor = t[1][3]
    end

    inside_br_progress = (curHonor - btm_break_point_honor)/(top_break_point_honor - btm_break_point_honor)

This fixes the issue for me and seems bug free. Starting @ Line 300 in honorspy.lua