WorldBossTimers

WorldBossTimers

1M Downloads

Should make the timers connected-realm aware

jagaudet opened this issue ยท 1 comments

commented

Or, at least, make that an option. For example, if I kill Nalak on Garithos, then switch to a Chromaggus character, the timer is accurate, but it won't let me share it. It also shows up as a separate timer, which is annoying.

I patched my local copy as follows as a first attempt, but it seems to have worked. Basically, I changed all checks like kill_info.realmname == GetRealmName()
to:
kill_info.realmName == GetRealmName() or tContains(GetAutoCompleteRealms(),kill_info.realmName)

For example:

function KillInfo:IsCompletelySafe(error_msgs)
<snip>
    if not (self.realmName == realmName) and not tContains(GetAutoCompleteRealms(),realmName) then
        table.insert(error_msgs, "Kill was made on " .. self.realmName .. ", but are now on unconnected realm " .. realmName .. ".");
    end
<snip>
end

I also had to modify the GUID generator:

function KillInfo.GetAdjustedRealmName()
    local connectedRealms=GetAutoCompleteRealms()
    if connectedRealms then
        local result=""
        for i,v in ipairs(connectedRealms) do
            result=result..v
        end
        return result
    else
        return GetRealmName()
    end
end

function KillInfo.CreateGUID(name, realmName, realm_type, map_id)
    local realmName = realmName or KillInfo.GetAdjustedRealmName();
    local realm_type = realm_type or Util.WarmodeStatus();
    local map_id = map_id or WBT.GetCurrentMapId();
    return name .. GUID_DELIM .. realmName .. GUID_DELIM .. realm_type .. GUID_DELIM .. map_id;
end
commented

Thanks, great addition!

I didn't know that you could get connected realms with API.

Fixed in 7d45df6.