Skip to content

Commit

Permalink
v0.6, update to 0.11.4, fix #31, fix #20, config, correct unload prog…
Browse files Browse the repository at this point in the history
…ress
  • Loading branch information
JavidPack committed Oct 11, 2019
1 parent dd3bda6 commit 8b64356
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 204 deletions.
2 changes: 1 addition & 1 deletion AllItemsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal void DrawUpdateExtraAccessories(SpriteBatch spriteBatch)
Point value = new Point(Main.mouseX, Main.mouseY);
Rectangle r = new Rectangle(0, 0, (int)((float)Main.inventoryBackTexture.Width * Main.inventoryScale), (int)((float)Main.inventoryBackTexture.Height * Main.inventoryScale));

CheatSheetPlayer csp = Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod);
CheatSheetPlayer csp = Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>();
for (int i = 0; i < csp.numberExtraAccessoriesEnabled; i++)
{
Main.inventoryScale = 0.85f;
Expand Down
9 changes: 7 additions & 2 deletions CheatSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public override void Load()

public override void Unload()
{
ButtonClicked.Clear();
ButtonTexture.Clear();
ButtonTooltip.Clear();

PaintToolsSlot.CurrentSelect = null;
AllItemsMenu.singleSlotArray = null;
UI.UICheckbox.checkboxTexture = null;
Expand Down Expand Up @@ -260,7 +264,8 @@ public override void AddRecipeGroups()
hotbar = new Hotbar(this);
//hotbar.Position = new Microsoft.Xna.Framework.Vector2(120, 180);
hotbar.Visible = true;
hotbar.Hide();
if(!GetConfig<CheatSheetClientConfig>().HotbarShownByDefault)
hotbar.Hide();
}
catch (Exception e)
{
Expand Down Expand Up @@ -619,7 +624,7 @@ internal static void ReportException(Exception e)
try
{
ReportData data = new ReportData(e);
data.additionaldata = "Loaded Mods: " + string.Join(", ", ModLoader.GetLoadedMods());
data.additionaldata = "Loaded Mods: " + string.Join(", ", ModLoader.Mods.Select(m => m.Name).ToArray());
string jsonpayload = JsonConvert.SerializeObject(data);
using (WebClient client = new WebClient())
{
Expand Down
134 changes: 8 additions & 126 deletions CheatSheet.csproj
Original file line number Diff line number Diff line change
@@ -1,134 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\references\tModLoader.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{04D22E3B-46D1-4647-B350-0AC3AEE68631}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CheatSheet</RootNamespace>
<AssemblyName>CheatSheet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<TargetFramework>net45</TargetFramework>
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
<LangVersion>latest</LangVersion>
</PropertyGroup>
<Target Name="BuildMod" AfterTargets="Build">
<Exec Command="&quot;$(tMLBuildServerPath)&quot; -build $(ProjectDir) -eac $(TargetPath) -define $(DefineConstants) -unsafe $(AllowUnsafeBlocks)" />
</Target>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework.Game\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Game.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework.Graphics\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Graphics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_32\Microsoft.Xna.Framework.Xact\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Xact.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\dllReferences\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="ReLogic">
<HintPath>..\..\..\Modding\tModLoader\references\ReLogic.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Terraria">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="build.txt" />
<Content Include="description.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="AllItemsMenu.cs" />
<Compile Include="CheatSheet.cs" />
<Compile Include="CheatSheetNPC.cs" />
<Compile Include="CheatSheetPlayer.cs" />
<Compile Include="CheatSheetWorld.cs" />
<Compile Include="Configuration.cs" />
<Compile Include="CustomUI\UIHotbar.cs" />
<Compile Include="Menus\BossDowner.cs" />
<Compile Include="Menus\ConfigurationTool.cs" />
<Compile Include="Menus\EventManagerHotbar.cs" />
<Compile Include="Menus\FullBright.cs" />
<Compile Include="Menus\GodMode.cs" />
<Compile Include="Menus\LightHack.cs" />
<Compile Include="Menus\MinionSlotBooster.cs" />
<Compile Include="Menus\NPCButchererHotbar.cs" />
<Compile Include="Menus\PaintToolsEx.cs" />
<Compile Include="Menus\PaintToolsSlot.cs" />
<Compile Include="Menus\PaintToolsUI.cs" />
<Compile Include="Menus\PaintToolsView.cs" />
<Compile Include="Menus\QuickClearHotbar.cs" />
<Compile Include="Menus\QuickTeleportHotbar.cs" />
<Compile Include="Menus\RecipeQuerySlot.cs" />
<Compile Include="Menus\SampleHotbar.cs" />
<Compile Include="Menus\SpawnRateMultiplier.cs" />
<Compile Include="ModUtils.cs" />
<Compile Include="UI\AnchorPosition.cs" />
<Compile Include="Menus\Hotbar.cs" />
<Compile Include="Menus\ExtendedCheatMenu.cs" />
<Compile Include="Menus\GenericItemSlot.cs" />
<Compile Include="Menus\ItemBrowser.cs" />
<Compile Include="Menus\ItemView.cs" />
<Compile Include="Menus\NPCBrowser.cs" />
<Compile Include="Menus\NPCSlot.cs" />
<Compile Include="Menus\NPCView.cs" />
<Compile Include="Menus\PaintToolsHotbar.cs" />
<Compile Include="Menus\RecipeBrowser.cs" />
<Compile Include="Menus\RecipeSlot.cs" />
<Compile Include="Menus\RecipeView.cs" />
<Compile Include="Menus\Slot.cs" />
<Compile Include="UI\UICheckbox.cs" />
<Compile Include="UI\UIImage.cs" />
<Compile Include="CustomUI\UIImageButtonWithBackground.cs" />
<Compile Include="UI\UIImageListButton.cs" />
<Compile Include="UI\UILabel.cs" />
<Compile Include="UI\UIScrollBar.cs" />
<Compile Include="UI\UIScrollView.cs" />
<Compile Include="CustomUI\UISlideWindow.cs" />
<Compile Include="UI\UITextbox.cs" />
<Compile Include="UI\UIView.cs" />
<Compile Include="UI\UIWindow.cs" />
<ProjectReference Include="..\BossChecklist\BossChecklist.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"C:\Program Files (x86)\Steam\steamapps\common\terraria\tModLoaderServer.exe" -build "$(ProjectDir)\" -eac "$(TargetPath)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
15 changes: 15 additions & 0 deletions CheatSheetClientConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.ComponentModel;
using Terraria.ModLoader.Config;

namespace CheatSheet
{
class CheatSheetClientConfig : ModConfig
{
public override ConfigScope Mode => ConfigScope.ClientSide;

[DefaultValue(false)]
[Label("Hotbar Shown by Default")]
[Tooltip("Allows the hotbar to default to being shown rather than hidden.")]
public bool HotbarShownByDefault { get; set; }
}
}
2 changes: 1 addition & 1 deletion CheatSheetWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override void Initialize()
{
try
{
CheatSheet.instance.hotbar.bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled;
CheatSheet.instance.hotbar.bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>().numberExtraAccessoriesEnabled;
CheatSheet.instance.paintToolsHotbar.UndoHistory.Clear();
CheatSheet.instance.paintToolsHotbar.UpdateUndoTooltip();
}
Expand Down
10 changes: 6 additions & 4 deletions Menus/Hotbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ public Hotbar(CheatSheet mod)
this.bTogglePaintTools.onLeftClick += new EventHandler(this.bTogglePaintTools_onLeftClick);
this.bCycleExtraAccessorySlots.onLeftClick += (s, e) =>
{
Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled = (Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled + 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled;
CheatSheetPlayer cheatSheetPlayer = Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>();
cheatSheetPlayer.numberExtraAccessoriesEnabled = (cheatSheetPlayer.numberExtraAccessoriesEnabled + 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + cheatSheetPlayer.numberExtraAccessoriesEnabled;
};
this.bCycleExtraAccessorySlots.onRightClick += (s, e) =>
{
Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled = (Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled == 0) ? 0 : (Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled - 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>(mod).numberExtraAccessoriesEnabled;
CheatSheetPlayer cheatSheetPlayer = Main.LocalPlayer.GetModPlayer<CheatSheetPlayer>();
cheatSheetPlayer.numberExtraAccessoriesEnabled = cheatSheetPlayer.numberExtraAccessoriesEnabled == 0 ? 0 : (cheatSheetPlayer.numberExtraAccessoriesEnabled - 1) % (CheatSheetPlayer.MaxExtraAccessories + 1);
bCycleExtraAccessorySlots.Tooltip = CSText("ExtraAccessorySlots") + ": " + cheatSheetPlayer.numberExtraAccessoriesEnabled;
};
this.bVacuum.onLeftClick += new EventHandler(this.bVacuum_onLeftClick);
this.bToggleNPCButcherer.onLeftClick += new EventHandler(this.bButcher_onLeftClick);
Expand Down
11 changes: 6 additions & 5 deletions Menus/ItemBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public ItemBrowser(CheatSheet mod)

uIImage2.Position = position;
uIImage2.Tag = j;
uIImage2.onLeftClick += new EventHandler(this.button_onLeftClick);
uIImage2.onLeftClick += (s, e) => buttonClick(s, e, true);
uIImage2.onRightClick += (s, e) => buttonClick(s, e, false);
uIImage2.ForegroundColor = ItemBrowser.buttonColor;
if (j == 0)
{
Expand Down Expand Up @@ -227,19 +228,19 @@ private void bClose_onLeftClick(object sender, EventArgs e)
//base.Visible = false;
}

private void button_onLeftClick(object sender, EventArgs e)
private void buttonClick(object sender, EventArgs e, bool left)
{
UIImage uIImage = (UIImage)sender;
int num = (int)uIImage.Tag;
if (num == (int)ItemBrowserCategories.ModItems)
{
string[] mods = ModLoader.GetLoadedMods();
string[] mods = ModLoader.Mods.Select(m => m.Name).ToArray();
lastModNameNumber = left ? (lastModNameNumber + 1) % mods.Length : (mods.Length + lastModNameNumber - 1) % mods.Length;
string currentMod = mods[lastModNameNumber];
lastModNameNumber = (lastModNameNumber + 1) % mods.Length;
if (currentMod == "ModLoader")
{
lastModNameNumber = left ? (lastModNameNumber + 1) % mods.Length : (mods.Length + lastModNameNumber - 1) % mods.Length;
currentMod = mods[lastModNameNumber];
lastModNameNumber = (lastModNameNumber + 1) % mods.Length;
}
this.itemView.selectedCategory = ItemBrowser.categories[0].Where(x => this.itemView.allItemsSlots[x].item.modItem != null && this.itemView.allItemsSlots[x].item.modItem.mod.Name == currentMod).ToArray();
this.itemView.activeSlots = this.itemView.selectedCategory;
Expand Down
11 changes: 6 additions & 5 deletions Menus/NPCBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ public NPCBrowser(CheatSheet mod)

uIImage2.Position = position;
uIImage2.Tag = j;
uIImage2.onLeftClick += new EventHandler(this.button_onLeftClick);
uIImage2.onLeftClick += (s, e) => buttonClick(s, e, true);
uIImage2.onRightClick += (s, e) => buttonClick(s, e, false);
uIImage2.ForegroundColor = NPCBrowser.buttonColor;
if (j == 0)
{
Expand Down Expand Up @@ -218,19 +219,19 @@ private void bClose_onLeftClick(object sender, EventArgs e)
//base.Visible = false;
}

private void button_onLeftClick(object sender, EventArgs e)
private void buttonClick(object sender, EventArgs e, bool left)
{
UIImage uIImage = (UIImage)sender;
int num = (int)uIImage.Tag;
if (num == (int)NPCBrowserCategories.ModNPCs)
{
string[] mods = ModLoader.GetLoadedMods();
string[] mods = ModLoader.Mods.Select(m => m.Name).ToArray();
lastModNameNumber = left ? (lastModNameNumber + 1) % mods.Length : (mods.Length + lastModNameNumber - 1) % mods.Length;
string currentMod = mods[lastModNameNumber];
lastModNameNumber = (lastModNameNumber + 1) % mods.Length;
if (currentMod == "ModLoader")
{
lastModNameNumber = left ? (lastModNameNumber + 1) % mods.Length : (mods.Length + lastModNameNumber - 1) % mods.Length;
currentMod = mods[lastModNameNumber];
lastModNameNumber = (lastModNameNumber + 1) % mods.Length;
}
this.npcView.selectedCategory = NPCBrowser.categories[0].Where(x => npcView.allNPCSlot[x].npcType >= NPCID.Count && NPCLoader.GetNPC(npcView.allNPCSlot[x].npcType).mod.Name == currentMod).ToArray();
this.npcView.activeSlots = this.npcView.selectedCategory;
Expand Down
Loading

0 comments on commit 8b64356

Please sign in to comment.