using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using INILoader; namespace ItemDictionary { public partial class ItemDictionary : Form { private void LoadItemData() { String item_path = String.Format("{0}/config/sp2_item.ini", main_path); INILoader.INILoader item_file_loader = new INILoader.INILoader(item_path, false); item_file_loader.SetTitle("common_info"); int count = item_file_loader.LoadInt("item_group_cnt", 0); for (int i = 0; i < count; ++i) { String group_key = String.Format("item_group{0}", i + 1); String temp = item_file_loader.LoadString(group_key, ""); String path = String.Format("{0}\\config\\{1}", main_path, temp); if (File.Exists(path) == false) continue; INILoader.INILoader item_loader = new INILoader.INILoader(path, false); item_loader.SetTitle("common"); int item_count = item_loader.LoadInt("item_cnt", 0); if (item_count == 0) continue; for (int j = 0; j < item_count; ++j) { String title = String.Format("item{0}", j + 1); item_loader.SetTitle(title); ItemData data = new ItemData(); int code = item_loader.LoadInt("code", 0); int type = code/100000; switch( type ) { case 0: data.desc = "일반 무기"; break; case 1: data.desc = "일반 갑옷"; break; case 2: data.desc = "일반 투구"; break; case 3: data.desc = "일반 망토"; break; default: data.desc = "오브젝트"; break; } data.type = "장비"; data.name = item_loader.LoadString("name", ""); data.pack_name = item_loader.LoadString("item_large_icon0", ""); item_data_list.Add(data); } } } private void LoadExtraItemData() { String item_path = String.Format("{0}/config/sp2_extraitem.ini", main_path); INILoader.INILoader item_file_loader = new INILoader.INILoader(item_path, false); item_file_loader.SetTitle("common_info"); int count = item_file_loader.LoadInt("item_group_cnt", 0); for (int i = 0; i < count; ++i) { String group_key = String.Format("item_group{0}", i + 1); String temp = item_file_loader.LoadString(group_key, ""); String path = String.Format("{0}\\config\\{1}", main_path, temp); if (File.Exists(path) == false) continue; INILoader.INILoader item_loader = new INILoader.INILoader(path, false); item_loader.SetTitle("common"); int item_count = item_loader.LoadInt("item_cnt", 0); if (item_count == 0) continue; for (int j = 0; j < item_count; ++j) { String title = String.Format("item{0}", j + 1); item_loader.SetTitle(title); ItemData data = new ItemData(); int code = item_loader.LoadInt("code", 0); int type = code / 100000; switch (type) { case 0: data.desc = "고급 무기"; break; case 1: data.desc = "고급 갑옷"; break; case 2: data.desc = "고급 투구"; break; case 3: data.desc = "고급 망토"; break; default: data.desc = "오브젝트"; break; } data.type = "고급장비"; data.name = item_loader.LoadString("name", ""); data.pack_name = item_loader.LoadString("item_large_icon0", ""); data.item_code = code; item_data_list.Add(data); } } } private void LoadSkillData() { String skill_path = String.Format("{0}/config/sp2_skill.ini", main_path); INILoader.INILoader skill_file_loader = new INILoader.INILoader(skill_path, false); skill_file_loader.SetTitle( "common_info" ); int count = skill_file_loader.LoadInt( "skill_group_cnt", 0 ); for( int i=0; i 0 ) { ItemData item_data = item_data_list.Find( p => p.item_code == code ); if( !String.IsNullOrEmpty(item_data.pack_name) ) data.pack_name = item_data.pack_name; } } data.name = costume_loader.LoadString("name", ""); data.desc = ""; data.type = "코스튬"; item_data_list.Add(data); } } } private void LoadAccessoryData() { String path = String.Format("{0}/config/sp2_accessory.ini", main_path); INILoader.INILoader loader = new INILoader.INILoader(path, false); loader.SetTitle("common_info"); int count = loader.LoadInt("item_group_cnt", 0); for (int i = 0; i < count; ++i) { String group_key = String.Format("item_group{0}", i + 1); String temp = loader.LoadString(group_key, ""); String accessory_path = String.Format("{0}\\config\\{1}", main_path, temp); if (File.Exists(accessory_path) == false) continue; INILoader.INILoader item_loader = new INILoader.INILoader(accessory_path, false); item_loader.SetTitle("common"); int item_cnt = item_loader.LoadInt("item_cnt", 0); for (int j = 0; j < item_cnt; ++j) { String title = String.Format("item{0}", j + 1); item_loader.SetTitle(title); ItemData data = new ItemData(); data.pack_name = item_loader.LoadString("item_large_icon0", ""); data.name = item_loader.LoadString("name", ""); data.desc = ""; int desc_cnt = item_loader.LoadInt( "max_tooltip_text_size", 0 ); for( int k=0; k(); item_custom_list.Clear(); if (!File.Exists("./custom_desc.txt")) return; StreamReader sr = new StreamReader("./custom_desc.txt"); String szLine = String.Empty; while (sr.Peek() > -1) { szLine = sr.ReadLine(); char[] charSeparators = new char[] { ',' }; String[] RetString = szLine.Split(charSeparators, 2); if( RetString.Length == 2 ) { ItemCustomData data; data.pack_name = RetString[0]; data.desc = RetString[1]; item_custom_list.Add(data); } } sr.Close(); } private void SaveCustomDesc() { if( item_custom_list.Count == 0 ) return; StreamWriter sw = new StreamWriter("./custom_desc.txt"); foreach( ItemCustomData data in item_custom_list ) { if( String.IsNullOrEmpty(data.desc) ) continue; String line = String.Format( "{0},{1}", data.pack_name, data.desc ); sw.WriteLine(line); } sw.Close(); } } }