public void Save(SHDialogsXml Dialogs, ref SHStringXml DialogString) { // 문자열 저장 File.Copy(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\name_dialog.xml", Directory.GetCurrentDirectory() + "\\Backup\\string_name_dialog." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); DialogString.Clear(); foreach (SHDialog dialog in Dialogs.dataList) { m_nSaySelectID = 0; string szKey = "DIALOG_TEXT_" + dialog.id.ToString(); AddString(szKey, dialog.text, ref DialogString); if (dialog.Say != null) { AddStringSay(dialog, dialog.Say, ref DialogString); } } DialogString.Compile(); // Save SHGlobal.Serialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path(SHLocaleType.KO_KR) + "name_dialog.xml", DialogString, Encoding.UTF8); }
public void Save(SHQuestsXml Quests, ref SHStringXml QuestString) { // 문자열 저장 File.Copy(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\name_quest.xml", Directory.GetCurrentDirectory() + "\\Backup\\string_name_quest." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); QuestString.Clear(); foreach (SHQuest quest in Quests.dataList) { string szKey = "QUEST_TITLE_" + quest.id.ToString(); AddString(szKey, quest.title, ref QuestString); szKey = "QUEST_DESC_" + quest.id.ToString(); AddString(szKey, quest.desc, ref QuestString); szKey = "QUEST_CATEGORY_" + quest.id.ToString(); AddString(szKey, quest.category, ref QuestString); if (quest.Objectives != null) { for (int r = 0; r < quest.Objectives.dataList.Count; r++) { SHQuestObjective obj = (SHQuestObjective)quest.Objectives.dataList[r]; szKey = "QUEST_OBJ_DESC_" + quest.id.ToString(); szKey = szKey + "_" + obj.id.ToString(); AddString(szKey, obj.desc, ref QuestString); } } } QuestString.Compile(); // Save SHGlobal.Serialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path(SHLocaleType.KO_KR) + "name_quest.xml", QuestString, Encoding.UTF8); }
public void SaveQuests() { if (Quests.LoadingFailed) { return; } CreateBackupDirectory(); SHQuestStringSaver stringSaver = new SHQuestStringSaver(); stringSaver.Save(Quests, ref LocalXml.QuestString); // Backup File.Copy(SHGlobal.GetServerSystemFolder() + "\\quest.xml", Directory.GetCurrentDirectory() + "\\Backup\\quest." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); // Save SHQuestStringReplacer replacer = new SHQuestStringReplacer(); replacer.ReplaceStringToKey(ref Quests); SHGlobal.Serialize <SHQuestsXml>(SHGlobal.GetClientSystemFolder() + "\\quest.xml", Quests, Encoding.UTF8); SHGlobal.Serialize <SHQuestsXml>(SHGlobal.GetServerSystemFolder() + "\\quest.xml", Quests, Encoding.UTF8); // 복구 replacer.ReplaceKeyToString(ref Quests, ref LocalXml.QuestString, false); }
public void SaveItemQuestRewarders() { SHItemRelatedNPCXml itemRelatedNPCXml = new SHItemRelatedNPCXml(); foreach (SHQuest quest in Quests.dataList) { foreach (SHQuestReward questReward in quest.Rewards.dataList) { if (SHQuestRewardType.ITEM != questReward.type) { continue; } string[] strParam1s = questReward.param1.Split(','); foreach (string strParam1 in strParam1s) { int nItemID = int.Parse(strParam1); ArrayList npcIDList = NPCs.GetNPCIDListByQuestID(quest.id); if (null == npcIDList) { continue; } SHItemRelatedNPC_Item itemRelatedNPC_Item = itemRelatedNPCXml[nItemID]; if (null == itemRelatedNPC_Item) { itemRelatedNPC_Item = new SHItemRelatedNPC_Item(); itemRelatedNPC_Item.id = nItemID; itemRelatedNPCXml.Add(itemRelatedNPC_Item); } foreach (int nNPCID in npcIDList) { SHItemRelatedNPC_NPC itemRelatedNPC_NPC = itemRelatedNPC_Item[nNPCID]; if (null == itemRelatedNPC_NPC) { itemRelatedNPC_NPC = new SHItemRelatedNPC_NPC(); itemRelatedNPC_NPC.id = nNPCID; itemRelatedNPC_Item.Add(itemRelatedNPC_NPC); } } } } } string strFileName = "\\item_questrewarder.xml"; if (File.Exists(SHGlobal.GetClientSystemFolder() + strFileName)) { CreateBackupDirectory(); // Backup File.Copy(SHGlobal.GetClientSystemFolder() + strFileName, Directory.GetCurrentDirectory() + "\\Backup\\conditions." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); } // Save SHGlobal.Serialize <SHItemRelatedNPCXml>(SHGlobal.GetClientSystemFolder() + strFileName, itemRelatedNPCXml, Encoding.UTF8); }
public void SaveItemDropers() { SHItemRelatedNPCXml itemRelatedNPCXml = new SHItemRelatedNPCXml(); foreach (SHLoot loot in Lootings.dataList) { for (int i = 0; i < loot.dataList.Count; i++) { if (loot.dataList[i].GetType() != typeof(SHLootItem)) { continue; } SHLootItem lootItem = loot.dataList[i] as SHLootItem; ArrayList npcIDList = NPCs.GetNPCIDListByLootID(loot.id); if (null == npcIDList) { continue; } SHItemRelatedNPC_Item itemRelatedNPC_Item = itemRelatedNPCXml[lootItem.id]; if (null == itemRelatedNPC_Item) { itemRelatedNPC_Item = new SHItemRelatedNPC_Item(); itemRelatedNPC_Item.id = lootItem.id; itemRelatedNPCXml.Add(itemRelatedNPC_Item); } foreach (int nNPCID in npcIDList) { SHItemRelatedNPC_NPC itemRelatedNPC_NPC = itemRelatedNPC_Item[nNPCID]; if (null == itemRelatedNPC_NPC) { itemRelatedNPC_NPC = new SHItemRelatedNPC_NPC(); itemRelatedNPC_NPC.id = nNPCID; itemRelatedNPC_Item.Add(itemRelatedNPC_NPC); } } } } string strFileName = "\\item_droper.xml"; if (File.Exists(SHGlobal.GetClientSystemFolder() + strFileName)) { CreateBackupDirectory(); // Backup File.Copy(SHGlobal.GetClientSystemFolder() + strFileName, Directory.GetCurrentDirectory() + "\\Backup\\conditions." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); } // Save SHGlobal.Serialize <SHItemRelatedNPCXml>(SHGlobal.GetClientSystemFolder() + strFileName, itemRelatedNPCXml, Encoding.UTF8); }
public void SaveStrings() { if (Strings.LoadingFailed) { return; } CreateBackupDirectory(); // Backup File.Copy(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\strings.xml", Directory.GetCurrentDirectory() + "\\Backup\\strings." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); // Save SHGlobal.Serialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\strings.xml", Strings, Encoding.UTF8); }
public void SaveLootings() { if (Lootings.LoadingFailed) { return; } CreateBackupDirectory(); // Backup File.Copy(SHGlobal.GetServerSystemFolder() + "\\loot.xml", Directory.GetCurrentDirectory() + "\\Backup\\loot." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); // Save SHGlobal.Serialize <SHLootingsXml>(SHGlobal.GetServerSystemFolder() + "\\loot.xml", Lootings, Encoding.UTF8); }
public void SaveItemConditions() { if (ItemConditions.LoadingFailed) { return; } CreateBackupDirectory(); // Backup File.Copy(SHGlobal.GetServerSystemFolder() + "\\conditions_item.xml", Directory.GetCurrentDirectory() + "\\Backup\\conditions_item." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); // Save SHGlobal.Serialize <SHConditionsXml>(SHGlobal.GetClientSystemFolder() + "\\conditions_item.xml", ItemConditions, Encoding.UTF8); SHGlobal.Serialize <SHConditionsXml>(SHGlobal.GetServerSystemFolder() + "\\conditions_item.xml", ItemConditions, Encoding.UTF8); }
public void SaveNPCString() { if (NPCs.LoadingFailed) { return; } CreateBackupDirectory(); File.Copy(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\name_npc.xml", Directory.GetCurrentDirectory() + "\\Backup\\string_name_npc." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); // Save SHGlobal.Serialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path(SHLocaleType.KO_KR) + "name_npc.xml", LocalXml.NPCNameString, Encoding.UTF8); }
public bool LoadNPCs() { NPCs = SHGlobal.Deserialize <SHNPCsXml>(SHGlobal.GetServerSystemFolder() + "\\npc.xml", Encoding.UTF8); if (NPCs == null) { NPCs = new SHNPCsXml(); NPCs.LoadingFail(); } foreach (SHNPC npc in NPCs.dataList) { string szKey = "NPC_NAME_" + npc.id.ToString(); if (LocalXml.NPCNameString.IsValid(szKey)) { string szValue = LocalXml.NPCNameString[szKey].ToString(); npc.Name = szValue; } } SHGlobal.Serialize <SHNPCsXml>(SHGlobal.GetServerSystemFolder() + "\\npc_translated.xml", NPCs, Encoding.UTF8); SHGlobal.Serialize <SHNPCsXml>(SHGlobal.GetClientSystemFolder() + "\\npc_translated.xml", NPCs, Encoding.UTF8); return(NPCs.Compile()); }
public void SaveRecipeByNPC() { SHRecipeNPCXml RecipeNPCXml = new SHRecipeNPCXml(); foreach (SHRecipe recipe in Recipe.dataList) { SHRecipeNPC sNPC = new SHRecipeNPC(); sNPC.recipe = recipe.id; int Index = 0; foreach (SHCraft craft in Craft.dataList) { foreach (int recipeid in craft.RecipeIDList) { if (recipe.id == recipeid) { foreach (SHNPC npc in NPCs.dataList) { SHNPCIType[] _iType = npc.GetIType(); string[] _iAct = npc.GetIAct(); for (int i = 0; i < 10; i++) { if (_iType[i] == SHNPCIType.craft) { if (Craft.IsValid(_iAct[i]) == false) { continue; } SHCraft craftinfo = Craft[_iAct[i]]; if (craftinfo.hidden == true) { continue; } int cID = Convert.ToInt32(_iAct[i]); if (craft.id == cID) { // if (Index >= 10) { break; } int FieldID = GetFieldIDByNPC(npc.id); if (FieldID == 0) { continue; } sNPC.Add(Index, npc.id.ToString(), FieldID.ToString()); Index++; break; } } } } } } } RecipeNPCXml.Add(sNPC); } string strFileName = "\\recipeNPC.xml"; SHGlobal.Serialize <SHRecipeNPCXml>(SHGlobal.GetClientSystemFolder() + strFileName, RecipeNPCXml, Encoding.UTF8); }
public void NPCInfoSave(int fieldID) { string strFieldFileName = String.Format("\\{0}.field.xml", fieldID); if (File.Exists(SHGlobal.GetClientFieldFolder() + strFieldFileName) == false) { return; } SHFieldXml field = SHGlobal.Deserialize <SHFieldXml>(SHGlobal.GetClientFieldFolder() + strFieldFileName, Encoding.UTF8); field.Compile(); SHFieldNPCXml fieldNPCXml = new SHFieldNPCXml(); foreach (SHSpawn spawn in field.fieldInfo.spawnList) { if (false == spawn.enabled) { continue; } foreach (SHSpawnNPC spawnnpc in spawn.dataList) { if (NPCs.IsValid(spawnnpc.id) == false) { continue; } SHNPC npc = NPCs[spawnnpc.id]; if (npc.InteractCount == 0) { continue; } string[] _Type = new string[2]; string[] _ICon = new string[2]; int Index = 0; SHNPCIType[] _iType = npc.GetIType(); string[] _iAct = npc.GetIAct(); for (int i = 0; i < 10; i++) { if (_iType[i] == SHNPCIType.craft) { if (Craft.IsValid(_iAct[i]) == false) { continue; } SHCraft craftinfo = Craft[_iAct[i]]; if (craftinfo.hidden == true) { continue; } _Type[Index] = "craft"; _ICon[Index] = craftinfo.type; Index++; break; } } for (int i = 0; i < 10; i++) { if (_iType[i] == SHNPCIType.trade) { if (NPCShop.IsValid(_iAct[i]) == false) { continue; } _ICon[Index] = "common"; SHNPCShop npcshop = NPCShop[_iAct[i]]; if (npcshop.repairable == true) { _ICon[Index] = "repair"; } if (npcshop.IsLicensable(Items, Talents) == true) { _ICon[Index] = "license"; } _Type[Index] = "shop"; Index++; break; } } if (Index == 0) { continue; } SHFieldNPC sNPC = new SHFieldNPC(); sNPC.id = spawnnpc.id; sNPC.name = npc.Name; sNPC.x = spawn.x; sNPC.y = spawn.y; sNPC.z = spawn.z; sNPC.type1 = _Type[0]; sNPC.icon1 = _ICon[0]; sNPC.type2 = _Type[1]; sNPC.icon2 = _ICon[1]; fieldNPCXml.Add(sNPC); } } if (fieldNPCXml.dataList.Count == 0) { return; } string strFileName = String.Format("\\{0}.field.npc.xml", fieldID); SHGlobal.Serialize <SHFieldNPCXml>(SHGlobal.GetClientFieldFolder() + "\\map" + strFileName, fieldNPCXml, Encoding.UTF8); }
public void SaveColt(String path, SHColtXml xmlData) { SHGlobal.Serialize <SHColtXml>(path, xmlData, Encoding.UTF8); }