@@ -5,7 +5,14 @@ import { objectAction } from '@server/world/actor/player/action/object-action';
5
5
import { ItemContainer } from '@server/world/items/item-container' ;
6
6
import { itemAction } from '@server/world/actor/player/action/item-action' ;
7
7
import { Item } from '@server/world/items/item' ;
8
+ import { buttonAction } from '@server/world/actor/player/action/button-action' ;
8
9
10
+ const buttonIds : number [ ] = [
11
+ 92 , // as note
12
+ 93 , // as item
13
+ 98 , // swap
14
+ 99 , // insert
15
+ ] ;
9
16
10
17
export const openBankInterface : objectAction = ( details ) => {
11
18
details . player . activeWidget = {
@@ -17,9 +24,6 @@ export const openBankInterface: objectAction = (details) => {
17
24
18
25
details . player . outgoingPackets . sendUpdateAllWidgetItems ( widgets . bank . tabWidget , details . player . inventory ) ;
19
26
details . player . outgoingPackets . sendUpdateAllWidgetItems ( widgets . bank . screenWidget , details . player . bank ) ;
20
- details . player . outgoingPackets . updateClientConfig ( 304 , details . player . sessionMetadata [ 'bankRearrangeMode' ] === 'insert' ? 1 : 0 ) ;
21
- details . player . outgoingPackets . updateClientConfig ( 115 , details . player . sessionMetadata [ 'bankWithdrawAs' ] === 'note' ? 1 : 0 ) ;
22
-
23
27
} ;
24
28
25
29
export const depositItem : itemAction = ( details ) => {
@@ -141,6 +145,24 @@ export const withdrawItem: itemAction = (details) => {
141
145
details . player . outgoingPackets . sendUpdateAllWidgetItems ( widgets . bank . screenWidget , details . player . bank ) ;
142
146
} ;
143
147
148
+ export const btnAction : buttonAction = ( details ) => {
149
+ const { player, buttonId} = details ;
150
+ player . settingChanged ( buttonId ) ;
151
+
152
+ const settingsMappings = {
153
+ 92 : { setting : 'bankWithdrawNoteMode' , value : 1 } ,
154
+ 93 : { setting : 'bankWithdrawNoteMode' , value : 0 } ,
155
+ 98 : { setting : 'bankInsertMode' , value : 0 } ,
156
+ 99 : { setting : 'bankInsertMode' , value : 1 } ,
157
+ } ;
158
+ if ( ! settingsMappings . hasOwnProperty ( buttonId ) ) {
159
+ return ;
160
+ }
161
+
162
+ const config = settingsMappings [ buttonId ] ;
163
+ player . settings [ config . setting ] = config . value ;
164
+ } ;
165
+
144
166
145
167
export default new RunePlugin ( [ {
146
168
type : ActionType . OBJECT_ACTION ,
@@ -158,4 +180,4 @@ export default new RunePlugin([{
158
180
widgets : widgets . bank . screenWidget ,
159
181
options : [ 'withdraw-1' , 'withdraw-5' , 'withdraw-10' , 'withdraw-all' ] ,
160
182
action : withdrawItem ,
161
- } ] ) ;
183
+ } , { type : ActionType . BUTTON , widgetId : widgets . bank . screenWidget . widgetId , buttonIds : buttonIds , action : btnAction } ] ) ;
0 commit comments