public static List <FOCommon.Worldmap.EncounterGroup.EncounterGroup> LoadNew(List <string> lines) { List <FOCommon.Worldmap.EncounterGroup.EncounterGroup> Groups = new List <FOCommon.Worldmap.EncounterGroup.EncounterGroup>(); int groupId = 0; EncounterGroup Group = null; foreach (string line in lines) { if (line.StartsWith("*")) // Npc data { string[] parts = line.Split('|'); string[] param = parts[0].Split(','); EncounterNpc NpcObj = new EncounterNpc(Int32.Parse(param[1]), Int32.Parse(param[2]), param[3], Int32.Parse(param[4]), param[5] == "1" ? true : false, Int32.Parse(param[6]), Int32.Parse(param[7]), Int32.Parse(param[8])); for (int i = 1; i < parts.Length; i++) { string[] npcData = parts[i].Split(','); if (Int32.Parse(npcData[0]) == (int)GroupFormatData.Item) { EncounterItem item = new EncounterItem(Int32.Parse(npcData[1]), Int32.Parse(npcData[2]), Int32.Parse(npcData[3]), Int32.Parse(npcData[4])); NpcObj.AddItem(item); } else if (Int32.Parse(npcData[0]) == (int)GroupFormatData.Perk) { EncounterPerk perk = new EncounterPerk(npcData[1], Int32.Parse(npcData[2]), Int32.Parse(npcData[3]), Int32.Parse(npcData[4])); NpcObj.Perks.Add(perk); } } Group.Npcs.Add(NpcObj); } else // Group data { if (String.IsNullOrEmpty(line) || line.Length < 5) { continue; } string[] param = line.Split(','); float quantityDay = (float)double.Parse(param[7], NumberStyles.Any, ci); float quantityNight = (float)double.Parse(param[8], NumberStyles.Any, ci); Group = new FOCommon.Worldmap.EncounterGroup.EncounterGroup(param[0], Int32.Parse(param[1]), Int32.Parse(param[2]), Int32.Parse(param[3]), Int32.Parse(param[4]), Int32.Parse(param[5]), Int32.Parse(param[6]), quantityDay, quantityNight, Int32.Parse(param[9]), Int32.Parse(param[10])); if (Group != null) { Group.Id = groupId++; Groups.Add(Group); } } } return(Groups); }
private void btnRemovePerk_Click(object sender, EventArgs e) { EncounterPerk CurrentPerk = (EncounterPerk)lstPerks.SelectedObject; if (CurrentPerk == null) { return; } CurrentNpc.Perks.Remove(CurrentPerk); RefreshPerks(); }