using System.Collections.Generic;
using UnityEngine;
namespace TKS.OutGame
{
/// 영웅 「정보」 화면 표 3장 해석·검증(2026-11-20 개발요청_영웅정보 §1).
public static partial class OutGameTables
{
static readonly string[] InfoSections = { "Base", "Battle" };
static readonly string[] InfoShows = { "BaseBonus", "Total", "Value" };
static readonly string[] InfoBaseKeys = { "hp", "atk", "def", "power" };
static readonly string[] InfoSourceKeys = { "lv", "promo", "star", "train", "treasure", "awaken" };
static HeroInfoDb ParseHeroInfo(Dictionary>> rows, OutGameData d, List e)
{
var t = ScriptableObject.CreateInstance();
const string fs = "hero_info_stats.csv";
if (Cols(rows[fs], fs, e, "n_order", "s_key", "s_name_ko", "e_section", "e_show"))
{
var seen = new HashSet();
foreach (var r in rows[fs])
{
var s = new HeroInfoDb.StatRow { order = Int(r, "n_order", fs, e), key = Get(r, "s_key"), nameKo = Get(r, "s_name_ko"), section = Get(r, "e_section"), show = Get(r, "e_show") };
if (!Unique(seen, s.key, fs, r, e)) continue;
CfgIs(s.section, fs + " " + s.key + " e_section", e, InfoSections);
CfgIs(s.show, fs + " " + s.key + " e_show", e, InfoShows);
if (s.section == "Base") CfgIs(s.key, fs + " Base 키", e, InfoBaseKeys);
else if (d.Awaken != null && d.Awaken.StatOf(s.key) == null && s.nameKo.Length == 0) e.Add(fs + ": " + s.key + " 이름 없음(awaken_stats 에도 없음)");
else if (!AwakenRules.Known(s.key)) e.Add(fs + ": " + s.key + " = 전투 효과 키가 아님");
t.stats.Add(s);
}
t.stats.Sort((a, b) => a.order.CompareTo(b.order));
}
const string fo = "hero_info_sources.csv";
if (Cols(rows[fo], fo, e, "n_order", "s_key", "s_name_ko", "s_goto"))
{
foreach (var r in rows[fo])
{
var s = new HeroInfoDb.SourceRow { order = Int(r, "n_order", fo, e), key = Get(r, "s_key"), nameKo = Get(r, "s_name_ko"), go = Get(r, "s_goto") };
CfgIs(s.key, fo + " s_key", e, InfoSourceKeys);
t.sources.Add(s);
}
t.sources.Sort((a, b) => a.order.CompareTo(b.order));
}
const string fc = "hero_chronicle.csv";
if (Cols(rows[fc], fc, e, "s_hero_id", "n_order", "s_year", "s_title_ko", "s_text_ko", "s_scenario", "s_epithet"))
foreach (var r in rows[fc])
{
var ev = new HeroInfoDb.Event { hero = Get(r, "s_hero_id"), order = Int(r, "n_order", fc, e), year = Get(r, "s_year"), title = Get(r, "s_title_ko"), text = Get(r, "s_text_ko"), scenario = Get(r, "s_scenario"), epithet = Get(r, "s_epithet") };
if (d.Heroes != null && d.Heroes.Get(ev.hero) == null) e.Add(fc + ": 영웅 「" + ev.hero + "」 = heroes 에 없음");
t.chronicle.Add(ev);
}
return t;
}
}
}