Files
Dota-Zombie-Invasion/scripts/vscripts/quests/questeventhandlers.lua
T
2026-05-29 15:11:31 +07:00

1512 lines
60 KiB
Lua

--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
local ____exports = {}
local ____modifier_pet_buff_npc_squirrel_event = require("abilities.modifiers.pets.modifier_pet_buff_npc_squirrel_event")
local modifier_pet_buff_npc_squirrel_event = ____modifier_pet_buff_npc_squirrel_event.modifier_pet_buff_npc_squirrel_event
local ____modifier_pet_buff_npc_pig_event = require("abilities.modifiers.pets.modifier_pet_buff_npc_pig_event")
local modifier_pet_buff_npc_pig_event = ____modifier_pet_buff_npc_pig_event.modifier_pet_buff_npc_pig_event
local ____modifier_pet_buff_npc_wolf_event = require("abilities.modifiers.pets.modifier_pet_buff_npc_wolf_event")
local modifier_pet_buff_npc_wolf_event = ____modifier_pet_buff_npc_wolf_event.modifier_pet_buff_npc_wolf_event
local ____clean_harbor_flag_markers = require("quests.clean_harbor_flag_markers")
local hideCleanHarborFlagPlacementMarkers = ____clean_harbor_flag_markers.hideCleanHarborFlagPlacementMarkers
local showCleanHarborFlagPlacementMarkers = ____clean_harbor_flag_markers.showCleanHarborFlagPlacementMarkers
local ____QuestSystem = require("quests.QuestSystem")
local QuestSystem = ____QuestSystem.QuestSystem
local ____QuestSystem = require("quests.QuestSystem")
local QuestState = ____QuestSystem.QuestState
local ____recipes = require("cooking.recipes")
local openRecipe = ____recipes.openRecipe
local ____entity_radius = require("utils.entity_radius")
local findNearestByClassname = ____entity_radius.findNearestByClassname
--- Общая утилита для квестов «принеси X предметов»
local function handleQuestItemTurnIn(self, hero, options)
local questSystem = QuestSystem:getInstance()
local shouldRemoveFromHero = options.removeFromHero ~= false
do
local slot = 0
while slot < 9 do
do
local item = hero:GetItemInSlot(slot)
if not item or item:IsNull() or item:GetAbilityName() ~= options.itemName then
goto __continue3
end
if options.useCharges then
local itemcount = item:GetCurrentCharges()
if itemcount < options.requiredCount then
questSystem:setQuestProgress(options.questId, options.objectiveKey, itemcount)
else
questSystem:setQuestProgress(options.questId, options.objectiveKey, options.requiredCount)
if shouldRemoveFromHero then
if itemcount > options.requiredCount then
item:SetCurrentCharges(itemcount - options.requiredCount)
else
item:RemoveSelf()
end
end
if options.timerHandle then
Timers:RemoveTimer(options.timerHandle)
end
end
else
questSystem:setQuestProgress(options.questId, options.objectiveKey, options.requiredCount)
if shouldRemoveFromHero then
item:RemoveSelf()
end
if options.timerHandle then
Timers:RemoveTimer(options.timerHandle)
end
end
break
end
::__continue3::
slot = slot + 1
end
end
end
local OLDMEN_MILK_BASE_REQUIRED = 5
local oldmenMilkTurnInCount = 0
--- Общая утилита: квестодатель бросает наградной предмет ближайшему герою
local function launchQuestRewardToNearestHero(self, questGiverName, itemName, searchRadius, launchHeight, launchDistance, launchDuration, targetRandomRadius)
if searchRadius == nil then
searchRadius = 700
end
if launchHeight == nil then
launchHeight = 150
end
if launchDistance == nil then
launchDistance = 200
end
if launchDuration == nil then
launchDuration = 0.7
end
if targetRandomRadius == nil then
targetRandomRadius = 0
end
local questGiver = Entities:FindByName(nil, questGiverName)
if not questGiver then
return
end
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
searchRadius,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_CLOSEST,
false
)
if #nearbyHeroes == 0 then
return
end
local hero = nearbyHeroes[1]
local rewardItem = CreateItem(itemName, nil, nil)
if not rewardItem then
return
end
local drop = CreateItemOnPositionForLaunch(
questGiver:GetAbsOrigin(),
rewardItem
)
if not drop then
return
end
local targetPosition = targetRandomRadius > 0 and hero:GetAbsOrigin() + RandomVector(targetRandomRadius) or hero:GetAbsOrigin()
rewardItem:LaunchLootInitialHeight(
false,
launchHeight,
launchDistance,
launchDuration,
targetPosition
)
questGiver:FaceTowards(hero:GetAbsOrigin())
end
local function dropQuestItemToHero(self, questGiver, hero, itemName)
local rewardItem = CreateItem(itemName, nil, nil)
if not rewardItem or rewardItem:IsNull() then
return
end
rewardItem:SetCurrentCharges(0)
local drop = CreateItemOnPositionForLaunch(
questGiver:GetAbsOrigin(),
rewardItem
)
if not drop then
UTIL_Remove(rewardItem)
return
end
rewardItem:LaunchLootInitialHeight(
false,
150,
200,
0.7,
hero:GetAbsOrigin()
)
questGiver:FaceTowards(hero:GetAbsOrigin())
end
--- Кладёт предмет квеста под ноги NPC, если некому кинуть герою.
local function dropQuestItemAtNpcFeet(self, questGiver, itemName)
local rewardItem = CreateItem(itemName, nil, nil)
if not rewardItem or rewardItem:IsNull() then
return
end
rewardItem:SetCurrentCharges(0)
local origin = questGiver:GetAbsOrigin()
local drop = CreateItemOnPositionForLaunch(origin, rewardItem)
if not drop then
UTIL_Remove(rewardItem)
return
end
rewardItem:LaunchLootInitialHeight(
false,
0,
80,
0.4,
origin
)
end
local function giveShovelToNearestHeroNearKunkka(self)
local questGiver = Entities:FindByName(nil, "npc_quest_giver_kunkka")
if not questGiver or questGiver:IsNull() then
print("[KunkkaQuest] npc_quest_giver_kunkka не найден — лопату не выдали")
return
end
local heroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
1400,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_CLOSEST,
false
)
for ____, unit in ipairs(heroes) do
do
local hero = unit
if not hero or hero:IsNull() or hero:FindItemInInventory("item_shovel") then
goto __continue28
end
dropQuestItemToHero(nil, questGiver, hero, "item_shovel")
return
end
::__continue28::
end
dropQuestItemAtNpcFeet(nil, questGiver, "item_shovel")
end
____exports.QuestEventHandlers = {
kunkka_quest_give_claw = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_give_claw_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_kunkka")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_wolf_claw",
questId = "kunkka_quest_give_claw",
objectiveKey = "custom_objective",
requiredCount = 10,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#kunkka_quest_give_claw_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#kunkka_quest_give_claw_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
7,
function()
GameRules:SendCustomMessage("#kunkka_quest_give_claw_message_complete_3", 0, 0)
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_kunkka",
"item_wolf_hat",
1400,
0,
150,
0.5,
RandomFloat(50, 100)
)
Timers:RemoveTimer(timertext2)
end
)
local timertext3
timertext3 = Timers:CreateTimer(
10,
function()
GameRules:SendCustomMessage("#kunkka_quest_give_claw_message_complete_4", 0, 0)
Timers:RemoveTimer(timertext3)
end
)
end,
onFail = function()
end
},
kunkka_quest_clean_harbor = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_clean_harbor_message_1", 0, 0)
showCleanHarborFlagPlacementMarkers(nil)
local questGiver = Entities:FindByName(nil, "npc_quest_giver_kunkka")
if questGiver ~= nil then
local item = CreateItem("item_clean_harbor", nil, nil)
if item then
local drop = CreateItemOnPositionForLaunch(
questGiver:GetAbsOrigin(),
item
)
local dropRadius = RandomFloat(50, 100)
local heroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
1400,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_CLOSEST,
false
)
if #heroes > 0 then
item:LaunchLootInitialHeight(
false,
0,
150,
0.5,
heroes[1]:GetAbsOrigin() + RandomVector(dropRadius)
)
end
end
end
end,
onComplete = function()
hideCleanHarborFlagPlacementMarkers(nil)
GameRules:SendCustomMessage("#kunkka_quest_clean_harbor_message_complete_1", 0, 0)
end,
onFail = function()
hideCleanHarborFlagPlacementMarkers(nil)
GameRules:SendCustomMessage("#kunkka_quest_clean_harbor_message_fail_1", 0, 0)
end
},
kunkka_quest_kill_lycan = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_kill_lycan_message_1", 0, 0)
local questSystem = QuestSystem:getInstance()
local lycanAlive = false
local entity = Entities:First()
while entity ~= nil do
if IsValidEntity(entity) then
local unit = entity
if unit.GetUnitName and unit:GetUnitName() == "npc_boss_lycan" then
if not unit:IsNull() and unit.IsAlive and unit:IsAlive() then
lycanAlive = true
break
end
end
end
entity = Entities:Next(entity)
end
if not lycanAlive then
questSystem:setQuestProgress("kunkka_quest_kill_lycan", "kill_lycan", 1)
end
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#kunkka_quest_kill_lycan_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end
},
kunkka_quest_kill_satyr_demon = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_kill_satyr_demon_message_1", 0, 0)
local questSystem = QuestSystem:getInstance()
local satyrAlive = false
local entity = Entities:First()
while entity ~= nil do
if IsValidEntity(entity) then
local unit = entity
if unit.GetUnitName and unit:GetUnitName() == "npc_demon_dragon_satyr" then
if not unit:IsNull() and unit.IsAlive and unit:IsAlive() then
satyrAlive = true
break
end
end
end
entity = Entities:Next(entity)
end
if not satyrAlive then
questSystem:setQuestProgress("kunkka_quest_kill_satyr_demon", "kill_satyr_demon", 1)
end
end,
onComplete = function()
GameRules:SendCustomMessage("#kunkka_quest_kill_satyr_demon_message_complete_1", 0, 0)
end,
onFail = function()
end
},
kunkka_quest_find_rom = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_find_rom_message_1", 0, 0)
local spawnPoints = Entities:FindAllByName("kunkka_rom_point")
if #spawnPoints > 0 then
local item = CreateItem("item_rom", nil, nil)
local physicalItem = CreateItemOnPositionForLaunch(
spawnPoints[1]:GetAbsOrigin(),
item
)
local dropRadius = RandomFloat(50, 100)
if item ~= nil then
item:LaunchLootInitialHeight(
false,
0,
150,
0.5,
spawnPoints[RandomInt(0, #spawnPoints - 1) + 1]:GetAbsOrigin() + RandomVector(dropRadius)
)
end
end
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_kunkka")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_rom",
questId = "kunkka_quest_find_rom",
objectiveKey = "custom_objective",
requiredCount = 1,
timerHandle = timer,
useCharges = false
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#kunkka_quest_find_rom_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#kunkka_quest_find_rom_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
7,
function()
GameRules:SendCustomMessage("#kunkka_quest_find_rom_message_complete_3", 0, 0)
Timers:RemoveTimer(timertext2)
end
)
local timertext3
timertext3 = Timers:CreateTimer(
10,
function()
GameRules:SendCustomMessage("#kunkka_quest_find_rom_message_complete_4", 0, 0)
Timers:RemoveTimer(timertext3)
end
)
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_kunkka",
"item_kunkka_sword",
1400,
0,
150,
0.5,
RandomFloat(50, 100)
)
end,
onFail = function()
end
},
kunkka_quest_2 = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_2_message_1", 0, 0)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#kunkka_quest_2_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#kunkka_quest_2_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
end
},
kunkka_quest_find_anchor = {
onAccept = function()
GameRules:SendCustomMessage("#kunkka_quest_find_anchor_message_1", 0, 0)
giveShovelToNearestHeroNearKunkka(nil)
end,
onComplete = function()
GameRules:SendCustomMessage("#kunkka_quest_find_anchor_message_complete_1", 0, 0)
end,
onFail = function()
GameRules:SendCustomMessage("#kunkka_quest_find_anchor_message_fail_1", 0, 0)
end
},
denny_quest_kill_sheeps = {
onAccept = function()
GameRules:SendCustomMessage("#denny_quest_kill_sheeps_message_1", 0, 0)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#denny_quest_kill_sheeps_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#denny_quest_kill_sheeps_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
end
},
denny_quest_kill_thieves = {
onAccept = function()
GameRules:SendCustomMessage("#denny_quest_kill_thieves_message_1", 0, 0)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#denny_quest_kill_thieves_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#denny_quest_kill_thieves_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
end,
onFail = function()
end
},
denny_quest_find_a_pet = {
onAccept = function()
GameRules:SendCustomMessage("#denny_quest_find_pet_message_1", 0, 0)
local questGiver = Entities:FindByName(nil, "npc_quest_giver_denny")
local item = CreateItem("item_pet", nil, nil)
if not item then
return
end
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
14000,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_CLOSEST,
false
)
local physicalItem = CreateItemOnPositionForLaunch(
questGiver and questGiver:GetAbsOrigin(),
item
)
if #nearbyHeroes > 0 then
item:LaunchLootInitialHeight(
false,
100,
150,
1,
nearbyHeroes[1]:GetAbsOrigin()
)
end
local point = Entities:FindByName(nil, "pet_point"):GetAbsOrigin()
local particle1 = ParticleManager:CreateParticle("particles/units/heroes/hero_bounty_hunter/bounty_hunter_track_trail_circle.vpcf", PATTACH_WORLDORIGIN, nil)
ParticleManager:SetParticleControl(particle1, 0, point)
local particle2 = ParticleManager:CreateParticle("particles/units/heroes/hero_bounty_hunter/bounty_hunter_track_shield_mark.vpcf", PATTACH_WORLDORIGIN, nil)
ParticleManager:SetParticleControl(particle2, 0, point)
local timer
timer = Timers:CreateTimer(function()
local nearbypet = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
point,
nil,
150,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_OUT_OF_WORLD,
FIND_CLOSEST,
false
)
if #nearbypet > 0 then
do
local i = 0
while i < #nearbypet do
local unit = nearbypet[i + 1]
local unitName = unit:GetUnitName()
if unitName == "npc_squirrel_event" or unitName == "npc_pig_event" or unitName == "npc_wolf_event" then
UTIL_Remove(unit)
local modifier
if unitName == "npc_squirrel_event" then
modifier = modifier_pet_buff_npc_squirrel_event.name
elseif unitName == "npc_pig_event" then
modifier = modifier_pet_buff_npc_pig_event.name
else
modifier = modifier_pet_buff_npc_wolf_event.name
end
local heroes = HeroList:GetAllHeroes()
do
local j = 0
while j < #heroes do
heroes[j + 1]:AddNewModifier(
heroes[j + 1],
getModifierSourceAbility(nil, heroes[j + 1]),
modifier,
{}
)
j = j + 1
end
end
local face = point - 1
local spawnunit = CreateUnitByName(
unitName,
point,
true,
nil,
nil,
DOTA_TEAM_GOODGUYS
)
spawnunit:FaceTowards(face)
local questSystem = QuestSystem:getInstance()
questSystem:setQuestProgress("denny_quest_find_pet", "find_a_pet", 1)
ParticleManager:DestroyParticle(particle1, false)
ParticleManager:DestroyParticle(particle2, false)
Timers:RemoveTimer(timer)
end
i = i + 1
end
end
else
local questSystem = QuestSystem:getInstance()
local quest = questSystem.quests:get("denny_quest_find_pet")
local questState = quest and quest.state
if questState == QuestState.FAILED then
Timers:RemoveTimer(timer)
ParticleManager:DestroyParticle(particle1, false)
ParticleManager:DestroyParticle(particle2, false)
return nil
end
end
return 0.66
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#denny_quest_find_pet_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
3,
function()
GameRules:SendCustomMessage("#denny_quest_find_pet_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
5,
function()
GameRules:SendCustomMessage("#denny_quest_find_pet_message_complete_3", 0, 0)
Timers:RemoveTimer(timertext2)
end
)
end
},
denny_quest_1 = {
onAccept = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
2,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
4,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_3", 0, 0)
local questGiver = Entities:FindByName(nil, "npc_quest_giver_denny")
local point = Entities:FindByName(nil, "point_denny_fight"):GetAbsOrigin()
if not (questGiver and questGiver:IsInstance(CDOTA_BaseNPC)) then
return
end
questGiver:SetAttackCapability(DOTA_UNIT_CAP_MELEE_ATTACK)
questGiver:MoveToPositionAggressive(toVectorWS(nil, point))
Timers:RemoveTimer(timertext2)
end
)
local rofltimer
rofltimer = Timers:CreateTimer(
9,
function()
local questSystem = QuestSystem:getInstance()
local quest = questSystem.quests:get("denny_quest_kill_sheeps")
local questState = quest and quest.state
if questState == QuestState.FAILED or questState == QuestState.COMPLETED then
Timers:RemoveTimer(rofltimer)
return nil
end
local Randomtext = RandomInt(1, 5)
if Randomtext == 1 then
GameRules:SendCustomMessage("#Denny_quest_1_rofl_message_1", 0, 0)
elseif Randomtext == 2 then
GameRules:SendCustomMessage("#Denny_quest_1_rofl_message_2", 0, 0)
elseif Randomtext == 3 then
GameRules:SendCustomMessage("#Denny_quest_1_rofl_message_3", 0, 0)
elseif Randomtext == 4 then
GameRules:SendCustomMessage("#Denny_quest_1_rofl_message_4", 0, 0)
elseif Randomtext == 5 then
GameRules:SendCustomMessage("#Denny_quest_1_rofl_message_5", 0, 0)
end
return 5
end
)
local hasSword = false
local timer
timer = Timers:CreateTimer(
4,
function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_denny")
if not questGiver then
return
end
if not hasSword then
local itemEntity = findNearestByClassname(
"dota_item_drop",
questGiver:GetAbsOrigin(),
450
)
if itemEntity ~= nil then
local containedItem = itemEntity:GetContainedItem()
if containedItem and not containedItem:IsNull() and containedItem:GetAbilityName() == "item_kunkka_sword" then
local sword = "item_kunkka_sword"
itemEntity:RemoveSelf()
questGiver:AddItemByName(sword)
questGiver:PickupDroppedItem(containedItem)
end
end
end
do
local i = 0
while i < 9 do
local item = questGiver:GetItemInSlot(i)
if item and item:GetAbilityName() == "item_kunkka_sword" then
hasSword = true
break
end
i = i + 1
end
end
local questSystem = QuestSystem:getInstance()
local progress = questSystem:getQuestProgress("denny_quest_kill_sheeps", "training_farm")
if not hasSword and progress >= 9 then
questSystem:failQuest("denny_quest_kill_sheeps")
local questGiver = Entities:FindByName(nil, "npc_quest_giver_denny")
local point = Entities:FindByName(nil, "new_point_denny"):GetAbsOrigin()
if not (questGiver and questGiver:IsInstance(CDOTA_BaseNPC)) then
return
end
questGiver:MoveToPosition(toVectorWS(nil, point))
Timers:RemoveTimer(timer)
Timers:RemoveTimer(rofltimer)
questGiver:SetAttackCapability(DOTA_UNIT_CAP_NO_ATTACK)
return nil
end
return 0.25
end
)
end,
onFail = function()
local timertext0
timertext0 = Timers:CreateTimer(
6,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_fail_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
9,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_fail_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
11,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_fail_3", 0, 0)
Timers:RemoveTimer(timertext2)
end
)
end,
onComplete = function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_denny")
local point = Entities:FindByName(nil, "new_point_denny"):GetAbsOrigin()
if not (questGiver and questGiver:IsInstance(CDOTA_BaseNPC)) then
return
end
questGiver:SetAttackCapability(DOTA_UNIT_CAP_NO_ATTACK)
questGiver:MoveToPosition(toVectorWS(nil, point))
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timer
timer = Timers:CreateTimer(
6,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_complete_2", 0, 0)
local timertext1
timertext1 = Timers:CreateTimer(
2.5,
function()
GameRules:SendCustomMessage("#Denny_quest_1_message_complete_3", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
do
local i = 0
while i < 9 do
local item = questGiver:GetItemInSlot(i)
if item and item:GetAbilityName() == "item_kunkka_sword" then
item:RemoveSelf()
break
end
i = i + 1
end
end
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_denny",
"item_kunkka_sword",
1400,
0,
150,
0.5,
RandomFloat(50, 100)
)
Timers:RemoveTimer(timer)
end
)
return nil
end
},
firestar_quest_1 = {
onAccept = function()
GameRules:SendCustomMessage("#firestar_quest_1_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_firestar")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_meat",
questId = "firestar_quest_1",
objectiveKey = "custom_objective",
requiredCount = 10,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#firestar_quest_1_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end
},
firestar_quest_gourmet = {
onAccept = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#firestar_quest_gourmet_message_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#firestar_quest_gourmet_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end
},
firestar_quest_leader_horn = {
onAccept = function()
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_firestar")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_lycan_horn",
questId = "firestar_quest_leader_horn",
objectiveKey = "bring_leader_horn",
requiredCount = 1,
timerHandle = timer,
useCharges = false
})
end
end
return 3
end)
end,
onComplete = function()
GameRules:SendCustomMessage("#firestar_quest_leader_horn_message_complete_1", 0, 0)
end
},
firestar_quest_fishing = {
onAccept = function()
GameRules:SendCustomMessage("#firestar_quest_fishing_message_1", 0, 0)
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_firestar",
"item_fishing_rod",
1400,
0,
150,
0.5,
RandomFloat(50, 100)
)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_firestar")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_fish",
questId = "firestar_quest_fishing",
objectiveKey = "bring_fish",
requiredCount = 10,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
GameRules:SendCustomMessage("#firestar_quest_fishing_message_complete_1", 0, 0)
end
},
oldmen_quest_1 = {
onAccept = function()
GameRules:SendCustomMessage("#oldmen_quest_1_message_1", 0, 0)
local requiredMilkCount = OLDMEN_MILK_BASE_REQUIRED * (oldmenMilkTurnInCount + 1)
QuestSystem:getInstance():setObjectiveRequired("oldmen_quest_1", "custom_objective", requiredMilkCount)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_oldmen")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_milk",
questId = "oldmen_quest_1",
objectiveKey = "custom_objective",
requiredCount = requiredMilkCount,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
oldmenMilkTurnInCount = oldmenMilkTurnInCount + 1
local nextRequiredMilkCount = OLDMEN_MILK_BASE_REQUIRED * (oldmenMilkTurnInCount + 1)
QuestSystem:getInstance():setObjectiveRequired("oldmen_quest_1", "custom_objective", nextRequiredMilkCount, false)
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#oldmen_quest_1_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
local timertext1
timertext1 = Timers:CreateTimer(
3,
function()
GameRules:SendCustomMessage("#oldmen_quest_1_message_complete_2", 0, 0)
Timers:RemoveTimer(timertext1)
end
)
local timertext2
timertext2 = Timers:CreateTimer(
5,
function()
GameRules:SendCustomMessage("#oldmen_quest_1_message_complete_3", 0, 0)
Timers:RemoveTimer(timertext2)
end
)
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_oldmen",
"item_testo",
1400,
0,
150,
0.5,
RandomFloat(50, 100)
)
local questSystem = QuestSystem:getInstance()
questSystem:resetQuest("oldmen_quest_1")
end
},
oldmen_quest_cheesemaker = {
onAccept = function()
GameRules:SendCustomMessage("#oldmen_quest_cheesemaker_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_oldmen")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_cheese",
questId = "oldmen_quest_cheesemaker",
objectiveKey = "bring_cheese",
requiredCount = 3,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#oldmen_quest_cheesemaker_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end
},
lina_quest_ent_heart = {
onAccept = function()
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_lina")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_ent_heart",
questId = "lina_quest_ent_heart",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#lina_quest_ent_heart_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
launchQuestRewardToNearestHero(nil, "npc_quest_giver_lina", "item_firecore")
end,
onFail = function()
end
},
lina_quest_bottle = {
onAccept = function()
launchQuestRewardToNearestHero(nil, "npc_quest_giver_lina", "item_pollen_keeper")
GameRules:SendCustomMessage("#lina_quest_bottle_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_lina")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_pollen_keeper",
questId = "lina_quest_bottle",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true,
removeFromHero = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#lina_quest_bottle_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
},
friend_quest_pizza_prep = {
onAccept = function()
GameRules:SendCustomMessage("#friend_quest_pizza_prep_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_friend")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
openRecipe(nil, "item_testo_pizza")
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_testo_pizza",
questId = "friend_quest_pizza_prep",
objectiveKey = "custom_objective",
requiredCount = 1,
timerHandle = timer,
useCharges = false,
removeFromHero = false
})
end
end
return 3
end)
end,
onComplete = function()
openRecipe(nil, "item_pizza")
openRecipe(nil, "item_mayonnaise")
GameRules:SendCustomMessage("#friend_quest_pizza_prep_message_complete_1", 0, 0)
launchQuestRewardToNearestHero(
nil,
"npc_quest_giver_friend",
"item_mayonnaise",
1400,
0,
150,
0.5
)
end,
onFail = function()
end
},
largo_quest_kill_frogs = {
onAccept = function()
GameRules:SendCustomMessage("#largo_quest_kill_frogs_message_1", 0, 0)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#largo_quest_kill_frogs_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
},
largo_quest_spider_legs = {
onAccept = function()
GameRules:SendCustomMessage("#largo_quest_spider_legs_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_largo")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_spider_legs_custom",
questId = "largo_quest_spider_legs",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#largo_quest_spider_legs_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
},
maiden_quest_eggs = {
onAccept = function()
GameRules:SendCustomMessage("#maiden_quest_eggs_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_maiden")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_egg",
questId = "maiden_quest_eggs",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#maiden_quest_eggs_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
},
doctor_quest_frog_paws = {
onAccept = function()
GameRules:SendCustomMessage("#doctor_quest_frog_paws_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_doctor")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_frog_paw",
questId = "doctor_quest_frog_paws",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#doctor_quest_frog_paws_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
},
doctor_quest_poison = {
onAccept = function()
GameRules:SendCustomMessage("#doctor_quest_poison_message_1", 0, 0)
local timer
timer = Timers:CreateTimer(function()
local questGiver = Entities:FindByName(nil, "npc_quest_giver_doctor")
if questGiver ~= nil then
local nearbyHeroes = FindUnitsInRadius(
DOTA_TEAM_GOODGUYS,
questGiver:GetAbsOrigin(),
nil,
700,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSIONS,
FIND_ANY_ORDER,
false
)
if #nearbyHeroes > 0 then
handleQuestItemTurnIn(nil, nearbyHeroes[1], {
itemName = "item_poison",
questId = "doctor_quest_poison",
objectiveKey = "custom_objective",
requiredCount = 20,
timerHandle = timer,
useCharges = true
})
end
end
return 3
end)
end,
onComplete = function()
local timertext0
timertext0 = Timers:CreateTimer(
0.1,
function()
GameRules:SendCustomMessage("#doctor_quest_poison_message_complete_1", 0, 0)
Timers:RemoveTimer(timertext0)
end
)
end,
onFail = function()
end
}
}
--- Трэк BH для квестовых всплывающих эффектов
function ____exports.precacheQuestBountyHunterParticles(self, context)
PrecacheResource("particle", "particles/units/heroes/hero_bounty_hunter/bounty_hunter_track_trail_circle.vpcf", context)
PrecacheResource("particle", "particles/units/heroes/hero_bounty_hunter/bounty_hunter_track_shield_mark.vpcf", context)
PrecacheResource("particle", "particles/econ/items/kunkka/divine_anchor/hero_kunkka_dafx_skills/kunkka_spell_x_spot_mark_red_fxset.vpcf", context)
end
return ____exports