@@ -9,6 +9,8 @@ import Vector3 from 'modloader64_api/math/Vector3';
99class cheatmenu_config {
1010 "hearts" : number ;
1111 "heartsLocked" : boolean ;
12+ "magic" : number ;
13+ "magicLocked" : boolean ;
1214 "rupees" : number ;
1315 "rupeesLocked" : boolean ;
1416 "time" : number ;
@@ -27,11 +29,13 @@ class cheatmenu_config{
2729 "bombsLocked" : boolean ;
2830 "bombchus" : number ;
2931 "bombchusLocked" : boolean ;
32+ "beans" : number ;
33+ "beansLocked" : boolean ;
3034 "arrows" : number ;
3135 "arrowsLocked" : boolean ;
32- [ key : string ] : any ;
3336 constructor ( ) {
3437 this . heartsLocked = false ;
38+ this . magicLocked = false ;
3539 this . rupeesLocked = false ;
3640 this . timeLocked = false ;
3741 this . position = new Vector3 ( 0 , 0 , 0 ) ;
@@ -43,6 +47,7 @@ class cheatmenu_config{
4347 this . seedsLocked = false ;
4448 this . bombsLocked = false ;
4549 this . bombchusLocked = false ;
50+ this . beansLocked = false ;
4651 this . arrowsLocked = false ;
4752 }
4853}
@@ -69,8 +74,11 @@ class cheatmenu implements IPlugin{
6974 if ( this . config . heartsLocked ) {
7075 this . core . save . health = this . config . hearts ;
7176 }
77+ if ( this . config . magicLocked ) {
78+ this . core . save . magic_current = this . config . magic ;
79+ }
7280 if ( this . config . rupeesLocked ) {
73- this . ModLoader . emulator . rdramWrite16 ( 0x11A604 , this . config . rupees ) ;
81+ this . core . save . rupee_count = this . config . rupees ;
7482 }
7583 if ( this . config . timeLocked ) {
7684 this . core . save . world_time = this . config . time ;
@@ -90,6 +98,9 @@ class cheatmenu implements IPlugin{
9098 if ( this . config . bombchusLocked ) {
9199 this . core . save . inventory . bombchuCount = this . config . bombchus ;
92100 }
101+ if ( this . config . beansLocked ) {
102+ this . core . save . inventory . magicBeansCount = this . config . beans ;
103+ }
93104 if ( this . config . arrowsLocked ) {
94105 this . core . save . inventory . arrows = this . config . arrows ;
95106 }
@@ -98,6 +109,51 @@ class cheatmenu implements IPlugin{
98109 // ... Set upwards velocity (?)
99110 this . ModLoader . emulator . rdramWrite16 ( 0x1daa90 , 0x40cb ) ;
100111 }
112+
113+ if ( this . config . hearts !== this . core . save . health ) {
114+ this . config . hearts = this . core . save . health ;
115+ this . ModLoader . gui . tunnel . send ( "cheatmenu:HealthUpdate" , this . config . hearts ) ;
116+ }
117+ if ( this . config . magic !== this . core . save . magic_current ) {
118+ this . config . magic = this . core . save . magic_current ;
119+ this . ModLoader . gui . tunnel . send ( "cheatmenu:MagicUpdate" , this . config . magic ) ;
120+ }
121+ if ( this . config . rupees !== this . core . save . rupee_count ) {
122+ this . config . rupees = this . core . save . rupee_count ;
123+ this . ModLoader . gui . tunnel . send ( "cheatmenu:RupeeUpdate" , this . config . rupees ) ;
124+ }
125+ if ( this . config . time !== this . core . save . world_time ) {
126+ this . config . time = this . core . save . world_time ;
127+ this . ModLoader . gui . tunnel . send ( "cheatmenu:TimeUpdate" , this . config . time ) ;
128+ }
129+ if ( this . config . dekuNuts !== this . core . save . inventory . dekuNutsCount ) {
130+ this . config . dekuNuts = this . core . save . inventory . dekuNutsCount ;
131+ this . ModLoader . gui . tunnel . send ( "cheatmenu:DekuNutUpdate" , this . config . dekuNuts ) ;
132+ }
133+ if ( this . config . dekuSticks !== this . core . save . inventory . dekuSticksCount ) {
134+ this . config . dekuSticks = this . core . save . inventory . dekuSticksCount ;
135+ this . ModLoader . gui . tunnel . send ( "cheatmenu:DekuStickUpdate" , this . config . dekuSticks ) ;
136+ }
137+ if ( this . config . seeds !== this . core . save . inventory . dekuSeeds ) {
138+ this . config . seeds = this . core . save . inventory . dekuSeeds ;
139+ this . ModLoader . gui . tunnel . send ( "cheatmenu:SeedUpdate" , this . config . seeds ) ;
140+ }
141+ if ( this . config . bombs !== this . core . save . inventory . bombsCount ) {
142+ this . config . bombs = this . core . save . inventory . bombsCount ;
143+ this . ModLoader . gui . tunnel . send ( "cheatmenu:BombUpdate" , this . config . bombs ) ;
144+ }
145+ if ( this . config . bombchus !== this . core . save . inventory . bombchuCount ) {
146+ this . config . bombchus = this . core . save . inventory . bombchuCount ;
147+ this . ModLoader . gui . tunnel . send ( "cheatmenu:BombchuUpdate" , this . config . bombchus ) ;
148+ }
149+ if ( this . config . beans !== this . core . save . inventory . magicBeansCount ) {
150+ this . config . beans = this . core . save . inventory . magicBeansCount ;
151+ this . ModLoader . gui . tunnel . send ( "cheatmenu:BeanUpdate" , this . config . bombchus ) ;
152+ }
153+ if ( this . config . arrows !== this . core . save . inventory . arrows ) {
154+ this . config . arrows = this . core . save . inventory . arrows ;
155+ this . ModLoader . gui . tunnel . send ( "cheatmenu:ArrowUpdate" , this . config . arrows ) ;
156+ }
101157 if ( this . config . position . x !== this . core . link . position . getRawPos ( ) . readFloatBE ( 0 ) || this . config . position . y !== this . core . link . position . getRawPos ( ) . readFloatBE ( 4 ) || this . config . position . z !== this . core . link . position . getRawPos ( ) . readFloatBE ( 8 ) ) {
102158 this . config . position . x = this . core . link . position . getRawPos ( ) . readFloatBE ( 0 ) ;
103159 this . config . position . y = this . core . link . position . getRawPos ( ) . readFloatBE ( 4 ) ;
@@ -122,38 +178,23 @@ class cheatmenu implements IPlugin{
122178
123179 update ( ) {
124180 this . core . save . health = this . config . hearts ;
181+ this . core . save . magic_current = this . config . magic ;
125182 this . core . save . world_time = this . config . time
126- this . ModLoader . emulator . rdramWrite16 ( 0x11A604 , this . config . rupees ) ;
183+ this . core . save . rupee_count = this . config . rupees ;
127184 this . core . save . inventory . dekuNutsCount = this . config . dekuNuts ;
128185 this . core . save . inventory . dekuSticksCount = this . config . dekuSticks ;
129186 this . core . save . inventory . dekuSeeds = this . config . seeds ;
130187 this . core . save . inventory . bombsCount = this . config . bombs ;
131188 this . core . save . inventory . bombchuCount = this . config . bombchus ;
189+ this . core . save . inventory . magicBeansCount = this . config . beans ;
132190 this . core . save . inventory . arrows = this . config . arrows ;
133191 }
134192
135- requestRefresh ( ) {
136- this . config . hearts = this . core . save . health ;
137- this . config . time = this . core . save . world_time ;
138- this . config . rupees = this . ModLoader . emulator . rdramRead16 ( 0x11A604 ) ;
139- this . config . dekuNuts = this . core . save . inventory . dekuNutsCount ;
140- this . config . dekuSticks = this . core . save . inventory . dekuSticksCount ;
141- this . config . seeds = this . core . save . inventory . dekuSeeds ;
142- this . config . bombs = this . core . save . inventory . bombsCount ;
143- this . config . bombchus = this . core . save . inventory . bombchuCount ;
144- this . config . arrows = this . core . save . inventory . arrows ;
145- this . ModLoader . gui . tunnel . send ( "cheatmenu:CheatUpdate" , this . config ) ;
146- }
147193
148194 @EventHandler ( OotEvents . ON_SAVE_LOADED )
149- onSaveLoaded ( ) {
195+ requestRefresh ( ) {
150196 this . saveLoaded = true ;
151- this . requestRefresh ( ) ;
152- }
153-
154- @TunnelMessageHandler ( "cheatmenu:RequestRefresh" )
155- onRequestRefresh ( ) {
156- this . requestRefresh ( ) ;
197+ this . ModLoader . gui . tunnel . send ( "cheatmenu:SaveUpdate" , this . config ) ;
157198 }
158199}
159200
0 commit comments