local ____lualib = require("lualib_bundle") local __TS__ArraySort = ____lualib.__TS__ArraySort local ____exports = {} --- Кто считается «реальным» игроком в лобби (совпадает с бывшей логикой GameMode). -- Без проверки контроллера в список попадают пустые/«невидимые» слоты на CUSTOM_GAME_SETUP. function ____exports.isRealLobbyPlayer(self, playerId) if not PlayerResource:IsValidPlayerID(playerId) then return false end if not PlayerResource:IsValidPlayer(playerId) then return false end if PlayerResource:IsFakeClient(playerId) then return false end return PlayerResource:GetPlayer(playerId) ~= nil end function ____exports.countRealLobbyPlayers(self) local n = 0 do local playerId = 0 while playerId < DOTA_MAX_PLAYERS do if ____exports.isRealLobbyPlayer(nil, playerId) then n = n + 1 end playerId = playerId + 1 end end return n end --- Игроки, участвующие в PvE-статистике матча: реальное лобби + команда -- (если слотов Dire нет — только GOODGUYS). function ____exports.collectStatsEligiblePlayerIds(self) local ids = {} local badMax = GameRules:GetCustomGameTeamMaxPlayers(DOTA_TEAM_BADGUYS) do local i = 0 while i < DOTA_MAX_PLAYERS do do local pid = i if not ____exports.isRealLobbyPlayer(nil, pid) then goto __continue10 end local team = PlayerResource:GetTeam(pid) if badMax == 0 then if team ~= DOTA_TEAM_GOODGUYS then goto __continue10 end else if team ~= DOTA_TEAM_GOODGUYS and team ~= DOTA_TEAM_BADGUYS then goto __continue10 end end ids[#ids + 1] = pid end ::__continue10:: i = i + 1 end end __TS__ArraySort( ids, function(____, a, b) return a - b end ) return ids end return ____exports