Exemple #1
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 #3
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 #4
0
 public BNpcData(XivCollection collection, Libra.BNpcName libraRow)
 {
     _Base = collection.GetSheet <BNpcBase>()[(int)libraRow.BaseKey];
     _Name = collection.GetSheet <BNpcName>()[(int)libraRow.NameKey];
 }