internal Treasure(JsonReader reader, XivCollection collection) { if (reader.TokenType != JsonToken.StartObject) throw new InvalidOperationException(); var allItems = collection.GetSheet<Item>(); while (reader.Read() && reader.TokenType != JsonToken.EndObject) { if (reader.TokenType != JsonToken.PropertyName) throw new InvalidOperationException(); switch (reader.Value.ToString()) { case "Currency": ReadCurrency(reader); break; case "Item": ReadItems(reader, allItems); break; case "WeekRestrictionIndex": ReadWeeklyRestriction(reader); break; case "coordinate": ReadCoordinates(reader); break; default: Console.Error.WriteLine("Unknown 'InstanceContent.Treasure' data key: {0}", reader.Value); throw new NotSupportedException(); } } }
public Enumerator(XivCollection collection) { _GilShopEnumerator = collection.GetSheet <GilShop>().GetEnumerator(); _GCShopEnumerator = collection.GetSheet <GCShop>().GetEnumerator(); _SpecialShopEnumerator = collection.GetSheet <SpecialShop>().GetEnumerator(); _FccShopEnumerator = collection.GetSheet <FccShop>().GetEnumerator(); }
internal RewardItem(JsonReader reader, XivCollection collection) { if (reader.TokenType != JsonToken.StartObject) throw new InvalidOperationException(); var allItems = collection.GetSheet<Item>(); var allQuests = collection.GetSheet<Quest>(); while (reader.Read() && reader.TokenType != JsonToken.EndObject) { if (reader.TokenType != JsonToken.PropertyName) throw new InvalidOperationException(); switch (reader.Value.ToString()) { case "has_rate_condition": this.HasRateCondition = ReadCondition(reader); break; case "Item": ReadItem(reader, allItems); break; case "Quest": ReadRequiredQuest(reader, allQuests); break; case "is_week_restriction_one": this.HasWeekRestriction = ReadCondition(reader); break; default: Console.Error.WriteLine("Unknown 'InstanceContent.RewardItem' data key: {0}", reader.Value); throw new NotSupportedException(); } } }
internal Fight(JsonReader reader, XivCollection collection) { if (reader.TokenType != JsonToken.StartObject) throw new InvalidOperationException(); var bnpcs = collection.BNpcs; while (reader.Read() && reader.TokenType != JsonToken.EndObject) { if (reader.TokenType != JsonToken.PropertyName) throw new InvalidOperationException(); switch (reader.Value.ToString()) { case "RewardItems": ReadRewardItems(reader, collection); break; case "ClearB": ReadCurrencyB(reader); break; case "SubBNpcNames": ReadSecondaryBNpcs(reader, bnpcs); break; case "ClearA": ReadCurrencyA(reader); break; case "Treasure": ReadTreasure(reader, collection); break; case "BNpcNames": ReadPrimaryBNpcs(reader, bnpcs); break; default: Console.Error.WriteLine("Unknown 'InstanceContent.Fight' data key: {0}", reader.Value); throw new NotSupportedException(); } } }
/// <summary> /// Initializes a new instance of the <see cref="ARealmReversed" /> class. /// </summary> /// <param name="gameDirectory">Directory of the game installation.</param> /// <param name="storeFile">File used for storing definitions and history.</param> /// <param name="language">Initial language to use.</param> /// <param name="libraFile">Location of the Libra Eorzea database file, or <c>null</c> if it should not be used.</param> public ARealmReversed(DirectoryInfo gameDirectory, FileInfo storeFile, Language language, FileInfo libraFile) { // Fix for being referenced in a .Net Core 2.1+ application (https://stackoverflow.com/questions/50449314/ibm437-is-not-a-supported-encoding-name => https://stackoverflow.com/questions/44659499/epplus-error-reading-file) // PM> dotnet add package System.Text.Encoding.CodePages Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); _GameDirectory = gameDirectory; _Packs = new PackCollection(Path.Combine(gameDirectory.FullName, "game", "sqpack")); _GameData = new XivCollection(Packs, libraFile) { ActiveLanguage = language }; _GameVersion = File.ReadAllText(Path.Combine(gameDirectory.FullName, "game", "ffxivgame.ver")); _StateFile = storeFile; _GameData.Definition = ReadDefinition(); using (ZipFile zipFile = new ZipFile(StateFile.FullName, ZipEncoding)) { if (!zipFile.ContainsEntry(VersionFile)) { Setup(zipFile); } } _GameData.Definition.Compile(); }
public override object ReadYaml(IParser parser, Type type) { var value = parser.Expect <Scalar>().Value; return (XivCollection.GetSheet <ClassJob>() .Single(e => string.Equals(e.Abbreviation, value, StringComparison.InvariantCultureIgnoreCase))); }
public ItemCollection(XivCollection collection) { Collection = collection; InventoryItemSheet = collection.GetSheet <Item>(); EventItemSheet = collection.GetSheet <EventItem>(); _InventoryRanges = Range.Combine(InventoryItemSheet.Header.DataFileRanges); _EventRanges = Range.Combine(EventItemSheet.Header.DataFileRanges); }
public ClassJobActionCollection(XivCollection collection) { Collection = collection; ActionSheet = collection.GetSheet <Action>(); CraftActionSheet = collection.GetSheet <CraftAction>(); _ActionRanges = Range.Combine(ActionSheet.Header.DataFileRanges); _CraftActionRanges = Range.Combine(CraftActionSheet.Header.DataFileRanges); }
protected internal EquipSlotCollection(XivCollection collection) { const int SlotCount = 14; Collection = collection; _EquipSlots = new EquipSlot[SlotCount]; for (int i = 0; i < SlotCount; ++i) { _EquipSlots[i] = new EquipSlot(this, i); } }
public Localize(ARealmReversed realm) { _realm = realm; _data = realm.GameData; _langs = new Tuple <string, Language>[] { Tuple.Create(Language.English.GetCode(), Language.English), Tuple.Create(Language.Japanese.GetCode(), Language.Japanese), Tuple.Create(Language.German.GetCode(), Language.German), Tuple.Create(Language.French.GetCode(), Language.French) }; }
static void ExtractConsumables(XivCollection gameData) { int[] foods = { 844, 845 }; JArray foodsArray = ExtractFoodTypes(gameData, foods); string foodsJson = Regex.Replace(foodsArray.ToString(Newtonsoft.Json.Formatting.Indented), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1"); File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + BASE_ANGULAR_PATH + "src\\app\\core\\data\\sources\\foods.json", foodsJson); int[] medicines = { 846 }; JArray medicinesArray = ExtractFoodTypes(gameData, medicines); string medicinesJson = Regex.Replace(medicinesArray.ToString(Newtonsoft.Json.Formatting.Indented), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1"); File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + BASE_ANGULAR_PATH + "src\\app\\core\\data\\sources\\medicines.json", medicinesJson); }
public BNpcCollection(XivCollection collection) { if (collection == null) { throw new ArgumentNullException("collection"); } if (!collection.IsLibraAvailable) { throw new NotSupportedException("BNpcs are only available when Libra Eorzea database is present."); } Collection = collection; BaseSheet = collection.GetSheet <BNpcBase>(); NameSheet = collection.GetSheet <BNpcName>(); }
/// <summary> /// Initializes a new instance of the <see cref="ARealmReversed" /> class. /// </summary> /// <param name="gameDirectory">Directory of the game installation.</param> /// <param name="storeFile">File used for storing definitions and history.</param> /// <param name="language">Initial language to use.</param> /// <param name="libraFile">Location of the Libra Eorzea database file, or <c>null</c> if it should not be used.</param> public ARealmReversed(DirectoryInfo gameDirectory, FileInfo storeFile, Language language, FileInfo libraFile) { _GameDirectory = gameDirectory; _Packs = new PackCollection(Path.Combine(gameDirectory.FullName, "game", "sqpack")); _GameData = new XivCollection(Packs, libraFile) { ActiveLanguage = language }; _GameVersion = File.ReadAllText(Path.Combine(gameDirectory.FullName, "game", "ffxivgame.ver")); _StateFile = storeFile; using (var zipFile = new ZipFile(StateFile.FullName, ZipEncoding)) { if (zipFile.ContainsEntry(VersionFile)) { RelationDefinition fsDef = null, zipDef = null; DateTime fsMod = DateTime.MinValue, zipMod = DateTime.MinValue; if (!TryGetDefinitionVersion(zipFile, GameVersion, out zipDef, out zipMod)) { zipDef = ReadDefinition(zipFile, DefinitionFile, out zipMod); } if (!TryGetDefinitionFromFileSystem(out fsDef, out fsMod)) { fsDef = null; } if (fsDef != null && fsMod > zipMod) { fsDef.Version = GameVersion; _GameData.Definition = fsDef; StoreDefinition(zipFile, fsDef, DefinitionFile); zipFile.Save(); } else { _GameData.Definition = zipDef; } } else { _GameData.Definition = Setup(zipFile); } } _GameData.Definition.Compile(); }
static JArray ExtractFoodTypes(XivCollection gameData, int[] types) { JArray res = new JArray(); foreach (var item in gameData.GetSheet <Item>()) { foreach (int type in types) { if (item.ItemAction.Type == type) { if (gameData.GetSheet <ItemFood>().ContainsRow(item.ItemAction.GetData(1))) { var food = gameData.GetSheet <ItemFood>()[item.ItemAction.GetData(1)]; if (food != null) { JObject foodRow = new JObject(); foreach (var param in food.Parameters) { if (param.BaseParam.DefaultValue.ToString() == "CP" || param.BaseParam.DefaultValue.ToString() == "Control" || param.BaseParam.DefaultValue.ToString() == "Craftsmanship") { if (foodRow.GetValue("itemId") == null) { foodRow.Add("itemId", item.Key); } JArray paramRow = new JArray(); foreach (var value in param.Values) { var valueRow = new JObject(); valueRow.Add("amount", ((ParameterValueRelativeLimited)value).Amount); valueRow.Add("max", ((ParameterValueRelativeLimited)value).Maximum); paramRow.Add(valueRow); } foodRow.Add(param.BaseParam.DefaultValue.ToString(), paramRow); } } if (foodRow.HasValues) { res.Add(foodRow); } } } } } } return(res); }
public DefaultEvaluationFunctionProvider(XivCollection data) { if (data == null) throw new ArgumentNullException("data"); this.Data = data; this.DefaultGenericTagEvaluator = EvaluateDefaultGenericElement; SetEvaluator(TagType.Time, EvaluateTime); SetEvaluator(TagType.Sheet, EvaluateSheet); SetEvaluator(TagType.SheetDe, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetEn, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetFr, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetJa, EvaluateSheetWithAttributive); SetEvaluator(TagType.Value, (p, e) => e.Content.TryEvaluate(p)); SetEvaluator(TagType.TwoDigitValue, EvaluateTwoDigitValue); SetEvaluator(TagType.ZeroPaddedValue, EvaluateZeroPaddedValue); }
public DefaultEvaluationFunctionProvider(XivCollection data) { if (data == null) { throw new ArgumentNullException("data"); } this.Data = data; this.DefaultGenericTagEvaluator = EvaluateDefaultGenericElement; SetEvaluator(TagType.Time, EvaluateTime); SetEvaluator(TagType.Sheet, EvaluateSheet); SetEvaluator(TagType.SheetDe, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetEn, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetFr, EvaluateSheetWithAttributive); SetEvaluator(TagType.SheetJa, EvaluateSheetWithAttributive); SetEvaluator(TagType.Value, (p, e) => e.Content.TryEvaluate(p)); SetEvaluator(TagType.TwoDigitValue, EvaluateTwoDigitValue); SetEvaluator(TagType.ZeroPaddedValue, EvaluateZeroPaddedValue); }
/// <summary> /// Initializes a new instance of the <see cref="ARealmReversed" /> class. /// </summary> /// <param name="gameDirectory">Directory of the game installation.</param> /// <param name="storeFile">File used for storing definitions and history.</param> /// <param name="language">Initial language to use.</param> /// <param name="libraFile">Location of the Libra Eorzea database file, or <c>null</c> if it should not be used.</param> public ARealmReversed(DirectoryInfo gameDirectory, FileInfo storeFile, Language language, FileInfo libraFile) { _GameDirectory = gameDirectory; _Packs = new PackCollection(Path.Combine(gameDirectory.FullName, "game", "sqpack")); _GameData = new XivCollection(Packs, libraFile) { ActiveLanguage = language }; _GameVersion = File.ReadAllText(Path.Combine(gameDirectory.FullName, "game", "ffxivgame.ver")); _StateFile = storeFile; _GameData.Definition = ReadDefinition(); using (var zipFile = new ZipFile(StateFile.FullName, ZipEncoding)) { if (!zipFile.ContainsEntry(VersionFile)) { Setup(zipFile); } } _GameData.Definition.Compile(); }
static void ExtractActionIcons(XivCollection gameData) { JObject res = new JObject(); foreach (var action in gameData.GetSheet <CraftAction>()) { int iconId = GetIconId(action.Icon); if (iconId != 405 && iconId > 0) { res.Add(action.Key.ToString(), iconId); } } foreach (var action in gameData.GetSheet <SaintCoinach.Xiv.Action>()) { int iconId = GetIconId(action.Icon); if (iconId != 405 && iconId > 0) { res.Add(action.Key.ToString(), iconId); } } string json = Regex.Replace(res.ToString(), "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1"); File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory + BASE_ANGULAR_PATH + "src\\app\\core\\data\\sources\\action-icons.json", json); }
public InventoryItemSheet(XivCollection collection, IRelationalSheet source) : base(collection, source) { }
public ShopCollection(XivCollection collection) { Collection = collection; }
protected XivConverter(XivCollection coll) { XivCollection = coll; }
public override object ReadYaml(IParser parser, Type type) { var value = parser.Expect <Scalar>().Value; return(XivCollection.GetSheet <BaseParam>().Single(bp => bp.Name == value)); }
public BaseParamConverter(XivCollection coll) : base(coll) { }
public ClassJobConverter(XivCollection coll) : base(coll) { }
public ItemActionSheet(XivCollection collection, IRelationalSheet source) : base(collection, source) { }
public ENpcCollection(XivCollection xivCollection) { Collection = xivCollection; BaseSheet = xivCollection.GetSheet <ENpcBase>(); ResidentSheet = xivCollection.GetSheet <ENpcResident>(); }
/// <summary> /// Initializes a new instance of the <see cref="ARealmReversed" /> class. /// </summary> /// <param name="gameDirectory">Directory of the game installation.</param> /// <param name="storeFile">File used for storing definitions and history.</param> /// <param name="language">Initial language to use.</param> /// <param name="libraFile">Location of the Libra Eorzea database file, or <c>null</c> if it should not be used.</param> public ARealmReversed(DirectoryInfo gameDirectory, FileInfo storeFile, Language language, FileInfo libraFile) { _GameDirectory = gameDirectory; _Packs = new PackCollection(Path.Combine(gameDirectory.FullName, "game", "sqpack")); _GameData = new XivCollection(Packs, libraFile) { ActiveLanguage = language }; _GameVersion = File.ReadAllText(Path.Combine(gameDirectory.FullName, "game", "ffxivgame.ver")); _StateFile = storeFile; using (var zipFile = new ZipFile(StateFile.FullName, ZipEncoding)) { if (zipFile.ContainsEntry(VersionFile)) { RelationDefinition fsDef = null, zipDef = null; DateTime fsMod = DateTime.MinValue, zipMod = DateTime.MinValue; if (!TryGetDefinitionVersion(zipFile, GameVersion, out zipDef, out zipMod)) zipDef = ReadDefinition(zipFile, DefinitionFile, out zipMod); if (!TryGetDefinitionFromFileSystem(out fsDef, out fsMod)) fsDef = null; if (fsDef != null && fsMod > zipMod) { fsDef.Version = GameVersion; _GameData.Definition = fsDef; StoreDefinition(zipFile, fsDef, DefinitionFile); zipFile.Save(); } else _GameData.Definition = zipDef; } else _GameData.Definition = Setup(zipFile); } _GameData.Definition.Compile(); }
private void ReadTreasure(JsonReader reader, XivCollection collection) { if (!reader.Read() || reader.TokenType != JsonToken.StartArray) throw new InvalidOperationException(); var values = new List<Treasure>(); while (reader.Read() && reader.TokenType != JsonToken.EndArray) { values.Add(new Treasure(reader, collection)); } this.Treasures = values; }
public override object ReadYaml(IParser parser, Type type) { var value = parser.Expect <Scalar>().Value; return(XivCollection.GetSheet <ClassJob>().Single(e => e.Abbreviation == value)); }
public EquipSlotConverter(XivCollection coll) : base(coll) { }
public override object ReadYaml(IParser parser, Type type) { var value = parser.Expect <Scalar>().Value; return(XivCollection.GetSheet <BaseParam>().Single(bp => string.Equals(bp.Name, value, StringComparison.InvariantCultureIgnoreCase))); }
public ItemConverter(XivCollection coll) : base(coll) { }
public BNpcData(XivCollection collection, Libra.BNpcName libraRow) { _Base = collection.GetSheet<BNpcBase>()[(int)libraRow.BaseKey]; _Name = collection.GetSheet<BNpcName>()[(int)libraRow.NameKey]; }