private List <WorldMapArea> ExtractUIMap(string path) { int idIndex = -1; int nameIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { idIndex = extractor.FindIndex("ID"); nameIndex = extractor.FindIndex("Name_lang"); }; var items = new List <WorldMapArea>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > idIndex && values.Length > nameIndex) { int uiMapId = int.Parse(values[idIndex]); items.Add(new WorldMapArea { UIMapId = uiMapId, AreaName = values[nameIndex] }); } }; extractor.ExtractTemplate(path, extractLine); return(items); }
private List <Spell> ExtractNames(string path) { int entryIndex = -1; int nameIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { entryIndex = extractor.FindIndex("ID"); nameIndex = extractor.FindIndex("Name_lang"); }; var spells = new List <Spell>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > entryIndex && values.Length > nameIndex) { spells.Add(new Spell { Id = int.Parse(values[entryIndex]), Name = values[nameIndex] }); } }; extractor.ExtractTemplate(path, extractLine); return(spells); }
private List <EntityId> ExtractSpells(string path, string descLang) { int entryIndex = -1; int descIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { entryIndex = extractor.FindIndex("ID"); descIndex = extractor.FindIndex("Description_lang"); }; var items = new List <EntityId>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > entryIndex && values.Length > descIndex && values[descIndex].Contains(descLang)) { items.Add(new EntityId { Id = int.Parse(values[entryIndex]) }); } }; extractor.ExtractTemplate(path, extractLine); return(items); }
private List <Item> ExtractItems(string path) { int idIndex = -1; int nameIndex = -1; int qualityIndex = -1; int sellPriceIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { idIndex = extractor.FindIndex("ID"); nameIndex = extractor.FindIndex("Display_lang"); qualityIndex = extractor.FindIndex("OverallQualityID"); sellPriceIndex = extractor.FindIndex("SellPrice"); }; var items = new List <Item>(); Action <string> extractLine = line => { string[] values = line.Split(","); if (line.Contains("\"")) { values = extractor.SplitQuotes(line); } else { values = line.Split(","); } if (values.Length > idIndex && values.Length > nameIndex && values.Length > qualityIndex && values.Length > sellPriceIndex) { items.Add(new Item { Entry = int.Parse(values[idIndex]), Quality = int.Parse(values[qualityIndex]), Name = values[nameIndex], SellPrice = int.Parse(values[sellPriceIndex]) }); } }; extractor.ExtractTemplate(path, extractLine); return(items); }
private void ExtractContinent(string path, List <WorldMapArea> wmas) { int mapIdIndex = -1; int directoryIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { mapIdIndex = extractor.FindIndex("ID"); directoryIndex = extractor.FindIndex("Directory"); }; Action <string> extractLine = line => { string[] values; if (line.Contains("\"")) { values = extractor.SplitQuotes(line); } else { values = line.Split(","); } if (values.Length > directoryIndex && values.Length > mapIdIndex) { int mapId = int.Parse(values[mapIdIndex]); var list = wmas.FindAll(x => x.MapID == mapId); foreach (var item in list) { item.Continent = values[directoryIndex]; } } }; extractor.ExtractTemplate(path, extractLine); }
private List <EntityId> ExtractItem(string path, List <EntityId> spells) { int entryIndex = -1; int spellIdIndex = -1; int ParentItemIDIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { entryIndex = extractor.FindIndex("ID"); spellIdIndex = extractor.FindIndex("SpellID"); ParentItemIDIndex = extractor.FindIndex("ParentItemID"); }; var items = new List <EntityId>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > entryIndex && values.Length > spellIdIndex && values.Length > ParentItemIDIndex) { int spellId = int.Parse(values[spellIdIndex]); if (spells.Any(s => s.Id == spellId)) { int ItemId = int.Parse(values[ParentItemIDIndex]); items.Add(new EntityId { Id = ItemId }); } } }; extractor.ExtractTemplate(path, extractLine); return(items); }
private void ExtractLevels(string path, List <Spell> spells) { int entryIndex = -1; int spellIdIndex = -1; int baseLevelIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { entryIndex = extractor.FindIndex("ID"); spellIdIndex = extractor.FindIndex("SpellID"); baseLevelIndex = extractor.FindIndex("BaseLevel"); }; Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > entryIndex && values.Length > spellIdIndex && values.Length > baseLevelIndex) { int level = int.Parse(values[baseLevelIndex]); if (level > 0 && int.TryParse(values[spellIdIndex], out int spellId)) { int index = spells.FindIndex(0, x => x.Id == spellId); if (index > -1) { Spell spell = spells[index]; spell.Level = level; spells[index] = spell; } } } }; extractor.ExtractTemplate(path, extractLine); }
private List <TalentTab> ExtractTalentTabs(string path) { int idIndex = -1; int NameIndex = -1; int BackgroundFileIndex = -1; int orderIndex = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { idIndex = extractor.FindIndex("ID"); NameIndex = extractor.FindIndex("Name_lang"); BackgroundFileIndex = extractor.FindIndex("BackgroundFile"); orderIndex = extractor.FindIndex("OrderIndex"); }; var talenttabs = new List <TalentTab>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > idIndex && values.Length > orderIndex) { talenttabs.Add(new TalentTab { Id = int.Parse(values[idIndex]), Name = values[NameIndex], BackgroundFile = values[BackgroundFileIndex], OrderIndex = int.Parse(values[orderIndex]) }); } }; extractor.ExtractTemplate(path, extractLine); return(talenttabs); }
public static List <TalentTreeElement> ExtractTalentTrees(string path) { int idIndex = -1; int tierIDIndex = -1; int columnIndex = -1; int tabIDIndex = -1; int spellRank0Index = -1; int spellRank1Index = -1; int spellRank2Index = -1; int spellRank3Index = -1; int spellRank4Index = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { idIndex = extractor.FindIndex("ID"); tierIDIndex = extractor.FindIndex("TierID"); columnIndex = extractor.FindIndex("ColumnIndex"); tabIDIndex = extractor.FindIndex("TabID"); spellRank0Index = extractor.FindIndex("SpellRank[0]"); spellRank1Index = extractor.FindIndex("SpellRank[1]"); spellRank2Index = extractor.FindIndex("SpellRank[2]"); spellRank3Index = extractor.FindIndex("SpellRank[3]"); spellRank4Index = extractor.FindIndex("SpellRank[4]"); }; var talents = new List <TalentTreeElement>(); Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > idIndex && values.Length > spellRank4Index) { //Console.WriteLine($"{values[entryIndex]} - {values[nameIndex]}"); talents.Add(new TalentTreeElement { TierID = int.Parse(values[tierIDIndex]), ColumnIndex = int.Parse(values[columnIndex]), TabID = int.Parse(values[tabIDIndex]), SpellIds = new List <int>() { int.Parse(values[spellRank0Index]), int.Parse(values[spellRank1Index]), int.Parse(values[spellRank2Index]), int.Parse(values[spellRank3Index]), int.Parse(values[spellRank4Index]) } }); } }; extractor.ExtractTemplate(path, extractLine); return(talents); }
private void ExtractBoundaries(string path, List <WorldMapArea> wmas) { int uiMapIdIndex = -1; int mapIdIndex = -1; int areaIdIndex = -1; int orderIndexIndex = -1; int region0Index = -1; int region1Index = -1; int region3Index = -1; int region4Index = -1; var extractor = new CSVExtractor(); extractor.HeaderAction = () => { uiMapIdIndex = extractor.FindIndex("UiMapID"); mapIdIndex = extractor.FindIndex("MapID"); areaIdIndex = extractor.FindIndex("AreaID"); orderIndexIndex = extractor.FindIndex("OrderIndex"); region0Index = extractor.FindIndex("Region[0]"); region1Index = extractor.FindIndex("Region[1]"); region3Index = extractor.FindIndex("Region[3]"); region4Index = extractor.FindIndex("Region[4]"); }; Action <string> extractLine = line => { var values = line.Split(","); if (values.Length > uiMapIdIndex && values.Length > mapIdIndex && values.Length > areaIdIndex && values.Length > region0Index && values.Length > region1Index && values.Length > region3Index && values.Length > region4Index ) { int uiMapId = int.Parse(values[uiMapIdIndex]); int orderIndex = int.Parse(values[orderIndexIndex]); int index = wmas.FindIndex(x => x.UIMapId == uiMapId && orderIndex == 0); if (index > -1) { wmas[index].MapID = int.Parse(values[mapIdIndex]); wmas[index].AreaID = int.Parse(values[areaIdIndex]); wmas[index].LocBottom = float.Parse(values[region0Index]); wmas[index].LocRight = float.Parse(values[region1Index]); wmas[index].LocTop = float.Parse(values[region3Index]); wmas[index].LocLeft = float.Parse(values[region4Index]); } } }; extractor.ExtractTemplate(path, extractLine); }