﻿-- chunkname: @scripts/settings/buff/buff_templates.lua

local BuffSettings = require("scripts/settings/buff/buff_settings")
local buff_categories = BuffSettings.buff_categories
local templates = {}

local function _create_entry(path, optional_default_buff_category)
	local entry_templates = require(path)

	for name, template in upairs(entry_templates) do
		templates[name] = template
		template.name = template.name or name
		template.buff_category = template.buff_category or optional_default_buff_category or buff_categories.generic
	end
end

_create_entry("scripts/settings/buff/boon_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/common_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/force_sword_2h_p1_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/gadget_buff_templates", buff_categories.gadget)
_create_entry("scripts/settings/buff/havoc_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/item_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/liquid_area_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/minion_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/mission_objective_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/mutator_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/player_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/syringe_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/training_grounds_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/weapon_buff_templates", buff_categories.generic)
_create_entry("scripts/settings/buff/hordes_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_cowboy_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_critical_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_electric_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_elementalist_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_fire_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_unkillable_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_family_buff_templates/hordes_unstoppable_family_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_adamant_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_generic_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_grenade_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_ogryn_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_psyker_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_veteran_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/hordes_buffs/hordes_legendary_buff_templates/hordes_legendary_zealot_buff_templates", buff_categories.hordes_buff)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_perks_melee_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_perks_ranged_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_autogun_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_autogun_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_autogun_p3_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_autopistol_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_bolter_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_boltpistol_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_chainaxe_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_chainsword_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_chainsword_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combataxe_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combataxe_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combataxe_p3_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combatknife_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combatsword_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combatsword_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_combatsword_p3_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_flamer_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcestaff_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcestaff_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcestaff_p3_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcestaff_p4_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcesword_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_forcesword_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_lasgun_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_lasgun_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_lasgun_p3_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_laspistol_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_club_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_club_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_combatblade_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_gauntlet_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_heavystubber_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_heavystubber_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_pickaxe_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_powermaul_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_powermaul_slabshield_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_rippergun_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_thumper_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_ogryn_thumper_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_plasmagun_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powermaul_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powermaul_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powermaul_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powermaul_shield_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powersword_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powersword_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_powersword_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_shotgun_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_shotgun_p2_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_shotgun_p4_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_shotpistol_shield_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_stubrevolver_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/weapon_traits_buff_templates/weapon_traits_bespoke_thunderhammer_2h_p1_buff_templates", buff_categories.weapon_traits)
_create_entry("scripts/settings/buff/archetype_buff_templates/shared_archetype_buff_templates", buff_categories.talents)
_create_entry("scripts/settings/buff/archetype_buff_templates/ogryn_buff_templates", buff_categories.talents)
_create_entry("scripts/settings/buff/archetype_buff_templates/psyker_buff_templates", buff_categories.talents)
_create_entry("scripts/settings/buff/archetype_buff_templates/veteran_buff_templates", buff_categories.talents)
_create_entry("scripts/settings/buff/archetype_buff_templates/zealot_buff_templates", buff_categories.talents)
_create_entry("scripts/settings/buff/archetype_buff_templates/adamant_buff_templates", buff_categories.talents)

local default_buff_icon = "content/ui/materials/icons/abilities/default"
local TEMPLATE_LOOKUPS = {
	NON_PREDICTED = {},
	PREDICTED = {},
}

for buff_name, template in pairs(templates) do
	template.name = buff_name
	template.predicted = not not template.predicted

	local target_lookup_table_name = template.predicted and "PREDICTED" or "NON_PREDICTED"

	TEMPLATE_LOOKUPS[target_lookup_table_name][buff_name] = buff_name

	if not template.icon then
		template.icon = default_buff_icon
	end
end

templates.NON_PREDICTED = TEMPLATE_LOOKUPS.NON_PREDICTED
templates.PREDICTED = TEMPLATE_LOOKUPS.PREDICTED

return settings("BuffTemplates", templates)
