public void Add(SHRecipeNPC i) { dataList.Add(i); }
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); }