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); }