Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script = {}
- --Menu.Find("Heroes", "Hero List", "Invoker", "Auto Usage", "Sun Strike Settings", "Auto Use")
- update_list_queue = {}
- menu = Menu.Find("Heroes", "Hero List", "Invoker", "Auto Usage", "Sun Strike Settings")
- if menu then
- switch = menu:Switch('Sun Strike for low HP teleport', false)
- switch:Icon("\u{f0e7}")
- input = menu:Input("Max no-vision time", "25")
- input:Icon("\u{f017}")
- end
- function contains(tbl, val)
- for i = 1, #tbl do
- if tbl[i] == val then
- return true
- end
- end
- return false
- end
- local handled_positions = {}
- local particle_name_map = {}
- local particle_data = {}
- local actionQueue = {}
- local nextActionTime = 0
- local heroes = {}
- function AddAction(delay, callback)
- table.insert(actionQueue, {time = GameRules.GetGameTime() + delay, action = callback})
- end
- local function add_divider()
- return
- end
- function script.OnUpdate()
- local now = GameRules.GetGameTime()
- if #actionQueue > 0 then
- local first = actionQueue[1]
- if now >= first.time then
- table.remove(actionQueue, 1)
- if first.action then
- first.action()
- end
- end
- end
- local allheroes = Heroes.GetAll()
- local localhero = Heroes.GetLocal()
- for i, hero in pairs(allheroes) do
- if hero and localhero and not Entity.IsSameTeam(hero, localhero) and not NPC.IsIllusion(hero) and Entity.IsAlive(hero) then
- local idx = Entity.GetIndex(hero)
- local isVisible = NPC.IsVisible(hero)
- --print(string.format("Hero: %s | Index: %d | IsVisible: %s", Entity.GetUnitName(hero), idx, tostring(isVisible)))
- if isVisible then
- heroes[idx] = os.time()
- --print("Seen update: " .. heroes[idx])
- end
- end
- end
- EMPCalc()
- icewallrender()
- -- autosunstrike()
- end
- function script.OnParticleCreate(prt)
- ---@diagnostic disable-next-line: undefined-field
- prt = table.copy(prt)
- local particle_info = {}
- if prt.entity and Entity.IsNPC(prt.entity) then
- local unit_name = NPC.GetUnitName(prt.entity)
- local health = Entity.GetHealth(prt.entity)
- particle_info.unit_name = unit_name
- particle_info.health = health
- particle_info.unit = prt.entity
- prt["[m]entity_name"] = unit_name
- end
- if prt.entityForModifiers and Entity.IsNPC(prt.entityForModifiers) then
- local unit_name = NPC.GetUnitName(prt.entityForModifiers)
- local health = Entity.GetHealth(prt.entityForModifiers)
- -- ⚠️ Важно: сохраняем `entityForModifiers`, а не `prt.entity`, как было у тебя
- particle_info.unit_name = unit_name
- particle_info.health = health
- particle_info.unit = prt.entityForModifiers
- prt["[m]entityForModifiers_name"] = unit_name
- end
- if next(particle_info) ~= nil then
- particle_data[prt.index] = particle_info
- end
- particle_name_map[prt.index] = prt.name
- add_divider()
- end
- function script.OnParticleUpdate(prt)
- if prt.controlPoint == 2 and prt.position == Vector(1.0, 1.0, 1.0) then
- return
- end
- local _localhero = Heroes.GetLocal()
- if not _localhero then return end -- тоже важно
- prt = table.copy(prt)
- if particle_name_map[prt.index] then
- prt["[m]name"] = particle_name_map[prt.index]
- end
- if prt["[m]name"] == "teleport_start" then
- local data = particle_data[prt.index]
- if not data then
- print("No entity data for this particle")
- return
- end
- if Entity.IsSameTeam(_localhero, data.unit) then
- print("Same team")
- return
- end
- local pos_key = tostring(math.floor(prt.position.x)) .. "_" .. tostring(math.floor(prt.position.y))
- if handled_positions[pos_key] then
- print("Already handled teleport at: " .. pos_key)
- return
- end
- handled_positions[pos_key] = true
- if Menu.Find("Heroes", "Hero List", "Invoker", "Auto Usage", "Sun Strike Settings", "Sun Strike for low HP teleport"):Get() == false then
- print("Sun strike for low HP disabled")
- return
- end
- if Entity.GetUnitName(_localhero) ~= "npc_dota_hero_invoker" then return end
- local sunstrike = NPC.GetAbility(_localhero, "invoker_sun_strike")
- local exort = NPC.GetAbility(_localhero, "invoker_exort")
- local invoke = NPC.GetAbility(_localhero, "invoker_invoke")
- if not sunstrike or not exort then return end
- local enemy = data.unit
- local exort_level = Ability.GetLevel(exort)
- local damage = 125 + (50 * exort_level)
- local player = Players.GetLocal()
- if Ability.IsReady(sunstrike) then
- print("Sunstrike is ready")
- if data.health + 5 <= damage then
- print("Damage critical!")
- if enemy then
- local enemyid = Entity.GetIndex(enemy)
- if heroes[enemyid] then
- print(data.unit_name .. " last seen at " .. heroes[enemyid])
- local now = os.time()
- local seconds_passed = now - heroes[enemyid]
- print("After " .. seconds_passed .. " seconds")
- local maxsleep = tonumber(Menu.Find("Heroes", "Hero List", "Invoker", "Auto Usage", "Sun Strike Settings", "Max no-vision time"):Get())
- print("Max no-vision time " .. maxsleep .. " sec.")
- if seconds_passed > maxsleep then
- print("Прошло более " .. maxsleep .. " секунд.")
- return
- end
- else
- print("Нет информации о последнем появлении для enemyid: " .. tostring(enemyid))
- end
- else
- print("data.unit is nil!")
- end
- if not Ability.IsHidden(sunstrike) then
- Player.PrepareUnitOrders(player, Enum.UnitOrder.DOTA_UNIT_ORDER_CAST_POSITION, nil, prt.position, sunstrike, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_HERO_ONLY, _localhero, false, true, false, true, nil, true)
- Engine.LookAt(prt.position.x, prt.position.y)
- return
- end
- for i = 1, 3 do
- AddAction(0.01, function()
- Player.PrepareUnitOrders(player, Enum.UnitOrder.DOTA_UNIT_ORDER_CAST_NO_TARGET, nil, Vector(), exort, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_HERO_ONLY, _localhero, false, true, false, true, nil, true)
- print("prepare #" .. i .. " for exort")
- end)
- end
- if invoke and Ability.IsReady(invoke) then
- print("invoke is ready and cast it")
- print("Начало " .. os.time())
- AddAction(0.25, function()
- Player.PrepareUnitOrders(player, Enum.UnitOrder.DOTA_UNIT_ORDER_CAST_NO_TARGET, nil, Vector(), invoke, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_HERO_ONLY, _localhero, false, true, false, true, nil, true)
- print("Конец ".. os.time())
- end)
- end
- AddAction(0.15, function()
- print("Casting sunstrike")
- Player.PrepareUnitOrders(player, Enum.UnitOrder.DOTA_UNIT_ORDER_CAST_POSITION, nil, prt.position, sunstrike, Enum.PlayerOrderIssuer.DOTA_ORDER_ISSUER_HERO_ONLY, _localhero, false, true, false, true, nil, true)
- -- Engine.ExecuteCommand("say Sunstrike casted at position: " .. tostring(prt.position) .. " for " .. data.unit_name)
- Engine.LookAt(prt.position.x, prt.position.y)
- end)
- end
- end
- end
- add_divider()
- end
- function script.OnParticleUpdateEntity(prt)
- MiniMap.SendLine(prt.position, false, false)
- prt = table.copy(prt)
- if (prt.entity and Entity.IsNPC(prt.entity)) then
- local unit_name = NPC.GetUnitName(prt.entity)
- prt["[m]entity_name"] = unit_name
- end
- if particle_name_map[prt.index] then
- prt["[m]name"] = particle_name_map[prt.index]
- end
- add_divider()
- end
- function script.OnParticleUpdateFallback(prt)
- prt = table.copy(prt)
- if particle_name_map[prt.index] then
- prt["[m]name"] = particle_name_map[prt.index]
- end
- add_divider()
- end
- function script.OnParticleDestroy(prt)
- prt = table.copy(prt)
- if particle_name_map[prt.index] then
- prt["[m]name"] = particle_name_map[prt.index]
- end
- particle_name_map[prt.index] = nil
- particle_data[prt.index] = nil
- add_divider()
- end
- --#endregion
- return script
Advertisement
Advertisement