diff --git a/CheatSheet.cs b/CheatSheet.cs index 5177626..e06adab 100644 --- a/CheatSheet.cs +++ b/CheatSheet.cs @@ -236,10 +236,19 @@ public override void AddRecipeGroups() } } + internal const int DefaultNumberOnlineToLoad = 30; + public int numberOnlineToLoad = 0; + public override void UpdateUI(GameTime gameTime) { base.UpdateUI(gameTime); + if(PaintToolsEx.schematicsToLoad != null && numberOnlineToLoad > 0 && CheatSheet.instance.paintToolsUI.view.childrenToRemove.Count == 0) + { + PaintToolsEx.LoadSingleSchematic(); + //CheatSheet.instance.paintToolsUI.view.ReorderSlots(); + } + if (PaintToolsSlot.updateNeeded) { bool oneUpdated = false; diff --git a/CheatSheet.csproj b/CheatSheet.csproj index 4c5b90d..3ae847e 100644 --- a/CheatSheet.csproj +++ b/CheatSheet.csproj @@ -80,6 +80,7 @@ + diff --git a/Configuration.cs b/Configuration.cs index e791a45..c63126a 100644 --- a/Configuration.cs +++ b/Configuration.cs @@ -96,6 +96,7 @@ internal class PersonalConfiguration public bool ClearMenu = true; public bool Vacuum = true; public bool LightHack = true; + public bool GodMode = true; //public bool BossDowner = true; //public bool EventManager = true; diff --git a/Localization/TranslationsNeeded.txt b/Localization/TranslationsNeeded.txt index fe8b678..343dbfa 100644 --- a/Localization/TranslationsNeeded.txt +++ b/Localization/TranslationsNeeded.txt @@ -1,3 +1,8 @@ -pt-BR 5 -pl-PL 99 -it-IT 99 +zh-Hans 3 +ru-RU 3 +pt-BR 8 +pl-PL 102 +it-IT 102 +fr-FR 3 +es-ES 3 +de-DE 3 diff --git a/Localization/de-DE.lang b/Localization/de-DE.lang index 9b723cf..d2f4e64 100644 --- a/Localization/de-DE.lang +++ b/Localization/de-DE.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Licht Hack: 25% LightHack.LightHack50%=Licht Hack: 50% LightHack.LightHack100%=Licht Hack: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Günstlings platz erhöhung: +0 MinionSlot.MinionSlotBoosterNew=Günstlings platz erhöhung: MinionSlot.MinionSlotBoosterText=Günstlings platz erhöhung nun bei @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Spawn rate ConfigurationTool.Vacuum=Sauger ConfigurationTool.Waypoints=Wegpunkte ConfigurationTool.LightHack=Licht Hack +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=Keine Erweiterungen\nCheat Modifikationen\nInstalliert diff --git a/Localization/en-US.lang b/Localization/en-US.lang index fa05bc3..904c512 100644 --- a/Localization/en-US.lang +++ b/Localization/en-US.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Light Hack: 25% LightHack.LightHack50%=Light Hack: 50% LightHack.LightHack100%=Light Hack: 100% +GodMode.GodModeDisabled=God Mode Disabled +GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Minion Slot Boost: +0 MinionSlot.MinionSlotBoosterNew=Minion Slot Boost: MinionSlot.MinionSlotBoosterText=Minion boost now at @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Spawn Rate ConfigurationTool.Vacuum=Vacuum ConfigurationTool.Waypoints=Waypoints ConfigurationTool.LightHack=Light Hack +ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=No Extension\nCheat Mods\nInstalled diff --git a/Localization/es-ES.lang b/Localization/es-ES.lang index 69a18b9..dd7b248 100644 --- a/Localization/es-ES.lang +++ b/Localization/es-ES.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Hack de Luz: 25% LightHack.LightHack50%=Hack de Luz: 50% LightHack.LightHack100%=Hack de Luz: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Mejora de Espacio para Esbirros: +0 MinionSlot.MinionSlotBoosterNew=Mejora de Espacio para Esbirros: MinionSlot.MinionSlotBoosterText=Mejora de Espacio para Esbirros ahora en @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Tasa de Spawns ConfigurationTool.Vacuum=Aspirador ConfigurationTool.Waypoints=Puntos de referencia ConfigurationTool.LightHack=Hack de Luz +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=No hay Mods\nMods Trampa\nInstalados diff --git a/Localization/fr-FR.lang b/Localization/fr-FR.lang index 576de47..211815b 100644 --- a/Localization/fr-FR.lang +++ b/Localization/fr-FR.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Manipulation de la Lumière: 25% LightHack.LightHack50%=Manipulation de la Lumière: 50% LightHack.LightHack100%=Manipulation de la Lumière: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Augmentation de la Capacité Maximale d'Invocations: +0 MinionSlot.MinionSlotBoosterNew=Augmentation de la Capacité Maximale d'Invocations: MinionSlot.MinionSlotBoosterText=Capacité Maximale Actuelle d'Invocations à @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Taux d'Apparition ConfigurationTool.Vacuum=Aspirateur d'Objets ConfigurationTool.Waypoints=Points de Localisation ConfigurationTool.LightHack=Manipulation de la Lumière +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=Pas d'Extensions\nde Modules de Triche\nInstallés diff --git a/Localization/it-IT.lang b/Localization/it-IT.lang index 4275111..a3b456c 100644 --- a/Localization/it-IT.lang +++ b/Localization/it-IT.lang @@ -42,6 +42,9 @@ # LightHack.LightHack50%=Light Hack: 50% # LightHack.LightHack100%=Light Hack: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + # MinionSlot.MinionSlotBooster=Minion Slot Boost: +0 # MinionSlot.MinionSlotBoosterNew=Minion Slot Boost: # MinionSlot.MinionSlotBoosterText=Minion boost now at @@ -62,6 +65,7 @@ # ConfigurationTool.Vacuum=Vacuum # ConfigurationTool.Waypoints=Waypoints # ConfigurationTool.LightHack=Light Hack +# ConfigurationTool.GodMode=God Mode # ExtendedCheatMenu.NoExtensionCheatModsInstalled=No Extension\nCheat Mods\nInstalled diff --git a/Localization/pl-PL.lang b/Localization/pl-PL.lang index 4275111..a3b456c 100644 --- a/Localization/pl-PL.lang +++ b/Localization/pl-PL.lang @@ -42,6 +42,9 @@ # LightHack.LightHack50%=Light Hack: 50% # LightHack.LightHack100%=Light Hack: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + # MinionSlot.MinionSlotBooster=Minion Slot Boost: +0 # MinionSlot.MinionSlotBoosterNew=Minion Slot Boost: # MinionSlot.MinionSlotBoosterText=Minion boost now at @@ -62,6 +65,7 @@ # ConfigurationTool.Vacuum=Vacuum # ConfigurationTool.Waypoints=Waypoints # ConfigurationTool.LightHack=Light Hack +# ConfigurationTool.GodMode=God Mode # ExtendedCheatMenu.NoExtensionCheatModsInstalled=No Extension\nCheat Mods\nInstalled diff --git a/Localization/pt-BR.lang b/Localization/pt-BR.lang index 0926786..2d71e37 100644 --- a/Localization/pt-BR.lang +++ b/Localization/pt-BR.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Hack de Luz: 25% LightHack.LightHack50%=Hack de Luz: 50% LightHack.LightHack100%=Hack de Luz: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Boost de Slot de Servos: +0 MinionSlot.MinionSlotBoosterNew=Boost de Slot de Servos: MinionSlot.MinionSlotBoosterText=Boost de servos agora em @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Taxa de Spawns ConfigurationTool.Vacuum=Aspirador ConfigurationTool.Waypoints=Waypoints ConfigurationTool.LightHack=Hack de Luz +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=Sem Mods de\nCheat com\nExtensões\nInstalados diff --git a/Localization/ru-RU.lang b/Localization/ru-RU.lang index 8a4e4bb..83f2b25 100644 --- a/Localization/ru-RU.lang +++ b/Localization/ru-RU.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=Увеличение яркости: 25% LightHack.LightHack50%=Увеличение яркости: 50% LightHack.LightHack100%=Увеличение яркости: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=Увеличение максимального количества миньонов: +0 MinionSlot.MinionSlotBoosterNew=Увеличение максимального количества миньонов: MinionSlot.MinionSlotBoosterText=Увеличение максимального количества миньонов теперь @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=Частота спавна мобов ConfigurationTool.Vacuum=Очистка предметов ConfigurationTool.Waypoints=Точки телепортации ConfigurationTool.LightHack=Увеличение яркости +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=Не установлено\nмодов с\nрасширениями diff --git a/Localization/zh-Hans.lang b/Localization/zh-Hans.lang index 6822c5f..1d59c78 100644 --- a/Localization/zh-Hans.lang +++ b/Localization/zh-Hans.lang @@ -42,6 +42,9 @@ LightHack.LightHack25%=透视照明: 25% LightHack.LightHack50%=透视照明: 50% LightHack.LightHack100%=透视照明: 100% +# GodMode.GodModeDisabled=God Mode Disabled +# GodMode.GodModeEnabled=God Mode Enabled + MinionSlot.MinionSlotBooster=额外召唤物数量: +0 MinionSlot.MinionSlotBoosterNew=额外召唤物数量: MinionSlot.MinionSlotBoosterText=最大召唤物数量 @@ -62,6 +65,7 @@ ConfigurationTool.SpawnRate=刷怪率 ConfigurationTool.Vacuum=快速拾取 ConfigurationTool.Waypoints=路径点 ConfigurationTool.LightHack=透视照明 +# ConfigurationTool.GodMode=God Mode ExtendedCheatMenu.NoExtensionCheatModsInstalled=无扩展模组\n作弊模组\n已安装 diff --git a/Menus/ConfigurationTool.cs b/Menus/ConfigurationTool.cs index 85af041..d17ece1 100644 --- a/Menus/ConfigurationTool.cs +++ b/Menus/ConfigurationTool.cs @@ -65,7 +65,7 @@ public ConfigurationWindow(Mod mod) this.mod = mod; this.CanMove = true; base.Width = 280; - base.Height = 348; + base.Height = 358; Texture2D texture = mod.GetTexture("UI/closeButton"); UIImage uIImage = new UIImage(texture); @@ -76,81 +76,66 @@ public ConfigurationWindow(Mod mod) //ConfigurationLoader.Initialized(); - string[] labels = new string[] { CSText("ItemBrowser"), CSText("NPCBrowser"), CSText("RecipeBrowser"), CSText("MinionBooster"), CSText("Butcher"), CSText("ClearMenu"), - CSText("ExtraAccessorySlots"), CSText("ModExtensions"), CSText("PaintTools"), CSText("SpawnRate"), CSText("Vacuum"), CSText("Waypoints"), CSText("LightHack") + string[] labels = new string[] { CSText("ItemBrowser"), CSText("NPCBrowser"), CSText("RecipeBrowser"), CSText("MinionBooster"), CSText("Butcher"), CSText("ClearMenu"), + CSText("ExtraAccessorySlots"), CSText("ModExtensions"), CSText("PaintTools"), CSText("SpawnRate"), CSText("Vacuum"), CSText("Waypoints"), CSText("LightHack"), CSText("GodMode") /* "Boss Downer", "Event Manager"*/ }; - bool[] selecteds = new bool[] { - ConfigurationLoader.personalConfiguration.ItemBrowser, - ConfigurationLoader.personalConfiguration.NPCBrowser, - ConfigurationLoader.personalConfiguration.RecipeBrowser, - ConfigurationLoader.personalConfiguration.MinionBooster, - ConfigurationLoader.personalConfiguration.Butcher, - ConfigurationLoader.personalConfiguration.ClearMenu, - ConfigurationLoader.personalConfiguration.ExtraAccessorySlots, - ConfigurationLoader.personalConfiguration.ModExtensions, - ConfigurationLoader.personalConfiguration.PaintTools, - ConfigurationLoader.personalConfiguration.SpawnRate, - ConfigurationLoader.personalConfiguration.Vacuum, - ConfigurationLoader.personalConfiguration.Waypoints, - ConfigurationLoader.personalConfiguration.LightHack, + Func[] selecteds = new Func[] { + ()=>ConfigurationLoader.personalConfiguration.ItemBrowser, + ()=>ConfigurationLoader.personalConfiguration.NPCBrowser, + ()=>ConfigurationLoader.personalConfiguration.RecipeBrowser, + ()=>ConfigurationLoader.personalConfiguration.MinionBooster, + ()=>ConfigurationLoader.personalConfiguration.Butcher, + ()=>ConfigurationLoader.personalConfiguration.ClearMenu, + ()=>ConfigurationLoader.personalConfiguration.ExtraAccessorySlots, + ()=>ConfigurationLoader.personalConfiguration.ModExtensions, + ()=>ConfigurationLoader.personalConfiguration.PaintTools, + ()=>ConfigurationLoader.personalConfiguration.SpawnRate, + ()=>ConfigurationLoader.personalConfiguration.Vacuum, + ()=>ConfigurationLoader.personalConfiguration.Waypoints, + ()=>ConfigurationLoader.personalConfiguration.LightHack, + ()=>ConfigurationLoader.personalConfiguration.GodMode, // ConfigurationLoader.configuration.BossDowner, // ConfigurationLoader.configuration.EventManager, }; + Action[] assignSelected = new Action[] { + (bool a)=>ConfigurationLoader.personalConfiguration.ItemBrowser = a, + (bool a)=>ConfigurationLoader.personalConfiguration.NPCBrowser = a, + (bool a)=>ConfigurationLoader.personalConfiguration.RecipeBrowser = a, + (bool a)=>ConfigurationLoader.personalConfiguration.MinionBooster = a, + (bool a)=>ConfigurationLoader.personalConfiguration.Butcher = a, + (bool a)=>ConfigurationLoader.personalConfiguration.ClearMenu = a, + (bool a)=>ConfigurationLoader.personalConfiguration.ExtraAccessorySlots = a, + (bool a)=>ConfigurationLoader.personalConfiguration.ModExtensions = a, + (bool a)=>ConfigurationLoader.personalConfiguration.PaintTools = a, + (bool a)=>ConfigurationLoader.personalConfiguration.SpawnRate = a, + (bool a)=>ConfigurationLoader.personalConfiguration.Vacuum = a, + (bool a)=>ConfigurationLoader.personalConfiguration.Waypoints = a, + (bool a)=>ConfigurationLoader.personalConfiguration.LightHack = a, + (bool a)=>ConfigurationLoader.personalConfiguration.GodMode = a, + }; + for (int i = 0; i < labels.Length; i++) { + int iClosure = i; UICheckbox cb = new UICheckbox(labels[i]); - cb.Selected = selecteds[i]; + cb.Selected = selecteds[i](); cb.X = spacing; cb.Y = i * 24 + spacing; - cb.SelectedChanged += new EventHandler(bCheckBoxTicked); + //cb.SelectedChanged += new EventHandler(bCheckBoxTicked); + cb.SelectedChanged += (a, b) => + { + assignSelected[iClosure](cb.Selected); + cb.Selected = selecteds[iClosure](); + ConfigurationLoader.SaveSetting(); + ((CheatSheet)mod).hotbar.ChangedConfiguration(); + ConfigurationTool.configurationWindow.selected = true; + }; //cb.label.ForegroundColor = Color.Red; AddChild(cb); } - - //UICheckbox cb = new UICheckbox("Item Browser"); - //cb.Selected = ConfigurationLoader.configuration.ItemBrowser; - //cb.X = 0; - //cb.Y = 1 * 20; - //cb.SelectedChanged += new EventHandler(bCheckBoxTicked); - //AddChild(cb); - - //cb = new UICheckbox("NPC Browser"); - //cb.Selected = ConfigurationLoader.configuration.NPCBrowser; - //cb.X = 0; - //cb.Y = 2 * 20; - //cb.SelectedChanged += new EventHandler(bCheckBoxTicked); - //AddChild(cb); - - //cb = new UICheckbox("Recipe Browser"); - //cb.Selected = ConfigurationLoader.configuration.RecipeBrowser; - //cb.X = 0; - //cb.Y = 3 * 20; - //cb.SelectedChanged += new EventHandler(bCheckBoxTicked); - //AddChild(cb); - - //cb = new UICheckbox("Minion Booster"); - //cb.Selected = ConfigurationLoader.configuration.MinionBooster; - //cb.X = 0; - //cb.Y = 4 * 20; - //cb.SelectedChanged += new EventHandler(bCheckBoxTicked); - //AddChild(cb); - - //for (int j = 0; j < 7; j++) - //{ - // GenericItemSlot genericItemSlot = new GenericItemSlot(); - // Vector2 position = new Vector2(this.spacing, this.spacing); - - // position.X += j * 60; - // position.Y += 250; - - // genericItemSlot.Position = position; - // genericItemSlot.Tag = j; - // RecipeBrowser.ingredients[j] = genericItemSlot; - // this.AddChild(genericItemSlot, false); - //} } private void bClose_onLeftClick(object sender, EventArgs e) @@ -158,74 +143,15 @@ private void bClose_onLeftClick(object sender, EventArgs e) Hide(); } - private void bCheckBoxTicked(object sender, EventArgs e) + public override void Draw(SpriteBatch spriteBatch) { - UICheckbox checkbox = (UICheckbox)sender; - switch (checkbox.Text) + base.Draw(spriteBatch); + + if (Visible && IsMouseInside()) { - case "Item Browser": - ConfigurationLoader.personalConfiguration.ItemBrowser = checkbox.Selected; - break; - - case "NPC Browser": - ConfigurationLoader.personalConfiguration.NPCBrowser = checkbox.Selected; - break; - - case "Recipe Browser": - ConfigurationLoader.personalConfiguration.RecipeBrowser = checkbox.Selected; - break; - - case "Minion Booster": - ConfigurationLoader.personalConfiguration.MinionBooster = checkbox.Selected; - break; - - case "Butcher": - ConfigurationLoader.personalConfiguration.Butcher = checkbox.Selected; - break; - - case "Clear Menu": - ConfigurationLoader.personalConfiguration.ClearMenu = checkbox.Selected; - break; - - case "Extra Accessory Slots": - ConfigurationLoader.personalConfiguration.ExtraAccessorySlots = checkbox.Selected; - break; - - case "Mod Extensions": - ConfigurationLoader.personalConfiguration.ModExtensions = checkbox.Selected; - break; - - case "Paint Tools": - ConfigurationLoader.personalConfiguration.PaintTools = checkbox.Selected; - break; - - case "Spawn Rate": - ConfigurationLoader.personalConfiguration.SpawnRate = checkbox.Selected; - break; - - case "Vacuum": - ConfigurationLoader.personalConfiguration.Vacuum = checkbox.Selected; - break; - - case "Waypoints": - ConfigurationLoader.personalConfiguration.Waypoints = checkbox.Selected; - break; - - case "Light Hack": - ConfigurationLoader.personalConfiguration.LightHack = checkbox.Selected; - break; - //case "Boss Downer": - // ConfigurationLoader.configuration.BossDowner = checkbox.Selected; - // break; - //case "Event Manager": - // ConfigurationLoader.configuration.EventManager = checkbox.Selected; - // break; - default: - break; + Main.LocalPlayer.mouseInterface = true; + Main.LocalPlayer.showItemIcon = false; } - ConfigurationLoader.SaveSetting(); - ((CheatSheet)mod).hotbar.ChangedConfiguration(); - ConfigurationTool.configurationWindow.selected = true; } } } \ No newline at end of file diff --git a/Menus/GodMode.cs b/Menus/GodMode.cs new file mode 100644 index 0000000..c9860cf --- /dev/null +++ b/Menus/GodMode.cs @@ -0,0 +1,60 @@ +using CheatSheet.UI; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + + +namespace CheatSheet.Menus +{ + class GodMode + { + internal static string CSText(string key, string category = "GodMode") => CheatSheet.CSText(category, key); + private static string[] GodModeStateStrings = new string[] { CSText("GodModeDisabled"), CSText("GodModeEnabled")}; + public static UIImage button; + + + private static bool _enabled = false; + public static bool Enabled + { + get { return _enabled; } + set + { + _enabled = value; + button.Tooltip = CSText(_enabled ? "GodModeEnabled" : "GodModeDisabled"); + button.ForegroundColor = _enabled ? Color.White : Color.LightSkyBlue; + } + } + + public static UIImage GetButton(Mod mod) + { + button = new UIImage(Main.itemTexture[ItemID.JimsWings]); + button.onLeftClick += (s, e) => + { + Enabled = !Enabled; + }; + Enabled = false; + return button; + } + } + + class GodModeModPlayer : ModPlayer + { + public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) + { + if (GodMode.Enabled) + return false; + return base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource); + } + + public override void PreUpdate() + { + if (GodMode.Enabled) + { + player.statLife = player.statLifeMax2; + player.statMana = player.statManaMax2; + } + } + } +} diff --git a/Menus/Hotbar.cs b/Menus/Hotbar.cs index cbb66d8..00cdeec 100644 --- a/Menus/Hotbar.cs +++ b/Menus/Hotbar.cs @@ -264,6 +264,7 @@ public Hotbar(CheatSheet mod) buttonView.AddChild(SpawnRateMultiplier.GetButton(mod)); buttonView.AddChild(MinionSlotBooster.GetButton(mod)); buttonView.AddChild(LightHack.GetButton(mod)); + buttonView.AddChild(GodMode.GetButton(mod)); // buttonView.AddChild(FullBright.GetButton(mod)); // buttonView.AddChild(BossDowner.GetButton(mod)); buttonView.AddChild(ConfigurationTool.GetButton(mod)); @@ -852,7 +853,6 @@ public void ChangedConfiguration() bToggleNPCBrowser.Visible = ConfigurationLoader.personalConfiguration.NPCBrowser; bToggleRecipeBrowser.Visible = ConfigurationLoader.personalConfiguration.RecipeBrowser; MinionSlotBooster.button.Visible = ConfigurationLoader.personalConfiguration.MinionBooster; - LightHack.button.Visible = ConfigurationLoader.personalConfiguration.LightHack; bToggleClearMenu.Visible = ConfigurationLoader.personalConfiguration.ClearMenu; bTogglePaintTools.Visible = ConfigurationLoader.personalConfiguration.PaintTools; bToggleExtendedCheat.Visible = ConfigurationLoader.personalConfiguration.ModExtensions; @@ -861,6 +861,7 @@ public void ChangedConfiguration() bToggleNPCButcherer.Visible = ConfigurationLoader.personalConfiguration.Butcher; bToggleQuickTeleport.Visible = ConfigurationLoader.personalConfiguration.Waypoints; LightHack.button.Visible = ConfigurationLoader.personalConfiguration.LightHack; + GodMode.button.Visible = ConfigurationLoader.personalConfiguration.GodMode; SpawnRateMultiplier.button.Visible = ConfigurationLoader.personalConfiguration.SpawnRate && SpawnRateMultiplier.HasPermission; //BossDowner.button.Visible = ConfigurationLoader.configuration.BossDowner; //bToggleEventManager.Visible = ConfigurationLoader.configuration.EventManager; diff --git a/Menus/PaintToolsEx.cs b/Menus/PaintToolsEx.cs index 7cac3e9..95b731f 100644 --- a/Menus/PaintToolsEx.cs +++ b/Menus/PaintToolsEx.cs @@ -38,6 +38,8 @@ internal static class PaintToolsEx private static Uri schematicsurl = new Uri("http://javid.ddns.net/tModLoader/jopojellymods/CheatSheet_Schematics_GetList.php"); private static bool waiting = false; + internal static Queue schematicsToLoad; + internal static void GetSchematicsComplete(object sender, UploadValuesCompletedEventArgs e) { if (!e.Cancelled) @@ -60,31 +62,35 @@ internal static void GetSchematicsComplete(object sender, UploadValuesCompletedE JArray schematicslist = (JArray)jsonObject["schematics"]; if (schematicslist != null) { - List list = new List(); + schematicsToLoad = new Queue(); + CheatSheet.instance.numberOnlineToLoad = CheatSheet.DefaultNumberOnlineToLoad; + //List list = new List(); foreach (JObject schematic in schematicslist.Children()) { - int id = (int)schematic["id"]; - string name = (string)schematic["name"]; - int rating = (int)schematic["rating"]; - int vote = (int)schematic["vote"]; - string tiledata = (string)schematic["tiledata"]; - try - { - Tile[,] tiles = LoadTilesFromBase64(tiledata); - if (tiles.GetLength(0) > 0) - { - var paintToolsSlot = new PaintToolsSlot(GetStampInfo(tiles)); - paintToolsSlot.browserID = id; - paintToolsSlot.browserName = name; - paintToolsSlot.rating = rating; - paintToolsSlot.vote = vote; - list.Add(paintToolsSlot); - } - } - catch { } + schematicsToLoad.Enqueue(schematic); + + //int id = (int)schematic["id"]; + //string name = (string)schematic["name"]; + //int rating = (int)schematic["rating"]; + //int vote = (int)schematic["vote"]; + //string tiledata = (string)schematic["tiledata"]; + //try + //{ + // Tile[,] tiles = LoadTilesFromBase64(tiledata); + // if (tiles.GetLength(0) > 0) + // { + // var paintToolsSlot = new PaintToolsSlot(GetStampInfo(tiles)); + // paintToolsSlot.browserID = id; + // paintToolsSlot.browserName = name; + // paintToolsSlot.rating = rating; + // paintToolsSlot.vote = vote; + // list.Add(paintToolsSlot); + // } + //} + //catch { } } - if (list.Count > 0) - CheatSheet.instance.paintToolsUI.view.Add(list.ToArray()); + //if (list.Count > 0) + // CheatSheet.instance.paintToolsUI.view.Add(list.ToArray()); } } else @@ -94,6 +100,36 @@ internal static void GetSchematicsComplete(object sender, UploadValuesCompletedE waiting = false; } + internal static void LoadSingleSchematic() + { + var schematic = schematicsToLoad.Dequeue(); + + int id = (int)schematic["id"]; + string name = (string)schematic["name"]; + int rating = (int)schematic["rating"]; + int vote = (int)schematic["vote"]; + string tiledata = (string)schematic["tiledata"]; + try + { + Tile[,] tiles = LoadTilesFromBase64(tiledata); + if (tiles.GetLength(0) > 0) + { + var paintToolsSlot = new PaintToolsSlot(GetStampInfo(tiles)); + paintToolsSlot.browserID = id; + paintToolsSlot.browserName = name; + paintToolsSlot.rating = rating; + paintToolsSlot.vote = vote; + CheatSheet.instance.paintToolsUI.view.AddEndDontSelect(paintToolsSlot); + } + } + catch { } + + CheatSheet.instance.numberOnlineToLoad--; + + if (schematicsToLoad.Count == 0) + schematicsToLoad = null; + } + internal static void OnlineImport(PaintToolsView paintToolsView) { if (waiting) @@ -129,6 +165,22 @@ internal static void OnlineImport(PaintToolsView paintToolsView) } } + internal static void LoadNextX(PaintToolsView view) + { + if (waiting) + { + Main.NewText("Wait for schematics to download first."); + return; + } + if(PaintToolsEx.schematicsToLoad == null) + { + Main.NewText("Load online schematics database first."); + return; + } + CheatSheet.instance.paintToolsUI.view.RemoveAllOnline(); + CheatSheet.instance.numberOnlineToLoad = CheatSheet.DefaultNumberOnlineToLoad; + } + internal static void Import(PaintToolsView paintToolsView) { try diff --git a/Menus/PaintToolsHotbar.cs b/Menus/PaintToolsHotbar.cs index 58bd910..4d9198c 100644 --- a/Menus/PaintToolsHotbar.cs +++ b/Menus/PaintToolsHotbar.cs @@ -683,6 +683,8 @@ public void Update2() } } } + // TODO: Experiment with WorldGen.stopDrops = true; + // TODO: Button to ignore TileFrame? for (int i = point.X; i < point.X + width; i++) { for (int j = 0; j < point.Y + height; j++) diff --git a/Menus/PaintToolsUI.cs b/Menus/PaintToolsUI.cs index 1cec84c..d68e7c9 100644 --- a/Menus/PaintToolsUI.cs +++ b/Menus/PaintToolsUI.cs @@ -117,6 +117,13 @@ public PaintToolsUI(Mod mod) uIImage.Tooltip = "Load Online Schematics Database"; this.AddChild(uIImage); + uIImage = new UIImage(Main.itemTexture[ItemID.AlphabetStatueN]); + position = position.Offset(uIImage.Width + this.spacing, 0); + uIImage.Position = position; + uIImage.onLeftClick += (a, b) => PaintToolsEx.LoadNextX(this.view); + uIImage.Tooltip = $"Load Next {CheatSheet.DefaultNumberOnlineToLoad}"; + this.AddChild(uIImage); + infoPanel = new UIView(); position = position.Offset(uIImage.Width + this.spacing, 0); infoPanel.Position = position; diff --git a/Menus/PaintToolsView.cs b/Menus/PaintToolsView.cs index c4ecd96..70b0b8b 100644 --- a/Menus/PaintToolsView.cs +++ b/Menus/PaintToolsView.cs @@ -37,6 +37,14 @@ public void Add(PaintToolsSlot slot) slot.Select(); ReorderSlots(); } + + public void AddEndDontSelect(PaintToolsSlot slot) + { + slotList.Add(slot); + //slot.Select(); + ReorderSlots(); + } + public void Add(PaintToolsSlot[] slots) { slotList.InsertRange(0, slots); @@ -61,6 +69,20 @@ public void RemoveSelectedItem() } } + public void RemoveAllOnline() + { + slotList.RemoveAll(x => x.browserID > 0); + if (!slotList.Contains(PaintToolsSlot.CurrentSelect)) + { + PaintToolsSlot.CurrentSelect = null; + CheatSheet.instance.paintToolsHotbar.StampTiles = new Tile[0, 0]; + CheatSheet.instance.paintToolsHotbar.stampInfo = null; + CheatSheet.instance.paintToolsUI.infoPanel.Visible = false; + CheatSheet.instance.paintToolsUI.submitPanel.Visible = false; + } + ReorderSlots(); + } + public void ReorderSlots() { base.ScrollPosition = 0f; diff --git a/UI/UIView.cs b/UI/UIView.cs index 429a4e3..9249199 100644 --- a/UI/UIView.cs +++ b/UI/UIView.cs @@ -40,7 +40,7 @@ internal class UIView public List children = new List(); - private List childrenToRemove = new List(); + internal List childrenToRemove = new List(); private static bool mouseUpHandled = false; diff --git a/build.txt b/build.txt index 2469219..ce95856 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = jopojelly, jofairden, rrryutaro -version = 0.4.2.2 +version = 0.4.3 displayName = Cheat Sheet homepage = http://forums.terraria.org/index.php?threads/cheat-sheet.41407/ buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\* diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..d7c8145 Binary files /dev/null and b/icon.png differ