GetDotaStats / stat-collection

Library for setting up stat collection for dota2 mods
http://getdotastats.com/
GNU General Public License v2.0
11 stars 8 forks source link

hostSteamID32 reported is not accurate #25

Closed jimmydorry closed 8 years ago

jimmydorry commented 8 years ago

It appears to just grab the first slot in the lobby.

MNoya commented 8 years ago

Right now sendStage1 is doing PlayerResource:GetSteamAccountID(0), in theory this should always be the host but if the playerIDs are actually just the game lobby order (before joining and deciding who has the better PC/Connection), it will require a for loop such as:

local hostID
for playerID = 0, DOTA_MAX_PLAYERS do
    if PlayerResource:IsValidPlayerID(playerID) then
        local player = PlayerResource:GetPlayer(playerID)
        if GameRules:PlayerHasCustomGameHostPrivileges(player) then 
            hostID = playerID
            return
        end
    end
end

to determine who has the real host privileges and get their steamID that way

jimmydorry commented 8 years ago

Wasn't aware of that function. :+1:

SinZ163 commented 8 years ago

It worked in the past, and did work briefly in reborn, but when valve added the feature to select host based on connection quality and hardware, player 0 wont always be host anymore, as it might have been allocated to other people

MNoya commented 8 years ago

Done