Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
 public void LoadStrings()
 {
     Strings = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\strings.xml", Encoding.UTF8);
     if (Strings == null)
     {
         Strings = new SHStringXml();
         Strings.LoadingFail();
     }
     Strings.Compile();
 }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
        public void SaveItems()
        {
            if (Items.LoadingFailed)
            {
                return;
            }

            CreateBackupDirectory();
            // Backup
            File.Copy(SHGlobal.GetClientSystemFolder() + "\\xitem.xml", Directory.GetCurrentDirectory() + "\\Backup\\xitem." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true);
            // Save
            SHGlobal.Serialize <SHItemsXml>(SHGlobal.GetClientSystemFolder() + "\\xitem.xml", Items, Encoding.UTF8);
            SHGlobal.Serialize <SHItemsXml>(SHGlobal.GetServerSystemFolder() + "\\xitem.xml", Items, Encoding.UTF8);
        }
Example #9
0
        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);
        }
Example #10
0
        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());
        }
Example #11
0
        public void LoadLocaleStrings()
        {
            if (LocalXml.NPCNameString != null)
            {
                LocalXml.NPCNameString.Clear();
            }
            LocalXml.NPCNameString = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path() + "name_npc.xml", Encoding.UTF8);
            LocalXml.NPCNameString.Compile();

            if (LocalXml.ItemNameString != null)
            {
                LocalXml.ItemNameString.Clear();
            }
            LocalXml.ItemNameString = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path() + "name_xitem.xml", Encoding.UTF8);
            LocalXml.ItemNameString.Compile();

            if (LocalXml.TalentNameString != null)
            {
                LocalXml.TalentNameString.Clear();
            }
            LocalXml.TalentNameString = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path() + "name_talent.xml", Encoding.UTF8);
            LocalXml.TalentNameString.Compile();

            if (LocalXml.QuestString != null)
            {
                LocalXml.QuestString.Clear();
            }
            LocalXml.QuestString = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path() + "name_quest.xml", Encoding.UTF8);
            LocalXml.QuestString.Compile();

            if (LocalXml.DialogString != null)
            {
                LocalXml.DialogString.Clear();
            }
            LocalXml.DialogString = SHGlobal.Deserialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path() + "name_dialog.xml", Encoding.UTF8);
            LocalXml.DialogString.Compile();
        }
Example #12
0
        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);
        }