public override void Load(TagCompound tag) { IList <string> downed = tag.GetList <string>("downed"); downedFriezaShip = downed.Contains("friezaShip"); downedGreatApe = downed.Contains("greatApe"); kiBeacons = tag.ContainsKey("KiBeacons") ? (List <Vector2>)tag.GetList <Vector2>("KiBeacons") : new List <Vector2>(); // cleanup ki beacon list, not sure why this is necessary. CleanupKiBeaconList(); for (var i = 0; i < 7; i++) { var cacheKeyNameX = $"DragonBall{i + 1}LocationX"; var cacheKeyNameY = $"DragonBall{i + 1}LocationY"; if (tag.ContainsKey(cacheKeyNameX) && tag.ContainsKey(cacheKeyNameY)) { var dbX = tag.GetInt(cacheKeyNameX); var dbY = tag.GetInt(cacheKeyNameY); var dbLocation = new Point(dbX, dbY); CacheDragonBallLocation(i + 1, dbLocation); } } }
//////////////// internal void Load(TagCompound tags) { var mymod = ModHelpersMod.Instance; var modworld = mymod.GetModWorld <ModHelpersWorld>(); if (tags.ContainsKey("world_mod_lock_count")) { int worldCount = tags.GetInt("world_mod_lock_count"); for (int i = 0; i < worldCount; i++) { string worldUid = tags.GetString("world_mod_lock_uid_" + i); int modCount = tags.GetInt("world_mod_lock_mods_" + i + "_count"); this.WorldModLocks[worldUid] = new HashSet <string>(); for (int j = 0; j < modCount; j++) { string modName = tags.GetString("world_mod_lock_mods_" + i + "_" + j); //LogHelpers.Log( "Load world_mod_lock_mods_" + i + "_" + j +": "+modName ); this.WorldModLocks[worldUid].Add(modName); } } } }
public override void Load(TagCompound tag) { CurrentQuest = tag.GetInt("CurrentQuest"); QuestsCompletedToday = tag.GetInt("QuestsCompletedToday"); QuestsCompleted = tag.GetInt("QuestsCompleted"); QuestKills = tag.GetInt("QuestKills"); }
public override void Load(TagCompound tag) { score = tag.GetInt("score"); exampleLifeFruits = tag.GetInt("exampleLifeFruits"); // nonStopParty was added after the initial ExampleMod release. Read https://github.com/blushiemagic/tModLoader/wiki/Saving-and-loading-using-TagCompound#mod-version-updates for information about how to handle version updates in your mod without messing up current users of your mod. nonStopParty = tag.GetBool("nonStopParty"); }
public override void Load(TagCompound tag) { try { int value = tag.GetInt("value"); if (value > 0) { loadedValue = value; Point position = new Point(tag.GetInt("x"), tag.GetInt("y")); Item[] deathInventory = new Item[player.inventory.Length]; Item[] deathArmor = new Item[player.armor.Length]; Item[] deathDye = new Item[player.dye.Length]; Item[] deathMiscEquips = new Item[player.miscEquips.Length]; Item[] deathMiscDyes = new Item[player.miscDyes.Length]; loadItemList(tag.Get <List <Item> >("deathInventory"), deathInventory); loadItemList(tag.Get <List <Item> >("deathArmor"), deathArmor); loadItemList(tag.Get <List <Item> >("deathDye"), deathDye); loadItemList(tag.Get <List <Item> >("deathMiscEquips"), deathMiscEquips); loadItemList(tag.Get <List <Item> >("deathMiscDyes"), deathMiscDyes); PlayerDeathInventory inventory = new PlayerDeathInventory(deathInventory, deathArmor, deathDye, deathMiscEquips, deathMiscDyes); playerDeathInventoryMap.Add(position, inventory); } } catch (Exception e) { mod.Logger.Error("Error loading saved tombstone inventory " + e.Message); } }
//////////////// public override void Load(TagCompound tag) { var self = this; this.TrialLicensedItems.Clear(); this.LicensedItems.Clear(); if (tag.ContainsKey("trial_license_key_count")) { int count = tag.GetInt("trial_license_key_count"); for (int i = 0; i < count; i++) { string itemKey = tag.GetString("trial_license_key_" + i); this.PendingLoadTrialLicenses.Add(new ItemDefinition(itemKey)); } if (LicensesMod.Config.DebugModeInfo) { LogHelpers.Alert(" Loaded for player " + this.player.name + " (" + this.player.whoAmI + ") " + count + " trial licensed items..."); } } if (tag.ContainsKey("license_key_count")) { int count = tag.GetInt("license_key_count"); for (int i = 0; i < count; i++) { string itemKey = tag.GetString("license_key_" + i); this.PendingLoadLicenses.Add(new ItemDefinition(itemKey)); } if (LicensesMod.Config.DebugModeInfo) { LogHelpers.Alert(" Loaded for player " + this.player.name + " (" + this.player.whoAmI + ") " + count + " licensed items..."); } } }
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"); }
public override void Load(TagCompound tag) { queue = tag.GetInt("queue"); obsidian = tag.GetInt("obsidian"); water = tag.GetInt("water"); lava = tag.GetInt("lava"); }
public override void Load(Item item, TagCompound tags) { if (item.type != ModContent.ItemType <CrossDimensionalAggregatorItem>()) { return; } bool isInit = tags.GetBool("is_init"); int music = tags.GetInt("music_type"); int uses = tags.GetInt("uses"); string spawnNpcEnc = tags.GetString("spawn_npcs"); IReadOnlyList <KeyValuePair <int, ISet <int> > > list = null; if (spawnNpcEnc != "" || isInit) { var rawList = JsonConvert.DeserializeObject <List <KeyValuePair <int, ISet <int> > > >(spawnNpcEnc); list = rawList.AsReadOnly(); } this.IsInitialized = isInit; this.MusicType = music; this.BannerItemTypesToNpcTypes = list; this.Uses = uses; }
public override void Load(TagCompound tag) { base.Load(tag); if (tag.ContainsKey("position")) { panelMain.LoadPositionJsonString(tag.GetString("position")); } if (tag.ContainsKey("SplitterBarLeft")) { panelSplitter.SetSplitterBarLeft(tag.GetFloat("SplitterBarLeft")); } if (tag.ContainsKey("killItems")) { TileWallUI.killItems = tag.GetString("killItems").Split(',').Select(x => x.Equals("1") ? true : false).ToArray <bool>(); } if (tag.ContainsKey("btnIconSize")) { btnIconSize.Index = tag.GetInt("btnIconSize"); UIItemSlot.scale = btnIconSize.GetValue <float>(); } if (tag.ContainsKey("btnFilterNear")) { btnFilterNear.Index = tag.GetInt("btnFilterNear"); } if (tag.ContainsKey("btnShowTile")) { btnShowTile.Index = tag.GetInt("btnShowTile"); } if (tag.ContainsKey("btnShowWall")) { btnShowWall.Index = tag.GetInt("btnShowWall"); } }
/// <summary> /// Gets the dimensions of a structure from a structure file within your mod. /// </summary> /// <param name="path">The path to your structure file within your mod - this should not include your mod's folder, only the path beyond it.</param> /// <param name="mod">The instance of your mod to grab the file from.</param> /// <param name="dims">The Point16 variable which you want to be set to the dimensions of the structure.</param> /// <param name="fullPath">Indicates if you want to use a fully qualified path to get the structure file instead of one from your mod - generally should only be used for debugging.</param> /// <returns></returns> public static bool GetDimensions(string path, Mod mod, ref Point16 dims, bool fullPath = false) { TagCompound tag = GetTag(path, mod, fullPath); dims = new Point16(tag.GetInt("Width"), tag.GetInt("Height")); return(true); }
//// public override void Load(TagCompound tag) { this.DownedBossesSnapshot.Clear(); var config = BossReignsConfig.Instance; if (tag.ContainsKey("is_paused")) { this.IsPaused = tag.GetBool("is_paused"); } if (tag.ContainsKey("elapsed_ticks")) { this.ElapsedReignBuildupTicks = tag.GetInt("elapsed_ticks"); } if (config.DebugModeFastTime) { this.ElapsedReignBuildupTicks /= 60; } if (tag.ContainsKey("bc_snapshot_count")) { int bcListCount = tag.GetInt("bc_snapshot_count"); for (int i = 0; i < bcListCount; i++) { string boss = tag.GetString("bc_snapshot_boss_" + i); this.DownedBossesSnapshot.Add(boss); } } this.IsLoaded = true; }
public override void Load(TagCompound tag) { if (!tag.ContainsKey("EmitterMode")) { return; } try { this.SetDefinition(new EmitterDefinition( isGoreMode: tag.GetBool("EmitterMode"), type: tag.GetInt("EmitterType"), scale: tag.GetFloat("EmitterScale"), delay: tag.GetInt("EmitterDelay"), speedX: tag.GetFloat("EmitterSpeedX"), speedY: tag.GetFloat("EmitterSpeedY"), color: new Color( tag.GetByte("EmitterColorR"), tag.GetByte("EmitterColorG"), tag.GetByte("EmitterColorB") ), transparency: tag.GetByte("EmitterAlpha"), scatter: tag.GetFloat("EmitterScatter"), hasGravity: tag.GetBool("EmitterHasGrav"), hasLight: tag.GetBool("EmitterHasLight"), isActivated: tag.GetBool("EmitterIsActivated") )); } catch { } }
/* Loads Character Statistics */ public override void Load(TagCompound tag) { try { Level = tag.GetInt("level"); Experience = tag.GetLong("experience"); TotalExperience = tag.GetLong("totalExperience"); } catch (SystemException e) { ModLoader.GetMod(EConstants.ModName).Logger.InfoFormat("@Level and Experience :: " + e); } try { foreach (PlayerStats stat in Enum.GetValues(typeof(PlayerStats))) { BaseStats[stat] = tag.GetInt("base" + stat.ToString().ToUpper()); } } catch (SystemException e) { ModLoader.GetMod(EConstants.ModName).Logger.InfoFormat("@Stats :: " + e); } }
public override void Load(TagCompound tag) { Damage.value = tag.GetInt("damage"); Speed.value = tag.GetInt("speed"); Crit.value = tag.GetInt("crit"); SetStats(); }
public override void Load(TagCompound tag) { base.Load(tag); if (tag.ContainsKey("position")) { panelMain.LoadPositionJsonString(tag.GetString("position")); } if (tag.ContainsKey("btnDisplayTarget")) { btnDisplayTarget.Index = tag.GetInt("btnDisplayTarget"); BannerChecklist.instance.bannerChecklistTool.isDisplayTarget = btnDisplayTarget.GetValue <bool>(); } if (tag.ContainsKey("btnIconSize")) { btnIconSize.Index = tag.GetInt("btnIconSize"); UIItemSlot.scale = btnIconSize.GetValue <float>(); } if (tag.ContainsKey("btnFilter")) { btnFilter.Index = tag.GetInt("btnFilter"); } if (tag.ContainsKey("btnSort")) { btnSort.Index = tag.GetInt("btnSort"); } if (tag.ContainsKey("btnSortReverse")) { btnSortReverse.Index = tag.GetInt("btnSortReverse"); } updateNeeded = true; }
public override void Load(TagCompound tag) { var modworld = this.mod.GetModWorld <WormholesWorld>(); int wormholes = tag.GetInt("wormholes_count"); this.TownPortalRightPositions = new Dictionary <string, Vector2>(); this.TownPortalLeftPositions = new Dictionary <string, Vector2>(); for (int i = 0; i < wormholes; i++) { string id = tag.GetString("wormhole_id_" + i); if (id == "") { continue; } this.ChartedLinks.Add(id); } int my_portal_count = tag.GetInt("my_town_portal_count"); for (int i = 0; i < my_portal_count; i++) { string world_id = tag.GetString("my_town_portal_id_" + i); float right_x = tag.GetFloat("my_town_right_portal_x_" + i); float right_y = tag.GetFloat("my_town_right_portal_y_" + i); float left_x = tag.GetFloat("my_town_left_portal_x_" + i); float left_y = tag.GetFloat("my_town_left_portal_y_" + i); var right = new Vector2(right_x, right_y); var left = new Vector2(left_x, left_y); this.TownPortalRightPositions[world_id] = right; this.TownPortalLeftPositions[world_id] = left; } }
private void LoadWishes(TagCompound tag) { PowerWishesLeft = tag.GetInt(nameof(PowerWishesLeft)); ImmortalityWishesLeft = tag.GetInt(nameof(ImmortalityWishesLeft)); SkillWishesLeft = tag.GetInt(nameof(SkillWishesLeft)); AwakeningWishesLeft = tag.GetInt(nameof(AwakeningWishesLeft)); ImmortalityRevivesLeft = tag.GetInt(nameof(ImmortalityRevivesLeft)); }
public override void Load(TagCompound tag) { LifeElixir = tag.GetInt("LifeElixir"); Fuaran = tag.GetInt("Fuaran"); KeepBuffs = tag.GetInt("KeepBuffs"); WellFed = tag.GetInt("WellFed"); BillIsDowned = tag.GetInt("BillIsDowned"); }
public override void Load(TagCompound tag) { cookieCount = tag.GetDouble("cookieCount"); cookiesPerSecond = tag.GetFloat("cookiesPerSecond"); goldenCookieCount = tag.GetInt("goldenCookieCount"); sugarLumpCount = tag.GetInt("sugerLumpCount"); timeOffMultiplier = (int)(DateTime.Now - Convert.ToDateTime(tag.GetString("exitTime"))).TotalSeconds; }
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"); }
public override void Load(TagCompound tag) { overStack = tag.GetInt(nameof(overStack)); item.SetNameOverride(tag.GetString(nameof(item.Name))); item.shoot = tag.GetInt(nameof(item.shoot)); item.damage = tag.GetInt(nameof(item.damage)); bulletType = tag.GetString(nameof(bulletType)); }
public override void Load(TagCompound tag) { int width = tag.GetInt("Width"); int height = tag.GetInt("Height"); oil = tag.GetList <int>("DataOil").To2DArray(width, height); gas = tag.GetList <int>("DataGas").To2DArray(width, height); }
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 static Loot Deserialze(TagCompound tag) { return(new Loot( tag.Get <Item>("Item"), tag.GetInt("Min"), tag.GetInt("Max"), tag.GetInt("Weight"))); }
public override void Load(TagCompound tag) { CurrentQuest = tag.GetInt("Current"); CompletedToday = tag.GetBool("Today"); CompletedTotal = tag.GetInt("Total"); PirateQuest = tag.GetBool("PirateQuest"); QuestKills = tag.GetInt("QuestKills"); }
public override void Load() { if (System.IO.File.Exists(ModLoader.ModPath.Replace("Mods", "SavedStructures") + "/TestWandCache")) { TagCompound tag = TagIO.FromFile(ModLoader.ModPath.Replace("Mods", "SavedStructures") + "/TestWandCache"); PreviewWidth = tag.GetInt("Width"); PreviewHeight = tag.GetInt("Height"); } }
//////////////// public override void Load(TagCompound tags) { if (tags.ContainsKey("exit_x")) { this.ExitTileX = tags.GetInt("exit_x"); this.ExitTileY = tags.GetInt("exit_y"); } this.IsInitialized = true; }
public override void Load(TagCompound tag) { warDemon = tag.GetBool("warDemon"); mageDemon = tag.GetBool("mageDemon"); shootDemon = tag.GetBool("shootDemon"); summonDemon = tag.GetBool("summonDemon"); demonPower = tag.GetInt("demonPower"); demonPower = tag.GetInt("currentPower"); }
public override void Load(TagCompound tag) { base.Load(tag); choseJob = tag.GetBool("choseJob"); job = tag.GetInt("job"); armorJob = tag.GetInt("armorJob"); defeatedWoF = tag.GetBool("defeatedWoF"); rogueBonus = tag.GetBool("rogueBonus"); }
internal static void LoadContainers(TagCompound tag) { if (tag.HasTag("data")) ReadContainers(new BinaryReader(new MemoryStream(tag.GetByteArray("data")))); foreach (var frameTag in tag.GetList<TagCompound>("itemFrames")) { TEItemFrame itemFrame = TileEntity.ByID[tag.GetInt("id")] as TEItemFrame; ItemIO.Load(itemFrame.item, frameTag.GetCompound("item")); } }
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")); }