kakysha / HonorSpy

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

HonorSpy:GetPoolBoostForToday #177

Closed Slivo-fr closed 2 years ago

Slivo-fr commented 2 years ago

Hey,

I don't understand the need to spread the boosted pool count over the week, it's kinda confusing to me ? Could I have a hint ?

Would a PR adding the option to use the full poolboost count any day of the week be welcome ?

Slivo-fr commented 2 years ago

Seee #180

teelolws commented 2 years ago

Oh I was wondering what was going on there. It was causing errors on the first day of the week if I had a pool boost count.

I see you play on Classic Era too. The changes I've been making lately are intended to eliminate the need to store the pool boost count. I want to track all the pool boost characters in HonorSpy. Hence storing everyone who got 15HKs "today" and going to great lengths to make sure those characters broadcast as soon as they get their 15th HK.

I also wrote this code, which I haven't included in any commits, to merge databases across connected realms. You'll need to change the realm names:

function HonorSpy:CombineVars()
local realm1 = "Arugal"
local realm2 = "Felstriker"

local factionrealm1 = HonorSpyDB.factionrealm["Horde - Arugal"].currentStandings
local factionrealm2 = HonorSpyDB.factionrealm["Horde - Felstriker"].currentStandings

for namerealm, data in pairs(factionrealm2) do
    if namerealm:find("%-") then 
        local _, _, name, realm = namerealm:find("(%a+)%-(%a+)")
        if not realm or realm == "" or not name or name == "" then print("error 1") return end
        if realm == realm1 then
            -- Example here: Player is from Arugal, message is from Felstriker, about a character on Arugal
            -- Lets just remove the bit about Arugal
            namerealm = name
            -- If the realm name does not match: Player is from Arugal, message is from Felstriker, about a character on Yojamba
            -- In this case just allow it as is
        end
    else
        -- Example here: Player is from Arugal, message is from Felstriker, about a character on Felstriker
        -- Add "-Felstriker" to the name
        namerealm = namerealm.."-"..realm2
    end

    local exists = false
    for namerealm2, data2 in pairs(factionrealm1) do
        if namerealm == namerealm2 then
            if data.last_checked < data2.last_checked then
                factionrealm1[namerealm] = data2
            end
            exists = true
            break
        end
    end

    if not exists then
        factionrealm1[namerealm] = data
    end
end
end
Slivo-fr commented 2 years ago

I fixed the said error with #178

The changes I've been making lately are intended to eliminate the need to store the pool boost count

I was thinking you did this to ease tracking of others players ! We do track the pool chars separately on our side, having them registered into the natural pool could be an option but let's allow both options maybe ?

I'm not sure to understand what the realm merging is about however, do you mind to elaborate ?

teelolws commented 2 years ago

I'm not sure to understand what the realm merging is about however, do you mind to elaborate ?

For example, if I log into any character on Arugal, I see this: image

But if I switch to a character on Felstriker, which is a connected realm, because the databases are separate, I just get an empty database like this: image

After I run that code, it merges the databases on those two servers and looks like this: image

I can't show an example because I have the other faction on Yojamba, but if I did the same thing on Yojamba, it would show his name without a realm, because its the same realm now.

Slivo-fr commented 2 years ago

Understood, thanks for the explanation !