using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; namespace TKS { /// /// 맹장 토벌전 표 해석(컨텐츠 모드 기획 10판 ③ · 표 = raid_rotation · raid_boss_stats · raid_rewards · raid_shop · raid_banners · raid_layout · content_modes_config raid.*). /// 서버(ThreeKingdomsServer `domain/warlord.rules.ts`)와 같은 일정 규칙: 메인 = 주마다 n_order 순서 · 서브 = 그 주 메인 다음 순서부터 하루씩. /// public static class RaidData { public const string Mode = "raid"; public const string Rotation = "raid_rotation"; public const string Stats = "raid_boss_stats"; public const string Rewards = "raid_rewards"; public const string Shop = "raid_shop"; public const string Banners = "raid_banners"; /// 맹장 · 출전 자리 · 딸린 것 자리 표(기획 세션 요청 · 2026-11-18). public const string Layout = "raid_layout"; public const string Main = "main"; public const string Sub = "sub"; public class Boss { public int order; public string id, nameKo, titleKo, art, orderBuffKo, patternKo, weakKo; public int hpCap; public ContentRow stats; } public static List Bosses() { var res = new List(); foreach (var r in ContentTables.Rows(Rotation)) { var b = new Boss { order = r.I("n_order"), id = r.S("s_boss_id"), nameKo = r.S("s_boss_name_ko"), titleKo = r.S("s_title_ko"), art = r.S("s_art"), orderBuffKo = r.S("s_order_buff_ko"), patternKo = r.S("s_pattern_ko"), weakKo = r.S("s_weak_ko"), hpCap = r.I("n_hp"), }; b.stats = ContentTables.Find(Stats, "s_boss_id", b.id); res.Add(b); } res.Sort((a, b) => a.order.CompareTo(b.order)); return res; } public static Boss Get(string id) { foreach (var b in Bosses()) if (b.id == id) return b; return null; } /// /// 이번 주 메인 · 오늘 서브(기기 일정 — 서버 모드는 서버 값). 주 = 현지 월요일 0시 시작 · 주 번호 = 2000-01-03(월) 부터 센 주. /// main = bosses[(주 − 1) % n] · sub = 메인 다음 순서부터 하루씩(raid.sub_order after_main · sub_days). /// public static void Schedule(DateTime nowUtc, out int week, out string main, out string sub) { var list = Bosses(); week = 0; main = sub = ""; if (list.Count == 0) return; int mainDays = Mathf.Max(1, ContentTables.Int(Mode, "main_days")); int subDays = Mathf.Max(1, ContentTables.Int(Mode, "sub_days")); var local = nowUtc.ToLocalTime().Date; var epoch = new DateTime(2000, 1, 3); int days = (int)(local - epoch).TotalDays; week = days / mainDays + 1; int day = (days % mainDays) / subDays; int n = list.Count, mainIdx = ((week - 1) % n + n) % n; main = list[mainIdx].id; if (n > 1) sub = list[(mainIdx + 1 + day % (n - 1)) % n].id; } /// 자리별 하루 기록 도전 수(raid.entries_split = 「main:1;sub:1」). public static int EntryLimit(string slot) { float v; return ContentTables.Map(Mode, "entries_split").TryGetValue(slot, out v) ? Mathf.RoundToInt(v) : 0; } public static float ScoreMult(string slot) { return ContentTables.Num(Mode, slot == Main ? "main_score_mult" : "sub_score_mult"); } public static string BannerArt(string bossId) { return "raid_banner_" + bossId + "_" + ContentTables.Str(Mode, "banner_size"); } } }