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

[EO 2.0] Bank Tabs


Matt
 Share

Recommended Posts

Alright. This tutorial will add 10 bank tabs to your banking system. It's fairly simple to add in.

Server and Client

>! Look for
>! ```
>! Public Const MAX_BANK As Long = 99
>! ```
and under it, put there this
>! ```
>! Public Const MAX_BANK_TABS As Long = 10
>! ```
Look for
>! ```
>! Private Type BankRec
Item(1 To MAX_BANK) As PlayerInvRec
End Type
>! ```
and replace it with
>! ```
>! Private Type BankTabRec
Item(1 To MAX_BANK) As PlayerInvRec
End Type
>! Private Type BankRec
BankTab(1 To MAX_BANK_TABS) As BankTabRec
End Type
>! ```
go to modEnumerations and put there
>! ```
>! CMoveItemToNewBankTab
>! ```
right above "CMSG_COUNT"

Server

>! Look for "Buffer.WriteLong SBank" and replace
>! ```
>! For i = 1 To MAX_BANK
Buffer.WriteLong Bank(index).Item(i).Num
Buffer.WriteLong Bank(index).Item(i).Value
Next
>! ```
with
>! ```
>! For t = 1 To MAX_BANK_TABS
For i = 1 To MAX_BANK
Buffer.WriteLong Bank(index).BankTab(t).Item(i).Num
Buffer.WriteLong Bank(index).BankTab(t).Item(i).Value
Next
Next
>! ```
Remember to declare the variable t as a long at the top of the sub.
>!  
>! Look for "Sub HandleChangeBankSlots(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)"
>! and declare a variable called BankTab as a long at the top of the sub.
>! After
>! ```
>! Buffer.WriteBytes Data()
```
put there this
>! ```
>! BankTab = Buffer.ReadLong
>! ```
Replace
>! ```
>! PlayerSwitchBankSlots Index, oldSlot, newSlot
>! ```
with
>! ```
>! PlayerSwitchBankSlots Index, BankTab, oldSlot, newSlot
>! ```
Look for "Sub HandleWithdrawItem(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)"
>! and declare a variable called BankTab as a long at the top of the sub.
>! After
>! ```
>! Buffer.WriteBytes Data()
```
put there this
>! ```
>! BankTab = Buffer.ReadLong
```
Replace
>! ```
>! TakeBankItem Index, bankslot, Amount
>! ```
with
>! ```
>! TakeBankItem Index, BankTab, bankslot, Amount
>! ```
Look for "Sub HandleDepositItem(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)"
>! and declare a variable called BankTab as a long at the top of the sub.
>! After
>! ```
>! Buffer.WriteBytes Data()
```
put there this
>! ```
>! BankTab = Buffer.ReadLong
```
Replace
>! ```
>! GiveBankItem Index, invSlot, Amount
>! ```
with
>! ```
>! GiveBankItem Index, BankTab, invSlot, Amount
>! ```
Now look for "Public Sub InitMessages()" and anywhere in that sub, put there this
>! ```
>! HandleDataSub(CMoveItemToNewBankTab) = GetAddress(AddressOf HandleMoveItemToNewBankTab)
>! ```
And at the bottom of the module, put there this
>! ```
>! Private Sub HandleMoveItemToNewBankTab(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim NewTab As Long, OldTab As Long, Slot As Long
Dim item As Long, Amount As Long, newSlot As Long

Set Buffer = New clsBuffer
Buffer.WriteBytes Data()

NewTab = Buffer.ReadLong
OldTab = Buffer.ReadLong
Slot = Buffer.ReadLong

With Bank(Index)
item = .BankTab(OldTab).item(Slot).Num
Amount = .BankTab(OldTab).item(Slot).value
newSlot = BankTabCanContainItem(Index, NewTab, item)

If newSlot >= 0 Then
.BankTab(OldTab).item(Slot).Num = 0
.BankTab(OldTab).item(Slot).value = 0

.BankTab(NewTab).item(newSlot).Num = item
.BankTab(NewTab).item(newSlot).value = Amount + .BankTab(NewTab).item(newSlot).value
End If
End With

SendBank (Index)

Set Buffer = Nothing
End Sub
>! Public Function BankTabCanContainItem(ByVal Index As Long, ByVal BankTab As Long, ByVal ItemNum As Long) As Long
Dim i As Long
>! For i = 1 To MAX_BANK
If Bank(Index).BankTab(BankTab).item(i).Num = ItemNum Then
BankTabCanContainItem = i
Exit Function
End If
Next

For i = 1 To MAX_BANK
If Bank(Index).BankTab(BankTab).item(i).Num = 0 Then
BankTabCanContainItem = i
Exit Function
End If
Next

Call PlayerMsg(Index, "This bank page is full!", BrightRed)
BankTabCanContainItem = -1
End Function
>! ```
Look for
>! ```
>! Function GetPlayerBankItemNum(ByVal Index As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemNum = Bank(Index).item(BankSlot).Num
End Function
>! Sub SetPlayerBankItemNum(ByVal Index As Long, ByVal BankSlot As Long, ByVal ItemNum As Long)
Bank(Index).item(BankSlot).Num = ItemNum
End Sub
>! Function GetPlayerBankItemValue(ByVal Index As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemValue = Bank(Index).item(BankSlot).Value
End Function
>! Sub SetPlayerBankItemValue(ByVal Index As Long, ByVal BankSlot As Long, ByVal ItemValue As Long)
Bank(Index).item(BankSlot).Value = ItemValue
End Sub
>! ```
replace them with
>! ```
>! Function GetPlayerBankItemNum(ByVal Index As Long, ByVal BankTab As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemNum = Bank(Index).BankTab(BankTab).item(BankSlot).Num
End Function
>! Sub SetPlayerBankItemNum(ByVal Index As Long, ByVal BankTab As Long, ByVal BankSlot As Long, ByVal ItemNum As Long)
Bank(Index).BankTab(BankTab).item(BankSlot).Num = ItemNum
End Sub
>! Function GetPlayerBankItemValue(ByVal Index As Long, ByVal BankTab As Long, ByVal BankSlot As Long) As Long
GetPlayerBankItemValue = Bank(Index).BankTab(BankTab).item(BankSlot).Value
End Function
>! Sub SetPlayerBankItemValue(ByVal Index As Long, ByVal BankTab As Long, ByVal BankSlot As Long, ByVal ItemValue As Long)
Bank(Index).BankTab(BankTab).item(BankSlot).Value = ItemValue
End Sub
>! ```
Replace the subs GiveBankItem and TakeBankItem with these two
>! ```
>! Sub GiveBankItem(ByVal Index As Long, ByVal BankTab As Long, ByVal invSlot As Long, ByVal Amount As Long)
Dim BankSlot
>! If invSlot < 0 Or invSlot > MAX_INV Then
Exit Sub
End If

If Amount < 0 Or Amount > GetPlayerInvItemValue(Index, invSlot) Then
Exit Sub
End If

BankSlot = FindOpenBankSlot(Index, BankTab, GetPlayerInvItemNum(Index, invSlot))

If BankSlot > 0 Then
If item(GetPlayerInvItemNum(Index, invSlot)).Type = ITEM_TYPE_CURRENCY Then
If GetPlayerBankItemNum(Index, BankTab, BankSlot) = GetPlayerInvItemNum(Index, invSlot) Then
Call SetPlayerBankItemValue(Index, BankTab, BankSlot, GetPlayerBankItemValue(Index, BankTab, BankSlot) + Amount)
Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), Amount)
Else
Call SetPlayerBankItemNum(Index, BankTab, BankSlot, GetPlayerInvItemNum(Index, invSlot))
Call SetPlayerBankItemValue(Index, BankTab, BankSlot, Amount)
Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), Amount)
End If
Else
If GetPlayerBankItemNum(Index, BankTab, BankSlot) = GetPlayerInvItemNum(Index, invSlot) Then
Call SetPlayerBankItemValue(Index, BankTab, BankSlot, GetPlayerBankItemValue(Index, BankTab, BankSlot) + 1)
Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), 0)
Else
Call SetPlayerBankItemNum(Index, BankTab, BankSlot, GetPlayerInvItemNum(Index, invSlot))
Call SetPlayerBankItemValue(Index, BankTab, BankSlot, 1)
Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), 0)
End If
End If
End If

SaveBank Index
SavePlayer Index
SendBank Index
>! End Sub
>! Sub TakeBankItem(ByVal Index As Long, ByVal BankTab As Long, ByVal BankSlot As Long, ByVal Amount As Long)
Dim invSlot
>!     If BankSlot < 0 Or BankSlot > MAX_BANK Then
        Exit Sub
    End If

    If Amount < 0 Or Amount > GetPlayerBankItemValue(Index, BankTab, BankSlot) Then
        Exit Sub
    End If

    invSlot = FindOpenInvSlot(Index, GetPlayerBankItemNum(Index, BankTab, BankSlot))

    If invSlot > 0 Then
        If item(GetPlayerBankItemNum(Index, BankTab, BankSlot)).Type = ITEM_TYPE_CURRENCY Then
            Call GiveInvItem(Index, GetPlayerBankItemNum(Index, BankTab, BankSlot), Amount)
            Call SetPlayerBankItemValue(Index, BankTab, BankSlot, GetPlayerBankItemValue(Index, BankTab, BankSlot) - Amount)
            If GetPlayerBankItemValue(Index, BankTab, BankSlot) <= 0 Then
                Call SetPlayerBankItemNum(Index, BankTab, BankSlot, 0)
                Call SetPlayerBankItemValue(Index, BankTab, BankSlot, 0)
            End If
        Else
            If GetPlayerBankItemValue(Index, BankTab, BankSlot) > 1 Then
                Call GiveInvItem(Index, GetPlayerBankItemNum(Index, BankTab, BankSlot), 0)
                Call SetPlayerBankItemValue(Index, BankTab, BankSlot, GetPlayerBankItemValue(Index, BankTab, BankSlot) - 1)
            Else
                Call GiveInvItem(Index, GetPlayerBankItemNum(Index, BankTab, BankSlot), 0)
                Call SetPlayerBankItemNum(Index, BankTab, BankSlot, 0)
                Call SetPlayerBankItemValue(Index, BankTab, BankSlot, 0)
            End If
        End If
    End If

    SaveBank Index
    SavePlayer Index
    SendBank Index
>! End Sub
>! ```
look for "Sub PlayerSwitchBankSlots" and replace it with this
>! ```
>! Sub PlayerSwitchBankSlots(ByVal Index As Long, ByVal BankTab As Long, ByVal oldSlot As Long, ByVal newSlot As Long)
Dim OldNum As Long
Dim OldValue As Long
Dim NewNum As Long
Dim NewValue As Long
>! If oldSlot = 0 Or newSlot = 0 Then
Exit Sub
End If

OldNum = GetPlayerBankItemNum(Index, BankTab, oldSlot)
OldValue = GetPlayerBankItemValue(Index, BankTab, oldSlot)
NewNum = GetPlayerBankItemNum(Index, BankTab, newSlot)
NewValue = GetPlayerBankItemValue(Index, BankTab, newSlot)

SetPlayerBankItemNum Index, BankTab, newSlot, OldNum
SetPlayerBankItemValue Index, BankTab, newSlot, OldValue

SetPlayerBankItemNum Index, BankTab, oldSlot, NewNum
SetPlayerBankItemValue Index, BankTab, oldSlot, NewValue

SendBank Index
End Sub
>! ```
Look for the function "FindOpenBankSlot" and replace it with this
>! ```
>! Function FindOpenBankSlot(ByVal Index As Long, ByVal BankTab As Long, ByVal ItemNum As Long) As Long
Dim i As Long
>! If Not IsPlaying(Index) Then Exit Function
If ItemNum <= 0 Or ItemNum > MAX_ITEMS Then Exit Function
>! For i = 1 To MAX_BANK
If GetPlayerBankItemNum(Index, BankTab, i) = ItemNum Then
FindOpenBankSlot = i
Exit Function
End If
Next i
>! For i = 1 To MAX_BANK
If GetPlayerBankItemNum(Index, BankTab, i) = 0 Then
FindOpenBankSlot = i
Exit Function
End If
Next i
>! End Function
>! ```

Client

>! Look for "Private Sub HandleBank(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)"
>! Replace
>! ```
>! For i = 1 To MAX_BANK
Bank.Item(i).num = Buffer.ReadLong
Bank.Item(i).Value = Buffer.ReadLong
Next
>! ```
with
>! ```
>! For t = 1 To MAX_BANK_TABS
For i = 1 To MAX_BANK
Bank.BankTab(t).Item(i).num = Buffer.ReadLong
Bank.BankTab(t).Item(i).Value = Buffer.ReadLong
Next
Next
If CurBankTab < 1 Or CurBankTab > MAX_BANK_TABS Then CurBankTab = 1
>! ```
Remember to declare the variable t as a long at the top of the sub.
>!  
>! Look for "Public Function GetBankItemNum(ByVal bankslot As Long) As Long"
>! and replace the function with this.
>! ```
>! Public Function GetBankItemNum(ByVal tabnum As Long, ByVal bankslot As Long) As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

If bankslot = 0 Then
GetBankItemNum = 0
Exit Function
End If

If bankslot > MAX_BANK Then
GetBankItemNum = 0
Exit Function
End If

If tabnum <= 0 Or tabnum > MAX_BANK_TABS Then
GetBankItemNum = 0
Exit Function
End If

GetBankItemNum = Bank.BankTab(tabnum).Item(bankslot).num

' Error handler
Exit Function
errorhandler:
HandleError "GetBankItemNum", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Function
End Function
>! ```
Look for the sub "Public Sub SetBankItemNum(ByVal bankslot As Long, ByVal itemnum As Long)"
>! and replace the whole thing with
>! ```
>! Public Sub SetBankItemNum(ByVal tabnum As Long, ByVal bankslot As Long, ByVal itemnum As Long)
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Bank.BankTab(tabnum).Item(bankslot).num = itemnum

' Error handler
Exit Sub
errorhandler:
HandleError "SetBankItemNum", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
>! ```
Look for the function "Public Function GetBankItemValue(ByVal bankslot As Long) As Long"
>! and replace the whole thing with
>! ```
>! Public Function GetBankItemValue(ByVal tabnum As Long, ByVal bankslot As Long) As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

GetBankItemValue = Bank.BankTab(tabnum).Item(bankslot).Value

' Error handler
Exit Function
errorhandler:
HandleError "GetBankItemValue", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Function
End Function
>! ```
Now, look for the sub "Public Sub SetBankItemValue(ByVal bankslot As Long, ByVal ItemValue As Long)"
>! and replace the whole thing with
>! ```
>! Public Sub SetBankItemValue(ByVal tabnum As Long, ByVal bankslot As Long, ByVal ItemValue As Long)
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

Bank.banktab(tabnum).Item(bankslot).Value = ItemValue

' Error handler
Exit Sub
errorhandler:
HandleError "SetBankItemValue", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub
>! ```
Look for
>! ```
>! Public BankY As Long
>! ```
and under it, put there
>! ```
>! Public CurBankTab As Long
>! ```
look for
>! ```
>! Buffer.WriteLong CDepositItem
```
and under it, put there
>! ```
>! Buffer.WriteLong CurBankTab
>! ```
Look for
>! ```
>! Buffer.WriteLong CWithdrawItem
>! ```
and under it, put there
>! ```
>! Buffer.WriteLong CurBankTab
>! ```
Look for "Private Sub picBank_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)" and under
>! ```
>! bankNum = IsBankItem(x, y)

If bankNum <> 0 Then
If Button = 1 Then
DragBankSlotNum = bankNum
End If
End If
>! ```
put there
>! ```
>! If IsTabNum(x, y) > 0 Then
CurBankTab = IsTabNum(x, y)
BltBank
End If
>! ```
Look for "Private Sub picBank_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)" and under
>! ```
>! For i = 1 To MAX_BANK
' There's actual code here, but it took up a lot of room. Look for the for statement.
Next
>! ```
put there
>! ```
>! If IsTabNum(x, y) > 0 Then
SendMoveItemToNewBankTab IsTabNum(x, y), CurBankTab, DragBankSlotNum
End If
>! ```
Then, somewhere in frmMain's code, put there this
>! ```
>! Private Function IsTabNum(ByVal x As Long, ByVal y As Long) As Long
Dim i As Long
Dim TempRec As RECT
>! IsTabNum = 0

For i = 1 To MAX_BANK_TABS
With TempRec
.Left = 34 + (i * 8) + (i - 1) + ((i - 1) * 32) - 4
.Right = .Left + 32
.top = 7
.Bottom = .top + 32
End With

If x >= TempRec.Left And x <= TempRec.Right Then
If y >= TempRec.top And y <= TempRec.Bottom Then
IsTabNum = i
Exit Function
End If
End If
Next
>! End Function
>! ```
At the bottom of modClientTCP, put there this
>! ```
>! Public Sub SendMoveItemToNewBankTab(ByVal NewTab As Long, ByVal OldTab As Long, ByVal Slot As Long)
Dim Buffer As clsBuffer
>! Set Buffer = New clsBuffer
Buffer.WriteLong CMoveItemToNewBankSlot

Buffer.WriteLong NewTab
Buffer.WriteLong OldTab
Buffer.WriteLong Slot

SendData Buffer.ToArray()
Set Buffer = Nothing
>! End Sub
>! ```
look for
>! ```
>! frmMain.picBank.Cls
>! ```
and under it put there
>! ```
>! For i = 1 To MAX_BANK_TABS
If Bank.BankTab(i).Item(1).num > 0 Then
ItemNum = Bank.BankTab(i).Item(1).num
If ItemNum < MAX_ITEMS Then
Sprite = Item(ItemNum).Pic

If Sprite <> 0 Then

If DDS_Item(Sprite) Is Nothing Then
Call InitDDSurf("Items\" & Sprite, DDSD_Item(Sprite), DDS_Item(Sprite))
End If

With sRECT
.top = 0
.Bottom = .top + 32
.Left = (DDSD_Item(Sprite).lWidth / 4) * 2
.Right = .Left + 32
End With

With dRECT
.Left = 34 + (i * 8) + (i - 1) + ((i - 1) * 32) - 4
.Right = .Left + 32
.top = 7
.Bottom = .top + 32
End With

Engine_BltToDC DDS_Item(Sprite), sRECT, dRECT, frmMain.picBank, False
End If
End If
End If
Next
>! ```
replace
>! ```
>! itemnum = GetBankItemNum(i)
>! ```
with
>! ```
>! itemnum = GetBankItemNum(CurBankTab, i)
>! ```
Look for
>! ```
>! UpdateDescWindow Bank.Item(bankNum).num, x2, y2
>! ```
and replace it with
>! ```
>! UpdateDescWindow Bank.BankTab(CurBankTab).Item(bankNum).num, x2, y2
>! ```
look for
>! ```
>! If GetBankItemNum(i) > 0 And GetBankItemNum(i) <= MAX_ITEMS Then
>! ```
and replace it with
>! ```
>! If GetBankItemNum(CurBankTab, i) > 0 And GetBankItemNum(CurBankTab, i) <= MAX_ITEMS Then
>! ```
replace
>! ```
>! ' If item is a stack - draw the amount you have
If GetBankItemValue(i) > 1 Then
y = dRECT.top + 22
x = dRECT.Left - 4

Amount = CStr(GetBankItemValue(i))
' Draw currency but with k, m, b etc. using a convertion function
If CLng(Amount) < 1000000 Then
colour = QBColor(White)
ElseIf CLng(Amount) > 1000000 And CLng(Amount) < 10000000 Then
colour = QBColor(Yellow)
ElseIf CLng(Amount) > 10000000 Then
colour = QBColor(BrightGreen)
End If
DrawText frmMain.picBank.hDC, x, y, ConvertCurrency(Amount), colour
End If
>! ```
with
>! ```
>! ' If item is a stack - draw the amount you have
If GetBankItemValue(CurBankTab, i) > 1 Then
y = dRECT.top + 22
x = dRECT.Left - 4

Amount = CStr(GetBankItemValue(CurBankTab, i))
' Draw currency but with k, m, b etc. using a convertion function
If CLng(Amount) < 1000000 Then
colour = QBColor(White)
ElseIf CLng(Amount) > 1000000 And CLng(Amount) < 10000000 Then
colour = QBColor(Yellow)
ElseIf CLng(Amount) > 10000000 Then
colour = QBColor(BrightGreen)
End If
DrawText frmMain.picBank.hDC, x, y, ConvertCurrency(Amount), colour
End If
>! ```
Look for "Public Sub BltBankItem(ByVal x As Long, ByVal y As Long)" and replace
>! ```
>! itemnum = GetBankItemNum(DragBankSlotNum)
Sprite = Item(GetBankItemNum(DragBankSlotNum)).Pic
>! ```
with
>! ```
>! itemnum = GetBankItemNum(CurBankTab, DragBankSlotNum)
Sprite = Item(GetBankItemNum(CurBankTab, DragBankSlotNum)).Pic
>! ```
Look for "Private Sub picBank_DblClick()" and replace
>! ```
>!     bankNum = IsBankItem(BankX, BankY)
    If bankNum <> 0 Then
         If GetBankItemNum(bankNum) = ITEM_TYPE_NONE Then Exit Sub

             If Item(GetBankItemNum(bankNum)).Type = ITEM_TYPE_CURRENCY Then
>! ```
with
>! ```
>!     bankNum = IsBankItem(BankX, BankY)
    If bankNum <> 0 Then
         If GetBankItemNum(CurBankTab, bankNum) = ITEM_TYPE_NONE Then Exit Sub

             If Item(GetBankItemNum(CurBankTab, bankNum)).Type = ITEM_TYPE_CURRENCY Then
>! ```

Save, compile, enjoy.
Link to comment
Share on other sites

> May i ask what it does Matt? Does it just make tabs so you can store more in bank?

Looks like it

For every bank tab create a bank with the MAX_BANK being the max amount of items

```
For t = 1 To MAX_BANK_TABS
For i = 1 To MAX_BANK
Buffer.WriteLong Bank(index).BankTab(t).Item(i).Num
Buffer.WriteLong Bank(index).BankTab(t).Item(i).Value
Next
Next

```
Link to comment
Share on other sites

There is a small error in the EO 2.0 base with withdrawing currency from a bank. Here is a fix for anyone who already has that fix added or if you just added this tutorial:

All Client:
Find this sub:
```
Private Sub lblCurrencyOk_Click()

```And replace the whole sub with this:
```
Private Sub lblCurrencyOk_Click()
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

If IsNumeric(txtCurrency.text) Then
If CurrencyMenu = 3 Then
If Val(txtCurrency.text) > GetBankItemValue(MyIndex, CurBankTab, tmpCurrencyItem) Then txtCurrency.text = GetBankItemValue(MyIndex, CurBankTab, tmpCurrencyItem)
ElseIf Val(txtCurrency.text) > GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) Then txtCurrency.text = GetPlayerInvItemValue(MyIndex, tmpCurrencyItem)
End If
Select Case CurrencyMenu
Case 1 ' drop item
SendDropItem tmpCurrencyItem, Val(txtCurrency.text)
Case 2 ' deposit item
DepositItem tmpCurrencyItem, Val(txtCurrency.text)
Case 3 ' withdraw item
WithdrawItem tmpCurrencyItem, ValCurrency
Case 4 ' offer trade item
TradeItem tmpCurrencyItem, Val(txtCurrency.text)
End Select
Else
AddText "Please enter a valid amount.", BrightRed
Exit Sub
End If

picCurrency.Visible = False
tmpCurrencyItem = 0
txtCurrency.text = vbNullString
CurrencyMenu = 0 ' clear

' Error handler
Exit Sub
errorhandler:
HandleError "lblCurrencyOk_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Sub
End Sub

```Next find :
```
Public Function GetBankItemValue

``` 
And replace the whole sub with this:
```
Public Function GetBankItemValue(ByVal Index As Long, ByVal tabnum As Long, ByVal bankslot As Long) As Long
' If debug mode, handle error then exit out
If Options.Debug = 1 Then On Error GoTo errorhandler

If Index > MAX_PLAYERS Then Exit Function

GetBankItemValue = Bank.BankTab(tabnum).Item(bankslot).value

' Error handler
Exit Function
errorhandler:
HandleError "GetBankItemValue", "modGameLogic", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
Exit Function
End Function

```Next in BltBank find this:
```
' If item is a stack - draw the amount you have
If GetBankItemValue(CurBankTab, i) > 1 Then
Y = dRECT.top + 22
X = dRECT.Left - 4

Amount = CStr(GetBankItemValue(CurBankTab, i))

``` 
And change it to this:

```
' If item is a stack - draw the amount you have
If GetBankItemValue(0, CurBankTab, i) > 1 Then
Y = dRECT.top + 22
X = dRECT.Left - 4

Amount = CStr(GetBankItemValue(0, CurBankTab, i))

``` 
I might have missed something so let me know and ill post the fix. After adding this you will have awesome bank tabs and your currency will withdraw the correct amounts.
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

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...