Beispiel #1
0
        public void LoadItems()
        {
            Items = SHGlobal.Deserialize <SHItemsXml>(SHGlobal.GetServerSystemFolder() + "\\xitem.xml", Encoding.UTF8);
            if (Items == null)
            {
                Items = new SHItemsXml();
                Items.LoadingFail();
            }

            foreach (SHItem item in Items.dataList)
            {
                string szKey = "ITEM_NAME_" + item.id.ToString();

                if (LocalXml.ItemNameString.IsValid(szKey))
                {
                    string szValue = LocalXml.ItemNameString[szKey].ToString();
                    item.name = szValue;
                }

                szKey = "ITEM_DESC_" + item.id.ToString();

                if (LocalXml.ItemNameString.IsValid(szKey))
                {
                    string szValue = LocalXml.ItemNameString[szKey].ToString();
                    item.desc = szValue;
                }
            }

            Items.Compile();
        }
Beispiel #2
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();
 }
Beispiel #3
0
 public void LoadItemConditions()
 {
     ItemConditions = SHGlobal.Deserialize <SHConditionsXml>(SHGlobal.GetServerSystemFolder() + "\\conditions_item.xml", Encoding.UTF8);
     if (ItemConditions == null)
     {
         ItemConditions = new SHConditionsXml();
         ItemConditions.LoadingFail();
     }
     ItemConditions.Compile();
 }
Beispiel #4
0
 public bool LoadLootings()
 {
     Lootings = SHGlobal.Deserialize <SHLootingsXml>(SHGlobal.GetServerSystemFolder() + "\\loot.xml", Encoding.UTF8);
     if (Lootings == null)
     {
         Lootings = new SHLootingsXml();
         Lootings.LoadingFail();
     }
     return(Lootings.Compile());
 }
Beispiel #5
0
        public void LoadQuests()
        {
            Quests = SHGlobal.Deserialize <SHQuestsXml>(SHGlobal.GetServerSystemFolder() + "\\quest.xml", Encoding.UTF8);
            if (Quests == null)
            {
                Quests = new SHQuestsXml();
                Quests.LoadingFail();
            }

            SHQuestStringReplacer replacer = new SHQuestStringReplacer();

            replacer.ReplaceKeyToString(ref Quests, ref LocalXml.QuestString, true);

            Quests.Compile();
        }
Beispiel #6
0
        public void LoadDialogs()
        {
            Dialogs = SHGlobal.Deserialize <SHDialogsXml>(SHGlobal.GetServerSystemFolder() + "\\dialog.xml", Encoding.UTF8);
            if (Dialogs == null)
            {
                Dialogs = new SHDialogsXml();
                Dialogs.LoadingFail();
            }

            SHDialogStringReplacer replacer = new SHDialogStringReplacer();

            replacer.ReplaceKeyToString(ref Dialogs, ref LocalXml.DialogString, true);

            Dialogs.Compile();
        }
Beispiel #7
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());
        }
Beispiel #8
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();
        }
Beispiel #9
0
        public int GetFieldIDByNPC(int NPCID)
        {
            ArrayList fieldList = FieldList.GetArrayList();

            foreach (SHField field in fieldList)
            {
                int fieldID = field.id;

                string strFieldFileName = String.Format("\\{0}.field.xml", fieldID);

                if (File.Exists(SHGlobal.GetClientFieldFolder() + strFieldFileName) == false)
                {
                    return(0);
                }

                SHFieldXml fieldxml = SHGlobal.Deserialize <SHFieldXml>(SHGlobal.GetClientFieldFolder() + strFieldFileName, Encoding.UTF8);
                fieldxml.Compile();

                foreach (SHSpawn spawn in fieldxml.fieldInfo.spawnList)
                {
                    foreach (SHSpawnNPC spawnnpc in spawn.dataList)
                    {
                        if (NPCs.IsValid(spawnnpc.id) == false)
                        {
                            continue;
                        }

                        if (spawnnpc.id == NPCID)
                        {
                            return(fieldID);
                        }
                    }
                }
            }
            return(0);
        }
Beispiel #10
0
        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);
        }
Beispiel #11
0
 public void LoadFieldList()
 {
     FieldList = SHGlobal.Deserialize <SHFieldListXml>(SHGlobal.GetServerSystemFolder() + "\\fieldlist.xml", Encoding.UTF8);
     FieldList.Compile();
 }
Beispiel #12
0
 public void LoadRecipe()
 {
     Recipe = SHGlobal.Deserialize <SHRecipeXml>(SHGlobal.GetServerSystemFolder() + "\\recipe.xml", Encoding.UTF8);
     Recipe.Compile();
 }
Beispiel #13
0
 public void LoadNPCShop()
 {
     NPCShop = SHGlobal.Deserialize <SHNPCShopXml>(SHGlobal.GetServerSystemFolder() + "\\npcshop.xml", Encoding.UTF8);
     NPCShop.Compile();
 }
Beispiel #14
0
 public void LoadCraft()
 {
     Craft = SHGlobal.Deserialize <SHCraftXml>(SHGlobal.GetServerSystemFolder() + "\\craft.xml", Encoding.UTF8);
     Craft.Compile();
 }
Beispiel #15
0
 public bool LoadTalents()
 {
     Talents = SHGlobal.Deserialize <SHTalentsXml>(SHGlobal.GetServerSystemFolder() + "\\talent.xml", Encoding.UTF8);
     return(Talents.Compile());
 }
Beispiel #16
0
 public SHColtXml LoadColt(string path)
 {
     return(SHGlobal.Deserialize <SHColtXml>(path, Encoding.UTF8));
 }