Skip to content

Commit

Permalink
v0.4.1, update to tModLoader v0.11.4, Config for slot positioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Oct 12, 2019
1 parent 725893d commit 57cc6c7
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 87 deletions.
89 changes: 7 additions & 82 deletions AutoTrash.csproj
Original file line number Diff line number Diff line change
@@ -1,88 +1,13 @@
<?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')" />
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\references\tModLoader.targets" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2BC3B58F-8CF0-4BA9-B715-513F470077A6}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoTrash</RootNamespace>
<AssemblyName>AutoTrash</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>
<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="System" />
</ItemGroup>
<ItemGroup>
<Content Include="build.txt" />
<Content Include="description.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="AutoTrashGlobalItem.cs" />
<Compile Include="AutoTrashListUI.cs" />
<Compile Include="AutoTrashPlayer.cs" />
<Compile Include="AutoTrash.cs" />
<Compile Include="ItemSlot.cs" />
<Compile Include="UICheckbox.cs" />
<Compile Include="UIGrid.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Modding\tModLoader\src\tModLoader\Terraria.csproj">
<Project>{3996d5fa-6e59-4fe4-9f2b-40eeef9645d5}</Project>
<Name>Terraria</Name>
</ProjectReference>
</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 Name="BuildMod" AfterTargets="Build">
<Exec Command="&quot;$(tMLBuildServerPath)&quot; -build $(ProjectDir) -eac $(TargetPath) -define $(DefineConstants) -unsafe $(AllowUnsafeBlocks)" />
</Target>
-->
</Project>
23 changes: 23 additions & 0 deletions AutoTrashClientConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using Microsoft.Xna.Framework;
using System.ComponentModel;
using Terraria.ModLoader.Config;

namespace AutoTrash
{
class AutoTrashClientConfig : ModConfig
{
public override ConfigScope Mode => ConfigScope.ClientSide;

[DefaultValue(8)]
[Label("AutoTrash Slot Icon Position X")]
[Tooltip("Customize the position of the AutoTrash slot measured left to right from the 1st hotbar")]
[Range(0, 10)]
public int SlotPositionX;

[DefaultValue(5)]
[Label("AutoTrash Slot Icon Position Y")]
[Tooltip("Customize the position of the AutoTrash slot measured top to bottom from the top hotbar")]
[Range(0, 10)]
public int SlotPositionY;
}
}
10 changes: 8 additions & 2 deletions AutoTrashGlobalItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public override bool Autoload(ref string name)

public override bool OnPickup(Item item, Player player)
{
var autoTrashPlayer = player.GetModPlayer<AutoTrashPlayer>(mod);
var autoTrashPlayer = player.GetModPlayer<AutoTrashPlayer>();
//Main.NewText("ItemID: " + item.type);
//foreach (var autoItme in autoTrashPlayer.AutoTrashItems)
//{
Expand Down Expand Up @@ -62,6 +62,9 @@ internal void DrawUpdateAutoTrash()

// Calculate Position of ItemSlot
Main.inventoryScale = 0.85f;

var config = mod.GetConfig<AutoTrashClientConfig>();

int xPosition = 448;
int yPosition = Main.instance.invBottom;
if ((Main.LocalPlayer.chest != -1 && !Main.recBigList) || Main.npcShop > 0)
Expand All @@ -72,7 +75,10 @@ internal void DrawUpdateAutoTrash()
}
xPosition -= (int)(56 * Main.inventoryScale);

var autoTrashPlayer = Main.LocalPlayer.GetModPlayer<AutoTrashPlayer>(mod);
xPosition += (int)((config.SlotPositionX - 8) * (56 * Main.inventoryScale));
yPosition += (int)((config.SlotPositionY - 5) * (56 * Main.inventoryScale));

var autoTrashPlayer = Main.LocalPlayer.GetModPlayer<AutoTrashPlayer>();
// Toggle Button
Texture2D inventoryTickTexture = Main.inventoryTickOnTexture;
if (!autoTrashPlayer.AutoTrashEnabled)
Expand Down
2 changes: 1 addition & 1 deletion ItemSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ protected override void DrawSelf(SpriteBatch spriteBatch)

public override void Click(UIMouseEvent evt)
{
var autoTrashPlayer = Main.LocalPlayer.GetModPlayer<AutoTrashPlayer>(AutoTrash.instance);
var autoTrashPlayer = Main.LocalPlayer.GetModPlayer<AutoTrashPlayer>();
autoTrashPlayer.AutoTrashItems.RemoveAll(x => x.type == this.item.type);
AutoTrash.instance.autoTrashListUI.UpdateNeeded();
}
Expand Down
14 changes: 14 additions & 0 deletions Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"profiles": {
"Terraria": {
"commandName": "Executable",
"executablePath": "$(tMLPath)",
"workingDirectory": "$(TerrariaSteamPath)"
},
"TerrariaServer": {
"commandName": "Executable",
"executablePath": "$(tMLServerPath)",
"workingDirectory": "$(TerrariaSteamPath)"
}
}
}
3 changes: 1 addition & 2 deletions build.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
author = jopojelly
version = 0.4
version = 0.4.1
displayName = Auto Trash
homepage = https://forums.terraria.org/index.php?threads/auto-trash.53592/
buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*
hideCode = false
hideResources = false
includeSource = true
languageVersion = 6
includePDB = true
notworkingside = Client

0 comments on commit 57cc6c7

Please sign in to comment.