198 lines
7.9 KiB
Lua
198 lines
7.9 KiB
Lua
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
local ____exports = {}
|
|
--- Каталог арсенала: реестр всех экип-предметов и список играбельных героев.
|
|
--
|
|
-- Раскладывается в две NetTable:
|
|
-- - "arsenal_catalog" / "items" → ArsenalItemDef[]
|
|
-- - "arsenal_catalog" / "heroes" → string[] (npc_dota_hero_*)
|
|
local DEFAULT_ITEM_ICON = "s2r://panorama/images/items/recipe_psd.vtex"
|
|
local ARSENAL_ICON = {
|
|
weapon = {ironBlade = "file://{images}/custom_game/arsenal/ironblade.png", stormEdge = "file://{images}/custom_game/arsenal/stormedge.png", sunfangSaber = "file://{images}/custom_game/arsenal/sunfangsaber.png"},
|
|
armor = {chainMail = "file://{images}/custom_game/arsenal/chainmail.png", dragonPlate = "file://{images}/custom_game/arsenal/dragonplate.png", vanguardShell = "file://{images}/custom_game/arsenal/vanguardshell.png"},
|
|
helmet = {leatherCap = "file://{images}/custom_game/arsenal/leathercap.png", arcaneCirclet = "file://{images}/custom_game/arsenal/arcanecirclet.png", warcrownMask = "file://{images}/custom_game/arsenal/warcrownmask.png"},
|
|
boots = {swiftBoots = "file://{images}/custom_game/arsenal/swiftboots.png", phaseTreads = "file://{images}/custom_game/arsenal/phasetreads.png", hermesGreaves = "file://{images}/custom_game/arsenal/hermesgreaves.png"},
|
|
necklace = {amberPendant = "file://{images}/custom_game/arsenal/amberpendant.png", soulLocket = "file://{images}/custom_game/arsenal/soullocket.png", prismChoker = "file://{images}/custom_game/arsenal/prismchoker.png"},
|
|
ring = {copperBand = "file://{images}/custom_game/arsenal/copperband.png", voidSignet = "file://{images}/custom_game/arsenal/voidsignet.png", titanLoop = "file://{images}/custom_game/arsenal/titancircle.png"}
|
|
}
|
|
--- Перечень слотов в порядке отображения в UI.
|
|
____exports.ARSENAL_SLOTS = {
|
|
"weapon",
|
|
"armor",
|
|
"helmet",
|
|
"boots",
|
|
"necklace",
|
|
"ring"
|
|
}
|
|
--- Полный список экип-предметов. Эффекты — отдельные модификаторы в
|
|
-- `src/vscripts/arsenal/items/<slot>/...` (имена согласованы с полем `modifier`).
|
|
--
|
|
-- Это базовый набор-каркас (по 2 предмета на слот). Расширять отдельной задачей.
|
|
____exports.ARSENAL_ITEMS = {
|
|
{
|
|
itemName = "item_arsenal_weapon_iron_blade",
|
|
slot = "weapon",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_weapon_iron_blade",
|
|
icon = ARSENAL_ICON.weapon.ironBlade
|
|
},
|
|
{
|
|
itemName = "item_arsenal_weapon_storm_edge",
|
|
slot = "weapon",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_weapon_storm_edge",
|
|
icon = ARSENAL_ICON.weapon.stormEdge
|
|
},
|
|
{
|
|
itemName = "item_arsenal_weapon_sunfang_saber",
|
|
slot = "weapon",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_weapon_storm_edge",
|
|
icon = ARSENAL_ICON.weapon.sunfangSaber
|
|
},
|
|
{
|
|
itemName = "item_arsenal_armor_chain_mail",
|
|
slot = "armor",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_armor_chain_mail",
|
|
icon = ARSENAL_ICON.armor.chainMail
|
|
},
|
|
{
|
|
itemName = "item_arsenal_armor_dragon_plate",
|
|
slot = "armor",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_armor_dragon_plate",
|
|
icon = ARSENAL_ICON.armor.dragonPlate
|
|
},
|
|
{
|
|
itemName = "item_arsenal_armor_vanguard_shell",
|
|
slot = "armor",
|
|
quality = "epic",
|
|
modifier = "modifier_arsenal_armor_dragon_plate",
|
|
icon = ARSENAL_ICON.armor.vanguardShell
|
|
},
|
|
{
|
|
itemName = "item_arsenal_helmet_leather_cap",
|
|
slot = "helmet",
|
|
quality = "rare",
|
|
modifier = "modifier_arsenal_helmet_leather_cap",
|
|
icon = ARSENAL_ICON.helmet.leatherCap
|
|
},
|
|
{
|
|
itemName = "item_arsenal_helmet_arcane_circlet",
|
|
slot = "helmet",
|
|
quality = "rare",
|
|
modifier = "modifier_arsenal_helmet_arcane_circlet",
|
|
icon = ARSENAL_ICON.helmet.arcaneCirclet
|
|
},
|
|
{
|
|
itemName = "item_arsenal_helmet_warcrown_mask",
|
|
slot = "helmet",
|
|
quality = "rare",
|
|
modifier = "modifier_arsenal_helmet_arcane_circlet",
|
|
icon = ARSENAL_ICON.helmet.warcrownMask
|
|
},
|
|
{
|
|
itemName = "item_arsenal_boots_swift_boots",
|
|
slot = "boots",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_boots_swift_boots",
|
|
icon = ARSENAL_ICON.boots.swiftBoots
|
|
},
|
|
{
|
|
itemName = "item_arsenal_boots_phase_treads",
|
|
slot = "boots",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_boots_phase_treads",
|
|
icon = ARSENAL_ICON.boots.phaseTreads
|
|
},
|
|
{
|
|
itemName = "item_arsenal_boots_hermes_greaves",
|
|
slot = "boots",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_boots_phase_treads",
|
|
icon = ARSENAL_ICON.boots.hermesGreaves
|
|
},
|
|
{
|
|
itemName = "item_arsenal_necklace_amber_pendant",
|
|
slot = "necklace",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_necklace_amber_pendant",
|
|
icon = ARSENAL_ICON.necklace.amberPendant
|
|
},
|
|
{
|
|
itemName = "item_arsenal_necklace_soul_locket",
|
|
slot = "necklace",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_necklace_soul_locket",
|
|
icon = ARSENAL_ICON.necklace.soulLocket
|
|
},
|
|
{
|
|
itemName = "item_arsenal_necklace_prism_choker",
|
|
slot = "necklace",
|
|
quality = "legendary",
|
|
modifier = "modifier_arsenal_necklace_soul_locket",
|
|
icon = ARSENAL_ICON.necklace.prismChoker
|
|
},
|
|
{
|
|
itemName = "item_arsenal_ring_copper_band",
|
|
slot = "ring",
|
|
quality = "mythic",
|
|
modifier = "modifier_arsenal_ring_copper_band",
|
|
icon = ARSENAL_ICON.ring.copperBand
|
|
},
|
|
{
|
|
itemName = "item_arsenal_ring_void_signet",
|
|
slot = "ring",
|
|
quality = "mythic",
|
|
modifier = "modifier_arsenal_ring_void_signet",
|
|
icon = ARSENAL_ICON.ring.voidSignet
|
|
},
|
|
{
|
|
itemName = "item_arsenal_ring_titan_loop",
|
|
slot = "ring",
|
|
quality = "mythic",
|
|
modifier = "modifier_arsenal_ring_void_signet",
|
|
icon = ARSENAL_ICON.ring.titanLoop
|
|
}
|
|
}
|
|
--- Карта itemName → ArsenalItemDef (для быстрого поиска по имени).
|
|
____exports.ARSENAL_ITEMS_MAP = (function()
|
|
local map = {}
|
|
for ____, item in ipairs(____exports.ARSENAL_ITEMS) do
|
|
map[item.itemName] = item
|
|
end
|
|
return map
|
|
end)(nil)
|
|
--- Парс `scripts/npc/herolist.txt` → имена героев со значением `>0` или `-1` (включённые).
|
|
-- Тот же фильтр, что в `GameMode.getEnabledHeroesFromHeroList`.
|
|
function ____exports.getEnabledHeroes(self)
|
|
local rawKv = LoadKeyValues("scripts/npc/herolist.txt")
|
|
local ____temp_2 = rawKv and rawKv.CustomHeroList
|
|
if ____temp_2 == nil then
|
|
____temp_2 = rawKv
|
|
end
|
|
local heroList = ____temp_2
|
|
if not heroList then
|
|
return {}
|
|
end
|
|
local result = {}
|
|
for heroName in pairs(heroList) do
|
|
local value = tonumber(tostring(heroList[heroName])) or 0
|
|
if value > 0 or value == -1 then
|
|
result[#result + 1] = tostring(heroName)
|
|
end
|
|
end
|
|
return result
|
|
end
|
|
--- Опубликовать каталог и список героев в NetTable. Вызывать один раз при старте сервера.
|
|
function ____exports.publishArsenalCatalog(self)
|
|
CustomNetTables:SetTableValue("arsenal_catalog", "items", ____exports.ARSENAL_ITEMS)
|
|
CustomNetTables:SetTableValue(
|
|
"arsenal_catalog",
|
|
"heroes",
|
|
{list = ____exports.getEnabledHeroes(nil)}
|
|
)
|
|
CustomNetTables:SetTableValue("arsenal_catalog", "slots", {list = ____exports.ARSENAL_SLOTS})
|
|
end
|
|
return ____exports
|