-
Notifications
You must be signed in to change notification settings - Fork 0
/
LMPGames_ClassChanger.js
3666 lines (3134 loc) · 110 KB
/
LMPGames_ClassChanger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*:
* @plugindesc Allows class changing using note tags w/ custom menu called by plugin command.
* @title Class Changer
* @author LMPGames
* @date 12/17/2021
* @version 2.0
* @filename LMPGames_ClassChanger.js
* @url https://github.com/Geowil/LMPGames_ClassChanger
*
*
* @param System Settings
* @desc Settings that enable or disable to change the plugin behavior.
*
*
* @param Is LMPGames_AWP Installed
* @parent System Settings
* @desc If turned on, enables support for LMPGames_AWP plugin. !~Currently not implemented~!
* @type boolean
* @default false
*
*
* @param Enable Currency Cost
* @parent System Settings
* @desc When enabled, turns on Currency Cost System. If enabled, cost formula required to be in note tags.
* @type boolean
* @default false
*
*
* @param Enable Item Cost
* @parent System Settings
* @desc When enabled, turns on Item Cost System. If enabled, cost formula and item id is required to be in the note tags.
* @type boolean
* @default false
*
*
* @param Enable Gender Requirements
* @parent System Settings
* @desc When enabled, turns on character gender requirements for changing classes.
* @type boolean
* @default false
*
*
* @param Enable Existing Class Requirement Bypass
* @parent System Settings
* @desc When enabled, if a character has been a class before, they don't have to meet the requirements to change to it again. See help for more info.
* @type boolean
* @default false
*
*
* @param Use Class Description
* @parent System Settings
* @desc When enabled, allows you to add a description for each class to them note tag for this plugin.
* @type boolean
* @default false
*
*
* @param Show Extended Parameters
* @parent System Settings
* @desc When enabled, will display SP and EX params in the class information window.
* @type boolean
* @default false
*
*
* @param Only Show Non-Zero Parameters
* @parent System Settings
* @desc When enabled, will hide parameters with a value of 0
* @type boolean
* @default false
*
*
* @param Enable Element Trait Icons
* @parent System Settings
* @desc When enabled, shows an icon with traits. You MUST set this up manually in the Element Trait Icon Mapping setting.
* @type boolean
* @default false
*
*
* @param Use Aliases
* @parent System Settings
* @desc When enabled, will automatically use alias placed in class note tag instead of the full class name.
* @type boolean
* @default false
*
*
* @param Use Cost on Bypass
* @parent System Settings
* @desc When enabled, bypass conditions will not bypass cost Requirements as well.
* @type boolean
* @default true
*
*
* @param Element Resist Display Mode
* @parent System Settings
* @desc Allows you to select the display mode for resistances and weaknesses. Mode 1: 150%/50% Mode 2: +50%/-50%
* @type number
* @min 1
* @max 2
* @default 1
*
*
* @param Currency Icon ID
* @parent System Settings
* @desc This setting sets the icon id to use with currency in the cost and currency windows.
* @type text
* @default 0
*
*
* @param Cost Item ID
* @parent System Settings
* @desc The ID for the item used by the item cost system. Required if item cost is enabled.
* @type Item
* @default 1
*
*
* @param Gender Mapping
* @parent System Settings
* @desc This setting allows you to create genders for gender class requirements. See Help for more information.
* @type note
* @default "{\"Male\" : \"M\", \"Female\" : \"F\", \"Other\" : \"O\"}"
*
*
* @param Element Trait Icon Mapping
* @parent System Settings
* @desc Maps the icon id to the element. Icon ids should be in the same order as the elements in your Type tab Elements list.
* @type note
* @default "[0, 76, 64, 65, 66, 67, 68, 69, 70, 71]"
*
*
* @param Element Attribute Order Mode
* @parent System Settings
* @desc This setting allows you to set element attribute order by. 1: desc 2: asc
* @type number
* @min 1
* @max 2
* @default 1
*
*
* @param Ignore Skill List
* @parent System Settings
* @desc Skill ids in this list will not be displayed in the class info by the plugin.
* @type note
* @default "[1, 2, 6, 7]"
*
*
* @param Font Settings
* @desc These settings control font size in various parts of the plugin.
*
*
* @param Font Color Settings
* @parent Font Settings
* @desc These settings allow you to change the font colors used in the plugin.
*
*
* @param Cost Requirement Pass Color
* @parent Font Color Settings
* @desc This sets the color for cost requirements that the player passes.
* @default #00CC00
*
*
* @param Cost Requirement Fail Color
* @parent Font Color Settings
* @desc This sets the color for the cost requirments that the player fails.
* @default #FF0000
*
*
* @param Class Requirement Pass Text Code value
* @parent Font Color Settings
* @desc This sets the text code to color the text in the requirements window when an item is passing. See help text for more info.
* @type text
* @default 0
*
*
* @param Class Requirement Fail Text Code value
* @parent Font Color Settings
* @desc This sets the text code to color the text in the requirements window when an item is failing. See help text for more info.
* @type text
* @default 10
*
*
* @param Class List Can Change Color
* @parent Font Color Settings
* @desc This sets the color of the list items in the class selection list if the player is able to change to that class.
* @default #FFFFFF
*
*
* @param Class List Cannot Change Color
* @parent Font Color Settings
* @desc This sets the color of the list items in the class selection list if the player is not able to change to that class.
* @default #787878
*
*
* @param Default Class List Color
* @parent Font Color Settings
* @desc This sets the color for classes in the class list that the player has already unlocked.
* @default #FFF
*
*
* @param Font Size Settings
* @parent Font Settings
*
*
* @param Class List Font Size
* @parent Font Size Settings
* @desc Sets the font size for class names in the Class List window.
* @type Text
* @default 26
*
*
* @param Actor Class List Content Font Size
* @parent Font Size Settings
* @desc Sets the font size for class listings in the 'Previous Classes' window.
* @type Text
* @default 22
*
*
* @param Actor Class List Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the heading for the "Previous Classes" window.
* @type text
* @default 24
*
*
* @param Class Requirements Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the heading for the "Class Reqs" window.
* @type text
* @default 24
*
*
* @param Class Requirements Group Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the group headings (IE: Level Requirement) in the "Class Reqs" window.
* @type text
* @default 22
*
*
* @param Class Requirements Content Font Size
* @parent Font Size Settings
* @desc Sets the font size for the requirement line items in the "Class Reqs" window.
* @type text
* @default 20
*
*
* @param Class Information Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the heading for the Class Information window.
* @type text
* @default 32
*
*
* @param Class Information Group Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the group heading for the Class Information window.
* @type text
* @default 28
*
*
* @param Class Information Sub-Group Heading Font Size
* @parent Font Size Settings
* @desc Sets the font size of the sub-group heading for the Class Information window.
* @type text
* @default 26
*
*
* @param Class Information Item Font Size
* @parent Font Size Settings
* @desc Sets the font size for the items in the Class Information window.
* @type text
* @default 24
*
*
* @param Text Settings
* @desc These settings allow you to control various aspects of text
* used in the plugin.
*
*
* @param Text Position Settings
* @parent Text Settings
* @desc These settings allow you move various heads and other text around in their respective windows
*
*
* @param Actor Class List Heading Position
* @parent Text Position Settings
* @desc Sets the X offset for the "Previous Classes" window heading.
* @type text
* @default 8
*
*
* @param Actor Class List Item Position
* @parent Text Position Settings
* @desc Sets the X offset for content in the "Previous Classes" window.
* @type text
* @default 18
*
*
* @param Class Requirements Heading Position
* @parent Text Position Settings
* @desc Sets the X offset for the "Class Reqs" window heading.
* @type text
* @default 45
*
*
* @param Class Requirements Group Heading Position
* @parent Text Position Settings
* @desc Sets the X offset for group headings in the "Class Reqs" window.
* @type text
* @default 5
*
*
* @param Class Requirements Item Position
* @parent Text Position Settings
* @desc Sets the X offset for the content in the "Class Reqs" window.
* @type text
* @default 15
*
*
* @param Class Information Group Heading Position
* @parent Text Position Settings
* @desc Sets the X offset of the group headings for the class
* Information window.
* @type text
* @default 5
*
*
* @param Class Information Sub-Group Heading Position
* @parent Text Position Settings
* @desc Sets the X offset of the sub-group headings for the Class Information window.
* @type text
* @default 25
*
*
* @param Class Information Item Position
* @parent Text Position Settings
* @desc Sets the X offset for list items in the Class Information window.
* @type text
* @default 25
*
*
* @param Class Information Sub-Item Position
* @parent Text Position Settings
* @desc Sets the X offset for the sub-list items in the Class Information window.
* @type text
* @default 35
*
*
* @param Text Heading Settings
* @parent Text Settings
*
*
* @param Actor Classes Header Text
* @parent Text Heading Settings
* @desc This setting allows you to set the header text for the Actor Previous Classes Window
* @type text
* @default Previous Classes
*
*
* @param Class Requirements Header Text
* @parent Text Heading Settings
* @desc This setting allows you to set the header text for the Class Requirements window.
* @type text
* @default Class Reqs
*
*
* @help
* Thanks for using my class changer plugin! For usage information,
* please visit the GitHub page linked below or check the project file:
*
* https://github.com/Geowil/LMPGames_ClassChanger
*
* Credits:
* SephirothSpawn - original RMXP script creator
*/
//Window/Scene Function Defines
function Scene_ClassChange() { this.initialize.apply(this, arguments); };
function Window_CCSelectActor() { this.initialize.apply(this, arguments); }
function Window_CCClassList() { this.initialize.apply(this, arguments); }
function Window_CCStatus() { this.initialize.apply(this, arguments); }
function Window_CCActorClasses() { this.initialize.apply(this, arguments); }
function Window_CCClassInfo() { this.initialize.apply(this, arguments); }
function Window_CCRequirementsInfo() { this.initialize.apply(this, arguments); }
function Window_CCCommand() { this.initialize.apply(this, arguments); }
function Window_CCCost() { this.initialize.apply(this, arguments); }
const lmpgamesCCParams = PluginManager.parameters('LMPGames_ClassChanger');
//Param Plugin Vars
var passReqColor = String(lmpgamesCCParams['Cost Requirement Pass Color']);
var failReqColor = String(lmpgamesCCParams['Cost Requirement Fail Color']);
var clsListDefaultColor = String(lmpgamesCCParams['Default Class List Color']);
var clsListChangeColor = String(lmpgamesCCParams['Class List Can Change Color']);
var clsListBlockedColor = String(lmpgamesCCParams['Class List Cannot Change Color']);
var actClsNameFntSize = parseInt(lmpgamesCCParams['Actor Class List Name Font Size']);
var actClsLevelFntSize = parseInt(lmpgamesCCParams['Actor Class List Level Font Size']);
var bIsCurrencyCostEnabled = (lmpgamesCCParams['Enable Currency Cost'] === 'true');
var bIsItemCostEnabled = (lmpgamesCCParams['Enable Item Cost'] === 'true');
var bAreGenderReqsEnabled = (lmpgamesCCParams['Enable Gender Requirements'] === 'true');
var genderNameMap = JSON.parse(JSON.parse(lmpgamesCCParams['Gender Mapping']));
var bUsingLMPAWP = (lmpgamesCCParams['Is LMPGames_AWP Installed'] === 'true');
var bAllowReqBypassOnOldClass = (lmpgamesCCParams['Enable Existing Class Requirement Bypass'] == 'true');
var currencyIconId = parseInt(lmpgamesCCParams['Currency Icon ID']);
var costItemId = parseInt(lmpgamesCCParams['Cost Item ID']);
var bIsCostSystemEnabled = (bIsCurrencyCostEnabled || bIsItemCostEnabled ? true : false);
var bUseClassDesc = (lmpgamesCCParams['Use Class Description'] === 'true');
var bShowExtParams = (lmpgamesCCParams['Show Extended Parameters'] === 'true');
var bOnlyShowNon0Params = (lmpgamesCCParams['Only Show Non-Zero Parameters'] === 'true');
var eleDispMode = parseInt(lmpgamesCCParams['Element Resist Display Mode']);
var eleOrderMode = parseInt(lmpgamesCCParams['Element Attribute Order Mode']);
var sklOrderMode = parseInt(lmpgamesCCParams['Skill Order Mode']);
var extParmDispMode = parseInt(lmpgamesCCParams['Extended Parameter Display Mode']);
var bElementIconsEnabled = (lmpgamesCCParams['Enable Element Trait Icons'] === 'true');
var elementIconMapping = JSON.parse(JSON.parse(lmpgamesCCParams['Element Trait Icon Mapping']));
var ignoreSkills = JSON.parse(JSON.parse(lmpgamesCCParams['Ignore Skill List']));
var bUseClsAlias = (lmpgamesCCParams['Use Aliases'] === 'true');
var bUseCostOnBypass = (lmpgamesCCParams['Use Cost on Bypass'] === 'true');
var clsReqPassTCode = lmpgamesCCParams['Class Requirement Pass Text Code value'];
var clsReqFailTCode = lmpgamesCCParams['Class Requirement Fail Text Code value'];
var clsListFontSize = parseInt(lmpgamesCCParams['Class List Font Size']);
var actClsLstHeadingFontSize = lmpgamesCCParams['Actor Class List Heading Font Size'];
var actClsLstItemFontSize = lmpgamesCCParams['Actor Class List Content Font Size'];
var clsReqHeadingFontSize = lmpgamesCCParams['Class Requirements Heading Font Size'];
var clsReqGrpHeadingFontSize = lmpgamesCCParams['Class Requirements Group Heading Font Size'];
var clsReqItemFontSize = lmpgamesCCParams['Class Requirements Content Font Size'];
var clsInfoHeadingFontSize = lmpgamesCCParams['Class Information Heading Font Size'];
var clsInfoGrpHeadingFontSize = lmpgamesCCParams['Class Information Group Heading Font Size'];
var clsInfoSGrpHeadingFontSize = lmpgamesCCParams['Class Information Sub-Group Heading Font Size'];
var clsInfoItemFontSize = lmpgamesCCParams['Class Information Item Font Size'];
var actClsLstHeadingXOffset = lmpgamesCCParams['Actor Class List Heading Position'];
var actClsLstItemXOffset = lmpgamesCCParams['Actor Class List Item Position'];
var clsReqHeadingXOffset = lmpgamesCCParams['Class Requirements Heading Position'];
var clsReqGrpHeadingXOffset = lmpgamesCCParams['Class Requirements Group Heading Position'];
var clsReqItemXOffset = lmpgamesCCParams['Class Requirements Item Position'];
var clsInfoGrpHeadingXOffset = lmpgamesCCParams['Class Information Group Heading Position'];
var clsInfoSGrpHeadingXOffset = lmpgamesCCParams['Class Information Sub-Group Heading Position'];
var clsInfoItemXOffset = lmpgamesCCParams['Class Information Item Position'];
var clsInfoSItemXOffset = lmpgamesCCParams['Class Information Sub-Item Position'];
var actClsHeaderText = lmpgamesCCParams['Actor Classes Header Text'];
var clsReqsHeaderText = lmpgamesCCParams['Class Requirements Header Text'];
var genderCodeMap = {};
if (Object.keys(genderNameMap).length > 0){
for (let key of Object.keys(genderNameMap)){
let val = genderNameMap[key].toLowerCase();
genderCodeMap[val] = key;
}
}
//Static Trait JSON List
var staticTraits = {
"21" : ["Max HP","Max MP","Atk","Def","MAtk","MDef","Agl","Luk"],
"22" : ["Hit Rate","Eva Rate","Crit Rate","Crit Eva Rate","Mg Eva Rate",
"Mg Reflect Rate","Counter Rate","HP Regen Rate","MP Regen Rate",
"TP Regen Rate"],
"23" : ["Targ Rate","Guard Eff Rate","Recv Eff Rate","Pharma Rate","MP Cost Rate",
"TP Chrg Rate","Phys Dmg Rate","Mg Dmg Rate","Floor Dmg Rate","Exp Rate"],
"55" : ["Normal","Duel Wield"],
"62" : ["Auto Battle (Berserk)","Guard","Substitute (Cover)","Preserve TP"],
"63" : ["Normal","Boss","Instant","No Dissolve"],
"64" : ["Enc. Rate Half","No Enc","No Ambushes","Inc Pre-Emptive","2x Gold","Double Item Drop"]
};
//TODO: Consider if AWP should merge note tag data, and if so does that include
//TODO: weapon note tag data for class changing.
//=============================================================================
// TouchInput
//=============================================================================
var lmpGamesClassChangeTouchInput_onMouseMove = TouchInput._onMouseMove;
TouchInput._onMouseMove = function(event) {
lmpGamesClassChangeTouchInput_onMouseMove.call(this, event);
this._mouseOverX = Graphics.pageToCanvasX(event.pageX);
this._mouseOverY = Graphics.pageToCanvasY(event.pageY);
};
//DataManager Functions
var lmpGamesClassChangerDataManager_databaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function(){
if (!lmpGamesClassChangerDataManager_databaseLoaded.call(this)) { return false;}
this.loadClassChangerData();
return true;
}
DataManager.loadClassChangerData = function(){
this.setupClassData();
this.setupActorData();
this.setupIWAData($dataItems);
this.setupIWAData($dataWeapons);
this.setupIWAData($dataArmors);
}
DataManager.setupClassData = function(){
for (let cls of $dataClasses){
if (cls){
if (cls.note != undefined){
let noteData = cls.note.split(/[\r\n]+/);
let tagStart = "<LMPCC_Requirements>";
let tagEnd = "</LMPCC_Requirements>";
let bInNoteTag = null;
let bNoCurrencyFormAdded = false;
let bNoItemFormAdded = false;
cls.changeRequirements = {
"classes" : {},
"gender" : "",
"weapons" : [],
"armor" : [],
"accs" : [],
"items" : []
};
cls.currencyCostFormula = "";
cls.itemCostFormula = "";
cls.desc = "";
cls.alias = "";
if (noteData.length > 0){
for (let line of noteData){
let lineData = line.split(":");
bInNoteTag = this.areInNoteTag(tagStart, tagEnd, lineData[0], bInNoteTag);
if (bInNoteTag) {
switch(lineData[0]){
case "<LMPCC_Requirements>":
break;
case "Class":
if (lineData.length == 3 && lineData[2].length > 0 &&
!cls.changeRequirements.classes.hasOwnProperty(lineData[1])){
cls.changeRequirements.classes[lineData[1]] = parseInt(lineData[2]);
}
break;
case "Gender":
if (lineData[1].length > 0){
cls.changeRequirements.gender = lineData[1].toLowerCase();
}
break;
case "Weapon":
if (lineData[1].length > 0 && !cls.changeRequirements.weapons.includes(lineData[1])){
cls.changeRequirements.weapons.push(parseInt(lineData[1]));
}
break;
case "Armor":
if (lineData[1].length > 0 && !cls.changeRequirements.armor.includes(lineData[1])){
cls.changeRequirements.armor.push(parseInt(lineData[1]));
}
break;
case "Acc":
if (lineData[1].length > 0 && !cls.changeRequirements.accs.includes(lineData[1])){
cls.changeRequirements.accs.push(parseInt(lineData[1]));
}
break;
case "Item":
if (lineData[1].length > 0 && !cls.changeRequirements.items.includes(lineData[1])){
cls.changeRequirements.items.push(parseInt(lineData[1]));
}
break;
case "CurrencyFormula":
if (bIsCurrencyCostEnabled){
if (lineData[1].length > 0){
cls.currencyCostFormula = lineData[1];
} else {
bNoCurrencyFormAdded = true;
}
}
break;
case "ItemFormula":
if (bIsItemCostEnabled){
if (lineData[1].length > 0){
cls.itemCostFormula = lineData[1];
} else {
bNoItemFormAdded = true;
}
}
break;
case "Desc":
if (lineData[1].length > 0){
cls.desc = lineData[1];
}
break;
case "Alias":
if (lineData[1].length > 0){
cls.alias = lineData[1];
}
break;
default:
break;
}
} else if (bInNoteTag === false){
break;
}
}
if (cls.currencyCostFormula == ""){
cls.currencyCostFormula = "parseInt(((avgClassLevels + 40) / 1.25).toFixed(0))";
}
if (cls.itemCostFormula == ""){
cls.itemCostFormula = "parseInt(((avgClassLevels + 40) / 1.25).toFixed(0))";
}
}
}
}
}
}
DataManager.setupActorData = function(){
for (let act of $dataActors){
if (act){
if (act.note != undefined){
let noteData = act.note.split(/[\r\n]+/);
let tagStart = "<LMPCC_Gender>";
let tagEnd = "</LMPCC_Gender>";
let bInNoteTag = null;
act.gender = '';
if (noteData.length > 0){
for (let line of noteData){
let lineData = line.split(":");
bInNoteTag = this.areInNoteTag(tagStart, tagEnd, lineData[0], bInNoteTag);
if (bInNoteTag){
switch (lineData[0]){
case "<LMPCC_Gender>":
break;
case "Gender":
if (lineData[1].length > 0 && Object.keys(genderCodeMap).length > 0){
if (genderCodeMap.hasOwnProperty(lineData[1].toLowerCase())){
act.gender = genderCodeMap[lineData[1].toLowerCase()];
}
}
break;
default:
break;
}
} else if (bInNoteTag === false){
break;
}
}
}
}
}
}
}
DataManager.setupIWAData = function(group){
for (let grp of group){
if (grp){
if (grp.note != undefined){
let noteData = grp.note.split(/[\r\n]+/);
let startTag = "<LMPCC_Settings>";
let endTag = "</LMPCC_Settings>";
let bInNoteTag = null;
grp.changeRequirements = {
"restrictions" : {
"canChangeTo" : [],
"cantChange" : false
},
"bypass" : []
};
if (noteData.length > 0){
for (let line of noteData){
let lineData = line.split(':');
if (bInNoteTag == null || lineData[0] == endTag){
bInNoteTag = this.areInNoteTag(startTag, endTag, lineData[0], bInNoteTag);
}
if (bInNoteTag){
switch (lineData[0]){
case "<LMPCC_Settings>":
break;
case "Restriction1":
if (lineData[1].length > 0){
grp.changeRequirements.restrictions.canChangeTo.push(parseInt(lineData[1]));
}
break;
case "Restriction2":
grp.changeRequirements.restrictions.cantChange = true;
break;
case "Bypass":
if (lineData[1].length > 0){
grp.changeRequirements.bypass.push(parseInt(lineData[1]));
}
break;
default:
break;
}
} else if (bInNoteTag === false){
break;
}
}
}
}
}
}
}
DataManager.areInNoteTag = function (startTag, endTag, line, bInNoteTag){
if (bInNoteTag == null && startTag == line) { return true; }
else if (bInNoteTag == true && endTag == line) { return false; }
else if (bInNoteTag == null && startTag != line) { return null; }
else if (bInNoteTag == true && endTag != line) { return true; }
else { return false; }
}
// Game_Interpreter Functions
var lmpGamesClassChangerGameInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
Game_Interpreter.prototype.pluginCommand = function(command, args){
if (command == "LMP.ClassChanger"){
let pluginCommand = command;
for(let arg of args){
pluginCommand += " " + arg;
}
if (pluginCommand.match(/LMP.ClassChanger[ ]Start/)){
let matches = ((/LMP.ClassChanger[ ]Start/).exec(pluginCommand) || undefined);
if (matches){
SceneManager.push(Scene_ClassChange);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Disable[ ]CurrencyCost/)){
let matches = ((/LMP.ClassChanger[ ]Disable[ ]CurrencyCost/).exec(pluginCommand) || undefined);
if (matches){
this.currencyCostSystemState(false);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Enable[ ]CurrencyCost/)){
let matches = ((/LMP.ClassChanger[ ]Enable[ ]CurrencyCost/).exec(pluginCommand) || undefined);
if (matches){
this.currencyCostSystemState(true);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Disable[ ]ItemCost/)){
let matches = ((/LMP.ClassChanger[ ]Disable[ ]ItemCost/).exec(pluginCommand) || undefined);
if (matches){
this.itemCostSystemState(false);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Enable[ ]ItemCost/)){
let matches = ((/LMP.ClassChanger[ ]Enable[ ]ItemCost/).exec(pluginCommand) || undefined);
if (matches){
this.itemCostSystemState(true);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]ChangeCostItemID[ ](\d+)/)){
let matches = ((/LMP.ClassChanger[ ]ChangeCostItemID[ ](\d+)/).exec(pluginCommand) || undefined);
if (matches){
this.changeItemCostId(matches[1]);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Disable[ ]GenderRequirements/)){
let matches = ((/LMP.ClassChanger[ ]Disable[ ]GenderRequirements/).exec(pluginCommand) || undefined);
if (matches){
this.genderRequirementsState(false);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Enable[ ]GenderRequirements/)){
let matches = ((/LMP.ClassChanger[ ]Enable[ ]GenderRequirements/).exec(pluginCommand) || undefined);
if (matches){
this.genderRequirementsState(true);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Disable[ ]ExistingClassBypass/)){
let matches = ((/LMP.ClassChanger[ ]Disable[ ]ExistingClassBypass/).exec(pluginCommand) || undefined);
if (matches){
this.existingClassBypassState(false)
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Enable[ ]ExistingClassBypass/)){
let matches = ((/LMP.ClassChanger[ ]Enable[ ]ExistingClassBypass/).exec(pluginCommand) || undefined);
if (matches){
this.existingClassBypassState(true);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Enable[ ]UseCostOnBypass/)){
let matches = ((/LMP.ClassChanger[ ]Enable[ ]UseCostOnBypass/).exec(pluginCommand) || undefined);
if (matches){
this.costOnBypassState(true);
}
} else if (pluginCommand.match(/LMP.ClassChanger[ ]Disable[ ]UseCostOnBypass/)){
let matches = ((/LMP.ClassChanger[ ]Disable[ ]UseCostOnBypass/).exec(pluginCommand) || undefined);
if (matches){
this.costOnBypassState(false);
}
} else {
lmpGamesClassChangerGameInterpreter_pluginCommand.call(this, command, args);
}
}
}
Game_Interpreter.prototype.currencyCostSystemState = function(isEnabled){
bIsCurrencyCostEnabled = isEnabled;
this.checkCostSystemStates();
}
Game_Interpreter.prototype.itemCostSystemState = function(isEnabled){
bIsItemCostEnabled = isEnabled;
this.checkCostSystemStates();
}
Game_Interpreter.prototype.checkCostSystemStates = function(){
if (bIsItemCostEnabled || bIsCurrencyCostEnabled){
bIsCostSystemEnabled = true;
} else {
bIsCostSystemEnabled = false;
}
}
Game_Interpreter.prototype.genderRequirementsState = function(isEnabled) { bAreGenderReqsEnabled = isEnabled; }
Game_Interpreter.prototype.existingClassBypassState = function(isEnabled) { bAllowReqBypassOnOldClass = isEnabled; }
Game_Interpreter.prototype.costOnBypassState = function(isEnabled) { bUseCostOnBypass = isEnabled; }
Game_Interpreter.prototype.changeItemCostId = function(iId) { costItemId = iId; }
//Game_Actor Functions
var lmpGamesGameActor_InitMembers = Game_Actor.prototype.initMembers;
Game_Actor.prototype.initMembers = function(){
lmpGamesGameActor_InitMembers.call(this);
this._actorClasses = {};
this._actorClasses[this._classId] = this._level;
}
var lmpGamesGameActor_LevelUp = Game_Actor.prototype.levelUp;
Game_Actor.prototype.levelUp = function(){
lmpGamesGameActor_LevelUp.call(this);
this._actorClasses[this._classId] = this._level;
}
var lmpGamesGameActor_ChangeClass = Game_Actor.prototype.changeClass;
Game_Actor.prototype.changeClass = function(classId, keepExp){
lmpGamesGameActor_ChangeClass.apply(this, arguments);
this.initSkills();
}
Game_Actor.prototype.getActorClasses = function() { return this._actorClasses; }
Game_Actor.prototype.getActorClassName = function(clsId) { return $dataClasses[clsId].name; }
Game_Actor.prototype.getActorClassLevel = function(clsId){
if (this._actorClasses.hasOwnProperty(clsId)){
return this._actorClasses[clsId];
} else {
return -1;
}
}
/* Scene_ClassChange Functions */
Scene_ClassChange.prototype = Object.create(Scene_MenuBase.prototype);
Scene_ClassChange.prototype.constructor = Scene_ClassChange;
Scene_ClassChange.prototype.initialize = function(){
Scene_MenuBase.prototype.initialize.call(this);
ImageManager.loadFace($gameParty.menuActor().faceName());
//Window Vars
this._actorSelectWnd = undefined;
this._classListWnd = undefined;
this._requirementsInfoWnd = undefined;
this._statusWnd = undefined;
this._actorClassesWnd = undefined;
this._classInfoWnd = undefined;
this._costWnd = undefined;
this._cmdWnd = undefined;
this._newClassId = 0;
this._selectedClassId = 0;
this._goldCost = 0;
this._itemCost = 0;
this._selectedActorId = 0;
this._selectedActor = undefined;
}
Scene_ClassChange.prototype.create = function(){
Scene_MenuBase.prototype.create.call(this);
this.createWindows();
this._actorSelectWnd.show();
this._actorSelectWnd.activate();
this._actorSelectWnd.select(0);
}
Scene_ClassChange.prototype.createWindows = function(){
this.createHelpWindow();
this.createGoldWindow();
this.createActorSelectWnd();
this.createClassListWindow();
this.createStatusWindow();
this.createActorClassesWindow();
this.createCostWindow();
this.createRequirementsWindow();
this.createClassInfoWindow();
this.createCommandWindow();
}
Scene_ClassChange.prototype.createGoldWindow = function() {
this._goldWindow = new Window_Gold(0, this._helpWindow.height);
this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height;
this._goldWindow.x = 0;
this._goldWindow.hide();
this.addWindow(this._goldWindow);
};
Scene_ClassChange.prototype.createActorSelectWnd = function(){
let x = 0;
let y = this._helpWindow.getHeight() + 10;
let w = Math.ceil(Graphics.width / 2.50);
let h = Graphics.height - y;
this._actorSelectWnd = new Window_CCSelectActor(x, y, w, h);
this._actorSelectWnd.setHandler('ok', this.onActorSelected.bind(this));
this._actorSelectWnd.setHandler('cancel', this.onActorSelectCancelled.bind(this));
this._actorSelectWnd.hide();
this.addWindow(this._actorSelectWnd);
}
Scene_ClassChange.prototype.onActorSelected = function(){
this._selectedActorId = this._actorSelectWnd.getSelectedActorId();
this._selectedActor = $gameParty.members().find(m => m && m._actorId == this._selectedActorId);
this._actorSelectWnd.hide();
this._actorSelectWnd.deactivate();
this._classListWnd.setSelectedActorId(this._selectedActorId);
this._classListWnd.setSubWindows(this._costWnd, this._requirementsInfoWnd);
this._classListWnd.refresh();
this._classListWnd.show();
this._classListWnd.activate();
this._classListWnd.select(0);
if (bIsCostSystemEnabled){
if (bIsCurrencyCostEnabled){
this._goldWindow.show();
}
this._costWnd.setSelectedActor(this._selectedActor);
this._costWnd.show();
}
this._statusWnd.setSelectedActor(this._selectedActor);
this._statusWnd.show();
this._requirementsInfoWnd.setSelectedActor(this._selectedActor);
this._requirementsInfoWnd.show();
this._actorClassesWnd.setSelectedActor(this._selectedActor);
this._actorClassesWnd.show();
}
Scene_ClassChange.prototype.onActorSelectCancelled = function() { SceneManager.pop(); }
Scene_ClassChange.prototype.createClassListWindow = function() {
let x = 0;
let y = this._helpWindow.getHeight() + 10;
let w = 235;
let h = Graphics.boxHeight - y - this._goldWindow.getHeight() - 10;
this._classListWnd = new Window_CCClassList(x, y, w, h, this._helpWindow);
this._classListWnd.setHandler('ok', this.onClassSelected.bind(this));
this._classListWnd.setHandler('cancel', this.onClassListCancelled.bind(this));
this._classListWnd.hide();
this.addWindow(this._classListWnd);
}
Scene_ClassChange.prototype.onClassSelected = function(){
this._selectedClassId = this._classListWnd.getSelectedClassId();
this._classListWnd.deactivate();
this._statusWnd.hide();
this._actorClassesWnd.hide();
this._classInfoWnd.setSelectedActor(this._selectedActor);
this._classInfoWnd.setSelectedClassId(this._selectedClassId);
this._classInfoWnd.refresh();
this._classInfoWnd.show();
this._cmdWnd.setSelectedActor(this._selectedActor);
this._cmdWnd.setSelectedClassId(this._selectedClassId);
this._cmdWnd.show();
this._cmdWnd.activate();
this._cmdWnd.select(0);
}
Scene_ClassChange.prototype.onClassListCancelled = function(){
this._classListWnd.deactivate();
this._classListWnd.hide();