Beispiel #1
0
        public FinishData Copy()
        {
            var result = new FinishData();

            foreach (var material in this.Materials)
            {
                result.Materials.Add(new ProductionMaterialData(material.Tag, material.Amount));
            }

            result.Color1 = this.Color1;
            result.Color2 = this.Color2;
            result.Color3 = this.Color3;

            return(result);
        }
Beispiel #2
0
        protected override void ReadEntry(JObject entry)
        {
            entry.AssertNotMissing("category", "id", "manualItemId", "itemId", "exp", "rank", "maxProgress", "rainBonus", "materials", "finish");

            var data = new ManualData();

            data.Category     = (ManualCategory)entry.ReadInt("category");
            data.Id           = entry.ReadInt("id");
            data.ManualItemId = entry.ReadInt("manualItemId");
            data.ItemId       = entry.ReadInt("itemId");
            data.Exp          = entry.ReadInt("exp");
            data.MaxProgress  = entry.ReadFloat("maxProgress");
            data.RainBonus    = entry.ReadFloat("rainBonus");

            // Rank
            var difficultyRank = entry.ReadString("rank");

            if (difficultyRank == "Novice")
            {
                data.Rank = SkillRank.Novice;
            }
            else
            {
                data.Rank = (SkillRank)(16 - int.Parse(difficultyRank, NumberStyles.HexNumber));
            }

            // Materials
            foreach (var material in entry["materials"])
            {
                var materialData = new ProductionMaterialData();

                materialData.Tag    = (string)material[0];
                materialData.Amount = (int)material[1];

                data.Materials.Add(materialData);
            }

            // Finishes
            foreach (JObject finish in entry["finish"])
            {
                var finishData = new FinishData();

                foreach (var material in finish["materials"])
                {
                    var materialData = new ProductionMaterialData();

                    materialData.Tag    = (string)material[0];
                    materialData.Amount = (int)material[1];

                    finishData.Materials.Add(materialData);
                }

                if (finish.ContainsKey("color1"))
                {
                    finishData.Color1 = finish.ReadUInt("color1");
                }
                if (finish.ContainsKey("color2"))
                {
                    finishData.Color2 = finish.ReadUInt("color2");
                }
                if (finish.ContainsKey("color3"))
                {
                    finishData.Color3 = finish.ReadUInt("color3");
                }

                data.Finish.Add(finishData);
            }

            data.ItemData = AuraData.ItemDb.Find(data.ItemId);
            if (data.ItemData == null)
            {
                throw new DatabaseErrorException("Item not found: " + data.ItemId);
            }

            this.Entries.Add(data);
        }