public override void ModifyTooltips(List <TooltipLine> tooltips) { bool history = false; List <ItemModel> localHistory = HistoryBookUI.MergeHistoryIntoInventory(this); if (localHistory.Count > 0) { for (int i = 0; i < localHistory.Count; i++) { ItemModel itemModel = localHistory[i]; //Only show in the tooltip if there is a number assigned if (itemModel.SummonCount > 0) { if (!history) { history = true; tooltips.Add(new TooltipLine(mod, "History", "History:")); } tooltips.Add(new TooltipLine(mod, "ItemModel", itemModel.Name + ": " + itemModel.SummonCount) { overrideColor = itemModel.Active ? Color.White : Color.Red }); } } } else { tooltips.Add(new TooltipLine(mod, "None", "No summon history specified")); } }
public override void Load() { Instance = this; if (!Main.dedServ && Main.netMode != 2) { HistoryBookUI = new HistoryBookUI(); HistoryBookUI.Activate(); HistoryBookUIInterface = new UserInterface(); HistoryBookUIInterface.SetState(HistoryBookUI); HistoryBookUI.redCrossTexture = GetTexture("UI/UIRedCross"); } SupportedMinions = new List <MinionModel>() { new MinionModel(ItemID.SlimeStaff, BuffID.BabySlime, ProjectileID.BabySlime), new MinionModel(ItemID.HornetStaff, BuffID.HornetMinion, ProjectileID.Hornet), new MinionModel(ItemID.ImpStaff, BuffID.ImpMinion, ProjectileID.FlyingImp), new MinionModel(ItemID.SpiderStaff, BuffID.SpiderMinion, new List <int>() { ProjectileID.VenomSpider, ProjectileID.JumperSpider, ProjectileID.DangerousSpider }), new MinionModel(ItemID.OpticStaff, BuffID.TwinEyesMinion, new List <int>() { ProjectileID.Retanimini, ProjectileID.Spazmamini }), new MinionModel(ItemID.PirateStaff, BuffID.PirateMinion, new List <int>() { ProjectileID.OneEyedPirate, ProjectileID.SoulscourgePirate, ProjectileID.PirateCaptain }), new MinionModel(ItemID.PygmyStaff, BuffID.Pygmies, new List <int>() { ProjectileID.Pygmy, ProjectileID.Pygmy2, ProjectileID.Pygmy3, ProjectileID.Pygmy4 }), new MinionModel(ItemID.XenoStaff, BuffID.UFOMinion, new List <int>() { ProjectileID.UFOMinion }), new MinionModel(ItemID.RavenStaff, BuffID.Ravens, new List <int>() { ProjectileID.Raven }), new MinionModel(ItemID.TempestStaff, BuffID.SharknadoMinion, new List <int>() { ProjectileID.Tempest }), new MinionModel(ItemID.DeadlySphereStaff, BuffID.DeadlySphere, new List <int>() { ProjectileID.DeadlySphere }), new MinionModel(ItemID.StardustDragonStaff, BuffID.StardustDragonMinion, ProjectileID.StardustDragon2, 1f), new MinionModel(ItemID.StardustCellStaff, BuffID.StardustMinion, new List <int>() { ProjectileID.StardustCellMinion }) }; ModdedSummonerWeaponsWithExistingBuff = new List <int>(); }
public override void Unload() { HistoryBookUIInterface = null; HistoryBookUI = null; HistoryBookUI.redCrossTexture = null; BookTypes = null; Instance = null; }
public override void Load() { Instance = this; if (!Main.dedServ && Main.netMode != 2) { HistoryBookUI = new HistoryBookUI(); HistoryBookUI.Activate(); HistoryBookUIInterface = new UserInterface(); HistoryBookUIInterface.SetState(HistoryBookUI); HistoryBookUI.redCrossTexture = GetTexture("UI/UIRedCross"); } }
private void UpdateHistoryBookUI() { //Since this is UI related, make sure to only run on client //Change the trigger type here bool holdingBook = Array.IndexOf(SummonersAssociation.BookTypes, player.HeldItem.type) > -1; if (TriggerStart && holdingBook && AllowedToOpenHistoryBookUI) { bool success = HistoryBookUI.Start(); if (!success) { CombatText.NewText(Main.LocalPlayer.getRect(), CombatText.DamagedFriendly, "No summon weapons found"); } } else if (HistoryBookUI.visible) { if (HistoryBookUI.heldItemIndex == Main.LocalPlayer.selectedItem) { //Keep it updated HistoryBookUI.summonCountTotal = player.maxMinions; if (HistoryBookUI.middle) { if (!HistoryBookUI.simple) { if (TriggerDelete) { if (!HistoryBookUI.aboutToDelete) { HistoryBookUI.aboutToDelete = true; } else { //Clear history, and use fresh inventory data HistoryBookUI.itemModels = HistoryBookUI.GetSummonWeapons(); CombatText.NewText(Main.LocalPlayer.getRect(), CombatText.HealLife, "Reset history"); HistoryBookUI.aboutToDelete = false; } } else if (TriggerStop) { if (HistoryBookUI.aboutToDelete) { HistoryBookUI.aboutToDelete = false; } else if (HistoryBookUI.returned == HistoryBookUI.UPDATE) { HistoryBookUI.UpdateHistoryBook((MinionHistoryBookSimple)player.HeldItem.modItem); HistoryBookUI.Stop(); CombatText.NewText(Main.LocalPlayer.getRect(), CombatText.HealLife, "Saved history"); } else if (HistoryBookUI.returned == HistoryBookUI.NONE) { //Nothing, just close HistoryBookUI.Stop(); } } } //If simple, just stop, since middle has no function there (saving is done when clicked on a weapon instead) else { if (mouseRightPressed || mouseLeftPressed) { HistoryBookUI.Stop(false); } } } //If in a segment else if (HistoryBookUI.IsMouseWithinAnySegment) { ItemModel highlighted = HistoryBookUI.itemModels[HistoryBookUI.returned]; if (highlighted.Active) { if (!HistoryBookUI.simple) { bool triggered = false; if (TriggerInc) { PlayerInput.ScrollWheelDelta = 0; //Only allow to increase if total summon count differential is above or //equal to the number of slots needed to summon if (HistoryBookUI.summonCountDelta >= highlighted.SlotsNeeded) { triggered = true; highlighted.SummonCount++; } else { //Indicate that incrementing isn't possible HistoryBookUI.colorFadeIn = 1f; } } else if (TriggerDec) { PlayerInput.ScrollWheelDelta = 0; //Only allow to decrease if current summon count is above zero if (highlighted.SummonCount > 0) { triggered = true; highlighted.SummonCount--; } } if (triggered) { try { Main.PlaySound(12); } catch { /*No idea why but this threw errors one time*/ } } } //If simple, set selected and stop/spawn else { if (TriggerSelect) { HistoryBookUI.selected = HistoryBookUI.returned; HistoryBookUI.UpdateHistoryBook((MinionHistoryBookSimple)Main.LocalPlayer.HeldItem.modItem); CombatText.NewText(Main.LocalPlayer.getRect(), CombatText.HealLife, "Selected: " + highlighted.Name); HistoryBookUI.Stop(); } } } else if (HistoryBookUI.simple) { if (TriggerSelect) { //If the selected item is saved in the history but it's not in the players inventory, just stop HistoryBookUI.Stop(); } } PlayerInput.ScrollWheelDelta = 0; } //Outside the UI else { /*if (triggerStop) {*/ if (mouseRightPressed || mouseLeftPressed) { HistoryBookUI.Stop(); } } } else { //Cancel the UI when you switch items HistoryBookUI.Stop(false); } if (justOpenedInventory) { //Cancel UI when inventory is opened HistoryBookUI.Stop(false); } } }