Example #1
0
        public override void Load(TagCompound tag)
        {
            AddTime = tag.GetIntArray("AddTime");
            tTime   = tag.GetInt("tTime");

            Body = tag.GetBool("Body");
            if (Body)
            {
                BodyType   = tag.GetString("BodyType");
                Health     = tag.GetIntArray("Health");
                Mana       = tag.GetIntArray("Mana");
                Health2    = tag.GetIntArray("Health2");
                Mana       = tag.GetIntArray("Mana");
                Eyes       = tag.Get <Color>("Eyes");
                Skin       = tag.Get <Color>("Skin");
                HairC      = tag.Get <Color>("HairC");
                Hair       = tag.GetInt("Hair");
                Shirt      = tag.Get <Color>("Shirt");
                UnderShirt = tag.Get <Color>("UnderShirt");
                Pants      = tag.Get <Color>("Pants");
                Shoes      = tag.Get <Color>("Shoes");
                Gender     = tag.GetBool("Gender");
            }

            Fetuses = tag.GetInt("Fetuses");
        }
Example #2
0
        /////////////////

        public bool Load(WormholesMod mymod, TagCompound tags)
        {
            if (mymod.Config.Data.DisableNaturalWormholes)
            {
                return(false);
            }
            if (!tags.ContainsKey("wormhole_count"))
            {
                return(false);
            }

            int holes = tags.GetInt("wormhole_count");

            if (holes == 0)
            {
                return(false);
            }

            if (mymod.IsDebugInfoMode())
            {
                LogHelpers.Log("Loading world ids (" + Main.netMode + "): " + holes);
            }

            int[] worm_l_x = tags.GetIntArray("wormhole_left_x");
            int[] worm_l_y = tags.GetIntArray("wormhole_left_y");
            int[] worm_r_x = tags.GetIntArray("wormhole_right_x");
            int[] worm_r_y = tags.GetIntArray("wormhole_right_y");

            for (int i = 0; i < holes && i < worm_l_x.Length && i < WormholeManager.PortalCount; i++)
            {
                if (i < this.Links.Count && this.Links[i] != null)
                {
                    this.Links[i].Close();
                }

                string id = tags.GetString("wormhole_id_" + i);
                if (mymod.IsDebugInfoMode())
                {
                    LogHelpers.Log("  world load id: " + id + " (" + i + ")");
                }

                Vector2 pos_l = new Vector2(worm_l_x[i], worm_l_y[i]);
                Vector2 pos_r = new Vector2(worm_r_x[i], worm_r_y[i]);

                var link = new WormholeLink(id, WormholeLink.GetColor(i), pos_l, pos_r);

                // Failsafe against glitched portals
                if (link.IsMisplaced)
                {
                    ErrorLogger.Log("Found bad portal. " + i + " " + worm_l_x[i] + "," + worm_l_y[i]
                                    + " : " + worm_r_x[i] + "," + worm_r_y[i]);
                    WormholeManager.ForceRegenWormholes = true;
                    break;
                }

                this.Links.Insert(i, link);
            }
            return(true);
        }
        ////////////////

        internal void Load(BetterPaintMod mymod, TagCompound tags, string prefix)
        {
            var myworld = ModContent.GetInstance <BetterPaintWorld>();

            this.Colors.Clear();
            this.Glows.Clear();

            if (tags.ContainsKey(prefix + "_x"))
            {
                int[] fgX = tags.GetIntArray(prefix + "_x");

                for (int i = 0; i < fgX.Length; i++)
                {
                    ushort tileX = (ushort)fgX[i];
                    int[]  fgY   = tags.GetIntArray(prefix + "_" + tileX + "_y");

                    for (int j = 0; j < fgY.Length; j++)
                    {
                        ushort tileY = (ushort)fgY[j];

                        byte[] clrArr = tags.GetByteArray(prefix + "_" + tileX + "_" + tileY);
                        Color  color  = new Color(clrArr[0], clrArr[1], clrArr[2], clrArr[3]);

                        Tile tile = Main.tile[tileX, tileY];

                        if (this.CanPaintAt(tile))
                        {
                            this.SetRawColorAt(color, tileX, tileY);
                        }
                    }
                }
            }

            if (tags.ContainsKey(prefix + "_g_x"))
            {
                int[] fgX = tags.GetIntArray(prefix + "_g_x");

                for (int i = 0; i < fgX.Length; i++)
                {
                    ushort tileX = (ushort)fgX[i];
                    int[]  fgY   = tags.GetIntArray(prefix + "_g_" + tileX + "_y");

                    for (int j = 0; j < fgY.Length; j++)
                    {
                        ushort tileY = (ushort)fgY[j];

                        byte glow = tags.GetByte(prefix + "_g_" + tileX + "_" + tileY);

                        Tile tile = Main.tile[tileX, tileY];

                        if (this.CanPaintAt(tile))
                        {
                            this.SetGlowAt(glow, tileX, tileY);
                        }
                    }
                }
            }
        }
Example #4
0
 public override void Load(TagCompound tag)
 {
     itemList      = tag.GetIntArray(nameof(itemList));
     itemStackList = tag.GetIntArray(nameof(itemStackList));
     ChestType     = tag.GetAsShort(nameof(ChestType));
     ChestName     = tag.GetString(nameof(ChestName));
     inventorySpot = tag.GetAsInt(nameof(inventorySpot));
     firstTick     = tag.GetBool(nameof(firstTick));
     GotChest      = tag.GetBool(nameof(GotChest));
 }
Example #5
0
        public override void Load(TagCompound tag)
        {
            unlock           = tag.GetIntArray(nameof(unlock));
            upgradeUnlock    = tag.GetIntArray(nameof(upgradeUnlock));
            upgrade          = tag.GetIntArray(nameof(upgrade));
            staminamax       = tag.GetInt(nameof(staminamax));
            permanentstamina = tag.GetInt(nameof(permanentstamina));
            HasSecondSlot    = tag.GetBool(nameof(HasSecondSlot));

            stamina = staminamax + permanentstamina;
        }
Example #6
0
 public override void Load(TagCompound tag)
 {
     if (tag.ContainsKey("GoldBroadsword"))
     {
         GoldBroadsword = tag.GetIntArray("GoldBroadsword");
     }
     if (tag.ContainsKey("GoldBroadsword"))
     {
         GoldBroadsword = tag.GetIntArray("GoldBroadsword");
     }
 }
Example #7
0
        ////////////////

        public void LoadVendorsForCurrentPlayer(CapitalismMod mymod, TagCompound tags, string worldId)
        {
            try {
                int vendorCount = tags.GetInt(worldId + "_vendor_count");

                IDictionary <int, VendorLogic> vendors;
                if (this.VendorWorlds.Keys.Contains(worldId) && this.VendorWorlds[worldId] != null)
                {
                    vendors = this.VendorWorlds[worldId];
                }
                else
                {
                    vendors = this.VendorWorlds[worldId] = new Dictionary <int, VendorLogic>(vendorCount);
                }

                for (int i = 0; i < vendorCount; i++)
                {
                    if (!tags.ContainsKey(worldId + "_vendor_npc_types_" + i))
                    {
                        continue;
                    }

                    int    npcType             = tags.GetInt(worldId + "_vendor_npc_types_" + i);
                    int[]  totalPurchaseTypes  = tags.GetIntArray(worldId + "_vendor_total_purchase_types_" + i);
                    int[]  totalSpendingsTypes = tags.GetIntArray(worldId + "_vendor_total_spendings_types_" + i);
                    string jsonTotalPurchases  = tags.GetString(worldId + "_vendor_total_purchases_str_" + i);
                    string jsonTotalSpendings  = tags.GetString(worldId + "_vendor_total_spendings_str_" + i);

                    float[] totalPurchases = JsonConvert.DeserializeObject <float[]>(jsonTotalPurchases);
                    float[] totalSpendings = JsonConvert.DeserializeObject <float[]>(jsonTotalSpendings);

                    //if( (DebugHelper.DEBUGMODE & 1) > 0 ) {
                    //	ErrorLogger.Log( "    load " + world_id + "_vendor_npc_types_" + i + ": " + npc_type );
                    //	ErrorLogger.Log( "    load " + world_id + "_vendor_total_purchase_types_" + i + ": " + string.Join( ",", total_purchase_types ) );
                    //	ErrorLogger.Log( "    load " + world_id + "_vendor_total_spendings_types_" + i + ": " + string.Join( ",", total_spendings_types ) );
                    //	ErrorLogger.Log( "    load " + world_id + "_vendor_total_purchases_str_" + i + ": " + json_total_purchases );
                    //	ErrorLogger.Log( "    load " + world_id + "_vendor_total_spendings_str_" + i + ": " + json_total_spendings );
                    //}

                    vendors[npcType] = VendorLogic.Create(npcType);
                    if (vendors[npcType] != null)
                    {
                        vendors[npcType].LoadTotalPurchases(totalPurchaseTypes, totalSpendingsTypes, totalPurchases, totalSpendings);
                    }
                }
            } catch (Exception e) {
                LogHelpers.Warn(e.ToString());
                this.VendorWorlds = new Dictionary <string, IDictionary <int, VendorLogic> >();
            }
        }
Example #8
0
 public override void Load(TagCompound tag)
 {
     try
     {
         level = tag.GetIntArray("levels");
         if (level.Length == 21)
         {
             int[] leveltemp = new int[22];
             for (int i = 0; i < 21; i++)
             {
                 leveltemp[i] = level[i];
             }
             level = leveltemp;
             for (int i = 0; i < 21; i++)
             {
                 experience[i] = tag.GetLong("exp" + i);
             }
         }
         else
         {
             for (int i = 0; i < 22; i++)
             {
                 experience[i] = tag.GetLong("exp" + i);
             }
         }
     }
     catch
     {
     }
 }
Example #9
0
        public override void Load(Item item, TagCompound tag)
        {
            if (item.type == 0 || tag == null || item.type == ModLoader.GetMod("ModLoader").ItemType("MysteryItem"))
            {
                return;
            }
            EMMItem info = item.GetGlobalItem <EMMItem>();

            int[]    ids        = tag.GetIntArray("IDs");
            double[] magnitudes = new double[4];
            magnitudes[0]      = tag.GetAsDouble("Magnitude0");
            magnitudes[1]      = tag.GetAsDouble("Magnitude1");
            magnitudes[2]      = tag.GetAsDouble("Magnitude2");
            magnitudes[3]      = tag.GetAsDouble("Magnitude3");
            info.alreadyRolled = tag.GetBool("Rolled?");
            info.title         = tag.GetString("Title");
            for (int i = 0; i < ids.Length; i++)
            {
                try
                {
                    addPrefix(item, ids[i], (float)magnitudes[i] / ((item.accessory) ? .6f : 1), i);
                }
                catch
                {
                    ErrorLogger.Log("Save Out of Bounds Error! Please report this.");
                }
            }
        }
Example #10
0
 public override void Load(TagCompound tag)
 {
     BossDefeatedList = new List <int>();
     BossDefeated     = tag.GetInt("BossDefeated");
     Day = tag.GetInt("day");
     ConvertToList(tag.GetIntArray("BossDefeatedList"));
     AnotherRpgMod.PlayerLevel = 0;
 }
        public override void Load(TagCompound tag)
        {
            TagCompound quizTag = tag.Get <TagCompound>("quiz");
            int         version = quizTag.GetInt("v");

            if (version == 0 && quizTag.ContainsKey("lastUsedTypes"))
            {
                LastUsedTypes = quizTag.GetIntArray("lastUsedTypes").Select(v => (PersonalityType)v).ToArray();
            }
        }
 public override void Load(TagCompound tag)
 {
     if (tag.ContainsKey("ItemsOnPotion"))
     {
         ItemsOnPotion = tag.GetList <Item>("ItemsOnPotion").ToList();
     }
     if (tag.ContainsKey("Brewed"))
     {
         Brewed = tag.GetBool("Brewed");
     }
     if (tag.ContainsKey("Style"))
     {
         Style = tag.GetInt("Style");
     }
     if (tag.ContainsKey("AverageColor"))
     {
         AverageColor = new Color(tag.GetIntArray("AverageColor")[0], tag.GetIntArray("AverageColor")[1], tag.GetIntArray("AverageColor")[2], tag.GetIntArray("AverageColor")[3]);
     }
 }
Example #13
0
        public override void Load(TagCompound tag)
        {
            villageReputation = tag.GetIntArray("VillageReputation");
            IList <TagCompound> villagerData = tag.GetList <TagCompound>("VillagerData");

            for (int i = 0; i < villagerData.Count; i++)
            {
                int villagerType    = NPCType <SkyVillager>();
                int recievedVilType = villagerData[i].GetAsInt("type");
                //if (recievedVilType == (int)VillagerType.LihzahrdVillager)
                //Lihzahrd Villager types here
                int npcIndex   = NPC.NewNPC((int)villagerData[i].GetFloat("x"), (int)villagerData[i].GetFloat("y"), villagerType);
                NPC npcAtIndex = Main.npc[npcIndex];
                npcAtIndex.GivenName = villagerData[i].GetString("name");
                ((Villager)npcAtIndex.modNPC).spriteVariation = villagerData[i].GetInt("spriteVar");
                ((Villager)npcAtIndex.modNPC).homePosition    = villagerData[i].Get <Vector2>("homePos");
            }
            villageGiftCooldown = tag.GetIntArray("VillageGiftCooldown");
        }
Example #14
0
 public override void LoadData(TagCompound tag)
 {
     partyUpgrades = tag.GetIntArray("partyUpgrades");
     playerCreated = tag.GetBool("playerCreated");
     playerDied    = tag.GetBool("playerDied");
     if (tag.ContainsKey("playerSpawn"))
     {
         originalSpawnPoint = tag.Get <Vector2>("playerSpawn");
     }
     KingdomTerrahearts.instance.ShowDialogUI();
 }
Example #15
0
        public override void Load(TagCompound tag)
        {
            vitricTopLeft   = tag.Get <Vector2>(nameof(vitricTopLeft));
            AnyBossDowned   = tag.GetBool(nameof(AnyBossDowned));
            GlassBossDowned = tag.GetBool(nameof(GlassBossDowned));
            SealOpen        = tag.GetBool(nameof(SealOpen));

            ForceStarfall = tag.GetBool(nameof(ForceStarfall));

            NPCUpgrades = tag.GetIntArray(nameof(NPCUpgrades));

            PureTiles      = (List <Vector2>)tag.GetList <Vector2>(nameof(PureTiles));
            PureSpawnPoint = tag.Get <Vector2>(nameof(PureSpawnPoint));


            for (int k = 0; k <= PureTiles.Count - 1; k++)
            {
                for (int i = (int)PureTiles[k].X - 16; i <= (int)PureTiles[k].X + 16; i++)
                {
                    for (int j = (int)PureTiles[k].Y - 16; j <= (int)PureTiles[k].Y + 16; j++)
                    {
                        Tile target = Main.tile[i, j];
                        if (target != null)
                        {
                            if (target.type == (ushort)mod.TileType("StonePure"))
                            {
                                target.type = TileID.Stone;
                            }
                            if (target.type == (ushort)mod.TileType("OreIvory"))
                            {
                                target.type = (ushort)mod.TileType("OreEbony");
                            }
                            if (target.type == (ushort)mod.TileType("VoidDoorOff"))
                            {
                                target.type = (ushort)mod.TileType("VoidDoorOn");
                            }
                        }
                    }
                }
            }

            foreach (NPC npc in Main.npc)
            {
                if (npc.townNPC)
                {
                    npc.life = 250 + NPCUpgrades[0] * 50;
                }
            }
            PureTiles.Clear();
            PureTiles = new List <Vector2> {
            };
        }
Example #16
0
        public override void Load(TagCompound tag)
        {
            LoadStand(tag);
            var retardedFuckingArrayBullshit = tag.GetIntArray("DamageCaps");

            if (retardedFuckingArrayBullshit.Length == 5)
            {
                for (int i = 0; i < 5; i++)
                {
                    damageCaps[i] = retardedFuckingArrayBullshit[i];
                }
            }
        }
Example #17
0
 public override void Load(TagCompound tag)
 {
     contrabande         = tag.Get <List <Item> >(nameof(contrabande));
     superintendentDelay = tag.GetInt(nameof(superintendentDelay));
     preset     = tag.GetInt(nameof(preset));
     witchQuest = tag.GetIntArray(nameof(witchQuest));
     witchEgg   = tag.GetBool(nameof(witchEgg));
     if (tag.Get <List <PlayerPreset> >(nameof(presets)) != null && tag.Get <List <PlayerPreset> >(nameof(presets)).Count > 0)
     {
         presets = tag.Get <List <PlayerPreset> >(nameof(presets));
     }
     //MBAddress = tag.GetString(nameof(MBAddress));
 }
Example #18
0
    /// <summary>
    /// Try to get from tag, else default to specified value. Supports int, float, double, bool, long, string, int[], byte[]
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="tag"></param>
    /// <param name="key"></param>
    /// <param name="defaultValue"></param>
    /// <returns></returns>
    public static T TryGet <T>(TagCompound tag, string key, T defaultValue)
    {
        try
        {
            T    val;
            Type type = typeof(T);
            if (type == typeof(int))
            {
                val = (T)Convert.ChangeType(tag.GetInt(key), type);
            }
            else if (type == typeof(float))
            {
                val = (T)Convert.ChangeType(tag.GetFloat(key), type);
            }
            else if (type == typeof(double))
            {
                val = (T)Convert.ChangeType(tag.GetDouble(key), type);
            }
            else if (type == typeof(bool))
            {
                val = (T)Convert.ChangeType(tag.GetBool(key), type);
            }
            else if (type == typeof(long))
            {
                val = (T)Convert.ChangeType(tag.GetLong(key), type);
            }
            else if (type == typeof(string))
            {
                val = (T)Convert.ChangeType(tag.GetString(key), type);
            }
            else if (type == typeof(int[]))
            {
                val = (T)Convert.ChangeType(tag.GetIntArray(key), type);
            }
            else if (type == typeof(byte[]))
            {
                val = (T)Convert.ChangeType(tag.GetByteArray(key), type);
            }
            else
            {
                throw new Exception();
            }

            return(val);
        }
        catch
        {
            return(defaultValue);
        }
    }
Example #19
0
        public override void Load(TagCompound tag)
        {
            var downed = tag.GetList <string>("downed");

            downedDualForce    = downed.Contains("DualForce");
            downedHarpyQueen   = downed.Contains("HarpyQueen");
            downedAlgorithmo   = downed.Contains("Algorithmo");
            tarr1              = tag.Get <List <int> >("tarr1");
            tarr2              = tag.Get <List <Vector2> >("tarr2");
            LMan.setupShop     = tag.Get <List <int> >("botShop");
            dualForceEncounter = tag.GetInt(nameof(dualForceEncounter));
            packages           = tag.Get <List <PackageData> >(nameof(packages));
            pirateIndex        = tag.GetIntArray(nameof(pirateIndex));
            pedestals          = tag.Get <List <PedestalData> >(nameof(pedestals));
        }
Example #20
0
        public override void Load(Item item, TagCompound tag)
        {
            buffTimes      = tag.GetIntArray("buffTimes");
            noDisplayTimes = tag.GetList <bool>("displayTimes").ToArray();

            itemBuffs = new List <Tuple <string, int> >();
            var list = tag.GetList <TagCompound>("itemBuffs");

            foreach (var i in list)
            {
                string type  = i.GetString("type");
                int    index = i.GetInt("timeIndex");
                itemBuffs.Add(new Tuple <string, int>(type, index));
            }
        }
Example #21
0
        public void GetIntArray_returns_null_item()
        {
            // arrange
            TagCompound target;
            Tag         actual;
            string      name;

            name = "alpha";

            target = new TagCompound();

            // act
            actual = target.GetIntArray(name);

            // assert
            Assert.IsNull(actual);
        }
Example #22
0
 public override void Load(TagCompound tag)
 {
     BossDefeatedList = new List <int>();
     BossDefeated     = tag.GetInt("BossDefeated");
     Day = tag.GetInt("day");
     ConvertToList(tag.GetIntArray("BossDefeatedList"));
     ascended           = tag.GetBool("ascended");
     ascendedLevelBonus = tag.GetInt("ascendedLevel");
     if (Main.netMode == NetmodeID.SinglePlayer)
     {
         PlayerLevel = tag.GetInt("PlayerLevel");
     }
     else
     {
         PlayerLevel = 0;
     }
 }
Example #23
0
        public void GetIntArray_returns_existing_tag()
        {
            // arrange
            TagCompound target;
            Tag         actual;
            string      name;

            name = "alpha";

            target = new TagCompound();
            target.Value.Add(name, new[] { 2190, 2994, 3248, 4294394 });

            // act
            actual = target.GetIntArray(name);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsInstanceOf <TagIntArray>(actual);
        }
Example #24
0
        ////////////////

        public override void Load(TagCompound tag)
        {
            var  mymod = (TheLunaticMod)this.mod;
            bool hasArrived = false, hasQuit = false, hasEnd = false, hasWon = false, isSafe = false;
            int  time = 0;

            int[] masks           = new int[0];
            int   customMaskCount = 0;

            string[] customMasks = new string[0];

            if (tag.ContainsKey("world_id"))
            {
                this.ID = tag.GetString("world_id");

                hasArrived = tag.GetBool("has_loony_arrived");
                hasQuit    = tag.GetBool("has_loony_quit");
                hasEnd     = tag.GetBool("has_game_ended");
                hasWon     = tag.GetBool("has_won");
                isSafe     = tag.GetBool("is_safe");

                time = tag.GetInt("half_days_elapsed_" + this.ID);

                masks = tag.GetIntArray("masks_given_" + this.ID);

                customMaskCount = tag.GetInt("custom_masks_given_" + this.ID);
                customMasks     = new string[customMaskCount];
                for (int i = 0; i < customMaskCount; i++)
                {
                    customMasks[i] = tag.GetString("custom_mask_" + this.ID + "_" + i);
                }
            }

            this.HasCorrectID = true;

            this.GameLogic.LoadOnce(hasArrived, hasQuit, hasEnd, hasWon, isSafe, time);
            this.MaskLogic.LoadOnce(masks, customMasks);
        }
Example #25
0
        private void TestNbt(TagCompound compoundTag)
        {
            var byteMin = compoundTag.GetByte("byte_min");

            Assert.AreEqual(-128, byteMin.Value);
            var byteMax = compoundTag.GetByte("byte_max");

            Assert.AreEqual(127, byteMax.Value);

            var shortMin = compoundTag.GetShort("short_min");

            Assert.AreEqual(-32768, shortMin.Value);
            var shortMax = compoundTag.GetShort("short_max");

            Assert.AreEqual(32767, shortMax.Value);

            var intMin = compoundTag.GetInt("int_min");

            Assert.AreEqual(-2147483648, intMin.Value);
            var intMax = compoundTag.GetInt("int_max");

            Assert.AreEqual(2147483647, intMax.Value);

            var longMin = compoundTag.GetLong("long_min");

            Assert.AreEqual(-9223372036854775808, longMin.Value);
            var longMax = compoundTag.GetLong("long_max");

            Assert.AreEqual(9223372036854775807, longMax.Value);

            var floatTag = compoundTag.GetFloat("float");

            Assert.AreEqual(12345.6f, floatTag.Value);

            var doubleTag = compoundTag.GetDouble("double");

            Assert.AreEqual(12345.6, doubleTag.Value);

            var byteArray = compoundTag.GetByteArray("byte_array");

            Assert.AreEqual(3, byteArray.Value.Length);
            Assert.AreEqual(0x12, byteArray.Value[0]);
            Assert.AreEqual(0x34, byteArray.Value[1]);
            Assert.AreEqual(0x56, byteArray.Value[2]);

            var stringTag = compoundTag.GetString("string");

            Assert.AreEqual("hello!", stringTag.Value);

            var list      = compoundTag.GetList("string_list");
            var listValue = list.GetArrayString();

            Assert.AreEqual(3, listValue.Length);
            Assert.AreEqual("i'm in an array!", listValue[0].Value);
            Assert.AreEqual("i am also in an array!", listValue[1].Value);
            Assert.AreEqual("walter", listValue[2].Value);

            var emptyList      = compoundTag.GetList("empty_list");
            var emptyListValue = emptyList.GetArrayByte();

            Assert.AreEqual(0, emptyListValue.Length);

            var listList      = compoundTag.GetList("list_list");
            var listListValue = listList.GetArrayList();

            Assert.AreEqual(3, listListValue.Length);
            var listListValue0 = listListValue[0].GetArrayFloat();

            Assert.AreEqual(3, listListValue0.Length);
            Assert.AreEqual(1.1f, listListValue0[0].Value);
            Assert.AreEqual(2.2f, listListValue0[1].Value);
            Assert.AreEqual(3.3f, listListValue0[2].Value);
            var listListValue1 = listListValue[1].GetArrayDouble();

            Assert.AreEqual(3, listListValue1.Length);
            Assert.AreEqual(4.4, listListValue1[0].Value);
            Assert.AreEqual(5.5, listListValue1[1].Value);
            Assert.AreEqual(6.6, listListValue1[2].Value);
            var listListValue2 = listListValue[2].GetArrayString();

            Assert.AreEqual(3, listListValue2.Length);
            Assert.AreEqual("wa", listListValue2[0].Value);
            Assert.AreEqual("ta", listListValue2[1].Value);
            Assert.AreEqual("shi", listListValue2[2].Value);

            var compound = compoundTag.GetCompound("compound");

            Assert.AreEqual(3, compound.Count);
            Assert.AreEqual(123, compound.GetByte("compound_byte").Value);
            Assert.AreEqual(694201337, compound.GetInt("compound_int").Value);
            Assert.AreEqual("*holds a gun to your temple*", compound.GetString("compound_string").Value);

            var emptyCompound = compoundTag.GetCompound("empty_compound");

            Assert.AreEqual(0, emptyCompound.Count);

            var intArray = compoundTag.GetIntArray("int_array");

            Assert.AreEqual(4, intArray.Value.Length);
            Assert.AreEqual(69, intArray.Value[0]);
            Assert.AreEqual(420, intArray.Value[1]);
            Assert.AreEqual(1337, intArray.Value[2]);
            Assert.AreEqual(117, intArray.Value[3]);

            var longArray = compoundTag.GetLongArray("long_array");

            Assert.AreEqual(4, longArray.Value.Length);
            Assert.AreEqual(69, longArray.Value[0]);
            Assert.AreEqual(420, longArray.Value[1]);
            Assert.AreEqual(1337, longArray.Value[2]);
            Assert.AreEqual(117, longArray.Value[3]);
        }
Example #26
0
 public override void Load(Item item, TagCompound tag)
 {
     if (tag.ContainsKey("AutoReuse"))
     {
         item.autoReuse = tag.GetBool("AutoReuse");
     }
     if (tag.ContainsKey("Consumable"))
     {
         item.consumable = tag.GetBool("Consumable");
     }
     if (tag.ContainsKey("Potion"))
     {
         item.potion = tag.GetBool("Potion");
     }
     if (tag.ContainsKey("Accessory"))
     {
         item.accessory = tag.GetBool("Accessory");
     }
     if (tag.ContainsKey("DamageType"))
     {
         item.SetDamageType(tag.GetByte("DamageType"));
     }
     if (tag.ContainsKey("Damage"))
     {
         item.damage = tag.GetInt("Damage");
     }
     if (tag.ContainsKey("KnockBack"))
     {
         item.knockBack = tag.GetFloat("KnockBack");
     }
     if (tag.ContainsKey("Crit"))
     {
         item.crit = tag.Get <ushort>("Crit");
     }
     if (tag.ContainsKey("Shoot"))
     {
         item.shoot = tag.Get <ushort>("Shoot");
     }
     if (tag.ContainsKey("ShootSpeed"))
     {
         item.shootSpeed = tag.GetFloat("ShootSpeed");
     }
     if (tag.ContainsKey("CreateTile"))
     {
         item.createTile = tag.Get <ushort>("CreateTile");
     }
     if (tag.ContainsKey("TileBoost"))
     {
         item.tileBoost = (sbyte)tag.Get <byte>("TileBoost");
     }
     if (tag.ContainsKey("BuffType"))
     {
         item.buffType = tag.Get <ushort>("BuffType");
     }
     if (tag.ContainsKey("BuffTime"))
     {
         item.buffTime = tag.GetInt("BuffTime");
     }
     if (tag.ContainsKey("HealLife"))
     {
         item.healLife = tag.Get <ushort>("HealLife");
     }
     if (tag.ContainsKey("HealMana"))
     {
         item.healMana = tag.Get <ushort>("HealMana");
     }
     if (tag.ContainsKey("Axe"))
     {
         item.axe = tag.Get <ushort>("Axe");
     }
     if (tag.ContainsKey("Pickaxe"))
     {
         item.pick = tag.Get <ushort>("Pickaxe");
     }
     if (tag.ContainsKey("Hammer"))
     {
         item.hammer = tag.Get <ushort>("Hammer");
     }
     if (tag.ContainsKey("MaxStack"))
     {
         item.maxStack = tag.GetInt("MaxStack");
     }
     if (tag.ContainsKey("UseAnimation"))
     {
         item.useAnimation = tag.Get <ushort>("UseAnimation");
     }
     if (tag.ContainsKey("UseTime"))
     {
         item.useTime = tag.Get <ushort>("UseTime");
     }
     if (tag.ContainsKey("Defense"))
     {
         item.defense = tag.GetInt("Defense");
     }
     if (tag.ContainsKey("FishingPole"))
     {
         item.fishingPole = tag.Get <ushort>("FishingPole");
     }
     if (tag.ContainsKey("Scale"))
     {
         item.scale = tag.GetFloat("Scale");
     }
     if (tag.ContainsKey("UseStyle"))
     {
         item.useStyle = tag.GetByte("UseStyle");
     }
     if (tag.ContainsKey("CostMP"))
     {
         item.mana = tag.Get <ushort>("CostMP");
     }
     if (tag.ContainsKey("BuffTypes"))
     {
         CustomProperties cItem     = item.GetGlobalItem <CustomProperties>();
         int[]            buffTypes = tag.GetIntArray("BuffTypes");
         int[]            buffTimes = tag.GetIntArray("BuffTimes");
         for (int i = 0; i < cItem.BuffTypes.Length; i++)
         {
             cItem.BuffTypes[i] = buffTypes[i];
             cItem.BuffTimes[i] = buffTimes[i];
         }
     }
 }
 public override void Load(TagCompound tag)
 {
     Buffs  = tag.GetIntArray(nameof(Buffs));
     Powers = tag.GetIntArray(nameof(Powers));
 }
Example #28
0
 public override void Load(TagCompound tag)
 {
     charge  = tag.GetInt("charge");
     charges = tag.GetIntArray("charges");
     type    = tag.GetInt("type");
 }
Example #29
0
 public override void Load(TagCompound tag) // Withdraws the gobbler storage from the savefile
 {
     GobblerStorage = tag.GetIntArray("GobblerStorage");
 }
 public override void Load(TagCompound tag)
 {
     ability          = tag.GetIntArray(nameof(ability));
     staminamax       = tag.GetInt(nameof(staminamax));
     permanentstamina = tag.GetInt(nameof(permanentstamina));
 }