@@ -47,7 +47,7 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
47
47
function noOp ( ) { }
48
48
// END: Utilities
49
49
// START: Cheats
50
- replaceProp ( sc . PlayerLevelTools , ' computeExp' , ( originalComputeExp ) => {
50
+ replaceProp ( sc . PlayerLevelTools , " computeExp" , ( originalComputeExp ) => {
51
51
return ( ...args ) => {
52
52
const exp = originalComputeExp . apply ( sc . PlayerLevelTools , args ) ;
53
53
// If xpcheat is enabled we multiple the exp by xpmultiplier and minimally add xpmingain experience.
@@ -64,7 +64,7 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
64
64
sc . ARENA_BONUS_OBJECTIVE . CHAIN ,
65
65
sc . ARENA_BONUS_OBJECTIVE . ITEMS_USED ,
66
66
] . forEach ( function ( bonus ) {
67
- replaceProp ( bonus , ' check' , ( originalCheck ) => {
67
+ replaceProp ( bonus , " check" , ( originalCheck ) => {
68
68
return ( ...args ) => {
69
69
// If arenaalwaysbonuses is enabled the checks always returns true.
70
70
return arenaalwaysbonuses || originalCheck . apply ( this , args ) ;
@@ -148,7 +148,7 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
148
148
}
149
149
} ,
150
150
addScore ( a , b ) {
151
- if ( ! arenanodamagepenalty || a !== ' DAMAGE_TAKEN' ) {
151
+ if ( ! arenanodamagepenalty || a !== " DAMAGE_TAKEN" ) {
152
152
// If arenanodamagepenalty is enabled we don't add damage taken.
153
153
this . parent . apply ( this , arguments ) ;
154
154
}
@@ -161,8 +161,8 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
161
161
return this . parent . apply ( this , arguments ) ;
162
162
} ,
163
163
} ) ;
164
- const getSpReplacer = toggleReplacer ( sc . CombatParams . prototype , ' getSp' , ( ) => function ( ) { return this . maxSp } ) ;
165
- const cancelActionReplacer = toggleReplacer ( ig . ENTITY . Player . prototype , ' cancelAction' , ( ) => noOp ) ;
164
+ const getSpReplacer = toggleReplacer ( sc . CombatParams . prototype , " getSp" , ( ) => function ( ) { return this . maxSp } ) ;
165
+ const cancelActionReplacer = toggleReplacer ( ig . ENTITY . Player . prototype , " cancelAction" , ( ) => noOp ) ;
166
166
ig . ENTITY . Player . inject ( {
167
167
startCharge ( ) {
168
168
// If ignorespcheat is enabled we replace the getSp function to return the max sp instead of current sp.
@@ -195,7 +195,7 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
195
195
this . parent . apply ( this , arguments ) ;
196
196
} ,
197
197
} ) ;
198
- const removeItemReplacer = toggleReplacer ( sc . PlayerModel . prototype , ' removeItem' , ( ) => noOp ) ;
198
+ const removeItemReplacer = toggleReplacer ( sc . PlayerModel . prototype , " removeItem" , ( ) => noOp ) ;
199
199
sc . TradeModel . inject ( {
200
200
doTrade ( ) {
201
201
// If tradecheat is enabled we replace the removeItem function with one that does nothing.
@@ -205,16 +205,16 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
205
205
return returnValue ;
206
206
} ,
207
207
} ) ;
208
- const getCombatRankByLabelReplacer = toggleReplacer ( sc . GameModel . prototype , ' getCombatRankByLabel' , ( ) => ( ) => 0 ) ;
209
- const mathRandomReplacer = toggleReplacer ( Math , ' random' , ( ) => ( ) => 0 ) ;
208
+ const getCombatRankByLabelReplacer = toggleReplacer ( sc . GameModel . prototype , " getCombatRankByLabel" , ( ) => ( ) => 0 ) ;
209
+ const mathRandomReplacer = toggleReplacer ( Math , " random" , ( ) => ( ) => 0 ) ;
210
210
sc . EnemyType . inject ( {
211
211
resolveItemDrops ( a ) {
212
212
enemydropcheat && getCombatRankByLabelReplacer . replace ( ) && mathRandomReplacer . replace ( ) && ( a . boosterState = sc . ENEMY_BOOSTER_STATE . BOOSTED ) ;
213
213
this . parent . apply ( this , arguments ) ;
214
214
enemydropcheat && getCombatRankByLabelReplacer . restore ( ) && mathRandomReplacer . restore ( ) ;
215
215
} ,
216
216
} ) ;
217
- const getModifierReplacer = toggleReplacer ( sc . CombatParams . prototype , ' getModifier' , ( ) => ( ) => 1000 ) ;
217
+ const getModifierReplacer = toggleReplacer ( sc . CombatParams . prototype , " getModifier" , ( ) => ( ) => 1000 ) ;
218
218
ig . ENTITY . ItemDestruct . inject ( {
219
219
dropItem ( a ) {
220
220
plantdropcheat && mathRandomReplacer . replace ( ) && getModifierReplacer . replace ( ) ;
@@ -225,7 +225,7 @@ ig.module("cheats").requires("game.feature.player.player-level", "game.feature.p
225
225
// END: Cheats
226
226
} ) ;
227
227
ig . baked = ! 0 ;
228
- ig . module ( "cheats-gui" ) . requires ( "game.feature.gui.screen.pause-screen" , "game.feature.menu.gui.base-menu" , "game.feature.menu.menu-model" , "impact.base.lang" , "impact.feature.gui.gui" , "game.feature.interact.button-group" , "game.feature.menu.gui.menu-misc" , "game.feature.menu.gui.options.options-misc" , "game.feature.gui.base.text" , "game.feature.gui.base.button" , "impact.feature.interact.press-repeater" , "game.feature.gui.base.numbers" ) . defines ( function ( ) {
228
+ ig . module ( "cheats-gui" ) . requires ( "game.feature.gui.screen.title-screen" , "game.feature.gui.screen. pause-screen", "game.feature.menu.gui.base-menu" , "game.feature.menu.menu-model" , "impact.base.lang" , "impact.feature.gui.gui" , "game.feature.interact.button-group" , "game.feature.menu.gui.menu-misc" , "game.feature.menu.gui.options.options-misc" , "game.feature.gui.base.text" , "game.feature.gui.base.button" , "impact.feature.interact.press-repeater" , "game.feature.gui.base.numbers" ) . defines ( function ( ) {
229
229
// START: Lang Extension
230
230
// If this code is changed into a real mod/extension this can be moved into a separate lang JSON.
231
231
const LANG_EXTENSION = {
@@ -264,7 +264,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
264
264
this . parent . apply ( this , arguments ) ;
265
265
function setProperties ( from , to ) {
266
266
for ( const [ key , value ] of Object . entries ( from ) ) {
267
- if ( typeof value === ' object' ) {
267
+ if ( typeof value === " object" ) {
268
268
setProperties ( value , to [ key ] = to [ key ] || { } ) ;
269
269
} else {
270
270
to [ key ] = value ;
@@ -278,28 +278,28 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
278
278
// END: Lang Extension
279
279
// START: Cheats Menu
280
280
const CHEAT_CONFIG = [
281
- [ ' xpcheat' , { type : ' CHECKBOX' } ] ,
282
- [ ' xpmultiplier' , { type : ' SLIDER' , min : 0 , max : 100 } ] ,
283
- [ ' xpmingain' , { type : ' SLIDER' , min : 0 , max : 1000 } ] ,
284
- [ ' creditcheat' , { type : ' CHECKBOX' } ] ,
285
- [ ' creditmultiplier' , { type : ' SLIDER' , min : 0 , max : 100 } ] ,
286
- [ ' donotremovecredit' , { type : ' CHECKBOX' } ] ,
287
- [ ' donotremovearenacoins' , { type : ' CHECKBOX' } ] ,
288
- [ ' arenaalwaysbonuses' , { type : ' CHECKBOX' } ] ,
289
- [ ' arenaperfectchain' , { type : ' CHECKBOX' } ] ,
290
- [ ' arenanodamagepenalty' , { type : ' CHECKBOX' } ] ,
291
- [ ' arenaalwaysplat' , { type : ' CHECKBOX' } ] ,
292
- [ ' ignorespcheat' , { type : ' CHECKBOX' } ] ,
293
- [ ' overheatelim' , { type : ' CHECKBOX' } ] ,
294
- [ ' invincible' , { type : ' CHECKBOX' } ] ,
295
- [ ' cpcheat' , { type : ' CHECKBOX' } ] ,
296
- [ ' consumableinfinite' , { type : ' CHECKBOX' } ] ,
297
- [ ' consumablenocooldown' , { type : ' CHECKBOX' } ] ,
298
- [ ' noknockbackonhit' , { type : ' CHECKBOX' } ] ,
299
- [ ' noactioncancelonhit' , { type : ' CHECKBOX' } ] ,
300
- [ ' tradecheat' , { type : ' CHECKBOX' } ] ,
301
- [ ' enemydropcheat' , { type : ' CHECKBOX' } ] ,
302
- [ ' plantdropcheat' , { type : ' CHECKBOX' } ] ,
281
+ [ " xpcheat" , { type : " CHECKBOX" } ] ,
282
+ [ " xpmultiplier" , { type : " SLIDER" , min : 0 , max : 100 } ] ,
283
+ [ " xpmingain" , { type : " SLIDER" , min : 0 , max : 1000 } ] ,
284
+ [ " creditcheat" , { type : " CHECKBOX" } ] ,
285
+ [ " creditmultiplier" , { type : " SLIDER" , min : 0 , max : 100 } ] ,
286
+ [ " donotremovecredit" , { type : " CHECKBOX" } ] ,
287
+ [ " donotremovearenacoins" , { type : " CHECKBOX" } ] ,
288
+ [ " arenaalwaysbonuses" , { type : " CHECKBOX" } ] ,
289
+ [ " arenaperfectchain" , { type : " CHECKBOX" } ] ,
290
+ [ " arenanodamagepenalty" , { type : " CHECKBOX" } ] ,
291
+ [ " arenaalwaysplat" , { type : " CHECKBOX" } ] ,
292
+ [ " ignorespcheat" , { type : " CHECKBOX" } ] ,
293
+ [ " overheatelim" , { type : " CHECKBOX" } ] ,
294
+ [ " invincible" , { type : " CHECKBOX" } ] ,
295
+ [ " cpcheat" , { type : " CHECKBOX" } ] ,
296
+ [ " consumableinfinite" , { type : " CHECKBOX" } ] ,
297
+ [ " consumablenocooldown" , { type : " CHECKBOX" } ] ,
298
+ [ " noknockbackonhit" , { type : " CHECKBOX" } ] ,
299
+ [ " noactioncancelonhit" , { type : " CHECKBOX" } ] ,
300
+ [ " tradecheat" , { type : " CHECKBOX" } ] ,
301
+ [ " enemydropcheat" , { type : " CHECKBOX" } ] ,
302
+ [ " plantdropcheat" , { type : " CHECKBOX" } ] ,
303
303
] ;
304
304
function getCheatValue ( cheat ) {
305
305
return window [ cheat ] ;
@@ -330,6 +330,24 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
330
330
this . list . setSize ( 400 , 240 ) ;
331
331
this . list . setPos ( 0 , 0 ) ;
332
332
this . list . setAlign ( ig . GUI_ALIGN . X_CENTER , ig . GUI_ALIGN . Y_CENTER ) ;
333
+ // Setup animations so that the list slides in like the other lists do (ex: Save, Options, etc).
334
+ this . list . hook . transitions = {
335
+ DEFAULT : {
336
+ state : { } ,
337
+ time : 0.2 ,
338
+ timeFunction : KEY_SPLINES . LINEAR ,
339
+ } ,
340
+ HIDDEN : {
341
+ state : {
342
+ alpha : 0 ,
343
+ offsetX : 218 ,
344
+ } ,
345
+ time : 0.2 ,
346
+ timeFunction : KEY_SPLINES . LINEAR ,
347
+ }
348
+ } ;
349
+ // List starts hidden.
350
+ this . list . doStateTransition ( "HIDDEN" , true ) ;
333
351
334
352
// Add press callback so we can react when checkboxes are changed.
335
353
this . buttonGroup . addPressCallback ( ( control ) => {
@@ -352,7 +370,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
352
370
this . contents . addChildGui ( label ) ;
353
371
354
372
switch ( data . type ) {
355
- case ' CHECKBOX' : {
373
+ case " CHECKBOX" : {
356
374
const button = new sc . CheckboxGui ( cheatValue , 30 ) ;
357
375
button . setAlign ( ig . GUI_ALIGN . X_LEFT , ig . GUI_ALIGN . Y_TOP ) ;
358
376
button . setPos ( 200 , rowYPos ) ;
@@ -361,7 +379,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
361
379
this . buttonGroup . addFocusGui ( button , 0 , row ) ;
362
380
break ;
363
381
}
364
- case ' SLIDER' : {
382
+ case " SLIDER" : {
365
383
const slider = new sc . OptionFocusSlider ( ( newValue ) => {
366
384
setCheatValue ( cheat , newValue ) ;
367
385
updateNumberDisplay ( ) ;
@@ -413,7 +431,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
413
431
const control = this . buttonGroup . getCurrentElement ( ) ;
414
432
const repeaterValue = this . getRepeaterValue ( ) ;
415
433
// Handle keyboard up and down keys.
416
- if ( repeaterValue === 'up' || repeaterValue === ' down' ) {
434
+ if ( repeaterValue === "up" || repeaterValue === " down" ) {
417
435
const controlTopY = control . hook . pos . y ;
418
436
const controlBottomY = controlTopY + control . hook . size . y ;
419
437
const scrollTopY = this . list . getScrollY ( ) ;
@@ -428,12 +446,12 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
428
446
}
429
447
// Handle left and right for sliders.
430
448
if ( control instanceof sc . OptionFocusSlider ) {
431
- // The value we update by varies based on whether we' re holding certain buttons for A11Y.
449
+ // The value we update by varies based on whether we" re holding certain buttons for A11Y.
432
450
const changeValue = sc . control . dashHold ( ) ? 100 : sc . control . quickmenu ( ) ? 10 : 1 ;
433
451
switch ( repeaterValue ) {
434
- case ' right' :
435
- case ' left' : {
436
- const direction = repeaterValue === ' left' ? - 1 : 1 ;
452
+ case " right" :
453
+ case " left" : {
454
+ const direction = repeaterValue === " left" ? - 1 : 1 ;
437
455
const newValue = control . getValue ( ) + ( changeValue * direction ) ;
438
456
const clamped = Math . max ( control . slider . minValue , Math . min ( control . slider . maxValue , newValue ) ) ;
439
457
control . setValue ( clamped ) ;
@@ -446,13 +464,13 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
446
464
} ,
447
465
getRepeaterValue : function ( ) {
448
466
if ( sc . control . rightDown ( ) ) {
449
- this . repeater . setDown ( ' right' ) ;
467
+ this . repeater . setDown ( " right" ) ;
450
468
} else if ( sc . control . leftDown ( ) ) {
451
- this . repeater . setDown ( ' left' ) ;
469
+ this . repeater . setDown ( " left" ) ;
452
470
} else if ( sc . control . downDown ( ) ) {
453
- this . repeater . setDown ( ' down' ) ;
471
+ this . repeater . setDown ( " down" ) ;
454
472
} else if ( sc . control . upDown ( ) ) {
455
- this . repeater . setDown ( 'up' ) ;
473
+ this . repeater . setDown ( "up" ) ;
456
474
}
457
475
return this . repeater . getPressed ( ) ;
458
476
} ,
@@ -468,6 +486,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
468
486
sc . menu . moveLeaSprite ( 0 , 0 , sc . MENU_LEA_STATE . HIDDEN ) ; // No idea what this is.
469
487
sc . menu . buttonInteract . pushButtonGroup ( this . buttonGroup ) ; // Make our button group active.
470
488
ig . interact . setBlockDelay ( 0.2 ) ; // Don't let the user interact while the menu is animating into place.
489
+ this . list . doStateTransition ( "DEFAULT" ) ; // Animation the list.
471
490
} ,
472
491
hideMenu ( ) {
473
492
this . removeObservers ( ) ;
@@ -477,6 +496,7 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
477
496
exitMenu ( ) {
478
497
sc . menu . buttonInteract . removeButtonGroup ( this . buttonGroup ) ; // Make our button group inactive.
479
498
sc . menu . popBackCallback ( ) ; // Unregister the back button handling.
499
+ this . list . doStateTransition ( "HIDDEN" ) ; // Animation the list.
480
500
} ,
481
501
onBackButtonPress ( ) {
482
502
// Pop our menu to go back up to the menu that created ours.
@@ -502,6 +522,32 @@ ig.module("cheats-gui").requires("game.feature.gui.screen.pause-screen", "game.f
502
522
return this . parent . apply ( this , arguments ) ;
503
523
} ,
504
524
} ) ;
525
+ sc . TitleScreenButtonGui . inject ( {
526
+ cheatsButton : null ,
527
+ init ( ) {
528
+ this . parent ( ) ;
529
+ this . cheatsButton = new sc . ButtonGui ( ig . lang . get ( "sc.cheats.title" ) , this . gameCodeButton . hook . size . x ) ;
530
+ this . cheatsButton . setAlign ( this . gameCodeButton . hook . align . x , this . gameCodeButton . hook . align . y ) ;
531
+ this . cheatsButton . setPos ( this . gameCodeButton . hook . pos . x , this . gameCodeButton . hook . pos . y + 28 ) ;
532
+ this . cheatsButton . onButtonPress = ( ) => {
533
+ // What menu should be entered when clicked.
534
+ sc . menu . setDirectMode ( true , sc . MENU_SUBMENU . CHEATS ) ;
535
+ sc . model . enterMenu ( true ) ;
536
+ } ;
537
+ this . cheatsButton . hook . transitions = this . gameCodeButton . hook . transitions ;
538
+ this . cheatsButton . doStateTransition ( "HIDDEN" , true ) ;
539
+ this . buttonGroup . insertFocusGui ( this . cheatsButton , 1 , 0 ) ;
540
+ this . insertChildGui ( this . cheatsButton ) ;
541
+ } ,
542
+ show ( ) {
543
+ this . parent ( ) ;
544
+ this . cheatsButton . doStateTransition ( "DEFAULT" ) ;
545
+ } ,
546
+ hide ( a ) {
547
+ this . parent . apply ( this , arguments ) ;
548
+ this . cheatsButton . doStateTransition ( "HIDDEN" , a ) ;
549
+ } ,
550
+ } ) ;
505
551
sc . PauseScreenGui . inject ( {
506
552
cheatsButton : null ,
507
553
init ( ) {
0 commit comments