**known issues: 1\. Small fix needed for Shops to work correctly…should be updated 03/24/12** I don't know if there is a better way to do this but this does work. It was a major learning process. I've tried to debug as much as possible and I haven't been able to make anything screw up so figured I'd share it. This will allow you to have all items stack to a limit that you set. **FORM** **Client - frmEditor_Item - (View Object)** Add a label entitled "lblStackLimit" with a caption of "Stack Limit: 0" Add a horizontal scroll bar entitled "scrlStackLimit" with a Min of 0 and a Max of 25 (This is where you set the maximum amount) (Refer to attachment for form screenshot) **CLIENT** **Client - frmEditor_Item - Private Sub cmbType_Click** Below this… ``` If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub ``` …add this: ``` If cmbType.ListIndex ITEM_TYPE_CURRENCY Then frmEditor_Item.lblStackLimit.Visible = True frmEditor_Item.scrlStackLimit.Visible = True lblStackLimit.Caption = "Stack Limit: " & scrlStackLimit.Value End If ``` Below this… ``` If (cmbType.ListIndex = ITEM_TYPE_SPELL) Then fraSpell.Visible = True Else fraSpell.Visible = False End If ``` …add this: ``` If cmbType.ListIndex = ITEM_TYPE_CURRENCY Then frmEditor_Item.scrlStackLimit.Visible = False frmEditor_Item.lblStackLimit.Visible = False End If ``` **Client - frmEditor_Item - Private Sub scrlStackLimit_Change** ``` Private Sub scrlStackLimit_Change() ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler If EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit Sub lblStackLimit.Caption = "Stack Limit: " & scrlStackLimit.Value Item(EditorIndex).StackLimit = scrlStackLimit.Value ' Error handler Exit Sub errorhandler: HandleError "scrlStackLimit_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit Sub End Sub ``` **Client - frmEditor_Map - Private Sub scrlMapItem_Change** Replace this… ``` If Item(scrlMapItem.Value).Type = ITEM_TYPE_CURRENCY Then scrlMapItemValue.Enabled = True Else scrlMapItemValue.Value = 1 scrlMapItemValue.Enabled = False End If ``` …with this: ``` scrlMapItemValue.Enabled = True ``` **Client - frmMain - Private Sub lblCurrencyOK_Click** If you have applied the 'Currency menu overflow' fix: ``` If Val(txtCurrency.text) > GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) Then txtCurrency.text = GetPlayerInvItemValue(MyIndex, tmpCurrencyItem) ``` You'll need to take it out. I just commented it out and planned on coming back to address the issue at a later date. **Client - frmMain - Private Sub picBank_DblClick** Replace this… ``` If Item(GetBankItemNum(bankNum)).Type = ITEM_TYPE_CURRENCY Then CurrencyMenu = 3 ' withdraw lblCurrency.Caption = "How many do you want to withdraw?" tmpCurrencyItem = bankNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub End If ``` …with this: ``` CurrencyMenu = 3 ' withdraw lblCurrency.Caption = "How many do you want to withdraw?" tmpCurrencyItem = bankNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub ``` **Client - frmMain - Private Sub picInventory_DblClick** Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, InvNum)).Type = ITEM_TYPE_CURRENCY Then CurrencyMenu = 2 ' deposit lblCurrency.Caption = "How many do you want to deposit?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub End If ``` …with this: ``` CurrencyMenu = 2 ' deposit lblCurrency.Caption = "How many do you want to deposit?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub ``` Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, TradeYourOffer(i).num)).Type = ITEM_TYPE_CURRENCY Then ' only exit out if we're offering all of it If TradeYourOffer(i).Value = GetPlayerInvItemValue(MyIndex, TradeYourOffer(i).num) Then Exit Sub End If Else Exit Sub End If ``` …with this: ``` If TradeYourOffer(i).Value = GetPlayerInvItemValue(MyIndex, TradeYourOffer(i).num) Then Exit Sub End If ``` Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, InvNum)).Type = ITEM_TYPE_CURRENCY Then CurrencyMenu = 4 ' offer in trade lblCurrency.Caption = "How many do you want to trade?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub End If ``` …with this: ``` CurrencyMenu = 4 ' offer in trade lblCurrency.Caption = "How many do you want to trade?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus Exit Sub ``` **Client - frmMain - Private Sub picInventory_MouseDown** Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, InvNum)).Type = ITEM_TYPE_CURRENCY Then If GetPlayerInvItemValue(MyIndex, InvNum) > 0 Then CurrencyMenu = 1 ' drop lblCurrency.Caption = "How many do you want to drop?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus End If Else Call SendDropItem(InvNum, 0) End If ``` …with this: ``` If GetPlayerInvItemValue(MyIndex, InvNum) > 0 Then CurrencyMenu = 1 ' drop lblCurrency.Caption = "How many do you want to drop?" tmpCurrencyItem = InvNum txtCurrency.text = vbNullString picCurrency.Visible = True txtCurrency.SetFocus End If ``` **Client - frmMain - Private Sub picInventory_MouseMove** Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, TradeYourOffer(i).num)).Type = ITEM_TYPE_CURRENCY Then ' only exit out if we're offering all of it If TradeYourOffer(i).Value = GetPlayerInvItemValue(MyIndex, TradeYourOffer(i).num) Then Exit Sub End If Else Exit Sub End If ``` …with this: ``` If TradeYourOffer(i).Value = GetPlayerInvItemValue(MyIndex, TradeYourOffer(i).num) Then Exit Sub End If ``` **Client - frmMain - Private Sub scrlAItem_Change** Replace this… ``` If Item(scrlAItem.Value).Type = ITEM_TYPE_CURRENCY Then scrlAAmount.Enabled = True Exit Sub End If ``` …with this: ``` scrlAAmount.Enabled = True Exit Sub ``` **Client - modClientTCP - Public Sub SendDropItem** Replace this… ``` If Item(GetPlayerInvItemNum(MyIndex, InvNum)).Type = ITEM_TYPE_CURRENCY Then If Amount < 1 Or Amount > PlayerInv(InvNum).Value Then Exit Sub End If ``` …with this: ``` If Amount < 1 Or Amount > PlayerInv(InvNum).Value Then Exit Sub ``` **Client - modDirectDraw7 - Sub BltInventory** Replace this… ``` If Not Item(tmpItem).Type = ITEM_TYPE_CURRENCY Then ' normal item, exit out GoTo NextLoop Else ' if amount = all currency, remove from inventory If TradeYourOffer(x).Value = GetPlayerInvItemValue(MyIndex, i) Then GoTo NextLoop Else ' not all, change modifier to show change in currency count amountModifier = TradeYourOffer(x).Value End If End If ``` …with this: ``` If TradeYourOffer(x).Value = GetPlayerInvItemValue(MyIndex, i) Then GoTo NextLoop Else ' not all, change modifier to show change in currency count amountModifier = TradeYourOffer(x).Value End If ``` **Client - modGameEditors - Public Sub ItemEditorInit** Below this… ``` If (frmEditor_Item.cmbType.ListIndex = ITEM_TYPE_SPELL) Then frmEditor_Item.fraSpell.Visible = True frmEditor_Item.scrlSpell.Value = .Data1 Else frmEditor_Item.fraSpell.Visible = False End If ``` …add this: ``` If (frmEditor_Item.cmbType.ListIndex ITEM_TYPE_CURRENCY) Then frmEditor_Item.lblStackLimit.Visible = True frmEditor_Item.scrlStackLimit.Visible = True Else frmEditor_Item.scrlStackLimit.Visible = False frmEditor_Item.lblStackLimit.Visible = False End If ``` Below this… ``` frmEditor_Item.scrlRarity.Value = .Rarity ``` …add this: ``` frmEditor_Item.scrlStackLimit.Value = .StackLimit ``` **Client - modTypes - Private Type ItemRec** Below this… ``` instaCast as Byte ``` …add this ``` StackLimit As Long ``` **SERVER** **Server - modGameLogic - Sub PlayerUnequipItem** Replace this… ``` GiveInvItem Index, GetPlayerEquipment(Index, EqSlot), 0 ``` …with this: ``` GiveInvItem Index, GetPlayerEquipment(Index, EqSlot), 1 ``` **Server - modGameLogic - Sub SpawnMapItems** Replace this… ``` If Item(Map(mapNum).Tile(x, y).Data1).Type = ITEM_TYPE_CURRENCY And Map(mapNum).Tile(x, y).Data2 GetPlayerInvItemValue(Index, invNum) Then Exit Sub ``` **Server - modHandleData - Sub HandleTradeItem** Replace this… ``` If Item(itemnum).Type = ITEM_TYPE_CURRENCY Then ' check if already offering same currency item For i = 1 To MAX_INV If TempPlayer(index).TradeOffer(i).Num = invSlot Then ' add amount TempPlayer(index).TradeOffer(i).Value = TempPlayer(index).TradeOffer(i).Value + amount ' clamp to limits If TempPlayer(index).TradeOffer(i).Value > GetPlayerInvItemValue(index, invSlot) Then TempPlayer(index).TradeOffer(i).Value = GetPlayerInvItemValue(index, invSlot) End If ' cancel any trade agreement TempPlayer(index).AcceptTrade = False TempPlayer(TempPlayer(index).InTrade).AcceptTrade = False SendTradeStatus index, 0 SendTradeStatus TempPlayer(index).InTrade, 0 SendTradeUpdate index, 0 SendTradeUpdate TempPlayer(index).InTrade, 1 ' exit early Exit Sub End If Next Else ' make sure they're not already offering it For i = 1 To MAX_INV If TempPlayer(index).TradeOffer(i).Num = invSlot Then PlayerMsg index, "You've already offered this item.", BrightRed Exit Sub End If Next End If ``` …with this: ``` For i = 1 To MAX_INV If TempPlayer(Index).TradeOffer(i).Num = invSlot Then ' add amount TempPlayer(Index).TradeOffer(i).Value = TempPlayer(Index).TradeOffer(i).Value + amount ' clamp to limits If TempPlayer(Index).TradeOffer(i).Value > GetPlayerInvItemValue(Index, invSlot) Then TempPlayer(Index).TradeOffer(i).Value = GetPlayerInvItemValue(Index, invSlot) End If ' cancel any trade agreement TempPlayer(Index).AcceptTrade = False TempPlayer(TempPlayer(Index).InTrade).AcceptTrade = False SendTradeStatus Index, 0 SendTradeStatus TempPlayer(Index).InTrade, 0 SendTradeUpdate Index, 0 SendTradeUpdate TempPlayer(Index).InTrade, 1 ' exit early Exit Sub End If Next ``` **Server - modPlayer - Function FindOpenBankSlot** Replace this… ``` For i = 1 To MAX_BANK If GetPlayerBankItemNum(index, i) = itemnum Then FindOpenBankSlot = i Exit Function End If Next i ``` …with this: ``` If Item(ItemNum).Type = ITEM_TYPE_CURRENCY Then For i = 1 To MAX_BANK If GetPlayerBankItemNum(Index, i) = ItemNum Then FindOpenBankSlot = i Exit Function End If Next End If For i = 1 To MAX_BANK If Item(ItemNum).Type ITEM_TYPE_CURRENCY Then If GetPlayerBankItemValue(Index, i) > 0 And GetPlayerBankItemNum(Index, i) = ItemNum Then If GetPlayerBankItemValue(Index, i) < Item(GetPlayerBankItemNum(Index, i)).StackLimit Then FindOpenBankSlot = i Exit Function End If End If End If Next ``` **Server - modPlayer - Function FindOpenInvSlot** After this… ``` If Item(itemnum).Type = ITEM_TYPE_CURRENCY Then ' If currency then check to see if they already have an instance of the item and add it to that For i = 1 To MAX_INV If GetPlayerInvItemNum(index, i) = itemnum Then FindOpenInvSlot = i Exit Function End If Next End If ``` …insert this: ``` For i = 1 To MAX_INV If Item(ItemNum).Type ITEM_TYPE_CURRENCY Then If GetPlayerInvItemValue(Index, i) > 0 And GetPlayerInvItemNum(Index, i) = ItemNum Then If GetPlayerInvItemValue(Index, i) < Item(GetPlayerInvItemNum(Index, i)).StackLimit Then FindOpenInvSlot = i Exit Function End If End If End If Next ``` **Server - modPlayer - Sub GiveBankItem** Replace this… ``` BankSlot = FindOpenBankSlot(index, GetPlayerInvItemNum(index, invSlot)) If BankSlot > 0 Then If Item(GetPlayerInvItemNum(index, invSlot)).Type = ITEM_TYPE_CURRENCY Then If GetPlayerBankItemNum(index, BankSlot) = GetPlayerInvItemNum(index, invSlot) Then Call SetPlayerBankItemValue(index, BankSlot, GetPlayerBankItemValue(index, BankSlot) + amount) Call TakeInvItem(index, GetPlayerInvItemNum(index, invSlot), amount) Else Call SetPlayerBankItemNum(index, BankSlot, GetPlayerInvItemNum(index, invSlot)) Call SetPlayerBankItemValue(index, BankSlot, amount) Call TakeInvItem(index, GetPlayerInvItemNum(index, invSlot), amount) End If Else If GetPlayerBankItemNum(index, BankSlot) = GetPlayerInvItemNum(index, invSlot) Then Call SetPlayerBankItemValue(index, BankSlot, GetPlayerBankItemValue(index, BankSlot) + 1) Call TakeInvItem(index, GetPlayerInvItemNum(index, invSlot), 0) Else Call SetPlayerBankItemNum(index, BankSlot, GetPlayerInvItemNum(index, invSlot)) Call SetPlayerBankItemValue(index, BankSlot, 1) Call TakeInvItem(index, GetPlayerInvItemNum(index, invSlot), 0) End If End If End If ``` …with this: ``` FindAnotherGiveBankItemSlot: BankSlot = FindOpenBankSlot(Index, GetPlayerInvItemNum(Index, invSlot)) If BankSlot > 0 Then If Item(GetPlayerInvItemNum(Index, invSlot)).Type = ITEM_TYPE_CURRENCY Then If GetPlayerBankItemNum(Index, BankSlot) = GetPlayerInvItemNum(Index, invSlot) Then Call SetPlayerBankItemValue(Index, BankSlot, GetPlayerBankItemValue(Index, BankSlot) + amount) Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), amount) Else Call SetPlayerBankItemNum(Index, BankSlot, GetPlayerInvItemNum(Index, invSlot)) Call SetPlayerBankItemValue(Index, BankSlot, amount) Call TakeInvItem(Index, GetPlayerInvItemNum(Index, invSlot), amount) End If Else If Item(GetPlayerInvItemNum(Index, invSlot)).Type ITEM_TYPE_CURRENCY Then If GetPlayerBankItemValue(Index, BankSlot) >= 1 Then If amount + GetPlayerBankItemValue(Index, BankSlot) Item(GetPlayerInvItemNum(Index, invSlot)).StackLimit Then amount = amount - (Item(GetPlayerInvItemNum(Index, invSlot)).StackLimit - GetPlayerBankItemValue(Index, BankSlot)) Call SetPlayerInvItemValue(Index, invSlot, GetPlayerInvItemValue(Index, invSlot) - (Item(GetPlayerInvItemNum(Index, invSlot)).StackLimit - GetPlayerBankItemValue(Index, BankSlot))) Call SendInventoryUpdate(Index, invSlot) Call SetPlayerBankItemValue(Index, BankSlot, Item(GetPlayerInvItemNum(Index, invSlot)).StackLimit) GoTo FindAnotherGiveBankItemSlot End If End If Else If GetPlayerBankItemValue(Index, BankSlot) = 0 Then If amount = 1 Then ItemVal = ItemVal - 1 Call SetPlayerInvItemNum(Index, i, ItemNum) Call SetPlayerInvItemValue(Index, i, GetPlayerInvItemValue(Index, i) + 1) If sendUpdate Then Call SendInventoryUpdate(Index, i) GiveInvItem = True GoTo FindAnotherGiveInvItemSlot Else Call SetPlayerInvItemNum(Index, i, ItemNum) Call SetPlayerInvItemValue(Index, i, GetPlayerInvItemValue(Index, i) + ItemVal) If sendUpdate Then Call SendInventoryUpdate(Index, i) GiveInvItem = True End If Else If GetPlayerInvItemValue(Index, i) > 0 Then If GetPlayerInvItemValue(Index, i) + ItemVal Item(GetPlayerInvItemNum(Index, i)).StackLimit Then ItemVal = ItemVal - (Item(GetPlayerInvItemNum(Index, i)).StackLimit - GetPlayerInvItemValue(Index, i)) Call SetPlayerInvItemNum(Index, i, ItemNum) Call SetPlayerInvItemValue(Index, i, Item(GetPlayerInvItemNum(Index, i)).StackLimit) If sendUpdate Then Call SendInventoryUpdate(Index, i) GiveInvItem = True GoTo FindAnotherGiveInvItemSlot End If End If End If End If Else Call PlayerMsg(Index, "Your inventory is full.", BrightRed) GiveInvItem = False End If ``` **Server - modPlayer - Function HasItem** Replace this… ``` If Item(itemnum).Type = ITEM_TYPE_CURRENCY Then HasItem = GetPlayerInvItemValue(index, i) Else HasItem = 1 End If ``` …with this: ``` HasItem = GetPlayerInvItemValue(Index, i) ``` **Server - modPlayer - Sub PlayerMapDropItem** Replace this… ``` If Item(GetPlayerInvItemNum(index, invNum)).Type = ITEM_TYPE_CURRENCY Then ' Check if its more then they have and if so drop it all If amount >= GetPlayerInvItemValue(index, invNum) Then MapItem(GetPlayerMap(index), i).Value = GetPlayerInvItemValue(index, invNum) Call MapMsg(GetPlayerMap(index), GetPlayerName(index) & " drops " & GetPlayerInvItemValue(index, invNum) & " " & Trim$(Item(GetPlayerInvItemNum(index, invNum)).Name) & ".", Yellow) Call SetPlayerInvItemNum(index, invNum, 0) Call SetPlayerInvItemValue(index, invNum, 0) Else MapItem(GetPlayerMap(index), i).Value = amount Call MapMsg(GetPlayerMap(index), GetPlayerName(index) & " drops " & amount & " " & Trim$(Item(GetPlayerInvItemNum(index, invNum)).Name) & ".", Yellow) Call SetPlayerInvItemValue(index, invNum, GetPlayerInvItemValue(index, invNum) - amount) End If Else ' Its not a currency object so this is easy MapItem(GetPlayerMap(index), i).Value = 0 ' send message Call MapMsg(GetPlayerMap(index), GetPlayerName(index) & " drops " & CheckGrammar(Trim$(Item(GetPlayerInvItemNum(index, invNum)).Name)) & ".", Yellow) Call SetPlayerInvItemNum(index, invNum, 0) Call SetPlayerInvItemValue(index, invNum, 0) End If ``` …with this: ``` If amount >= GetPlayerInvItemValue(Index, invNum) Then MapItem(GetPlayerMap(Index), i).Value = GetPlayerInvItemValue(Index, invNum) Call MapMsg(GetPlayerMap(Index), GetPlayerName(Index) & " drops " & GetPlayerInvItemValue(Index, invNum) & " " & Trim$(Item(GetPlayerInvItemNum(Index, invNum)).Name) & ".", Yellow) Call SetPlayerInvItemNum(Index, invNum, 0) Call SetPlayerInvItemValue(Index, invNum, 0) Else MapItem(GetPlayerMap(Index), i).Value = amount Call MapMsg(GetPlayerMap(Index), GetPlayerName(Index) & " drops " & amount & " " & Trim$(Item(GetPlayerInvItemNum(Index, invNum)).Name) & ".", Yellow) Call SetPlayerInvItemValue(Index, invNum, GetPlayerInvItemValue(Index, invNum) - amount) End If ``` **Server - modPlayer - Sub PlayerMapGetItem** Below this… ``` If (MapItem(mapNum, i).y = GetPlayerY(index)) Then ``` …add this: ``` FindAnotherPlayerMapGetItemSlot: ``` Replace this… ``` If Item(GetPlayerInvItemNum(index, n)).Type = ITEM_TYPE_CURRENCY Then Call SetPlayerInvItemValue(index, n, GetPlayerInvItemValue(index, n) + MapItem(mapNum, i).Value) Msg = MapItem(mapNum, i).Value & " " & Trim$(Item(GetPlayerInvItemNum(index, n)).Name) Else Call SetPlayerInvItemValue(index, n, 0) Msg = Trim$(Item(GetPlayerInvItemNum(index, n)).Name) End If ``` …with this: ``` If Item(GetPlayerInvItemNum(Index, n)).Type = ITEM_TYPE_CURRENCY Then Call SetPlayerInvItemValue(Index, n, GetPlayerInvItemValue(Index, n) + MapItem(mapNum, i).Value) Msg = MapItem(mapNum, i).Value & " " & Trim$(Item(GetPlayerInvItemNum(Index, n)).Name) End If If Item(GetPlayerInvItemNum(Index, n)).Type ITEM_TYPE_CURRENCY Then If GetPlayerInvItemValue(Index, n) + MapItem(mapNum, i).Value Item(GetPlayerInvItemNum(Index, n)).StackLimit Then MapItem(mapNum, i).Value = MapItem(mapNum, i).Value - (Item(GetPlayerInvItemNum(Index, n)).StackLimit - GetPlayerInvItemValue(Index, n)) Call SetPlayerInvItemValue(Index, n, GetPlayerInvItemValue(Index, n) + (Item(GetPlayerInvItemNum(Index, n)).StackLimit - GetPlayerInvItemValue(Index, n))) Call SendInventoryUpdate(Index, n) GoTo FindAnotherPlayerMapGetItemSlot End If End If End If ``` **Server - modPlayer - Sub TakeBankItem** Replace this… ``` invSlot = FindOpenInvSlot(index, GetPlayerBankItemNum(index, BankSlot)) If invSlot > 0 Then If Item(GetPlayerBankItemNum(index, BankSlot)).Type = ITEM_TYPE_CURRENCY Then Call GiveInvItem(index, GetPlayerBankItemNum(index, BankSlot), amount) Call SetPlayerBankItemValue(index, BankSlot, GetPlayerBankItemValue(index, BankSlot) - amount) If GetPlayerBankItemValue(index, BankSlot) 1 Then Call GiveInvItem(index, GetPlayerBankItemNum(index, BankSlot), 0) Call SetPlayerBankItemValue(index, BankSlot, GetPlayerBankItemValue(index, BankSlot) - 1) Else Call GiveInvItem(index, GetPlayerBankItemNum(index, BankSlot), 0) Call SetPlayerBankItemNum(index, BankSlot, 0) Call SetPlayerBankItemValue(index, BankSlot, 0) End If End If End If ``` …with this: ``` FindAnotherTakeBankItemSlot: invSlot = FindOpenInvSlot(Index, GetPlayerBankItemNum(Index, BankSlot)) If invSlot > 0 Then If Item(GetPlayerBankItemNum(Index, BankSlot)).Type = ITEM_TYPE_CURRENCY Then Call GiveInvItem(Index, GetPlayerBankItemNum(Index, BankSlot), amount) Call SetPlayerBankItemValue(Index, BankSlot, GetPlayerBankItemValue(Index, BankSlot) - amount) If GetPlayerBankItemValue(Index, BankSlot) = 1 Then If amount + GetPlayerInvItemValue(Index, invSlot) GetPlayerInvItemValue(Index, invSlot) Then Exit Function End If ' Check to see if the player has the item If invSlot > 0 Then If ItemVal >= GetPlayerInvItemValue(Index, invSlot) Then TakeInvItem = True Else Call SetPlayerInvItemValue(Index, invSlot, GetPlayerInvItemValue(Index, invSlot) - ItemVal) Call SendInventoryUpdate(Index, invSlot) End If If TakeInvItem Then Call SetPlayerInvItemNum(Index, invSlot, 0) Call SetPlayerInvItemValue(Index, invSlot, 0) ' Send the inventory update Call SendInventoryUpdate(Index, invSlot) Exit Function End If End If End Function ``` **Server - modPlayer - TakeInvSlot** Replace this… ``` If Item(itemnum).Type = ITEM_TYPE_CURRENCY Then ' Is what we are trying to take away more then what they have? If so just set it to zero If ItemVal >= GetPlayerInvItemValue(index, invSlot) Then TakeInvSlot = True Else Call SetPlayerInvItemValue(index, invSlot, GetPlayerInvItemValue(index, invSlot) - ItemVal) End If Else TakeInvSlot = True End If ``` …with this: ``` If ItemVal >= GetPlayerInvItemValue(Index, invSlot) Then TakeInvSlot = True Else Call SetPlayerInvItemValue(Index, invSlot, GetPlayerInvItemValue(Index, invSlot) - ItemVal) End If ``` **Server - modPlayer - Public Sub UseItem** Replace this… ``` Call TakeInvItem(index, Player(index).Inv(invNum).Num, 0) ``` …with this: ``` Call TakeInvItem(Index, invNum, 1) ``` For each case of equipment type (Armor, Weapon, Helmet, Shield) Replace this… ``` TakeInvItem Index, ItemNum, 0 If tempItem > 0 Then GiveInvItem Index, tempItem, 0 ' give back the stored item tempItem = 0 End If ``` …with this: ``` TakeInvItem Index, invNum, 1 If tempItem > 0 Then GiveInvItem Index, tempItem, 1 ' give back the stored item tempItem = 0 End If ``` **Server - modServerTCP - Sub SendTradeUpdate** Replace this… ``` If Item(TempPlayer(index).TradeOffer(i).Num).Type = ITEM_TYPE_CURRENCY Then totalWorth = totalWorth + (Item(GetPlayerInvItemNum(index, TempPlayer(index).TradeOffer(i).Num)).price * TempPlayer(index).TradeOffer(i).Value) Else totalWorth = totalWorth + Item(GetPlayerInvItemNum(index, TempPlayer(index).TradeOffer(i).Num)).price End If ``` …with this: ``` totalWorth = totalWorth + (Item(GetPlayerInvItemNum(Index, TempPlayer(Index).TradeOffer(i).Num)).price * TempPlayer(Index).TradeOffer(i).Value) ``` **Server - modTypes - Private Type ItemRec** Below this… ``` instaCast As Byte ``` …add this: ``` StackLimit As Long ```