コード例 #1
0
            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();
                    }
                }
            }
コード例 #2
0
 public Enumerator(XivCollection collection)
 {
     _GilShopEnumerator     = collection.GetSheet <GilShop>().GetEnumerator();
     _GCShopEnumerator      = collection.GetSheet <GCShop>().GetEnumerator();
     _SpecialShopEnumerator = collection.GetSheet <SpecialShop>().GetEnumerator();
     _FccShopEnumerator     = collection.GetSheet <FccShop>().GetEnumerator();
 }
コード例 #3
0
            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();
                    }
                }
            }
コード例 #4
0
            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();
                    }
                }
            }
コード例 #5
0
        /// <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();
        }
コード例 #6
0
        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)));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
            }
        }
コード例 #10
0
 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)
     };
 }
コード例 #11
0
        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);
        }
コード例 #12
0
 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>();
 }
コード例 #13
0
        /// <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();
        }
コード例 #14
0
        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);
        }
コード例 #17
0
ファイル: ARealmReversed.cs プロジェクト: zaevi/SaintCoinach
        /// <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();
        }
コード例 #18
0
        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);
        }
コード例 #19
0
 public InventoryItemSheet(XivCollection collection, IRelationalSheet source) : base(collection, source)
 {
 }
コード例 #20
0
 public ShopCollection(XivCollection collection)
 {
     Collection = collection;
 }
コード例 #21
0
 protected XivConverter(XivCollection coll)
 {
     XivCollection = coll;
 }
コード例 #22
0
        public override object ReadYaml(IParser parser, Type type)
        {
            var value = parser.Expect <Scalar>().Value;

            return(XivCollection.GetSheet <BaseParam>().Single(bp => bp.Name == value));
        }
コード例 #23
0
 public BaseParamConverter(XivCollection coll) : base(coll)
 {
 }
コード例 #24
0
 public ClassJobConverter(XivCollection coll) : base(coll)
 {
 }
コード例 #25
0
 public ItemActionSheet(XivCollection collection, IRelationalSheet source) : base(collection, source)
 {
 }
コード例 #26
0
 public ENpcCollection(XivCollection xivCollection)
 {
     Collection    = xivCollection;
     BaseSheet     = xivCollection.GetSheet <ENpcBase>();
     ResidentSheet = xivCollection.GetSheet <ENpcResident>();
 }
コード例 #27
0
        /// <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();
        }
コード例 #28
0
            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;
            }
コード例 #29
0
        public override object ReadYaml(IParser parser, Type type)
        {
            var value = parser.Expect <Scalar>().Value;

            return(XivCollection.GetSheet <ClassJob>().Single(e => e.Abbreviation == value));
        }
コード例 #30
0
 public EquipSlotConverter(XivCollection coll) : base(coll)
 {
 }
コード例 #31
0
        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)));
        }
コード例 #32
0
 public ItemConverter(XivCollection coll) : base(coll)
 {
 }
コード例 #33
0
ファイル: BNpcData.cs プロジェクト: mclark4386/SaintCoinach
 public BNpcData(XivCollection collection, Libra.BNpcName libraRow) {
     _Base = collection.GetSheet<BNpcBase>()[(int)libraRow.BaseKey];
     _Name = collection.GetSheet<BNpcName>()[(int)libraRow.NameKey];
 }