public override void Load(TagCompound tc) { LimitCurrent = tc.GetInt("LimitPoints"); if (EpicBattleFantasyUltimate.instance == null) { return; } for (int i = 0; i < EpicBattleFantasyUltimate.instance?.SlotUI.FlairSlots.Length; ++i) { string flairSlotData = tc.GetString("flairSlot_" + i); if (!string.IsNullOrWhiteSpace(flairSlotData)) { EpicBattleFantasyUltimate.instance.SlotUI.FlairSlots[i].Item = ItemIO.FromBase64(flairSlotData); } else { EpicBattleFantasyUltimate.instance.SlotUI.FlairSlots[i].Item = new Item(); } } }
TextSnippet ITagHandler.Parse(string text, Color baseColor, string options) { Item item = new Item(); int type; bool check = false; if (int.TryParse(text, out type)) { item.netDefaults(type); } if (item.type <= 0) { return(new TextSnippet(text)); } item.stack = 1; // options happen here, we add MID (=ModItemData) options if (options != null) { // don't know why all these options here in vanilla, // since it only assumed one option (stack OR prefix, since prefixed items don't stack) string[] array = options.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { if (array[i].Length != 0) { char c = array[i][0]; int value2; // MID is present, we will override if (c == 'd') { item = ItemIO.FromBase64(array[i].Substring(1)); } else if (c == 'o') { item.SetNameOverride(array[i].Substring(1)); } else if (c == 'c') { check = true; } else if (c != 'p') { int value; if ((c == 's' || c == 'x') && int.TryParse(array[i].Substring(1), out value)) { item.stack = Utils.Clamp <int>(value, 1, item.maxStack); } } else if (int.TryParse(array[i].Substring(1), out value2)) { item.Prefix((int)((byte)Utils.Clamp <int>(value2, 0, ModPrefix.PrefixCount))); } } } } string str = ""; if (item.stack > 1) { str = " (" + item.stack + ")"; } return(new ItemHoverFixTagHandler.ItemHoverFixSnippet(item, check) { Text = "[" + item.AffixName() + str + "]", CheckForHover = true, DeleteWhole = true }); }