Giter Club home page Giter Club logo

infinitechestsv3's Introduction

InfiniteChestsV3

This is a completely rewritten version of MarioE's original InfiniteChests plugin. Most of this plugin was copied or modified from that one.

Plugin Features:

  • Saves chests to database, allowing more than 1,000 chests per map.
  • Allows conversion of chest storage to/from database at will.
  • Allows chests to be "claimed" (protected) by users.
  • Allows chests to be "public" (other users can edit but not destroy).
  • Allows chests to "refill" (chest contents are restored at a specified interval).
  • Allows players to destroy all empty chests automatically.
  • Allows players to allow only certain users and/or groups to access protected chests.
  • Allows players to search the entire chest database for specific items.
  • Supports usage of Key of Light/Key of Night items.

Things this plugin will not do (as of now):

  • Chest name support. Chest names are stored in tile data, which would be very costly to implement.

Commands

/chest claim - Protects a chest via user account.
/chest unclaim - Unprotects a chest.
/chest info - Displays X/Y coordinates and account owner.
/chest search <item name> - Searches chests for a specific item.
/chest allow <player name> - Gives user access to chest.
/chest remove <player name> - Removes chest access from user.
/chest allowgroup <group name> - Gives players with that group access to chest.
/chest removegroup <group name> - Removes group access to chest.
/chest public - Toggles the 'public' setting of a chest, allowing others to use but not destroy the chest.
/chest refill <seconds> - Sets the interval in which chests refill items.
/chest cancel - Cancels any of the above actions.
/convchests [-r] - Converts any "real" chests to database chests (or reverse with `-r`).
/prunechests - Permanently removes empty chests from the world and database.
/transferchests - Converts the database from InfiniteChests V1 or V2 to InfiniteChestsV3.

###Permisisons

ic.use - Enables use of /chest
ic.claim - Enables use of /chest claim, unclaim
ic.info - Enables use of /chest info
ic.search - Enables use of /chest search
ic.public - Enables use of /chest public
ic.protect - Players with this permission will have their chests automatically protected via user account.
ic.refill - Enables use of /chest refill
ic.edit - Allows player to edit any chest regardless of chest protection.
ic.convert - Enables use of /convchests
ic.prune - Enables use of /prunechests
ic.transfer - Enables use of /transferchests

infinitechestsv3's People

Contributors

zaicon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

infinitechestsv3's Issues

Bug where all storage units can’t be opened.

Issue: after joining the server, no storage units (chest/barrel/trash/etc.) can be opened. Hovering over them all show a name of “Chest” even for barrels and trash cans that have never been renamed.

Placing a new chest works, and the chest can be opened afterwards. All the commands seems to be working as intended, but once the player leave the server and re-connect, the newly placed chest will have buggy behavior exactly like the ones described above.

No error messages seen in server console or the logs.

I am using TShock 4.3.26, with this plugin compiled from source code after fixing some outdated dependencies.

Edit:

  • the bugged chests/barrels/dressers/trash cans, etc. still have the issue even after removing the plugin

Add Support for QuickStackToNearbyChests

This is just an annoying little thing. It's not actually that hard to implement, just hard to make sure it works exactly like it should (because the internals are more picky than they need to be).

Error on latest release of tshock

TShock 4.5.14 for Terraria 1.4.3.4 Error
[02/26/22 06:17:32] [Server API] Warning: Plugin "InfiniteChestsV3" has had an unhandled exception thrown by one of its NetGetData handlers:
System.MissingMethodException: Method not found: 'Int32 Terraria.Item.NewItem(Int32, Int32, Int32, Int32, Int32, Int32, Boolean, Int32, Boolean, Boolean)'.
at InfiniteChestsV3.InfMain.OnGetData(GetDataEventArgs args)
at TerrariaApi.Server.HandlerCollection`1.Invoke(ArgsType args) in D:\a\TShock\TShock\TerrariaServerAPI\TerrariaServerAPI\TerrariaApi.Server\HandlerCollection.cs:line 109
[02/26/22 06:17:36] [Server API] Warning: Plugin "InfiniteChestsV3" has had an unhandled exception thrown by one of its NetGetData handlers:
System.MissingMethodException: Method not found: 'Int32 Terraria.Item.NewItem(Int32, Int32, Int32, Int32, Int32, Int32, Boolean, Int32, Boolean, Boolean)'.
at InfiniteChestsV3.InfMain.OnGetData(GetDataEventArgs args)

Raise chest limit to 8000

Raise chest limit to 8000 from 1000 for /convchests -r command per wiki.

I have already corrected this in a fork I've made for the mimic chests, this is just an issue to track it. I've also fixed the bug regarding the mimics spawning themselves, however, I'm trying to fix bug #6 as well, and will submit a pull request after that.

Add Support for Chest Keys

The plan is to manually spawn the appropriate mimic when a Key of Light/Night is placed in an empty chest.

Corrupted Chest Bug After Spawning Mimic

Description: A newly-placed chest where a mimic was spawned using a Key does not get converted to the database and is considered "corrupted".

How to Reproduce:

  • Spawn a Hallowed/Corrupted/Crimson Mimic using a Light/Dark Key.
  • Place a new chest in the exact same location.
  • The server doesn't seem to see the new chest. Relogging (or otherwise resetting tile data) makes the chest disappear on the client. For some reason, this only happens while this plugin is active, so further investigation is necessary.

NPE on latest TShock Version

"exception": { "message": "Object reference not set to an instance of an object", "type": "NullReferenceException", "trace": " at InfiniteChestsV3.InfChest.ItemsToString () [0x00021] in <30047d7537194e36abb8a3ffc7397560>:0 \n at InfiniteChestsV3.DB.AddChest (InfiniteChestsV3.InfChest chest) [0x00000] in <30047d7537194e36abb8a3ffc7397560>:0 \n at InfiniteChestsV3.InfMain.InnerConvChests () [0x00063] in <30047d7537194e36abb8a3ffc7397560>:0 \n at InfiniteChestsV3.InfMain.<OnWorldLoadAsync>b__18_0 () [0x00006] in <30047d7537194e36abb8a3ffc7397560>:0 \n at System.Threading.Tasks.Task.InnerInvoke () [0x00012] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.Tasks.Task.Execute () [0x00016] in <8f2c484307284b51944a1a13a14c0266>:0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 \n at InfiniteChestsV3.InfMain+<OnWorldLoadAsync>d__18.MoveNext () [0x00072] in <30047d7537194e36abb8a3ffc7397560>:0 \n--- End of stack trace from previous location where exception was thrown ---\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__1 (System.Object state) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000e] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x0008d] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x0002a] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00096] in <8f2c484307284b51944a1a13a14c0266>:0 \n at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <8f2c484307284b51944a1a13a14c0266>:0 ", "inner": null }

Constant errors in console

When no player is in the server, the plugin won't send any errors in the server console, but when I join on either of the 2 characters I tested, and on both journey and normal mode, the log will be filled with this error:
[Server API] Warning: Plugin "InfiniteChestsV3" has had an unhandled exception thrown by one of its NetGetData handlers: System.MissingMethodException: Method not found: 'Boolean Terraria.Player.get_ZoneHoly()'. at InfiniteChestsV3.InfMain.OnGetData(GetDataEventArgs args) at TerrariaApi.Server.HandlerCollection1.Invoke(ArgsType args) in D:\a\TShock\TShock\TerrariaServerAPI\TerrariaServerAPI\TerrariaApi.Server\HandlerCollection.cs:line 109`
I can't set chests to refill either, and I feel like this error has something to do with it.

Item duplication

Description:
Currently, there is an item duplication bug.

How to reproduce:

  1. Have two players and one item.
  2. Player 1; put the item into a chest and close the chest view.
  3. Player 2; open the chest view.
  4. Player 1; open the chest view.
  5. Player 1 and 2; take the item.
  6. Now there are 2 items.

Suggested solution:
Use the already implemented "chest in use" game mechanic (the one with the opened chest animation) by using a real empty chest as "tunnel" to check if the chest is in use, then refuse access when it's in use.

Add Support for Golden/Crystal Chests

I vaguely remember the chests code differed for the new chests, but I haven't yet looked into this. I plan to make sure this works before it is released.

Key of Light / Dark - Multiple Issues

The Key of Light currently does not work at all - and the problem becomes quite obvious when looking at this line of code: https://github.com/Zaicon/InfiniteChestsV3/blob/master/InfiniteChestsV3/InfMain.cs#L373

The check is only looking for 3091, which is the Key of Night. Key of Light, 3092, was forgotten about.

The Key of Night works, but it only works when the current zone is Corruption / Crimson. This requirement does not exist in the vanilla game, and can be once again traced down to the same line of code: https://github.com/Zaicon/InfiniteChestsV3/blob/master/InfiniteChestsV3/InfMain.cs#L373

Edit: The error with Key of Light occurred with commit 5e386ca (otherwise known as 1.4 update). The issue with key spawning being bound to zones however appears to have always existed.

Not Working on TShock 5.2 for Terraria 1.4.4.9

Keep getting this error. Sorry, don't know much about all of this.

[Server API] Error InfiniteChestsV3.dll was built for X86 but expected it to be compatible with X64.
[Server API] Error Startup aborted due to an exception in the Server API initialization:
System.InvalidOperationException: Failed to load assembly "InfiniteChestsV3.dll".
---> System.IO.FileLoadException: Could not load file or assembly 'InfiniteChestsV3, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null'.
at System.Runtime.Loader.AssemblyLoadContext.InternalLoad(ReadOnlySpan1 arrAssembly, ReadOnlySpan1 arrSymbols)
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore)
at TerrariaApi.Server.ServerApi.LoadPlugins() in /home/runner/work/TShock/TShock/TerrariaServerAPI/TerrariaServerAPI/TerrariaApi.Server/ServerApi.cs:line 351
--- End of inner exception stack trace ---
at TerrariaApi.Server.ServerApi.LoadPlugins() in /home/runner/work/TShock/TShock/TerrariaServerAPI/TerrariaServerAPI/TerrariaApi.Server/ServerApi.cs:line 422
at TerrariaApi.Server.ServerApi.Initialize(String[] commandLineArgs, Main game) in /home/runner/work/TShock/TShock/TerrariaServerAPI/TerrariaServerAPI/TerrariaApi.Server/ServerApi.cs:line 126
at TerrariaApi.Server.HookManager.InitialiseAPI() in /home/runner/work/TShock/TShock/TerrariaServerAPI/TerrariaServerAPI/TerrariaApi.Server/HookManager.cs:line 29

Chests cant be opened

My chests cant be opened, EVERY CHEST, if you place a new lne, they work, but if you rejoin, they wont work again...

It doesn't work very well on cell phones

You see, I have a Terraria version 1.4.0.5 server with Tshock 4.4.0 pree-realese 12. On PC it works fine, but on mobile it is unable to open them, I don't understand, it would be because the plugin is designed with the right click or something So? 😬

Add /prunechests Command

I overlooked adding the /prunechests command; I'm just making this issue to make sure I remember to add this in soon.

Limited Functionality for Guests

At the moment, guest access isn't handled very well. They only have basic functionality in that they can add and remove items to chests (if applicable). However, all guests share refill data (if one person takes something out of a 5-second refill chest, all guests have to wait 5 seconds for the refill to take effect). The plugin will also error or crash if a guest is given permission to do other things such as claim chests or use any other /chest commands.

Possible solutions to this are 1) add code in to handle guests separately (probably by index for refill chests and adding applicable handling code to other /chest commands), 2) change the storage key for chests from user ID to some other user-specific identification (username?) (but not index because we want this to persist between sessions, if possible), and 3) revert back to handling refills based on the chest instead of player (that is, if someone triggers a refill chest, all players have to wait for the refill instead of just that one player).

If anyone would like to comment on this or try implementing one of these, feel free to do so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.