internal Fight(JsonReader reader, XivCollection collection)
            {
                if (reader.TokenType != JsonToken.StartObject)
                {
                    throw new InvalidOperationException();
                }

                Collections.BNpcCollection 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;

                    case "ClearC":
                        ReadCurrencyC(reader);
                        break;

                    default:
                        Console.Error.WriteLine("Unknown 'InstanceContent.Fight' data key: {0}", reader.Value);
                        throw new NotSupportedException();
                    }
                }
            }
            private void ReadRewardItems(JsonReader reader, XivCollection collection)
            {
                if (!reader.Read() || reader.TokenType != JsonToken.StartArray)
                {
                    throw new InvalidOperationException();
                }

                List <RewardItem> values = new List <RewardItem>();

                while (reader.Read() && reader.TokenType != JsonToken.EndArray)
                {
                    values.Add(new RewardItem(reader, collection));
                }
                this.RewardItems = values;
            }
Exemple #3
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;
            }
Exemple #4
0
        public InstanceContentData(InstanceContent instanceContent)
        {
            this.InstanceContent = instanceContent ?? throw new ArgumentNullException("instanceContent");

            XivCollection coll = instanceContent.Sheet.Collection;

            if (!coll.IsLibraAvailable)
            {
                return;
            }

            var libraRow = coll.Libra.InstanceContents.FirstOrDefault(i => i.Key == instanceContent.Key);

            if (libraRow != null)
            {
                Parse(libraRow);
            }
        }
Exemple #5
0
        private ILocation[] BuildLocations()
        {
            Level[] levelLocations = BuildLevels();

            XivCollection coll = Collection.Collection;

            if (!coll.IsLibraAvailable)
            {
                return(levelLocations.Cast <ILocation>().ToArray());
            }

            var libraENpc = coll.Libra.ENpcResidents.FirstOrDefault(i => i.Key == this.Key);

            if (libraENpc == null)
            {
                return(levelLocations.ToArray());
            }

            List <ILocation> locations = new List <ILocation>();

            locations.AddRange(levelLocations.Cast <ILocation>());

            IXivSheet <PlaceName> placeNames = coll.GetSheet <PlaceName>();
            IXivSheet <Map>       maps       = coll.GetSheet <Map>();

            if (libraENpc.Coordinates != null)
            {
                foreach (var coord in libraENpc.Coordinates)
                {
                    PlaceName placeName = placeNames.First(i => i.Key == coord.Item1);

                    foreach (var c in coord.Item2)
                    {
                        // Only add if no Level exists in the same area.
                        if (!levelLocations.Any(l => Math.Abs(l.MapX - c.X) < 1 && Math.Abs(l.MapY - c.Y) < 1 && (l.Map.LocationPlaceName == placeName || l.Map.PlaceName == placeName || l.Map.RegionPlaceName == placeName)))
                        {
                            locations.Add(new GenericLocation(placeName, c.X, c.Y));
                        }
                    }
                }
            }

            return(locations.ToArray());
        }
            internal RewardItem(JsonReader reader, XivCollection collection)
            {
                if (reader.TokenType != JsonToken.StartObject)
                {
                    throw new InvalidOperationException();
                }

                IXivSheet <Item>  allItems  = collection.GetSheet <Item>();
                IXivSheet <Quest> 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();
                    }
                }
            }
Exemple #7
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();
                    }
                }
            }
Exemple #8
0
 public XivSheet(XivCollection collection, IRelationalSheet source)
 {
     Collection = collection;
     _Source    = source;
 }
Exemple #9
0
 public BNpcData(XivCollection collection, Object libraRow)
 {
 }
Exemple #10
0
 public XivSheet2(XivCollection collection, IRelationalSheet source) :
     base(collection, source)
 {
 }
Exemple #11
0
 public BNpcData(XivCollection collection, Libra.BNpcName libraRow)
 {
     _Base = collection.GetSheet <BNpcBase>()[(int)libraRow.BaseKey];
     _Name = collection.GetSheet <BNpcName>()[(int)libraRow.NameKey];
 }