Exemplo n.º 1
0
 public void Save(Terraria.ModLoader.IO.TagCompound tag)
 {
     tag.Add("ModVersion", MainMod.ModVersion);
     tag.Add("ObjectivesProgressCount", LoreInternalProgress.Count);
     for (int i = 0; i < LoreInternalProgress.Count; i++)
     {
         ClassLoreStepProgress clsp = LoreInternalProgress[i];
         tag.Add("ObjectivesProgressStep" + i, LoreInternalProgress[i].StepValue);
     }
 }
Exemplo n.º 2
0
 public void SaveQuest(string QuestKey, Terraria.ModLoader.IO.TagCompound Writer)
 {
     Writer.Add(QuestKey + "_ID", QuestID);
     Writer.Add(QuestKey + "_ModID", QuestModID);
     Terraria.ModLoader.IO.TagCompound QuestData = new Terraria.ModLoader.IO.TagCompound();
     if (IsUnexistingQuest)
     {
         QuestData = SavedQuestData;
     }
     else
     {
         CustomSaveQuest(QuestKey, QuestData);
     }
     Writer.Add(QuestKey + "_QuestData", QuestData);
 }
Exemplo n.º 3
0
 public override Terraria.ModLoader.IO.TagCompound Save()
 {
     Terraria.ModLoader.IO.TagCompound tag = new Terraria.ModLoader.IO.TagCompound();
     tag.Add("ModVersion", MainMod.ModVersion);
     tag.Add("ClassCount", Classes.Count);
     for (int c = 0; c < Classes.Count; c++)
     {
         Classes[c].Save(tag, c);
     }
     SaveSkillSlot(tag, CombatSkill, "CombatSkillSlot");
     for (int s = 0; s < 4; s++)
     {
         SaveSkillSlot(tag, ActiveSkill[s], "ActiveSkillSlot_" + s);
     }
     return(tag);
 }
Exemplo n.º 4
0
        public void Save(Terraria.ModLoader.IO.TagCompound tag, int ClassIndex)
        {
            string ClassText = "Class_" + ClassIndex;

            tag.Add(ClassText + "_ID", ClassID);
            tag.Add(ClassText + "_ModID", ClassModID);
            tag.Add(ClassText + "_Level", Level);
            tag.Add(ClassText + "_Exp", Exp);
            tag.Add(ClassText + "_SkillCount", Skills.Count);
            for (int s = 0; s < Skills.Count; s++)
            {
                string SkillText = ClassText + "_Skill_" + s;
                tag.Add(SkillText + "_ID", Skills[s].ID);
                tag.Add(SkillText + "_ModID", Skills[s].ModID);
                tag.Add(SkillText + "_Level", Skills[s].RealLevel);
                tag.Add(SkillText + "_Cooldown", Skills[s].Cooldown);
            }
        }
Exemplo n.º 5
0
 public void Save(Terraria.ModLoader.IO.TagCompound writer, string UniqueID)
 {
     writer.Add(UniqueID + "_ID", RequestID);
     writer.Add(UniqueID + "_ModID", RequestModID);
     writer.Add(UniqueID + "_State", (byte)state);
     writer.Add(UniqueID + "_ObjectiveCount", ObjectiveCount);
     writer.Add(UniqueID + "_MaxObjectiveCount", MaxObjectiveCount);
     writer.Add(UniqueID + "_TimeLeft", RequestTimeLeft);
     for (byte i = 0; i < 3; i++)
     {
         string            RewardID = UniqueID + "_rwi" + i;
         ThisRequestReward reward   = Rewards[i];
         writer.Add(RewardID + "_item", reward.item);
         writer.Add(RewardID + "_value", reward.value);
     }
 }
Exemplo n.º 6
0
 public void SaveSkillSlot(Terraria.ModLoader.IO.TagCompound tag, SkillSlot ss, string SkillSlotText)
 {
     if (ss.ClassPosition == -1)
     {
         tag.Add(SkillSlotText + "_Exists", false);
     }
     else
     {
         tag.Add(SkillSlotText + "_Exists", true);
         tag.Add(SkillSlotText + "_ClassID", Classes[ss.ClassPosition].ClassID);
         tag.Add(SkillSlotText + "_ClassModID", Classes[ss.ClassPosition].ClassModID);
         tag.Add(SkillSlotText + "_SkillID", Classes[ss.ClassPosition].Skills[ss.SkillPosition].ID);
         tag.Add(SkillSlotText + "_SkillModID", Classes[ss.ClassPosition].Skills[ss.SkillPosition].ModID);
     }
 }
Exemplo n.º 7
0
 public static void SaveShops(Terraria.ModLoader.IO.TagCompound tag)
 {
     tag.Add("Shop_Count", Shops.Count);
     for (int s = 0; s < Shops.Count; s++)
     {
         string       ShopTag = "Shop_s" + s + ">";
         GuardianShop shop    = Shops[s];
         tag.Add(ShopTag + "OwnerID", shop.OwnerID);
         tag.Add(ShopTag + "OwnerModID", shop.OwnerModID);
         tag.Add(ShopTag + "ItemCount", shop.Items.Count);
         for (int i = 0; i < shop.Items.Count; i++)
         {
             string           ItemTag = ShopTag + "i" + i + ">";
             GuardianShopItem item    = shop.Items[i];
             bool             HasItem = item.ItemID != 0;
             tag.Add(ItemTag + "hasitem", HasItem);
             if (HasItem)
             {
                 Item dummyItem = new Item();
                 dummyItem.SetDefaults(item.ItemID, true);
                 bool IsModItem = dummyItem.modItem != null;
                 tag.Add(ItemTag + "ismoditem", IsModItem);
                 if (IsModItem)
                 {
                     tag.Add(ItemTag + "itemname", dummyItem.modItem.Name);
                     tag.Add(ItemTag + "itemmodname", dummyItem.modItem.mod.Name);
                 }
                 else
                 {
                     tag.Add(ItemTag + "itemid", item.ItemID);
                 }
                 tag.Add(ItemTag + "saletime", item.SaleTime);
                 tag.Add(ItemTag + "timedsaletime", item.TimedSaleTime);
                 tag.Add(ItemTag + "stack", item.Stack);
             }
         }
     }
 }
Exemplo n.º 8
0
 public static void Save(Terraria.ModLoader.IO.TagCompound tag)
 {
     tag.Add("TombstoneExists", SpawnedTombstone);
     tag.Add("TombstonePosX", TombstoneTileX);
     tag.Add("TombstonePosY", TombstoneTileY);
 }
Exemplo n.º 9
0
        public void Save(Terraria.ModLoader.IO.TagCompound tag, int UniqueID)
        {
            tag.Add("GuardianID_" + UniqueID, ID);
            tag.Add("GuardianModID_" + UniqueID, ModID);
            if (_Name != null)
            {
                tag.Add("Name_" + UniqueID, _Name);
            }
            tag.Add("NameID_" + UniqueID, PickedName);
            tag.Add("StarterFlag_" + UniqueID, IsStarter);
            tag.Add("FriendshipLevel_" + UniqueID, FriendshipLevel);
            tag.Add("FriendshipProgress_" + UniqueID, FriendshipProgression);
            tag.Add("TravellingStacker_" + UniqueID, TravellingStacker);
            tag.Add("DamageStacker_" + UniqueID, DamageStacker);
            tag.Add("FoodStacker_" + UniqueID, FoodStacker);
            tag.Add("DrinkStacker_" + UniqueID, DrinkStacker);
            tag.Add("ComfortStack_" + UniqueID, ComfortStack);
            tag.Add("ComfortPoints_" + UniqueID, ComfortPoints);
            tag.Add("HealthPercentage_" + UniqueID, HP <= 0 ? 0 : (HP == MHP ? 1f : (float)HP / MHP));
            tag.Add("IsKnockedOut_" + UniqueID, KnockedOut);
            tag.Add("IsKnockedOutCold_" + UniqueID, KnockedOutCold);
            tag.Add("LifeCrystals_" + UniqueID, LifeCrystalHealth);
            tag.Add("LifeFruits_" + UniqueID, LifeFruitHealth);
            tag.Add("IsMale_" + UniqueID, Male);
            tag.Add("ManaCrystals_" + UniqueID, ManaCrystals);
            tag.Add("CombatTactic_" + UniqueID, (byte)tactic);
            tag.Add("TankingFlag_" + UniqueID, Tanker);
            tag.Add("QuickMountOverride_" + UniqueID, OverrideQuickMountToMountGuardianInstead);
            tag.Add("MountMeleeUsageToggle_" + UniqueID, UseHeavyMeleeAttackWhenMounted);
            tag.Add("AvoidCombat_" + UniqueID, AvoidCombat);
            tag.Add("ChargeAhead_" + UniqueID, ChargeAhead);
            tag.Add("Passive_" + UniqueID, Passive);
            tag.Add("AttackMyTarget_" + UniqueID, AttackMyTarget);
            tag.Add("SitOnMount_" + UniqueID, SitOnTheMount);
            tag.Add("MayLootItems_" + UniqueID, MayLootItems);
            tag.Add("SetToPlayerSize_" + UniqueID, SetToPlayerSize);
            tag.Add("GetItemsISendtoTrash_" + UniqueID, GetItemsISendtoTrash);
            tag.Add("UseWeaponsByInventoryOrder" + UniqueID, UseWeaponsByInventoryOrder);
            tag.Add("ProtectMode" + UniqueID, ProtectMode);
            tag.Add("AutoSell" + UniqueID, AutoSellWhenInvIsFull);
            tag.Add("HideWereForm" + UniqueID, HideWereForm);
            tag.Add("GiftGiven_" + UniqueID, GiftGiven);
            for (int i = 0; i < 8; i++)
            {
                tag.Add("MessageFlags" + i + "_" + UniqueID, MessageTriggerFlags[i]); //It crashes
            }
            int InventorySize = Inventory.Length;

            tag.Add("InventorySize_" + UniqueID, InventorySize);
            for (int i = 0; i < InventorySize; i++)
            {
                tag.Add("Inventory_" + i + "_exists_" + UniqueID, this.Inventory[i].type != 0);
                if (this.Inventory[i].type != 0)
                {
                    tag.Add("Inventory_" + i + "_" + UniqueID, this.Inventory[i]);
                }
            }
            int EquipmentsSize = Equipments.Length;

            tag.Add("EquipmentsSize_" + UniqueID, EquipmentsSize);
            for (int e = 0; e < EquipmentsSize; e++)
            {
                tag.Add("Equipment_" + e + "_exists_" + UniqueID, this.Equipments[e].type != 0);
                if (this.Equipments[e].type != 0)
                {
                    tag.Add("Equipment_" + e + "_" + UniqueID, this.Equipments[e]);
                }
            }
            int BuffCount = Buffs.Count;

            tag.Add("BuffCount_" + UniqueID, BuffCount);
            for (int b = 0; b < Buffs.Count; b++)
            {
                int ID = Buffs[b].ID, Time = Buffs[b].Time;
                if (ID < 0 || ID >= Main.maxBuffTypes)
                {
                    ID = Time = 0;
                }
                tag.Add("Buff_" + b + "_type_" + UniqueID, ID);
                tag.Add("Buff_" + b + "_time_" + UniqueID, Time);
            }
            int SkillCount = SkillList.Count;

            tag.Add("SkillCount_" + UniqueID, SkillCount);
            for (int s = 0; s < SkillCount; s++)
            {
                tag.Add("SkillType_" + s + "_" + UniqueID, SkillList[s].skillType.ToString());
                tag.Add("SkillLevel_" + s + "_" + UniqueID, SkillList[s].Level);
                tag.Add("SkillProgress_" + s + "_" + UniqueID, SkillList[s].Progress);
            }
            tag.Add("BodyDye_" + UniqueID, BodyDye.type);
            tag.Add("FatigueCount_" + UniqueID, (byte)Fatigue);
            tag.Add("InjuryCount_" + UniqueID, (byte)Injury);
            //request.Save(tag, UniqueID);
            request.Save(tag, "Request_" + UniqueID);

            /*tag.Add("HasExistenceTime_" + UniqueID, LifeTime.HasValue);
             * if(LifeTime.HasValue)
             *  tag.Add("ExistenceTime_" + UniqueID, LifeTime.Value.TotalSeconds);*/
            tag.Add("SkinID_" + UniqueID, SkinID);
            tag.Add("OutfitID_" + UniqueID, OutfitID);
            tag.Add("Coins_" + UniqueID, (int)_Coins - int.MaxValue);
            SaveCustom(tag, UniqueID);
            GuardianCommonStatus.SaveStatus(ID, ModID);
        }