Bank

Safe player storage

Total Downloads: 2,480 - First Release: Sep 7, 2016 - Last Update: Apr 29, 2018

5/5, 12 likes
  1. More testing today.
    - unloaded the plugin and config files
    - cleared all banks from \data\banks
    - installed it fresh.
    - bank.json config:
    Code:
    {
        "Settings": {
            "boxes": {
                "bank.big": "assets/prefabs/deployable/large wood storage/box.wooden.large.prefab",
                "bank.default": "assets/prefabs/deployable/woodenbox/woodbox_deployed.prefab"
            },
            "cooldownMinutes": 0.1,
            "defaultBox": "assets/prefabs/deployable/woodenbox/woodbox_deployed.prefab",
            "defaultSlots": 4,
            "keyring": true,
            "NPCBankersOnly": false,
            "NPCIDs": [
                "1601981617"
            ],
            "radiationMax": 1,
            "slots": {
                "bank.big": 6,
                "bank.default": 4
            }
        },
        "VERSION": "0.0.10"
    }
    - bank_itemlimits.json config:
    Code:
    {
      "explosive.timed": {
        "enabled": true,
        "minimum": 0,
        "maximum": 2
      }
    }
    - /bank. deposit and withdraw with no issues.
    - turned off the terrain and water layers and i can see the box under the ground. spawns when you /bank and then goes away when you close your inventory.
    - everything seems fine.
    - deposit 1 C4.
    - close your inventory
    - box under the terrain does not disappear
    - /bank is unresponsive. you need to /reload bank to get it to open again
    - /reload bank and then /bank to open your box. it is empty and you can still see the original box under the terrain. there are now 2 boxes.
    - you can use the new box with all items just fine. it only breaks when you deposit any c4.
    - if you repeat this process while standing in the same spot, sometimes the boxes will stack on each other and cause a box to be destroyed. when a box is destroyed it spits the items out. sometimes those items spit up to the surface.. basically a dupe bug if you can get it going. i managed to dupe like 300 rockets. keep in mind somebody would have to have reload perms to do this effectively.
    - 1.png shows that i was able to close my inventory and the box still shows under the terrain. if i noclip, i'd see my c4 inside.
    - 2.png shows the 1st box in 1.png and the new box that was created after i reloaded the plugin.
    - note: i removed all old boxes before and after testing. i only test in one spot on my server.
    - my oxide log:
    Code:
    08:10 [Info] Loaded plugin Bank v0.0.10 by rustservers.io
    08:10 [Info] [MagicDescription] Server description updated!
    08:10 [Error] Failed to call hook 'OnPlayerLootEnd' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:10 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.OnPlayerLootEnd (.PlayerLoot inventory) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:11 [Error] Failed to call hook 'OnPlayerLootEnd' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:11 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.OnPlayerLootEnd (.PlayerLoot inventory) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:11 [Error] Failed to call hook 'OnPlayerLootEnd' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:11 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.OnPlayerLootEnd (.PlayerLoot inventory) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:11 [Error] Failed to call hook 'cmdBank' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:11 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.ShowBank (.BasePlayer player, .BaseEntity target) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.cmdBank (.BasePlayer player, System.String command, System.String[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:11 [Error] Failed to call hook 'Unloaded' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:11 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.Unloaded () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:11 [Info] [MagicDescription] Server description updated!
    08:11 [Info] Unloaded plugin Bank v0.0.10 by rustservers.io
    08:11 [Info] Loaded plugin Bank v0.0.10 by rustservers.io
    08:11 [Info] [MagicDescription] Server description updated!
    08:13 [Error] Failed to call hook 'OnPlayerLootEnd' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:13 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.OnPlayerLootEnd (.PlayerLoot inventory) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:13 [Error] Failed to call hook 'cmdBank' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:13 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.ShowBank (.BasePlayer player, .BaseEntity target) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.cmdBank (.BasePlayer player, System.String command, System.String[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:13 [Error] Failed to call hook 'Unloaded' on plugin 'Bank v0.0.10' (InvalidCastException: Cannot cast from source type to destination type.)
    08:13 [Stacktrace]   at Oxide.Plugins.Bank.GetItemLimit (.Item item) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.InvalidateBank (.BasePlayer player, Oxide.Plugins.BankProfile profile, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CloseBank (.BasePlayer player, .StorageContainer view) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.Unloaded () [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    08:13 [Info] [MagicDescription] Server description updated!
    08:13 [Info] Unloaded plugin Bank v0.0.10 by rustservers.io
     

    Attached Files:

    • 1.png
      1.png
      File size:
      891.5 KB
      Views:
      58
    • 2.png
      2.png
      File size:
      1.1 MB
      Views:
      50
  2. Am I the only one with this issue?
     
  3. The problem is that the game can't convert the object in the itemLimits dictionary to type ItemLimit. This can be remedied by changing all of the references for the itemLimits to ItemLimit instead of object. I also made a change to the InvalidateBank method to make sure the limit is enabled before it goes about checking the limits.

    Edit: Not allowed to post the file...

    So here are the lines you need to change:

    38
    Code:
    private Dictionary<string, ItemLimit> itemLimits = new Dictionary<string, ItemLimit>();
    344
    Code:
    itemLimits = configFile.ReadObject<Dictionary<string, ItemLimit>>("Bank_ItemLimits");
    418
    Code:
    private Dictionary<string, ItemLimit> GetDefaultItemLimits() {
    439
    Code:
    configFile.WriteObject<Dictionary<string, ItemLimit>>("Bank_ItemLimits", GetDefaultItemLimits());
    486
    Code:
    configFile.WriteObject<Dictionary<string, ItemLimit>>("Bank_ItemLimits", itemLimits);
    InvalidateBank function:
    Code:
    void InvalidateBank(BasePlayer player, BankProfile profile, StorageContainer view) {
                bool returned = false;            foreach(var item in view.inventory.itemList.ToArray()) {
                    ItemLimit limit = GetItemLimit(item);                if(limit != null) {
                        if (!limit.enabled)
                            continue;                    if(item.amount < limit.minimum) {
                            returned = true;
                            if(!item.MoveToContainer(player.inventory.containerMain)) {
                                item.Drop(player.eyes.HeadForward() * 2, default(Vector3));
                            }
                            continue;
                        }                    if(item.amount > limit.maximum) {
                            returned = true;
                            Item invalidItem = item.SplitItem(item.amount - limit.maximum);                        if(!invalidItem.MoveToContainer(player.inventory.containerMain)) {
                                invalidItem.Drop(player.eyes.HeadForward() * 2, default(Vector3));
                            }
                            continue;
                        }
                    }
                }
     
    Last edited by a moderator: Mar 30, 2017
  4. Am I the only one that has players saying the lost stuff? I'm assuming they're just trying to get free items.
     
  5. I haven't had any complaints and the data files seem to be ok on my server. This mod is severely broken unless you do the mods Biscuit posted.
     
  6. Calytic

    Calytic Community Admin Community Mod

    Calytic updated Bank with a new update entry:

    0.1.0

     
  7. Anybody test this yet to make sure the limits work? Don't want to update from biscuit's fix if still has item limit issues.
     
  8. So, it gives me 2 kinds of errors.

    Code:
    20:25 [Error] Failed to call hook 'CanNetworkTo' on plugin 'Bank v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    20:25 [Stacktrace]   at Oxide.Plugins.Bank.IsBank (.BaseNetworkable entity) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.CanNetworkTo (.BaseNetworkable entity, .BasePlayer target) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0 
    Code:
    14:34 [Error] Failed to call hook 'CanUseLockedEntity' on plugin 'Bank v0.1.0' (NullReferenceException: Object reference not set to an instance of an object)
    14:34 [Stacktrace]   at Oxide.Plugins.Bank.CanUseLockedEntity (.BasePlayer player, .BaseLock lockItem) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.Bank.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0 
    Otherwise the plugin works, but I just get the messages at times.
    Config files shouldn't be the error, but I've uploaded them anyways.

    Thanks in advance.
     

    Attached Files:

  9. Did you add the edits I suggested above?
     
  10. Oh, I haven't.
    Maybe it'd be easier if you PM-d me the file or nah?
    Would be much appreciated since I'm a bit busy.
     
  11. Yeah, just give me a bit.
     
  12. How to use it on building blocked?
     
  13. Players can dupe items... OMG xDD
     
  14. use biscuit's version. he fixed a bunch of that dupe stuff
    came here to report that if i /viewbank somebody then it overwrites my bank
     
  15. Hello, wait so I need the newest release of this plugin and I also need to do the biscuit release changes. Am I correct? Thank you.
     
  16. i added all lines except the InvalidateBank function: and the code, where do i add these lines.. please help thank you.
     
  17. Calytic

    Calytic Community Admin Community Mod

    The issue @Findles raised that biscuits code addressed was fixed in the last version.

    Though I appreciate the enthusiasm and always consider community contributions for inclusion into the upstream - in this particular case I took a different approach which does enable "the game [to] convert the object in the itemLimits dictionary to type ItemLimit" implicitly.

    With respect to any possible duping issues, this plugin is written with two major dupe prevention methods:
    1. A bank box is not networked to any other players except its owner, in other words no one else should see your bank box
    2. A bank box is invulnerable. Even if other players can see your bank box, they cannot destroy it
    Regarding the two new errors (CanNetworkTo,OnUseLockedEntity), I assure you they are unrelated to the previous issue. That being said, I have not received any actionable intelligence on them. On that note please consider Reporting bugs and issues | Oxide
     
  18. You can dupe items when you climb and you land over the box, the box insta-destroy and items land on the floor. You can repeat as much times as you want.
     
  19. as reported, this exactly is what happens.
    edit: you would notice it if you have an npc set for bank, or if multiple players did /bank near each other
     
  20. How to prevent of dump items in game cause player dump alot of rpg