public InstanceContentData(InstanceContent instanceContent)
        {
            if (instanceContent == null)
                throw new ArgumentNullException("instanceContent");

            this.InstanceContent = instanceContent;

            var coll = instanceContent.Sheet.Collection;
            if (!coll.IsLibraAvailable) return;

            var libraRow = coll.Libra.InstanceContents.FirstOrDefault(i => i.Key == instanceContent.Key);
            if (libraRow != null)
                Parse(libraRow);
        }
示例#2
0
        public InstanceContentData(InstanceContent instanceContent)
        {
            this.InstanceContent = instanceContent ?? throw new ArgumentNullException("instanceContent");

            var coll = instanceContent.Sheet.Collection;

            if (!coll.IsLibraAvailable)
            {
                return;
            }

            // Now inaccurate.
            //var libraRow = coll.Libra.InstanceContents.FirstOrDefault(i => i.Key == instanceContent.Key);
            //if (libraRow != null)
            //    Parse(libraRow);
        }
示例#3
0
            internal InstanceContentRequirement(Quest quest)
            {
                const int QuestCount = 3;

                this.Type = (PrerequisiteQuestsRequirementType)quest.AsInt32("InstanceContentJoin");

                List <InstanceContent> contents = new List <InstanceContent>();

                for (int i = 0; i < QuestCount; ++i)
                {
                    InstanceContent c = quest.As <InstanceContent>("InstanceContent", i);

                    if (c.Key != 0)
                    {
                        contents.Add(c);
                    }
                }
                this.InstanceContents = contents;
            }
示例#4
0
        public InstanceContentData(InstanceContent instanceContent)
        {
            if (instanceContent == null)
            {
                throw new ArgumentNullException("instanceContent");
            }

            this.InstanceContent = instanceContent;

            var coll = instanceContent.Sheet.Collection;

            if (!coll.IsLibraAvailable)
            {
                return;
            }

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

            if (libraRow != null)
            {
                Parse(libraRow);
            }
        }
示例#5
0
        JObject CreateTreasureCoffer(dynamic instance, IEnumerable <Saint.InstanceContentData.Treasure> sTreasures, Saint.InstanceContent sInstanceContent, HashSet <int> treasureSet)
        {
            dynamic treasures     = new JObject();
            var     treasureItems = new JArray();

            treasures.items = treasureItems;

            foreach (var sTreasure in sTreasures)
            {
                if (sTreasure.Coordinates != null)
                {
                    treasures.coords = new JArray
                    {
                        sTreasure.Coordinates.Value.X,
                        sTreasure.Coordinates.Value.Y
                    };
                }

                foreach (var sItem in sTreasure.Items)
                {
                    if (treasureItems.Any(i => (int)i == sItem.Key))
                    {
                        continue;
                    }

                    treasureSet.Add(sItem.Key);
                    treasureItems.Add(sItem.Key);
                    var item = _builder.Db.ItemsById[sItem.Key];
                    if (item.instances == null)
                    {
                        item.instances = new JArray();
                    }
                    JArray itemInstances = item.instances;
                    if (!itemInstances.Any(i => (int)i == sInstanceContent.Key))
                    {
                        itemInstances.Add(sInstanceContent.Key);
                    }

                    _builder.Db.AddReference(instance, "item", sItem.Key, false);
                    _builder.Db.AddReference(item, "instance", (string)instance.id, true);
                }
            }

            return(treasureItems.Count > 0 ? treasures : null);
        }
示例#6
0
 public InstanceContentData(InstanceContent instanceContent)
 {
 }