Skip to content

Commit

Permalink
Updated for TShock 4.5.17 / Terraria 1.4.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mpql committed Apr 11, 2022
1 parent b8f8d77 commit 6a3f77b
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 82 deletions.
19 changes: 13 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@

# Created by https://www.toptal.com/developers/gitignore/api/visualstudio
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio

### VisualStudio ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
Expand Down Expand Up @@ -211,9 +210,6 @@ PublishScripts/
*.nuget.props
*.nuget.targets

# Nuget personal access tokens and Credentials
nuget.config

# Microsoft Azure Build Output
csx/
*.build.csdef
Expand Down Expand Up @@ -302,6 +298,15 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand Down Expand Up @@ -358,6 +363,9 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

Expand Down Expand Up @@ -389,7 +397,6 @@ FodyWeavers.xsd
*.msp

# JetBrains Rider
.idea/
*.sln.iml

### VisualStudio Patch ###
Expand Down
79 changes: 31 additions & 48 deletions InfiniteChestsV3.sln
Original file line number Diff line number Diff line change
@@ -1,48 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfiniteChestsV3", "InfiniteChestsV3\InfiniteChestsV3.csproj", "{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}"
EndProject
Project("{911E67C6-3D85-4FCE-B560-20A9C3E3FF48}") = "TerrariaServer", "..\..\..\Desktop\TShock 4.4.0-dev\TerrariaServer.exe", "{92CF58D1-DD58-43FA-B96A-DD284DFF0D9E}"
ProjectSection(DebuggerProjectSystem) = preProject
PortSupplier = 00000000-0000-0000-0000-000000000000
Executable = C:\Users\kzaic\Desktop\TShock 4.4.0-dev\TerrariaServer.exe
RemoteMachine = CLAY-PC
StartingDirectory = C:\Users\kzaic\Desktop\TShock 4.4.0-dev
Environment = Default
LaunchingEngine = 00000000-0000-0000-0000-000000000000
UseLegacyDebugEngines = No
LaunchSQLEngine = No
AttachLaunchAction = No
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|x86.Build.0 = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|Any CPU.Build.0 = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|x86.ActiveCfg = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|x86.Build.0 = Release|Any CPU
{92CF58D1-DD58-43FA-B96A-DD284DFF0D9E}.Debug|Any CPU.ActiveCfg = Release|x86
{92CF58D1-DD58-43FA-B96A-DD284DFF0D9E}.Debug|x86.ActiveCfg = Release|x86
{92CF58D1-DD58-43FA-B96A-DD284DFF0D9E}.Release|Any CPU.ActiveCfg = Release|x86
{92CF58D1-DD58-43FA-B96A-DD284DFF0D9E}.Release|x86.ActiveCfg = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D6918228-3308-45DF-80C6-CBCB19027B5A}
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfiniteChestsV3", "InfiniteChestsV3\InfiniteChestsV3.csproj", "{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|x86.ActiveCfg = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Debug|x86.Build.0 = Debug|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|Any CPU.Build.0 = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|x86.ActiveCfg = Release|Any CPU
{7B49FF3F-F30A-413B-B8C0-7C59DDCFA5C1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D6918228-3308-45DF-80C6-CBCB19027B5A}
EndGlobalSection
EndGlobal
12 changes: 6 additions & 6 deletions InfiniteChestsV3/DB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static InfChest GetChest(int x, int y)
InfChest chest = new InfChest(reader.Get<int>("UserID"), x, y, Main.worldID)
{
id = reader.Get<int>("ID"),
isPublic = reader.Get<int>("Public") == 1 ? true : false,
isPublic = reader.Get<int>("Public") == 1,
refill = reader.Get<int>("Refill")
};
chest.StringToGroups(reader.Get<string>("Groups"));
Expand All @@ -90,7 +90,7 @@ public static InfChest GetChest(int id)
InfChest chest = new InfChest(reader.Get<int>("UserID"), reader.Get<int>("X"), reader.Get<int>("Y"), Main.worldID)
{
id = id,
isPublic = reader.Get<int>("Public") == 1 ? true : false,
isPublic = reader.Get<int>("Public") == 1,
refill = reader.Get<int>("Refill")
};
chest.StringToGroups(reader.Get<string>("Groups"));
Expand Down Expand Up @@ -196,7 +196,7 @@ public static List<Point> DeleteEmptyChests()

List<Point> points = new List<Point>();

string query = $"SELECT * FROM InfChests3 WHERE Items = '{sb.ToString()}' AND WorldID = {Main.worldID} AND Refill = -1;";
string query = $"SELECT * FROM InfChests3 WHERE Items = '{sb}' AND WorldID = {Main.worldID} AND Refill = -1;";
using (var reader = db.QueryReader(query))
{
while (reader.Read())
Expand All @@ -206,7 +206,7 @@ public static List<Point> DeleteEmptyChests()
}
}

query = $"DELETE FROM InfChests3 WHERE Items = '{sb.ToString()}' AND WorldID = {Main.worldID} AND Refill = -1;";
query = $"DELETE FROM InfChests3 WHERE Items = '{sb}' AND WorldID = {Main.worldID} AND Refill = -1;";
db.Query(query);
return points;
}
Expand Down Expand Up @@ -336,7 +336,7 @@ public static int TransferV2()
int userid = reader.Get<int>("UserID");
int x = reader.Get<int>("X");
int y = reader.Get<int>("Y");
bool ispublic = reader.Get<int>("Public") == 1 ? true : false;
bool ispublic = reader.Get<int>("Public") == 1;
List<int> users = string.IsNullOrEmpty(reader.Get<string>("Users")) ? new List<int>() : reader.Get<string>("Users").Split(',').ToList().ConvertAll(p => int.Parse(p));
List<string> groups = string.IsNullOrEmpty(reader.Get<string>("Groups")) ? new List<string>() : reader.Get<string>("Groups").Split(',').ToList();
int refill = reader.Get<int>("Refill");
Expand Down Expand Up @@ -393,7 +393,7 @@ public static int TransferV2()
int userid = reader.Get<int>("UserID");
int x = reader.Get<int>("X");
int y = reader.Get<int>("Y");
bool ispublic = reader.Get<int>("Public") == 1 ? true : false;
bool ispublic = reader.Get<int>("Public") == 1;
List<int> users = string.IsNullOrEmpty(reader.Get<string>("Users")) ? new List<int>() : reader.Get<string>("Users").Split(',').ToList().ConvertAll(p => int.Parse(p));
List<string> groups = string.IsNullOrEmpty(reader.Get<string>("Groups")) ? new List<string>() : reader.Get<string>("Groups").Split(',').ToList();
int refill = reader.Get<int>("Refill");
Expand Down
4 changes: 2 additions & 2 deletions InfiniteChestsV3/InfChest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class InfChest
public List<int> users;
public int refill;
public int worldid;
public bool isRefill { get { return refill > -1; } }
public bool isEmpty
public bool IsRefill { get { return refill > -1; } }
public bool IsEmpty
{
get
{
Expand Down
19 changes: 10 additions & 9 deletions InfiniteChestsV3/InfMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.DataStructures;
using Terraria.Localization;
using TerrariaApi.Server;
using TShockAPI;
Expand All @@ -17,7 +18,7 @@ namespace InfiniteChestsV3
public class InfMain : TerrariaPlugin
{
#region Plugin Information
public override string Author => "Zaicon";
public override string Author => "Zaicon +mpql";
public override string Description => "The third version of InfiniteChests!";
public override string Name => "InfiniteChestsV3";
public override Version Version => Assembly.GetExecutingAssembly().GetName().Version;
Expand Down Expand Up @@ -289,9 +290,9 @@ private void OnGetData(GetDataEventArgs args)
RefillChestInfo rcinfo = GetRCInfo(!gplayer.IsLoggedIn ? -1 : gplayer.Account.ID, gchest.id);

//use refill items if exists, or create new refill entry, or use items directly
if (gchest.isRefill && rcinfo != null && (DateTime.Now - rcinfo.TimeOpened).TotalSeconds < gchest.refill)
if (gchest.IsRefill && rcinfo != null && (DateTime.Now - rcinfo.TimeOpened).TotalSeconds < gchest.refill)
items = rcinfo.CurrentItems;
else if (gchest.isRefill)
else if (gchest.IsRefill)
{
if (rcinfo != null)
DeleteOldRCInfo(!gplayer.IsLoggedIn ? -1 : gplayer.Account.ID, gchest.id);
Expand Down Expand Up @@ -407,7 +408,7 @@ private void OnGetData(GetDataEventArgs args)
}
}

if (cichest.isRefill)
if (cichest.IsRefill)
circinfo.CurrentItems[itemslot] = item;
else
{
Expand Down Expand Up @@ -489,7 +490,7 @@ private void OnGetData(GetDataEventArgs args)
if (success == -1)
{
NetMessage.TrySendData((int)PacketTypes.PlaceChest, index, -1, null, action, tilex, tiley, style);
Item.NewItem(tilex * 16, tiley * 16, 32, 32, Chest.chestItemSpawn[style], 1, noBroadcast: true);
Item.NewItem(new EntitySource_DebugCommand(), tilex * 16, tiley * 16, 32, 32, Chest.chestItemSpawn[style], 1, noBroadcast: true);
}
else
{
Expand Down Expand Up @@ -527,12 +528,12 @@ private void OnGetData(GetDataEventArgs args)
else if (chest.userid != player.Account.ID && chest.userid != -1 && !player.HasPermission("ic.edit"))
{
player.SendErrorMessage("This chest is protected.");
player.SendTileSquare(tilex, tiley, 3);
player.SendTileSquareCentered(tilex, tiley, 3);
}
//check for empty chest
else if (!chest.isEmpty)
else if (!chest.IsEmpty)
{
player.SendTileSquare(tilex, tiley, 3);
player.SendTileSquareCentered(tilex, tiley, 3);
}
else
{
Expand Down Expand Up @@ -865,7 +866,7 @@ private async void ConvChestsAsync(CommandArgs args)
args.Player.SendErrorMessage("This command has already been run!");
return;
}
if (DB.GetCount() > 8000) // Max is 8000: https://terraria.gamepedia.com/Chests
if (DB.GetCount() > 8000) // Max is 8000: https://terraria.gamepedia.com/Chests
{
args.Player.SendErrorMessage("There are more than 8000 chests in the database, which is more than the map can hold.");
return;
Expand Down
4 changes: 2 additions & 2 deletions InfiniteChestsV3/InfiniteChestsV3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Data.Sqlite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<Reference Include="Mono.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Mono.Data.Sqlite.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -66,7 +66,7 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>References\TerrariaServer.exe</HintPath>
</Reference>
<Reference Include="TShockAPI, Version=4.5.4.0, Culture=neutral, processorArchitecture=x86">
<Reference Include="TShockAPI, Version=4.5.5.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\TShockAPI.dll</HintPath>
</Reference>
Expand Down
10 changes: 5 additions & 5 deletions InfiniteChestsV3/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("InfiniteChestsV3")]
[assembly: AssemblyDescription("https://github.com/mopquill/InfiniteChestsV3")]
[assembly: AssemblyDescription("https://github.com/mpql/InfiniteChestsV3")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("InfiniteChestsV3")]
[assembly: AssemblyCopyright("© Zaicon 2020, Mopquill 2021")]
[assembly: AssemblyCopyright("© Zaicon 2020, updated by mpql 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0.0-mopquill.2")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: AssemblyInformationalVersion("1.6.0.0-mpql.1")]
Binary file modified InfiniteChestsV3/References/OTAPI.dll
Binary file not shown.
Binary file modified InfiniteChestsV3/References/TShockAPI.dll
Binary file not shown.
Binary file modified InfiniteChestsV3/References/TerrariaServer.exe
Binary file not shown.
22 changes: 21 additions & 1 deletion InfiniteChestsV3/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.9.12.0" newVersion="6.9.12.0" />
<bindingRedirect oldVersion="0.0.0.0-8.0.28.0" newVersion="8.0.28.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
Expand All @@ -18,6 +18,26 @@
<assemblyIdentity name="Mono.Data.Sqlite" publicKeyToken="0738eb9f132ed756" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.20.0.0" newVersion="3.20.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Compression.LZ4.Streams" publicKeyToken="2186fa9121ef231d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.16.0" newVersion="1.2.16.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="BouncyCastle.Crypto" publicKeyToken="0e99375e54769942" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.8.9.0" newVersion="1.8.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="K4os.Hash.xxHash" publicKeyToken="32cd54395057cec3" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.7.0" newVersion="1.0.7.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file removed InfiniteChestsV3/bin/Release/InfiniteChestsV3.dll
Binary file not shown.
Binary file modified InfiniteChestsV3/bin/Release/InfiniteChestsV3.pdb
Binary file not shown.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
This is updated for TShock 4.5.4 / Terraria 1.4.2.3, with my fixes for [Zaicon/InfiniteChestsV3](https://github.com/Zaicon/InfiniteChestsV3) [#6](https://github.com/Zaicon/InfiniteChestsV3/issues/6), [#10]((https://github.com/Zaicon/InfiniteChestsV3/issues/11)), and [#11](https://github.com/Zaicon/InfiniteChestsV3/issues/11) from back in 2020. If anyone wants to tackle any other issues, please feel free to send PRs. - Mopquill
# InfiniteChestsV3-mpql

# InfiniteChestsV3
This is the collection of ongoing compatibility and bug fixes I've written for [Zaicon/InfiniteChestsV3](https://github.com/Zaicon/InfiniteChestsV3) from 2020-2022, as that seems to be abandoned.

This is a completely rewritten version of MarioE's original InfiniteChests plugin. Most of this plugin was copied or modified from that one.
If anyone wants to tackle any issues, please feel free to send PRs. I am not a C#-, or even a software programmer, so I cannot guarantee I'll make any updates / bugfixes myself unless I'm actively playing and happen to have the motivation to hunt something down.

You can find the latest release available for download at [mpql/InfiniteChestsV3/releases](https://github.com/mpql/InfiniteChestsV3/releases).


## Changelog

Note: I'm changing the versioning scheme with 1.6.0-mpql to be more in line with [semver](https://github.com/semver/semver).

### 1.6.0-mpql
- Updated for TShock 4.5.17 / Terraria 1.4.3.6
- Chest naming is still broken

### 1.3.0.0-mpql.2
- Updated for TShock

### 1.3.0.0-mpql.1
- Fixes [#6 Corrupted Chest Bug After Spawning Mimic](https://github.com/Zaicon/InfiniteChestsV3/issues/6)
- Fixes [#10 Key of Light / Dark - Multiple Issues](https://github.com/Zaicon/InfiniteChestsV3/issues/10)
- Mimics spawned outside of Corruption or Crimson will randomly spawn as either Corrupted or Crimson, so you can access mimics from outside your world's evil without having to build a corresponding section of the world.
- Fixes [#11 Raise chest limit to 8000](https://github.com/Zaicon/InfiniteChestsV3/issues/11)

---


# Original Readme

## InfiniteChestsV3

### Plugin Features:
- Saves chests to database, allowing more than 8,000 chests per map.
Expand Down

0 comments on commit 6a3f77b

Please sign in to comment.