-- Separate local custom-game benchmark. Loopback-only capture; no account data. local function encode(v) if type(v)=='number' then return tostring(v) end if type(v)=='boolean' then return tostring(v) end if type(v)=='string' then return '"'..v:gsub('\\','\\\\'):gsub('"','\\"'):gsub('\n','\\n')..'"' end if type(v)=='table' then local list={}; for k,x in pairs(v) do list[#list+1]=encode(tostring(k))..':'..encode(x) end; return '{'..table.concat(list,',')..'}' end return 'null' end local function read(unit,method,...) local args={...};local count=select('#',...);local ok,result=pcall(function() return unit[method](unit,unpack(args,1,count)) end) return ok and result or nil end local function publish(row) local make=CreateHTTPRequestScriptVM or CreateHTTPRequest if not make then print('DOTA_COOLDOWN_HTTP_UNAVAILABLE');return end local request=make('POST','http://127.0.0.1:5199/native') request:SetHTTPRequestRawPostBody('application/json',encode(row)) request:Send(function(result) if result.StatusCode~=200 then print('DOTA_COOLDOWN_HTTP_ERROR '..tostring(result.StatusCode)) end end) end function Precache(context) for _,hero in ipairs({'lina','axe','sven'}) do PrecacheUnitByNameSync('npc_dota_hero_'..hero,context) end end function Activate() GameRules:SetHeroSelectionTime(0);GameRules:SetStrategyTime(0);GameRules:SetShowcaseTime(0);GameRules:SetPreGameTime(0);GameRules:GetGameModeEntity():SetCustomGameForceHero('npc_dota_hero_axe') print('DOTA_COOLDOWN_BENCH_START') local mode=GameRules:GetGameModeEntity();local queue={} for _,hero in ipairs({'lina','axe','sven'}) do for _,level in ipairs({1,18,25}) do queue[#queue+1]={hero=hero,level=level} end for _,item in ipairs({'item_octarine_core','item_ultimate_scepter','item_power_treads','item_black_king_bar','item_blade_mail'}) do queue[#queue+1]={hero=hero,level=18,item=item} end end local current=nil;local unit=nil;local phase=0 mode:SetContextThink('dotacooldown_measure',function() if phase==0 then if GameRules:State_Get()0 then release=elapsed;DC_CASTRELEASE=Time() end if current.passive and attacks<4 and elapsed>=(attacks+1)*.4 then target:RemoveModifierByName('modifier_dotacooldown_bench');target:PerformAttack(caster,true,true,true,false,false,false,true);target:AddNewModifier(target,nil,'modifier_dotacooldown_bench',{});attacks=attacks+1 end if elapsed