mrhappyasthma / HoN-Ranked-Quickstats-Tooltips-Mod

Enables quickstat tooltips to display current season ranked data when moused-over. This is reminiscent of the old main interface game_lobby UI.
1 stars 1 forks source link

[Bug] Match History section of the floating panel is missing. #3

Closed mrhappyasthma closed 3 years ago

mrhappyasthma commented 3 years ago

Seems like this can be populated using OnPlayerStatsMatchListResult and PlayerStatsMatchListResult.

This populates the _matchList local variable. The data we need is in the following:

match['heroname']
match['result']
match['kills']
match['deaths']
match['assists']

We may need to do some modification for heroname and result to get it to match the expected input for the panel. Also the heroname needs to be resolved using GetHeroIconPath.

mrhappyasthma commented 3 years ago

By calling self:QuickStatsMod_OnPlayerStatsMatchListResult(_matchList) inside of function Player_Stats_V2:OnPlayerStatsMatchListResult(...) with the following implementation:

function Player_Stats_V2:QuickStatsMod_OnPlayerStatsMatchListResult(matchlist)
    for i=1, math.min(7, #matchlist) do
        local match = matchlist[i]

        local heroname = string.lower(string.sub(match['heroname'], 6, -1))
        local iconPath = GetHeroIconPath(heroname)

        local result = '^522Lose'
        if match['result'] == '1' then
            result = '^884Win'
        end

        local KDA = '^g'..match['kills']..'^*/^r'..match['deaths']..'^*/^y'..match['assists']

        println(iconPath .. ':' .. result .. ':' .. KDA)
    end
end

I get the following output, which is what we want

img

I just need to figure out how to best call this trigger from my widget. Also the parameters do not include the hero name, so making sure that we can fetch this for only the current user may require checking the mouse hover param.

mrhappyasthma commented 3 years ago

The form is PlayerStatsMatchList.

SubmitForm('PlayerStatsMatchList', 'f', 'match_history_overview', 'nickname', StripClanTag(<nickName>), 'cookie', Client.GetCookie(), 'table', 'campaign' , 'num', '7', 'curseason', '0')
mrhappyasthma commented 3 years ago

Fixed in https://github.com/mrhappyasthma/HoN-Ranked-Quickstats-Tooltips-Mod/commit/fafdee75951a9728855048a1cc087e4cf76100a9