Exemplo n.º 1
0
        public void TestTypePromotions()
        {
            var tag = new TagCompound {
                ["byte1"]   = (byte)5,
                ["byte2"]   = (byte)254,
                ["short1"]  = (short)3200,
                ["short2"]  = (short)-3200,
                ["int1"]    = 0xFFEEFF,
                ["long1"]   = long.MaxValue,
                ["float1"]  = 1.25264f,
                ["float2"]  = float.MaxValue,
                ["float3"]  = float.NaN,
                ["double1"] = 1.25264
            };

            Assert.AreEqual(tag.GetAsShort("byte1"), (short)5);
            Assert.AreEqual(tag.GetAsShort("byte2"), (short)254);
            Assert.AreEqual(tag.GetAsShort("short2"), -3200);
            Assert.AreEqual(tag.GetAsInt("byte1"), 5);
            Assert.AreEqual(tag.GetAsInt("byte2"), 254);
            Assert.AreEqual(tag.GetAsInt("short1"), 3200);
            Assert.AreEqual(tag.GetAsInt("short2"), -3200);
            Assert.AreEqual(tag.GetAsInt("int1"), 0xFFEEFF);
            Assert.AreEqual(tag.GetAsLong("byte1"), 5);
            Assert.AreEqual(tag.GetAsLong("byte2"), 254);
            Assert.AreEqual(tag.GetAsLong("short1"), 3200);
            Assert.AreEqual(tag.GetAsLong("short2"), -3200);
            Assert.AreEqual(tag.GetAsLong("int1"), 0xFFEEFF);
            Assert.AreEqual(tag.GetAsLong("long1"), long.MaxValue);
            Assert.AreEqual(tag.GetAsDouble("float1"), 1.25264f);
            Assert.AreEqual(tag.GetAsDouble("float2"), float.MaxValue);
            Assert.AreEqual(tag.GetAsDouble("float3"), double.NaN);
            Assert.AreEqual(tag.GetAsDouble("double1"), 1.25264);
        }
Exemplo n.º 2
0
        public override void NetReceive(BinaryReader reader, bool lightReceive)
        {
            TagCompound tag = TagIO.Read(reader);

            energy = new EnergyCore(tag.GetAsInt("maxEnergy"));
            energy.addEnergy(tag.GetAsInt("energy"));
        }
Exemplo n.º 3
0
 public int GetResearchedAmount(String itemTag)
 {
     if (research.ContainsKey(itemTag))
     {
         return(research.GetAsInt(itemTag));
     }
     return(0);
 }
Exemplo n.º 4
0
 public override void Load(TagCompound tag)
 {
     mobID       = tag.GetAsInt("mobId");
     currentSoul = tag.GetAsInt("soulCount");
     if (tag.ContainsKey("maxSoulCount"))
     {
         maxSoul = tag.GetAsInt("maxSoulCount");
     }
 }
Exemplo n.º 5
0
        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);
        }
        public override void LoadWorldData(TagCompound tag)
        {
            IList <string> downed = tag.GetList <string>("downed");

            downedBetsy               = downed.Contains("betsy");
            ShouldBeEternityMode      = downed.Contains("shouldBeEternityMode");
            EternityMode              = downed.Contains("eternity") || downed.Contains("m*******t");
            CanPlayMaso               = downed.Contains("CanPlayMaso");
            MasochistModeReal         = downed.Contains("getReal");
            downedFishronEX           = downed.Contains("downedFishronEX");
            downedDevi                = downed.Contains("downedDevi");
            downedAbom                = downed.Contains("downedAbom");
            downedMutant              = downed.Contains("downedMutant");
            AngryMutant               = downed.Contains("AngryMutant");
            haveForcedAbomFromGoblins = downed.Contains("haveForcedAbomFromGoblins");
            ReceivedTerraStorage      = downed.Contains("ReceivedTerraStorage");
            spawnedDevi               = downed.Contains("spawnedDevi");

            for (int i = 0; i < downedBoss.Length; i++)
            {
                downedBoss[i] = downed.Contains($"downedBoss{i}") || downed.Contains($"downedChampion{i}");
            }

            if (tag.ContainsKey("mutantP1"))
            {
                skipMutantP1 = tag.GetAsInt("mutantP1");
            }
        }
Exemplo n.º 7
0
        public override void Load(TagCompound tag)
        {
            IList <string> downed = tag.GetList <string>("downed");

            downedBetsy          = downed.Contains("betsy");
            _downedBoss          = downed.Contains("boss");
            MasochistMode        = downed.Contains("m*******t");
            downedFishronEX      = downed.Contains("downedFishronEX");
            downedDevi           = downed.Contains("downedDevi");
            downedAbom           = downed.Contains("downedAbom");
            downedMutant         = downed.Contains("downedMutant");
            AngryMutant          = downed.Contains("AngryMutant");
            downedMM             = downed.Contains("downedMadhouse");
            firstGoblins         = downed.Contains("forceMeteor");
            NoMasoBossScaling    = downed.Contains("NoMasoBossScaling");
            ReceivedTerraStorage = downed.Contains("ReceivedTerraStorage");

            for (int i = 0; i < downedChampions.Length; i++)
            {
                downedChampions[i] = downed.Contains("downedChampion" + i.ToString());
            }

            if (tag.ContainsKey("mutantP1"))
            {
                skipMutantP1 = tag.GetAsInt("mutantP1");
            }
        }
Exemplo n.º 8
0
        public override void Load(Item item, TagCompound tag)
        {
            string rarityModName = tag.GetString("rarityMod");
            Mod    mod           = ModLoader.GetMod(rarityModName);

            if (mod == null)
            {
                PathOfModifiers.Instance.Logger.Warn($"Mod '{rarityModName}' not found");
                return;
            }
            string rarityFullName = tag.GetString("rarityFullName");
            Type   type           = mod.Code.GetType(rarityFullName);

            if (type == null)
            {
                PathOfModifiers.Instance.Logger.Warn($"Rarity '{type.FullName}' doesn't exist");
                return;
            }
            if (type.IsDefined(typeof(DisableAffix), false))
            {
                PathOfModifiers.Instance.Logger.Warn($"Rarity '{type.FullName}' is disabled");
                return;
            }
            rarity = PoMDataLoader.raritiesItem[PoMDataLoader.rarityItemMap[type]];
            int         affixCount = tag.GetAsInt("affixCount");
            TagCompound affixTag;
            Affix       affix;

            for (int i = 0; i < affixCount; i++)
            {
                affixTag = tag.GetCompound(i.ToString());
                string affixModName = affixTag.GetString("affixMod");
                mod = ModLoader.GetMod(affixModName);
                if (mod == null)
                {
                    PathOfModifiers.Instance.Logger.Warn($"Mod '{affixModName}' not found");
                    continue;
                }
                string affixFullName = affixTag.GetString("affixFullName");
                type = mod.Code.GetType(affixFullName);
                if (type == null)
                {
                    PathOfModifiers.Instance.Logger.Warn($"Affix '{affixFullName}' doesn't exist");
                    continue;
                }
                if (type.IsDefined(typeof(DisableAffix), false))
                {
                    PathOfModifiers.Instance.Logger.Warn($"Affix '{affixFullName}' is disabled");
                    continue;
                }
                affix = PoMDataLoader.affixesItem[PoMDataLoader.affixItemMap[type]].Clone();
                affix.Load(affixTag, item);
                AddAffix(affix, item);
            }
            UpdateName(item);
        }
Exemplo n.º 9
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));
 }
Exemplo n.º 10
0
        public override void Load(TagCompound tag)
        {
            int downed = tag.GetAsInt("downed");

            bossesDown          = (MetroidBossDown)downed;
            spawnedPhazonMeteor = tag.Get <bool>("spawnedPhazonMeteor");

            TorizoRoomLocation.X = tag.Get <int>("TorizoRoomLocation.X");
            TorizoRoomLocation.Y = tag.Get <int>("TorizoRoomLocation.Y");
        }
Exemplo n.º 11
0
        private void LoadVoid(TagCompound tag)
        {
            VoidAffinity    = tag.Get <ushort>(nameof(VoidAffinity));
            MaxVoidAffinity = tag.Get <ushort>(nameof(MaxVoidAffinity));

            VoidItemCooldown = tag.GetAsInt(nameof(VoidItemCooldown));

            VoidHeartHP = tag.GetInt(nameof(VoidHeartHP));

            MaxVoidHearts = tag.GetInt(nameof(MaxVoidHearts));
        }
Exemplo n.º 12
0
 public override void Load(TagCompound tag)
 {
     if (tag.ContainsKey("sf") && tag.ContainsKey("sfmax") && tag.ContainsKey("sfcolor") && tag.ContainsKey("sfcolortype"))
     {
         starFlare[0]         = tag.GetAsInt("sf");
         maxStarFlare         = tag.GetAsInt("sfmax");
         customStarFlareColor = tag.Get <Color>("sfcolor");
         starFlareColorType   = tag.GetAsInt("sfcolortype");
         //bluePrint = tag.Get<bool[]>("blueprint");
         //Helper.Array2Setting(tag.Get<bool[]>("setting"));
     }
     for (int i = 0; i < bluePrint.Length; i++)
     {
         if (tag.ContainsKey("blueprint" + i.ToString()))
         {
             bluePrint[i] = tag.GetBool("blueprint" + i.ToString());
         }
         else
         {
             bluePrint[i] = false;
         }
     }
     base.Load(tag);
 }
Exemplo n.º 13
0
        public override void Load(TagCompound tag)
        {
            // Checking if the player data exists at all
            this.level = tag.GetAsInt("Level");

            if (this.level > 0)
            {
                SaveVersionHandler.Load(this, tag);
            }
            // If it doesn't, create a new player
            else
            {
                this.InitializeNewPlayer();
            }
        }
Exemplo n.º 14
0
        public override void Load(TagCompound tag)
        {
            if (tag.ContainsKey("count"))
            {
                IList <int> count = tag.GetList <int>("count");
                EyeCount       = count[0];
                SlimeCount     = count[1];
                EaterCount     = count[2];
                BrainCount     = count[3];
                BeeCount       = count[4];
                SkeletronCount = count[5];
                WallCount      = count[6];
                DestroyerCount = count[7];
                PrimeCount     = count[8];
                TwinsCount     = count[9];
                PlanteraCount  = count[10];
                GolemCount     = count[11];
                FishronCount   = count[12];
                CultistCount   = count[13];
                MoonlordCount  = count[14];
            }

            IList <string> downed = tag.GetList <string>("downed");

            downedBetsy          = downed.Contains("betsy");
            _downedBoss          = downed.Contains("boss");
            MasochistMode        = downed.Contains("m*******t");
            downedFishronEX      = downed.Contains("downedFishronEX");
            downedDevi           = downed.Contains("downedDevi");
            downedAbom           = downed.Contains("downedAbom");
            downedMutant         = downed.Contains("downedMutant");
            AngryMutant          = downed.Contains("AngryMutant");
            downedMM             = downed.Contains("downedMadhouse");
            forceMeteor          = downed.Contains("forceMeteor");
            NoMasoBossScaling    = downed.Contains("NoMasoBossScaling");
            ReceivedTerraStorage = downed.Contains("ReceivedTerraStorage");

            for (int i = 0; i < downedChampions.Length; i++)
            {
                downedChampions[i] = downed.Contains("downedChampion" + i.ToString());
            }

            if (tag.ContainsKey("mutantP1"))
            {
                skipMutantP1 = tag.GetAsInt("mutantP1");
            }
        }
Exemplo n.º 15
0
        public override void Load(TagCompound tag)
        {
            List <TagCompound> npcTags = tag.GetList <TagCompound>(nameof(ISaveableEntity)) as List <TagCompound>;

            foreach (TagCompound currentTag in npcTags)
            {
                Vector2 position      = currentTag.Get <Vector2>(nameof(NPC.position));
                int     npcInstanceId = NPC.NewNPC((int)position.X, (int)position.Y, ModLoader.GetMod(currentTag.GetString(nameof(NPC.modNPC.mod))).BuffType(currentTag.GetString(nameof(NPC.modNPC.Name))));

                if (Main.npc[npcInstanceId].modNPC is ISaveableEntity saveable)
                {
                    saveable.Load(currentTag);
                }

                if (currentTag.ContainsKey(nameof(NPC.life)))
                {
                    Main.npc[npcInstanceId].life = tag.GetAsInt(nameof(NPC.life));
                }
            }
        }
Exemplo n.º 16
0
        public override void Load(TagCompound tag)
        {
            peatSold  = tag.GetAsInt("peatSold");
            worldEvil = tag.GetByte("worldEvil");
            if (tag.ContainsKey("worldSurfaceLow"))
            {
                _worldSurfaceLow = tag.GetDouble("worldSurfaceLow");
            }
            if (tag.ContainsKey("defiledHearts"))
            {
                Defiled_Hearts = tag.Get <List <Vector2> >("defiledHearts").Select(Utils.ToPoint).ToList();
            }

            defiledResurgenceTiles = new List <(int, int)>()
            {
            };
            defiledAltResurgenceTiles = new List <(int, int, ushort)>()
            {
            };
        }
Exemplo n.º 17
0
        public override void Load(TagCompound tag)
        {
            if (tag.ContainsKey("count"))
            {
                IList <int> count = tag.GetList <int>("count");
                EyeCount       = count[0];
                SlimeCount     = count[1];
                EaterCount     = count[2];
                BrainCount     = count[3];
                BeeCount       = count[4];
                SkeletronCount = count[5];
                WallCount      = count[6];
                DestroyerCount = count[7];
                PrimeCount     = count[8];
                TwinsCount     = count[9];
                PlanteraCount  = count[10];
                GolemCount     = count[11];
                FishronCount   = count[12];
                CultistCount   = count[13];
                MoonlordCount  = count[14];
            }

            IList <string> downed = tag.GetList <string>("downed");

            downedBetsy     = downed.Contains("betsy");
            _downedBoss     = downed.Contains("boss");
            MasochistMode   = downed.Contains("m*******t");
            downedFishronEX = downed.Contains("downedFishronEX");
            downedAbom      = downed.Contains("downedAbom");
            downedMutant    = downed.Contains("downedMutant");
            AngryMutant     = downed.Contains("AngryMutant");
            downedMM        = downed.Contains("downedMadhouse");
            forceMeteor     = downed.Contains("forceMeteor");

            if (tag.ContainsKey("mutantP1"))
            {
                skipMutantP1 = tag.GetAsInt("mutantP1");
            }
        }
Exemplo n.º 18
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            int messageID = reader.ReadByte();

            Logger.Info("Received Message id " + messageID);

            /*message 0: Share research with server (not used)
             * int Player
             * TAGCompound Research*/
            if (messageID == 0)
            {
                int player = reader.ReadByte();
                if (Main.netMode == NetmodeID.Server || player != Main.myPlayer)
                {
                    TagCompound tempResearch = TagIO.Read(reader);
                    foreach (KeyValuePair <string, object> read in tempResearch)
                    {
                        Main.player[player].GetModPlayer <ResearchPlayer>().research[read.Key] = tempResearch.GetAsInt(read.Key);
                    }
                    Main.player[player].GetModPlayer <ResearchPlayer>().dirtyCache = true;
                    Main.player[player].GetModPlayer <ResearchPlayer>().RebuildCache();
                    return;
                }
            }

            /*message 1: dirty cache
             * int player
             * refreshes the cache*/
            if (messageID == 1)
            {
                int player = reader.ReadByte();
                Main.player[player].GetModPlayer <ResearchPlayer>().dirtyCache = true;
                Main.player[player].GetModPlayer <ResearchPlayer>().RebuildCache();
                return;
            }

            /*message 10 : P2P item cache sharing
             * byte player
             * int count
             * int[count] itemIDs
             * Share the cache with another player. Meant to share multiple, fully researched items at once.
             * Will send another such message to the sender (with this whoAmI) with the researched items,
             * and will keep sending them to one another until the cache is equal*/
            if (messageID == 10) //Shared item Cache
            {
                ResearchPlayer rp     = Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>();
                int            sendTo = reader.ReadByte();
                //Logger.Info("Received shared cache Message to "+i);
                List <int> oldCache = new List <int>();
                oldCache.AddRange(rp.researchedCache);

                int count = reader.ReadInt32();
                for (int i = 0; i < count; i++)
                {
                    int id = reader.ReadInt32();
                    if (!rp.IsResearched(id))
                    {
                        rp.AddResearchedAmount(id, ResearchTable.GetTotalResearch(id));
                        rp.CheckRecipesForItem(id);
                    }
                }
                if (Main.netMode == NetmodeID.Server || sendTo != Main.myPlayer)
                {
                    rp.shareCacheTo(sendTo);
                }
                return;
            }

            /*message 11: Share single item with intermediate result
             * byte player to send to
             * byte player that sent the message
             * int item
             * int research count
             *
             * Adds the research count to the player's research, and replies with the same message with its previous research count
             */
            if (messageID == 11)
            {
                ResearchPlayer rp           = Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>();
                int            sendTo       = reader.ReadByte();
                int            orgSender    = reader.ReadByte();
                int            itm          = reader.ReadInt32();
                int            amount       = reader.ReadInt32();
                int            prevResearch = rp.GetResearchedAmount(itm);
                int            res          = rp.AddResearchedAmount(itm, amount);
                if (Main.netMode == NetmodeID.Server)
                {
                    ModPacket pk = GetPacket();
                    pk.Write((byte)11);
                    pk.Write((byte)(sendTo));
                    pk.Write((byte)(orgSender));
                    pk.Write(itm);
                    pk.Write(amount);
                    pk.Send(sendTo);
                    return;
                }
                //Logger.Info("Received share single item Message from " + sender + ". Item " + itm + " with amount "+ amount);

                if (rp.IsResearched(itm) && res != amount)
                {
                    rp.CheckRecipesForItem(itm);

                    //Logger.Info("Item "+ itm + " was fully researched with " + amount);
                    rp.RebuildCache();
                    if (orgSender == Main.myPlayer)
                    {
                        return;
                    }
                    ModPacket pk = GetPacket();
                    pk.Write((byte)11);
                    pk.Write((byte)(orgSender));
                    pk.Write((byte)(orgSender));
                    pk.Write(itm);
                    pk.Write(prevResearch + amount);
                    pk.Send();
                }
                else
                {
                    //Logger.Info("Item " + itm + " was not fully researched with " + amount);
                }
                return;
            }

            /*message 12: Share prefixes
             * byte player to send to
             * int itm
             * int count
             * byte[count] prefixes
             *
             * Sends all prefixes for item itm, with no replies. Only adds prefixes.*/
            if (messageID == 12)
            {
                ResearchPlayer rp       = Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>();
                int            sendTo   = reader.ReadByte();
                int            itm      = reader.ReadInt32();
                int            count    = reader.ReadInt32();
                List <byte>    prefixes = new List <byte>();
                for (int i = 0; i < count; i++)
                {
                    byte p = reader.ReadByte();
                    prefixes.Add(p);
                    rp.AddResearchPrefix(itm, p);
                }
                if (Main.netMode == NetmodeID.Server)
                {
                    ModPacket pk = GetPacket();
                    pk.Write((byte)12);
                    pk.Write((byte)(sendTo));

                    pk.Write(prefixes.Count);
                    for (int k = 0; k < prefixes.Count; k++)
                    {
                        pk.Write((byte)(prefixes[k]));
                    }
                    pk.Send(sendTo);
                }
                return;
            }

            if (messageID == 99)
            {
                int player = reader.ReadByte();
                ResearchTable.InitResearchTable();
                if (Main.netMode == NetmodeID.Server)
                {
                    ModPacket pk = this.GetPacket();
                    pk.Write((byte)99);
                    pk.Write((byte)player);
                    pk.Send(-1, player);
                    ModContent.GetInstance <ExceptionListConfig>().forceReload = false;
                    SaveListConfig();
                }
                else
                {
                    Main.player[Main.myPlayer].GetModPlayer <ResearchPlayer>().RebuildCache();
                }
                ModContent.GetInstance <ExceptionListConfig>().forceReload = false;
                return;
            }
        }
 public void LoadLevels(TagCompound tag)
 {
     Level = tag.GetAsInt(nameof(Level));
     _executedLevelingRuleNames = tag.GetList <string>(nameof(ExecutedNPCLevelingRuleNames)) as List <string>;
 }
Exemplo n.º 20
0
 public override void Load(TagCompound tag)
 {
     mobID = tag.GetAsInt("mobID");
     timerUntilNextSpawn = tag.GetAsInt("timer");
 }
Exemplo n.º 21
0
 public override void Load(TagCompound tag)
 {
     rng = tag.GetAsInt("number");
 }
Exemplo n.º 22
0
        public override void Load(TagCompound tag)
        {
            int buffIndex = 0;

            var size = LansToggleableBuffs.instance.getBuffLength();

            int version = 0;

            for (int i = 0; i < boughtbuffsavail.Length; i++)
            {
                boughtbuffsavail[i] = false;
                buffsavail[i]       = false;
            }

            try
            {
                version = tag.GetAsInt("version");
            }
            catch
            {
            }
            try
            {
                if (version == 0)
                {
                    foreach (var v in LansToggleableBuffs.instance.oldSaveModBuffValues)
                    {
                        var tempTag = tag.Get <TagCompound>(v.saveTag);
                        if (tempTag != null)
                        {
                            var b1 = tempTag.GetByteArray("boughtbuffsavail");
                            var b2 = tempTag.GetByteArray("buffsavail");


                            if (b1.Length == v.buffs.Length && b2.Length == v.buffs.Length)
                            {
                                for (int i = 0; i < v.buffs.Length; i++)
                                {
                                    bool found         = false;
                                    int  buffSaveIndex = 0;
                                    foreach (var newModBuffs in LansToggleableBuffs.instance.modBuffValues)
                                    {
                                        if (newModBuffs.saveTag == v.saveTag)
                                        {
                                            for (int j = 0; j < newModBuffs.buffs.Length; j++)
                                            {
                                                if (newModBuffs.buffs[j].name == v.buffs[i].name)
                                                {
                                                    boughtbuffsavail[buffSaveIndex] = b1[i] == 1?true:false;
                                                    buffsavail[buffSaveIndex]       = b2[i] == 1?true:false;;

                                                    found = true;
                                                }
                                                else
                                                {
                                                    buffSaveIndex++;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            buffSaveIndex += newModBuffs.buffs.Length;
                                        }
                                    }

                                    if (!found)
                                    {
                                        throw new Exception("Mod buff was not found");
                                    }
                                }
                            }
                            else
                            {
                                throw new Exception("Mod length was not the same");
                            }
                        }
                        else
                        {
                            throw new Exception("Mod without buff save");
                        }
                    }
                }
                else
                {
                    var mods = tag.GetList <TagCompound>("mods");

                    foreach (var value in mods)
                    {
                        buffIndex = 0;

                        foreach (var v in LansToggleableBuffs.instance.modBuffValues)
                        {
                            if (value.GetString("modName") == v.saveTag)
                            {
                                foreach (var buffValue in value.GetList <TagCompound>("buffs"))
                                {
                                    int buffIndexOffset = buffIndex;
                                    foreach (var buff in v.buffs)
                                    {
                                        if (buff.name == buffValue.GetString("name"))
                                        {
                                            boughtbuffsavail[buffIndexOffset] = buffValue.GetBool("bought");
                                            buffsavail[buffIndexOffset]       = buffValue.GetBool("using");
                                        }
                                        else
                                        {
                                            buffIndexOffset++;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                buffIndex += v.buffs.Length;
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 23
0
 private void LoadShadowFiend(TagCompound tag)
 {
     _souls = tag.GetAsInt(nameof(Souls));
 }
Exemplo n.º 24
0
 public override void Load(TagCompound tag)
 {
     CyberWrath        = tag.GetBool("CyberWrath");
     CyberWrathPoints1 = tag.GetAsInt("CyberWrathPoints1");
 }
Exemplo n.º 25
0
 public override void Load(TagCompound tag)
 {
     energy.addEnergy(tag.GetAsInt("energy"));
 }
Exemplo n.º 26
0
 public sealed override void Load(TagCompound tag)
 {
     energy = new EnergyCore(0);
     LoadEntity(tag);
     energy.addEnergy(tag.GetAsInt("energy"));
 }