Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

All Known Bank Fixes


balliztik1
 Share

Recommended Posts

For 2.8, the banking system has undergone a rather large change. For those that want to fix these errors in their own sources, I am compiling all the known bugs here. Some of these bugs have been around for a while, so even if you are using an older source, such as TE, it might be good to add this.

Known Bugs as of 6/19/2009:

* Bank Buttons too Small
* Items not deposited from a specific slot
* Equipped Item checks not working
* A few other, secret errors (Marsh has advised me not to release the specifics, as players could exploit the bugs in games without this fix)

**Bank Button Fix**
For some reason, the bank buttons that came with 2.7 are impossibly small. AkselJ has a tutorial with pictures, here: [[EE 2.7] How to fix bank and trade](http://www.touchofdeathforums.com/smf/index.php/topic,44128.0.html)

Basically, in the frmBank object view, drag and resize the deposit and withdraw buttons to a bigger size.

**Deposit Fixes** The remaining fixes all have to do with depositing items. It's a pretty simple fix. Just replace your Packet_BankDeposit with this:

```
Public Sub Packet_BankDeposit(ByVal index As Long, ByVal InvNum As Long, ByVal Amount As Long)
    Dim BankSlot As Long
    Dim ItemNum As Long

    ItemNum = GetPlayerInvItemNum(index, InvNum)

    BankSlot = FindOpenBankSlot(index, ItemNum)
    If BankSlot = 0 Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "Bank full!" & END_CHAR)
        Exit Sub
    End If

    If Amount > GetPlayerInvItemValue(index, InvNum) Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You can't deposit more than you have!" & END_CHAR)
        Exit Sub
    End If

    'Fix posted back in 2.5\. Never added.
    If GetPlayerWeaponSlot(index) = InvNum Or GetPlayerArmorSlot(index) = InvNum Or GetPlayerShieldSlot(index) = InvNum Or GetPlayerHelmetSlot(index) = InvNum Or GetPlayerLegsSlot(index) = InvNum Or GetPlayerRingSlot(index) = InvNum Or GetPlayerNecklaceSlot(index) = InvNum Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You can't deposit worn equipment!" & END_CHAR)
        Exit Sub
    End If

    If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Or Item(ItemNum).Stackable = 1 Then
        If Amount < 1 Then
            Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You must deposit more than 0!" & END_CHAR)
            Exit Sub
        End If
    End If

    'Shouldn't have to revert to this, but leaving it just in case
    'Call TakeItem(index, ItemNum, Amount)

    If GetPlayerInvItemValue(index, InvNum) > Amount Then
        Call SetPlayerInvItemValue(index, InvNum, GetPlayerInvItemValue(index, InvNum) - Amount)
    ElseIf GetPlayerInvItemValue(index, InvNum) = Amount Then
        Call SetPlayerInvItemNum(index, InvNum, 0)
        Call SetPlayerInvItemValue(index, InvNum, 0)
        Call SetPlayerInvItemDur(index, InvNum, 0)
    End If
    Call SendInventoryUpdate(index, InvNum)

    Call GiveBankItem(index, ItemNum, Amount, BankSlot)
    Call SendBank(index)
End Sub
```
The main problem with the bank system was that you select an item from your inventory list, but that item slot isn't really used. Instead, the item slot is converted to the item number, which is fed to the TakeItem sub. This results in the wrong item being taken if a player has more than one of that item. I simply changed the TakeItem call to one that checks only the given slot.

A second problem is that the item's number was being checked against the item's slot. For the same reason that the TakeItem sub gave us problems, this doesn't work. They are two different values. I PMed a fix to the developers back in 2.5, but for some reason, it never found its way in. This prevents worn items from being unequipped and deposited.

The errors that I'm not at liberty to discuss are also fixed here. I won't be sharing the details, but this fix provides a safeguard against them. If you need more details, or your bank system is different and you still want this fix, PM me, and I'll see what I can do.
Link to comment
Share on other sites

Thanks! This helped a lot! I've modified your code slightly to make it so that the messages pop up rather than show on the bank screen. For me, and I'm sure many others, this is more convenient. Also, it will probably be more helpful to those who didn't modify the box that displays the message in frmBank.frm. Well, here it is:

Replace your **Packet_BankDeposit** in _modHandleData_ on the Server side with this:

```
Public Sub Packet_BankDeposit(ByVal index As Long, ByVal InvNum As Long, ByVal Amount As Long)
    Dim BankSlot As Long
    Dim ItemNum As Long

    ItemNum = GetPlayerInvItemNum(index, InvNum)

    BankSlot = FindOpenBankSlot(index, ItemNum)
    If BankSlot = 0 Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "Your bank is full! Please remove an item if you wish to deposit any more." & END_CHAR)
        Exit Sub
    End If

    If Amount > GetPlayerInvItemValue(index, InvNum) Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You can't deposit more than what you have!" & END_CHAR)
        Exit Sub
    End If

    'Fix posted back in 2.5\. Never added.
    If GetPlayerWeaponSlot(index) = InvNum Or GetPlayerArmorSlot(index) = InvNum Or GetPlayerShieldSlot(index) = InvNum Or GetPlayerHelmetSlot(index) = InvNum Or GetPlayerLegsSlot(index) = InvNum Or GetPlayerRingSlot(index) = InvNum Or GetPlayerNecklaceSlot(index) = InvNum Then
        Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You can't deposit equipped items!" & END_CHAR)
        Exit Sub
    End If

    If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Or Item(ItemNum).Stackable = 1 Then
        If Amount < 1 Then
            Call SendDataTo(index, "bankmsg" & SEP_CHAR & "You must deposit more than 0!" & END_CHAR)
            Exit Sub
        End If
    End If

    'Shouldn't have to revert to this, but leaving it just in case
    'Call TakeItem(index, ItemNum, Amount)

    If GetPlayerInvItemValue(index, InvNum) > Amount Then
        Call SetPlayerInvItemValue(index, InvNum, GetPlayerInvItemValue(index, InvNum) - Amount)
    ElseIf GetPlayerInvItemValue(index, InvNum) = Amount Then
        Call SetPlayerInvItemNum(index, InvNum, 0)
        Call SetPlayerInvItemValue(index, InvNum, 0)
        Call SetPlayerInvItemDur(index, InvNum, 0)
    End If
    Call SendInventoryUpdate(index, InvNum)

    Call GiveBankItem(index, ItemNum, Amount, BankSlot)
    Call SendBank(index)

End Sub
```
Also, open up the **Client** and go to _modHandleData_. Find this:

```
If LCase$(parse(0)) = "bankmsg" Then
        frmBank.lblMsg.Caption = Trim$(parse(1))
        Exit Sub
    End If
```
Replace it with this:

```
If LCase$(parse(0)) = "bankmsg" Then
        Call MsgBox(Trim(parse(1)))
        Exit Sub
    End If
```
You don't have to post this at the top, but I feel that people should have the option to choose whichever they prefer. Anyway, thanks a lot again!

EDIT: I noticed that I kept my own messages there. You can change them as you like.
Link to comment
Share on other sites

  • 2 months later...
@[God:

> Owen link=topic=46695.msg543250#msg543250 date=1252650749]
> yeah i think if he's trying to get the play to get a white box its
> AlertMsg right?

Not quite. AlertMsg kicks them from the game. ;P

You'd have to change it within the "bankmsg" packet. Instead of changing the form's text, it would show a MsgBox.
Link to comment
Share on other sites

@Balliztik1:

> Oh, just noticed this.
>
> In your post, Kimimaru, you used MsgBox, but that's the server. The player won't receive that message. The server hoster will.
>
> Sorry for double post, but I was going through old topics and noticed that.

Okay, thanks for pointing that out; I never realized it since I am the only one online, and I have control of the server.

If you still want the MsgBox, you can check out my other post with it on there; I updated it.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...