using System; using System.Collections.Generic; using UnityEngine; namespace TKS.OutGame { /// /// 승급 장비 = 병종 5 × 부위 6 × 등급 7 = 210(gear_items.csv · 2026-11-20 장비 등급 드랍 요청서) · 등급 = gear_grades(일반 ~ 신화 · 순서 · 이름 · 색) · /// 병종 · 부위 = gear_kinds(n_slot = 승급 장비 칸) · 스테이지 드랍 = gear_drop_chapters(장 → 등급 가중치) + stage_drop(스테이지 → 지역 특화 · 배율 · 지정 장비 2종) + drop_rules(상자 굴림 · 몫 · 2026-11-23). /// public class GearDb : ScriptableObject { [Serializable] public class Item { public string id; public string nameKo; public string kind; [Tooltip("gear_grades s_grade(white … red)")] public string grade; [Tooltip("등급 순서 1~ (gear_grades n_order · 합성 사슬 = 같은 병종 · 부위 아래 등급)")] public int order; public int sellGold; public int dropFromChapter; public string craftFrom; public int craftCount; public int craftBlueprint; [Tooltip("병종 키(infantry · spear · cavalry · archer · strategist)")] public string unitType = ""; [Tooltip("UI 테마 아이콘 id")] public string icon = ""; [Tooltip("장착 능력치 %(표 값 · 지금 능력치 계산에는 쓰지 않음 = economy gear_bonus_pct)")] public float statPct; } [Serializable] public class Grade { public string grade = ""; public int order; public string nameKo = ""; public string color = ""; } [Serializable] public class Kind { public string unitType = ""; public string unitKo = ""; public string kind = ""; public string kindKo = ""; public int slot; public string nameKo = ""; public string icon = ""; } [Serializable] public class ChapterDrop { public int chapter; public string[] grades = new string[0]; public float[] weights = new float[0]; } /// 스테이지 드랍(stage_drop.csv · 2026-11-23 스테이지 보상 드랍 요청서) — 지역 특화 · 배율 · 지정 장비(한 병종의 부위 2개). [Serializable] public class StageDrop { public int chapter; public int stage; [Tooltip("지역 특화 = gold · exp · gear(s_region)")] public string region = ""; public float goldMult = 1f; public float expMult = 1f; [Tooltip("상자 기대 개수 배율(스테이지 종류 × 지역 · 표에서 이미 곱한 값)")] public float gearMult = 1f; public string unitType = ""; [Tooltip("지정 부위(l_kind · 한 병종의 부위 2개 · 반반)")] public string[] kinds = new string[0]; [Tooltip("어려움 보스 조각 영웅(추후 · 자리만)")] public string[] hardShardHeroes = new string[0]; } /// 드랍 규칙(drop_rules.csv 키 · 값) — 상자 굴림 수 · 상자를 든 적 가중치 · 처치 몫 가중치 · 보스 첫 클리어 확정 상자 · 지정 장비 몫 %. [Serializable] public class DropRules { public int chestRolls; public float carrierSoldier; public float carrierGeneral; public float carrierBoss; public float shareSoldier; public float shareGeneral; public float shareBoss; public int bossFirstChest; public float focusPct; } public const string RegionGold = "gold"; public const string RegionExp = "exp"; public const string RegionGear = "gear"; public List items = new List(); public List grades = new List(); public List kinds = new List(); public List chapterDrops = new List(); public List stageDrops = new List(); public DropRules rules = new DropRules(); public Grade GradeOf(string g) { foreach (var x in grades) if (x.grade == g) return x; return null; } /// 등급 색 목록(s_color 「;」 · 2개 이상 = 화면에서 순환하는 무지개). public Color[] ColorsOf(string g) { var x = GradeOf(g); if (x == null || string.IsNullOrEmpty(x.color)) return new Color[0]; var parts = x.color.Split(';'); var res = new List(); foreach (var p in parts) { Color c; if (ColorUtility.TryParseHtmlString(p, out c)) res.Add(c); } return res.ToArray(); } /// 장비 등급 이름(gear_grades s_name_ko · 없으면 키). public string GradeName(string g) { var x = GradeOf(g); return x != null ? x.nameKo : g; } /// 그 장의 드랍 등급 줄(표 끝을 넘는 장 = 마지막 줄). public ChapterDrop DropFor(int chapter) { ChapterDrop last = null; foreach (var c in chapterDrops) { if (c.chapter == chapter) return c; if (last == null || c.chapter > last.chapter) last = c; } return last != null && chapter > last.chapter ? last : null; } public StageDrop FocusFor(int chapter, int stage) { foreach (var s in stageDrops) if (s.chapter == chapter && s.stage == stage) return s; return null; } /// 병종 · 부위 · 등급 장비. public Item Find(string unitType, string kind, string grade) { foreach (var i in items) if (i.unitType == unitType && i.kind == kind && i.grade == grade) return i; return null; } Dictionary index; public Item Get(string id) { if (string.IsNullOrEmpty(id)) return null; if (index == null || index.Count != items.Count) { index = new Dictionary(); foreach (var i in items) index[i.id] = i; } Item res; return index.TryGetValue(id, out res) ? res : null; } public void InvalidateIndex() { index = null; } /// 등급 id → 순서(gear_grades · 표가 없으면 장비에서 · 없으면 0). public int OrderOf(string grade) { var g = GradeOf(grade); if (g != null) return g.order; foreach (var i in items) if (i.grade == grade) return i.order; return 0; } } }