Example #1
0
        public override TagCompound Save()
        {
            ClearTransformations();

            TagCompound tag = new TagCompound();

            tag.Add(nameof(PlayerInitialized), PlayerInitialized);

            SaveRace(tag);
            SaveMastery(tag);
            SaveTransformations(tag);
            SaveKi(tag);
            SaveOverload(tag);
            SaveGuardian(tag);
            SaveNPCs(tag);
            SaveHair(tag);
            SaveWishes(tag);

            TransformationDefinitionManager.Instance.ForAllItems(t => t.OnPreAcquirePlayerSaving(this, tag));
            ForAllAcquiredTransformations(t => t.Definition.OnPlayerSaving(this, tag));

            // added to store the player's original eye color if possible
            if (originalEyeColor != null)
            {
                tag.Add("OriginalEyeColorR", originalEyeColor.Value.R);
                tag.Add("OriginalEyeColorG", originalEyeColor.Value.G);
                tag.Add("OriginalEyeColorB", originalEyeColor.Value.B);
            }

            return(tag);
        }
Example #2
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound()
            {
                [nameof(StrangePresenceDebuff)] = StrangePresenceDebuff
            };

            List <TagCompound> npcTags = new List <TagCompound>();

            for (int i = 0; i < Main.npc.Length; i++)
            {
                if (Main.npc[i] is ISaveableEntity saveable)
                {
                    TagCompound npcTag = new TagCompound();
                    NPC         npc    = Main.npc[i];

                    npcTag.Add(nameof(NPC.position), npc.position);
                    npcTag.Add(nameof(NPC.modNPC.Name), npc.modNPC.Name);
                    npcTag.Add(nameof(NPC.modNPC.mod), npc.modNPC.mod.Name);

                    if (saveable.SaveHP)
                    {
                        npcTag.Add(nameof(NPC.life), npc.life);
                    }

                    saveable.Save(npcTag);

                    npcTags.Add(npcTag);
                }
            }

            tag.Add(nameof(ISaveableEntity), npcTags);
            return(tag);
        }
Example #3
0
 public override TagCompound Save()
 {
     tag = new TagCompound();
     tag.Add("inputSlot", inventory[0]);
     tag.Add("outputSlot", inventory[1]);
     return(base.Save());
 }
Example #4
0
 private void SaveKi(TagCompound tag)
 {
     tag.Add(nameof(Ki), Ki);
     tag.Add(nameof(BaseMaxKi), BaseMaxKi);
     tag.Add(nameof(MaxKiModifierPerm), MaxKiModifierPerm);
     tag.Add(nameof(BossesKilled), BossesKilled);
 }
Example #5
0
        public static void SaveMultistructureToFile(ref List <TagCompound> toSave, string targetPath = null)
        {
            string path = ModLoader.ModPath.Replace("Mods", "SavedStructures");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string thisPath = targetPath ?? Path.Combine(path, "SavedMultiStructure_" + DateTime.Now.ToString("d-M-y----H-m-s-f"));

            Main.NewText("Structure saved as " + thisPath, Color.Yellow);
            FileStream stream = File.Create(thisPath);

            stream.Close();

            TagCompound tag = new TagCompound();

            tag.Add("Structures", toSave);
            tag.Add("Version", StructureHelper.Instance.Version.ToString());

            TagIO.ToFile(tag, thisPath);

            toSave.Clear();
        }
Example #6
0
 public override void CustomSaveQuest(string QuestKey, TagCompound Writer)
 {
     Writer.Add(QuestKey + "questver", QuestVersion);
     Writer.Add(QuestKey + "qstep", QuestStep);
     Writer.Add(QuestKey + "qfish", FishGiven);
     Writer.Add(QuestKey + "qconc", ConclusionState);
 }
Example #7
0
        public void TestDuplicate()
        {
            var tag = new TagCompound();

            tag.Add("key", "value");
            tag.Add("key", 5);
        }
Example #8
0
        internal TagCompound Save()
        {
            TagCompound tag = new TagCompound
            {
                { SAVE_KEY_LEVEL, Level },
                { SAVE_KEY_XP, XP }
            };

            foreach (AlignmentStat stat in AlignmentStats.Values)
            {
                if (stat.DoSave)
                {
                    tag.Add(stat.UnlocalizedName, stat.Save());
                }
            }

            foreach (MinorStat stat in MinorStats.Values)
            {
                if (stat.DoSave)
                {
                    tag.Add(stat.UnlocalizedName, stat.Save());
                }
            }

            return(tag);
        }
Example #9
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound();

            tag.Add("solarMist", solarMist);
            tag.Add("solarMistTimer", solarMistTimer);
            return(base.Save());
        }
Example #10
0
        /*public override void SaveCustomData(BinaryWriter writer)
         * {
         *      writer.Write(saveVersion);
         *      writer.Write(CyberWrath);
         *      writer.Write(CyberWrathPoints1);
         * } */

        public override TagCompound Save()
        {
            TagCompound save_data = new TagCompound();

            save_data.Add("CyberWrath", CyberWrath);
            save_data.Add("CyberWrathPoints1", CyberWrathPoints1);
            return(save_data);
        }
Example #11
0
        public override TagCompound Save()
        {
            TagCompound data = new TagCompound();

            data.Add("rain", Rain);
            data.Add("sandStorm", sandStorm);
            return(data);
        }
Example #12
0
        public override TagCompound Save()
        {
            TagCompound save_data = new TagCompound();

            save_data.Add("TheBloom", TheBloom);
            save_data.Add("bloomPoints1", bloomPoints1);
            return(save_data);
        }
Example #13
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound();

            tag.Add("mobID", mobID);
            tag.Add("timer", timerUntilNextSpawn);
            return(tag);
        }
Example #14
0
        public override void NetSend(BinaryWriter writer, bool lightSend)
        {
            TagCompound tag = new TagCompound();

            tag.Add("energy", energy.getCurrentEnergyLevel());
            tag.Add("maxEnergy", energy.getMaxEnergyLevel());
            TagIO.Write(tag, writer);
        }
Example #15
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound();

            tag.Add("candy", candy);
            tag.Add("variants", variants);
            return(tag);
        }
 private void SaveWishes(TagCompound tag)
 {
     tag.Add(nameof(PowerWishesLeft), PowerWishesLeft);
     tag.Add(nameof(ImmortalityWishesLeft), ImmortalityWishesLeft);
     tag.Add(nameof(SkillWishesLeft), SkillWishesLeft);
     tag.Add(nameof(AwakeningWishesLeft), AwakeningWishesLeft);
     tag.Add(nameof(ImmortalityRevivesLeft), ImmortalityRevivesLeft);
 }
Example #17
0
 public override void CustomSaveQuest(string QuestKey, TagCompound Writer)
 {
     Writer.Add(QuestKey + "_Version", SaveVersion);
     Writer.Add(QuestKey + "_TalkedAboutTuto", LunaTalkedAboutTutorial);
     Writer.Add(QuestKey + "_CallTutoStep", CallingStep);
     Writer.Add(QuestKey + "_OrderTutoStep", OrderTutorialStep);
     Writer.Add(QuestKey + "_TenantTutoStep", TalkedAboutTentants);
 }
 public override void CustomSaveQuest(string QuestKey, TagCompound Writer)
 {
     Writer.Add("Version", QuestVersion);
     Writer.Add("BlueDialogueStep", BlueDialogueStep);
     Writer.Add("BlueWasPresent", BlueWasPresent);
     Writer.Add("SpokeToBluePosQuest", SpokeToBluePosQuest);
     Writer.Add("SpottedZacksonce", SpottedZacksOnce);
 }
Example #19
0
        public TagCompound SerializeData()
        {
            TagCompound tag = new TagCompound();

            tag.Add("filterItems", new List <Item>(filterItems));
            tag.Add("filterWhitelist", filterWhitelist);

            return(tag);
        }
Example #20
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound();

            tag.Add("mobId", mobID);
            tag.Add("soulCount", currentSoul);
            tag.Add("maxSoulCount", maxSoul);
            return(tag);
        }
Example #21
0
        public override TagCompound Save()
        {
            TagCompound tag = new TagCompound();

            tag.Add(nameof(MenuOffset), MenuOffset);
            tag.Add(nameof(CurrentHunger), CurrentHunger);
            tag.Add(nameof(CurrentThirst), CurrentThirst);

            return(tag);
        }
Example #22
0
        public override TagCompound Save()
        {
            TagCompound tc = new TagCompound();

            tc.Add("UltraMode", UltraMode);
            tc.Add("EoADowned", Apocalypse);
            tc.Add("UltraEoCDowned", TerrariaUltraApocalypse.EoCDeath);
            //tc.Add("apocalypseMoon", apocalypseMoon);
            return(tc);
        }
Example #23
0
        public TagCompound GetExtraData()
        {
            TagCompound res = new TagCompound();

            res.Add("dsvd", haveDiscovered);
            res.Add("name", name);
            res.Add("chest", SaveChestData(chest));
            res.Add("sign", SaveSignData(sign));
            return(res);
        }
Example #24
0
        private void SaveHair(TagCompound tag)
        {
            if (ChosenHairStyle == null)
            {
                ChosenHairStyle = HairStyleManager.Instance.NoChoice;
            }

            tag.Add(nameof(HairChecked), HairChecked);
            tag.Add(nameof(ChosenHairStyle), ChosenHairStyle.UnlocalizedName);
        }
        public override TagCompound Save()
        {
            var tag = new TagCompound();

            tag.Add("queue", queue);
            tag.Add("obsidian", obsidian);
            tag.Add("water", water);
            tag.Add("lava", lava);
            return(tag);
        }
Example #26
0
        internal TagCompound Save()
        {
            TagCompound tc = new TagCompound();

            tc.Add("charge", charge);
            tc.Add("x", x);
            tc.Add("y", y);
            tc.Add("pid", pidOwner);
            return(tc);
        }
Example #27
0
        private static TagCompound PopulateTag()
        {
            var ret = new TagCompound();

            ret.Add("mpubl", new TagByte {
                Data = 101
            });
            ret.Add("mprot", new TagByte {
                Data = 101
            });
            ret.Add("mpriv", new TagByte {
                Data = 101
            });

            ret.Add("fpubl", new TagByte {
                Data = 101
            });
            ret.Add("fprot", new TagByte {
                Data = 101
            });
            ret.Add("fpriv", new TagByte {
                Data = 101
            });

            ret.Add("ppubl", new TagByte {
                Data = 101
            });
            ret.Add("pprot", new TagByte {
                Data = 101
            });
            ret.Add("ppriv", new TagByte {
                Data = 101
            });
            return(ret);
        }
Example #28
0
        public override TagCompound Save()
        {
            TagCompound cpd = new TagCompound();

            cpd.Add("on", this.on);
            if (bullets != null && !bullets.IsAir)
            {
                cpd.Add("bullets", bullets);
            }
            return(cpd);
        }
 public override void CustomSaveQuest(string QuestKey, TagCompound Writer)
 {
     Writer.Add(QuestKey + "_Version", Version);
     for (int i = 0; i < 4; i++)
     {
         Writer.Add(QuestKey + "_SolReq_" + i, SolidificationRequestGiven[i]);
         Writer.Add(QuestKey + "_SolUnlock_" + i, SolidificationUnlocked[i]);
     }
     Writer.Add(QuestKey + "_LeopoldKnows", SpokeToLeopoldAboutTheEmotionalPigs);
     Writer.Add(QuestKey + "_BlandUnlocked", UnlockedBland);
 }
Example #30
0
 public override void SaveCustom(TagCompound tag, int UniqueID)
 {
     tag.Add(UniqueID + "tg_saveID", AlexanderSaveID);
     tag.Add(UniqueID + "tg_SleuthCount", IdentifiedGuardians.Count);
     for (int i = 0; i < IdentifiedGuardians.Count; i++)
     {
         GuardianID gid = IdentifiedGuardians[i];
         tag.Add(UniqueID + "tg_SleuthID_" + i, gid.ID);
         tag.Add(UniqueID + "tg_SleuthModID_" + i, gid.ModID);
     }
 }