/// <summary>
 /// Load the mod settings.
 /// </summary>
 public override void Load(TagCompound tag)
 {
     SetWings(false, ItemIO.Load(tag.GetCompound(WINGS_TAG)));
     SetWings(true, ItemIO.Load(tag.GetCompound(VANITY_WINGS_TAG)));
     SetDye(ItemIO.Load(tag.GetCompound(WING_DYE_TAG)));
     EquipWingSlot.ItemVisible = tag.GetBool(HIDDEN_TAG);
 }
Esempio n. 2
0
 /// <summary>
 /// Load the mod settings.
 /// </summary>
 public override void Load(TagCompound tag)
 {
     Tervania.instance.ui.Refresh();
     SetESoul(ItemIO.Load(tag.GetCompound(EnchantedSoulTag)));
     SetBSoul(ItemIO.Load(tag.GetCompound(BulletSoulTag)));
     SetGSoul(ItemIO.Load(tag.GetCompound(GuardianSoulTag)));
 }
 /// <summary>
 /// Load the mod settings.
 /// </summary>
 public override void Load(TagCompound tag)
 {
     SetWings(false, ItemIO.Load(tag.GetCompound(WingsTag)));
     SetWings(true, ItemIO.Load(tag.GetCompound(VanityWingsTag)));
     SetDye(ItemIO.Load(tag.GetCompound(WingDyeTag)));
     EquipSlot.ItemVisible = tag.GetBool(HiddenTag);
 }
Esempio n. 4
0
 void LoadExtraData(TagCompound extraData)
 {
     haveDiscovered = extraData.GetBool("dsvd");
     name           = extraData.GetString("name");
     chest          = AcquireChestData(extraData.GetCompound("chest"));
     sign           = AcquireSignData(extraData.GetCompound("sign"));
 }
Esempio n. 5
0
 public override void Load(TagCompound tag)
 {
     UUID = tag.Get <Guid>("UUID");
     Handler.Load(tag.GetCompound("Items"));
     EnergyHandler.Load(tag.GetCompound("Energy"));
     radius = tag.GetInt("Radius");
     height = tag.GetInt("Depth");
 }
        internal static void Load(VapePlayer modPlayer, TagCompound tag)
        {
            TagCompound stats        = tag.GetCompound("BaseStats");
            TagCompound skillLevels  = tag.GetCompound("SkillLevels");
            TagCompound chaosBonuses = tag.GetCompound("ChaosBonuses");

            string key;

            modPlayer.statPoints  = tag.GetAsInt("StatPoints");
            modPlayer.skillPoints = tag.GetAsInt("SkillPoints");
            modPlayer.chaosPoints = tag.GetAsInt("ChaosPoints");

            // Unboxing values into the proper dictionary
            foreach (var stat in stats)
            {
                key = stat.Key;
                // Intellect was removed in v0.3.1
                if (key == "Intellect")
                {
                    modPlayer.statPoints += (int)stat.Value;
                    continue;
                }
                // Agility was renamed to Haste in v0.3.1
                else if (key == "Agility")
                {
                    key = "Haste";
                }
                modPlayer.BaseStats[key] = (int)stat.Value;
            }

            foreach (var skillLevel in skillLevels)
            {
                modPlayer.SkillLevels[skillLevel.Key] = (int)skillLevel.Value;
            }

            foreach (var chaosBonus in chaosBonuses)
            {
                key = chaosBonus.Key;
                // Movement Speed as a chaos bonus was replaced with Max Run Speed in v0.3.1
                if (key == "Movement Speed")
                {
                    key = "Max Run Speed";
                }
                modPlayer.ChaosBonuses[key] = (float)chaosBonus.Value;
            }

            modPlayer.chaosRank = tag.GetAsInt("ChaosRank");
            modPlayer.chaosXp   = tag.GetAsLong("ChaosXp");

            modPlayer.xp = tag.GetAsLong("Xp");
            Vector2 expUIPos = tag.Get <Vector2>("expUIPos");

            VapeRPG vapeMod = (modPlayer.mod as VapeRPG);

            vapeMod.ExpUI.SetPanelPosition(expUIPos);
        }
Esempio n. 7
0
 public override void Load(TagCompound tag)
 {
     mod.Logger.Info("Mod World Load start");
     if (tag.ContainsKey("chunkData") && tag.GetCompound("chunkData").Count != 0)
     {
         LoadChunk(tag.GetCompound("chunkData"));
     }
     else
     {
         CreateChunk();
     }
     mod.Logger.Info("Mod World Load end");
 }
Esempio n. 8
0
        public override void Load(TagCompound tag)
        {
            Inactive = tag.GetBool("Inactive");
            TagCompound tagCenter = tag.GetCompound("Center");

            center = new Point16(tagCenter.GetShort("X"), tagCenter.GetShort("Y"));
        }
Esempio n. 9
0
        public override void Load(TagCompound tag)
        {
            base.Load(tag);
            TagCompound tagLocator = tag.GetCompound("Locator");

            locator = new Point16(tagLocator.GetShort("X"), tagLocator.GetShort("Y"));
        }
Esempio n. 10
0
        public override void Load(TagCompound tag)
        {
            amuletSlotItem = ItemIO.Load(tag.GetCompound("amuletSlotItem"));

            // Load to slot
            Decimation.amuletSlotState.LoadItem(amuletSlotItem);
        }
        public override void Load(TagCompound tag)
        {
            SingleEntryFactory.Instance = tag.Get <SingleEntryFactory>(SingleEntriesTagName);
            LoadTagCompoundStorage(tag.GetCompound(DimensionListTagName));

            SingleEntryFactory.Instance.Load();
        }
Esempio n. 12
0
        public override void Load(Item item, TagCompound tag)
        {
            TagCompound statBonusTC = tag.GetCompound("StatBonuses");

            this.wasQualified = tag.GetBool("WasQualified");
            this.statBonus.Clear();

            if (this.wasQualified)
            {
                this.quality = (ItemQuality)Enum.Parse(ItemQuality.Common.GetType(), tag.GetString("Quality"));
                foreach (var x in statBonusTC)
                {
                    // Fix for potential error due to removing Intellect from stats
                    if (x.Key != "Intellect")
                    {
                        this.statBonus.Add(x.Key, (int)x.Value);
                    }
                }

                if (this.quality == ItemQuality.Unique)
                {
                    item.expert = true;
                }
            }
        }
Esempio n. 13
0
 internal void Load(TagCompound tag)
 {
     for (int i = 0; i < item.Length; i += 1)
     {
         item[i] = ItemIO.Load(tag.GetCompound($"item{i}"));
     }
 }
Esempio n. 14
0
        public override void Load(TagCompound tag)
        {
            research = tag;
            if (research == null)
            {
                research = new TagCompound();
            }
            if (research.ContainsKey("0.research"))
            {
                destroyingItem = ItemIO.Load(research.GetCompound("0.research"));
                research.Remove("0.research");
            }
            if (research.ContainsKey("0.prefix"))
            {
                ((ResearchFrom14)ModLoader.GetMod("ResearchFrom14")).preUI.itemSlot.item     = ItemIO.Load(research.GetCompound("0.prefix"));
                ((ResearchFrom14)ModLoader.GetMod("ResearchFrom14")).preUI.itemSlot.realItem = ((ResearchFrom14)ModLoader.GetMod("ResearchFrom14")).preUI.itemSlot.item;
                research.Remove("0.prefix");
            }

            if (!research.ContainsKey(ResearchFrom14.ItemIDToTag(ModContent.ItemType <ResearchSharingBook>())) ||
                !research.ContainsKey(ResearchFrom14.ItemIDToTag(ModContent.ItemType <ResearchErasingBook>())))
            {
                research[ResearchFrom14.ItemIDToTag(ModContent.ItemType <ResearchSharingBook>())] = Int32.MaxValue - 1000;
                research[ResearchFrom14.ItemIDToTag(ModContent.ItemType <ResearchErasingBook>())] = Int32.MaxValue - 1000;
            }
            researchedCache     = new List <int>();
            researchedTileCache = new List <int>();
            researchedTileAdj   = new bool[TileLoader.TileCount];
            mod.Logger.Info("Player " + player.name + " knows " + research.Count + " Items");
            populateCache = Task.Run(actualRebuildCache);
        }
Esempio n. 15
0
        public override void Load(TagCompound tag)
        {
            try
            {
                Tier = (DuctTier)tag.GetInt("Tier");
                switch (Tier)
                {
                case DuctTier.Basic:
                    Speed = 20;
                    break;

                case DuctTier.Advanced:
                    Speed = 12;
                    break;

                case DuctTier.Elite:
                    Speed = 5;
                    break;
                }

                if (tag.ContainsKey("Module"))
                {
                    TagCompound module = tag.GetCompound("Module");
                    Module        = (BaseModule)Activator.CreateInstance(Type.GetType(module.GetString("Type")));
                    Module.Parent = this;
                    Module.Load(module.GetCompound("Data"));
                }
            }
            catch
            {
            }
        }
Esempio n. 16
0
        public static T Deserialize <T>(TagCompound tag) where T : TagSerializable
        {
            if (tag == null)
            {
                return(default(T));
            }

            Type type = GetType(tag.GetString("type"));

            if (type == null)
            {
                throw new TypeUnloadedException();
            }

            FieldInfo deserializerField = type.GetField("DESERIALIZER");

            if (deserializerField == null)
            {
                throw new Exception(string.Format("Missing deserializer for type {0}.", type.FullName));
            }

            ITagDeserializer <T> deserializer = (ITagDeserializer <T>)deserializerField.GetValue(null);
            TagCompound          dataTag      = tag.HasTag("data") ? tag.GetCompound("data") : null;

            return(deserializer.Deserialize(dataTag));
        }
Esempio n. 17
0
        public static ChestRule Deserialize(TagCompound tag)
        {
            var rule = new ChestRuleGuaranteed();

            rule.pool = DeserializePool(tag.GetCompound("Pool"));

            return(rule);
        }
Esempio n. 18
0
 public override void Load(TagCompound tag)
 {
     data.Load(tag.GetCompound(nameof(data)));
     if (data.name == null)
     {
         data.SetDefault();                    //safety check
     }
 }
Esempio n. 19
0
 public InventoryItem(TagCompound tag)
 {
     Id = tag.GetTag("id").ToValueString();
     Count = tag.GetByteValue("Count");
     Damage = tag.GetShortValue("Damage");
     Slot = tag.GetByteValue("Slot");
     Tag = tag.Contains("tag") ? tag.GetCompound("tag") : null;
 }
Esempio n. 20
0
        public Item(string id, TagCompound tag) : base(id, tag)
        {
            var item = tag.GetCompound("Item");

            ItemId = item.GetTag("id").GetValue().ToString();
            Count  = item.GetByteValue("Count");
            Damage = item.GetShortValue("Damage");
        }
Esempio n. 21
0
 internal static void Load(TagCompound compound)
 {
     foreach (var biome in biomes.Values)
     {
         TagCompound biomeCompound = compound.GetCompound(biome.GetType().FullName);
         biome.Load(biomeCompound);
     }
 }
Esempio n. 22
0
 public override void Load(TagCompound tag)
 {
     if (!Guid.TryParse(tag.GetString("ID"), out ID))
     {
         ID = Guid.NewGuid();
     }
     Handler.Load(tag.GetCompound("Items"));
 }
Esempio n. 23
0
        //Loads data
        public override void Load(Item item, TagCompound tag)
        {
            itemName = tag.GetString("Name");
            shaderID = ShaderID.Load(tag.GetCompound("Shader"));

            //Set the item's name correctly
            item.SafeNameOverride(itemName);
        }
Esempio n. 24
0
        public override void Load(TagCompound tag)
        {
            var downed = tag.GetList <string>("downed");

            downedAbomination  = downed.Contains("abomination");
            downedPuritySpirit = downed.Contains("puritySpirit");
            ExampleTravelingMerchant.Load(tag.GetCompound("traveler"));
        }
Esempio n. 25
0
 internal static void Load(TagCompound compound)
 {
     foreach (var item in items.Values)
     {
         TagCompound itemCompound = compound.GetCompound(item.GetType().FullName);
         item.Load(itemCompound);
     }
 }
        private void LoadPokeballs(TagCompound tag)
        {
            ThrownPokeballs = new Dictionary <string, int>();

            foreach (KeyValuePair <string, object> kvp in tag.GetCompound(nameof(ThrownPokeballs)))
            {
                ThrownPokeballs.Add(kvp.Key, int.Parse(kvp.Value.ToString()));
            }
        }
 public override void Load(TagCompound tag)
 {
     UUID = tag.Get <Guid>("UUID");
     Handler.Load(tag.GetCompound("Items"));
     if (tag.ContainsKey("NPC"))
     {
         npcType = tag.GetInt("NPC");
     }
 }
Esempio n. 28
0
        public static ChestRule Deserialize(TagCompound tag)
        {
            var rule = new ChestRulePool();

            rule.itemsToGenerate = tag.GetInt("ToGenerate");
            rule.pool            = DeserializePool(tag.GetCompound("Pool"));

            return(rule);
        }
Esempio n. 29
0
        public static ChestRule Deserialize(TagCompound tag)
        {
            var rule = new ChestRuleChance();

            rule.chance = tag.GetFloat("Chance");
            rule.pool   = DeserializePool(tag.GetCompound("Pool"));

            return(rule);
        }
Esempio n. 30
0
 internal void Load(TagCompound tag)
 {
     unlocked = tag.GetInt("unlocked");
     for (int i = 0; i <= unlocked; i += 1)
     {
         page[i].Load(tag.GetCompound("page" + i));
     }
     OpenPage(0);
 }
Esempio n. 31
0
 public override void Load(TagCompound tag)
 {
     Setup(tag);
     int type = ModLoader.GetMod(modName)?.ItemType(itemName) ?? 0;
     if (type > 0)
     {
         item.netDefaults(type);
         item.modItem.Load(tag.GetCompound("data"));
         ItemIO.LoadGlobals(item, tag.GetList<TagCompound>("globalData"));
     }
 }
Esempio n. 32
0
        public static void Load(Item item, TagCompound tag)
        {
            if (tag.Count == 0)
            {
                item.netDefaults(0);
                return;
            }

            string modName = tag.GetString("mod");
            if (modName == "Terraria")
            {
                item.netDefaults(tag.GetInt("id"));
                if (tag.HasTag("legacyData"))
                    LoadLegacyModData(item, tag.GetByteArray("legacyData"), tag.GetBool("hasGlobalSaving"));
            }
            else
            {
                int type = ModLoader.GetMod(modName)?.ItemType(tag.GetString("name")) ?? 0;
                if (type > 0)
                {
                    item.netDefaults(type);
                    if (tag.HasTag("legacyData"))
                        LoadLegacyModData(item, tag.GetByteArray("legacyData"), tag.GetBool("hasGlobalSaving"));
                    else
                        item.modItem.Load(tag.GetCompound("data"));
                }
                else
                {
                    item.netDefaults(ModLoader.GetMod("ModLoader").ItemType("MysteryItem"));
                    ((MysteryItem)item.modItem).Setup(tag);
                }
            }

            item.Prefix(tag.GetByte("prefix"));
            item.stack = tag.GetTag<int?>("stack") ?? 1;
            item.favorited = tag.GetBool("fav");

            if (!(item.modItem is MysteryItem))
                LoadGlobals(item, tag.GetList<TagCompound>("globalData"));
        }