File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { filestore } from '@server/game/game-server';
44import { hasValueNotNull } from '@engine/util/data' ;
55import { findItem } from '@engine/config/config-handler' ;
66import { logger } from '@runejs/core' ;
7+ import { fromNote } from '.' ;
78
89
910export interface ContainerUpdateEvent {
@@ -308,7 +309,7 @@ export class ItemContainer {
308309 if ( ! itemDefinition ) {
309310 throw new Error ( `Item ID ${ item . itemId } not found!` ) ;
310311 }
311- if ( itemDefinition . stackable || everythingStacks ) {
312+ if ( itemDefinition . stackable || everythingStacks || fromNote ( item ) > - 1 ) {
312313 if ( this . has ( item . itemId ) ) {
313314 const invItem = this . items [ this . findIndex ( item . itemId ) ] ;
314315 return invItem . amount + item . amount <= 2147483647 ;
Original file line number Diff line number Diff line change @@ -114,10 +114,12 @@ export const withdrawItem: itemInteractionActionHandler = (details) => {
114114 }
115115
116116 let itemIdToAdd : number = details . itemId ;
117+ let stackable = details . itemDetails . stackable ;
117118 if ( details . player . settings . bankWithdrawNoteMode ) {
118119 const toNoteId : number = toNote ( details . itemId ) ;
119120 if ( toNoteId > - 1 ) {
120121 itemIdToAdd = toNoteId ;
122+ stackable = true ;
121123 } else {
122124 details . player . sendMessage ( 'This item can not be withdrawn as a note.' ) ;
123125 }
@@ -154,7 +156,7 @@ export const withdrawItem: itemInteractionActionHandler = (details) => {
154156 countToRemove = itemAmount ;
155157 }
156158
157- if ( ! details . itemDetails . stackable ) {
159+ if ( ! stackable ) {
158160 const slots = playerInventory . getOpenSlotCount ( ) ;
159161 if ( slots < countToRemove ) {
160162 countToRemove = slots ;
@@ -170,7 +172,11 @@ export const withdrawItem: itemInteractionActionHandler = (details) => {
170172 amount : removeFromContainer ( playerBank , details . itemId , countToRemove )
171173 } ;
172174
173- playerInventory . add ( { itemId : itemToAdd . itemId , amount : itemToAdd . amount } ) ;
175+ if ( stackable )
176+ playerInventory . add ( { itemId : itemToAdd . itemId , amount : itemToAdd . amount } ) ;
177+ else
178+ for ( let count = 0 ; count < itemToAdd . amount ; count ++ )
179+ playerInventory . add ( { itemId : itemToAdd . itemId , amount : 1 } ) ;
174180
175181 updateBankingInterface ( details . player ) ;
176182} ;
You can’t perform that action at this time.
0 commit comments