protected AdvancedDropdownItem AddWorlds(AdvancedDropdownItem parent, GameInfo_Volume vol) { int id = 0; foreach (var w in vol.Worlds.Where(x => x.Maps.Length > 0)) { var worldItem = new AdvancedDropdownItem(GetName(w.Index, WorldNames?.TryGetItem(w.Index))) { id = -1 }; foreach (var m in w.Maps.OrderBy(x => x)) { worldItem.AddChild(new MapSelectionDropdownItem(GetLevelName(w.Index, m), vol.Name, w.Index, m) { id = id++ }); } parent.AddChild(worldItem); } return(parent); }
/// <summary> /// Loads all data. Should be positioned on the start /// if the second data hunk. /// </summary> /// <param name="dataReader"></param> public ExecutableData(IDataReader dataReader) { // TODO: For now we search the offset of the filelist manually // until we decode all of the data. dataReader.Position = (int)dataReader.FindString("0Map_data.amb", 0) - 184; // TODO ... FileList = new FileList(dataReader); WorldNames = new WorldNames(dataReader); Messages = new Messages(dataReader); if (dataReader.ReadDword() != 0) { throw new AmbermoonException(ExceptionScope.Data, "Invalid executable data."); } AutomapNames = new AutomapNames(dataReader); OptionNames = new OptionNames(dataReader); SongNames = new SongNames(dataReader); SpellTypeNames = new SpellTypeNames(dataReader); SpellNames = new SpellNames(dataReader); LanguageNames = new LanguageNames(dataReader); ClassNames = new ClassNames(dataReader); RaceNames = new RaceNames(dataReader); AbilityNames = new AbilityNames(dataReader); AttributeNames = new AttributeNames(dataReader); AbilityNames.AddShortNames(dataReader); AttributeNames.AddShortNames(dataReader); ItemTypeNames = new ItemTypeNames(dataReader); AilmentNames = new AilmentNames(dataReader); UITexts = new UITexts(dataReader); // TODO: There is a bunch of binary data (gfx maybe?) // TODO: Then finally the item data comes ... // TODO ... }
public string GetWorldName(int worldIndex) => WorldNames?.TryGetItem(worldIndex) ?? $"{worldIndex:00}";