-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMoogle_X_ActorsFriendshipSystem.js
2124 lines (1949 loc) · 81.3 KB
/
Moogle_X_ActorsFriendshipSystem.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
//=============================================================================
// Actors Friendship System by Moogle_X
// Moogle_X_ActorsFriendshipSystem.js
// Created on: November 12nd 2015
//=============================================================================
var Imported = Imported || {};
Imported.Moogle_X_AFS = true;
var Moogle_X = Moogle_X || {};
Moogle_X.AFS = Moogle_X.AFS || {};
//=============================================================================
/*:
* @plugindesc v2.08 Adds friendship mechanic between actors.
* @author Moogle_X
*
* @param Default All Leaders
* @desc Make all actors become leaders by default. 1:Yes 0:No
* @default 1
*
* @param Default Max Level
* @desc This is the default value for max Friendship Level for all actors.
* @default 10
*
* @param Default Exp for Level Up
* @desc This is the default value for Friendship Points needed to level up.
* @default 20
*
* @param Friendship Gain Each Battle
* @desc Friendship Points gained for each active party members to other leaders in battle party.
* @default 1
*
* @param Allows Level Down
* @desc Decide whether Friendship Level can decrease or not. 1:Yes 0:No
* @default 0
*
* @param ---Scene---
* @default
*
* @param Use Single Leader Scene
* @desc Only the first leader's friend list will be shown. 1:Yes 0:No
* @default 0
*
* @param Show in Main Menu
* @desc Put "Show Friendship" scene command in main menu. 1:Yes 0:No
* @default 1
*
* @param Show Menu Switch ID
* @desc Turning on the in-game switch with this ID will put scene command in main menu. Put 0 to ignore this feature.
* @default 0
*
* @param Menu Vocab
* @desc Change the "Show Friendship" command name in main menu.
* @default Friendship
*
* @param Help Text
* @desc This is the text at the top of "Show Friendship" scene.
* @default View Friendship Data
*
* @param ---Window Leader List---
* @default
*
* @param Leader Name Color
* @desc This is the color for actor's name in Window Leader List.
* @default 0
*
* @param Back Text
* @desc Change the text for "Back" at the bottom of Window Leader List.
* @default Back
*
* @param Back Text Color
* @desc This is the color for "Back" at the bottom of Window Leader List.
* @default 0
*
* @param Back Icon
* @desc Change the icon for "Back" at the bottom of Window Leader List. Put 0 for no icon.
* @default 16
*
* @param ---Window Friend List---
* @default
*
* @param Maximum Number of Rows
* @desc This is the maximum number of friends shown in the window. Adjust to suit your screen resolution.
* @default 4
*
* @param ---Friend's Face---
* @default
*
* @param Show Friend's Face
* @desc Decide whether to draw actor's face in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Face Offset X
* @desc Change the offset X value of actor's face in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Face Offset Y
* @desc Change the offset Y value of actor's face in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Friend's Name---
* @default
*
* @param Show Friend's Name
* @desc Decide whether to draw actor's name in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Friend Name Color
* @desc This is the color for actor's name in Window Friend List.
* @default 0
*
* @param Friend Name Width
* @desc This is the rectangle width for actor's name in Window Friend List.
* @default 168
*
* @param Friend Name Alignment
* @desc This is the text alignment for actor's name in Window Friend List. (left center right)
* @default left
*
* @param Friend Name Offset X
* @desc Change the offset X value of actor's name in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Friend Name Offset Y
* @desc Change the offset Y value of actor's name in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Friendship Level Text---
* @default
*
* @param Friendship Level Text
* @desc Change "Friendship Level" text in Window Friend List.
* @default Friendship Level
*
* @param Show Friendship Level Text
* @desc Decide whether to draw "Friendship Level" text in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Friendship Level Text Color
* @desc This is the color for "Friendship Level" text in Window Friend List.
* @default 16
*
* @param Friendship Level Text Width
* @desc This is the rectangle width for "Friendship Level" text in Window Friend List.
* @default 200
*
* @param Friendship Level Text Alignment
* @desc This is the text alignment for "Friendship Level" text in Window Friend List. (left center right)
* @default left
*
* @param Friendship Level Text Offset X
* @desc Change the offset X value of "Friendship Level" text in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Friendship Level Text Offset Y
* @desc Change the offset Y value of "Friendship Level" text in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Friendship Level Number---
* @default
*
* @param Show Friendship Level Number
* @desc Decide whether to draw "Friendship Level" number in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Friendship Level Number Color
* @desc This is the color for "Friendship Level" number in Window Friend List.
* @default 0
*
* @param Friendship Level Number Width
* @desc This is the rectangle width for "Friendship Level" number in Window Friend List.
* @default 40
*
* @param Friendship Level Number Alignment
* @desc This is the text alignment for "Friendship Level" number in Window Friend List. (left center right)
* @default right
*
* @param Friendship Level Number Offset X
* @desc Change the offset X value of "Friendship Level" number in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Friendship Level Number Offset Y
* @desc Change the offset Y value of "Friendship Level" number in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Friendship Gauge---
* @default
*
* @param Show Friendship Gauge
* @desc Decide whether to draw Friendship Gauge in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Gauge Height
* @desc This is the height of Friendship Gauge in Window Friend List.
* @default 18
*
* @param Gauge Width
* @desc This is the width of Friendship Gauge in Window Friend List.
* @default 382
*
* @param Color 1
* @desc This is the gradient color 1 of Friendship Gauge.
* @default 24
*
* @param Color 2
* @desc This is the gradient color 2 of Friendship Gauge.
* @default 29
*
* @param Friendship Gauge Offset X
* @desc Change the offset X value of Friendship Gauge in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Friendship Gauge Offset Y
* @desc Change the offset Y value of Friendship Gauge in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param Use Pretty Gauges Patch
* @desc Activate compatibility patch for Rocketmancer's PrettyGauges plugin? 1:Yes 0:No
* @default 0
*
* @param ---Current FP Text---
* @default
*
* @param Current FP Text
* @desc Change "Current FP" text in Window Friend List.
* @default Current FP
*
* @param Show Current FP Text
* @desc Decide whether to draw "Current FP" text in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Current FP Text Color
* @desc This is the color for "Current FP" text in Window Friend List.
* @default 16
*
* @param Current FP Text Width
* @desc This is the rectangle width for "Current FP" text in Window Friend List.
* @default 200
*
* @param Current FP Text Alignment
* @desc This is the text alignment for "Current FP" text in Window Friend List. (left center right)
* @default left
*
* @param Current FP Text Offset X
* @desc Change the offset X value of "Current FP" text in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Current FP Text Offset Y
* @desc Change the offset Y value of "Current FP" text in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Current FP Number---
* @default
*
* @param Show Current FP Number
* @desc Decide whether to draw "Current FP" number in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param Current FP Number Color
* @desc This is the color for "Current FP" number in Window Friend List.
* @default 0
*
* @param Current FP Number Width
* @desc This is the rectangle width for "Current FP" number in Window Friend List.
* @default 200
*
* @param Current FP Number Alignment
* @desc This is the text alignment for "Current FP" number in Window Friend List. (left center right)
* @default right
*
* @param Current FP Number Offset X
* @desc Change the offset X value of "Current FP" number in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Current FP Number Offset Y
* @desc Change the offset Y value of "Current FP" Number in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---To Next Level Text---
* @default
*
* @param To Next Level Text
* @desc Change "To Next Level" text in Window Friend List.
* @default To Next Level
*
* @param Show To Next Level Text
* @desc Decide whether to draw "To Next Level" text in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param To Next Level Text Color
* @desc This is the color for "To Next Level" text in Window Friend List.
* @default 16
*
* @param To Next Level Text Width
* @desc This is the rectangle width for "To Next Level" text in Window Friend List.
* @default 200
*
* @param To Next Level Text Alignment
* @desc This is the text alignment for "To Next Level" text in Window Friend List. (left center right)
* @default left
*
* @param To Next Level Text Offset X
* @desc Change the offset X value of "To Next Level" text in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param To Next Level Text Offset Y
* @desc Change the offset Y value of "To Next Level" text in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---To Next Level Number---
* @default
*
* @param Show To Next Level Number
* @desc Decide whether to draw "To Next Level" number in Window Friend List. 1:Yes 0:No
* @default 1
*
* @param To Next Level Number Color
* @desc This is the color for "To Next Level" number in Window Friend List.
* @default 0
*
* @param To Next Level Number Width
* @desc This is the rectangle width for "To Next Level" number in Window Friend List.
* @default 200
*
* @param To Next Level Number Alignment
* @desc This is the text alignment for "To Next Level" number in Window Friend List. (left center right)
* @default right
*
* @param To Next Level Number Offset X
* @desc Change the offset X value of "To Next Level" number in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param To Next Level Number Offset Y
* @desc Change the offset Y value of "To Next Level" Number in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Friendship Icons---
* @default
*
* @param Friendship Icons Offset X
* @desc Change the offset X value of "Friendship Icons" in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Friendship Icons Offset Y
* @desc Change the offset Y value of "Friendship Icons" in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---FP Lock Icon---
* @default
*
* @param Default Lock Icon
* @desc This is the default icon shown when actor is under FP Lock effect. Put 0 for no icon.
* @default 4
*
* @param FP Lock Icon Offset X
* @desc Change the offset X value of "FP Lock Icon" in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param FP Lock Icon Offset Y
* @desc Change the offset Y value of "FP Lock Icon" in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @param ---Custom Friend Icon---
* @default
*
* @param Custom Friend Icon Offset X
* @desc Change the offset X value of "Custom Friend Icon" in Window Friend List. (Positive: right; Negative: left)
* @default 0
*
* @param Custom Friend Icon Offset Y
* @desc Change the offset Y value of "Custom Friend Icon" in Window Friend List. (Positive: down; Negative: up)
* @default 0
*
* @help
* ============================================================================
* Introduction
* ============================================================================
* This plugin adds friendship mechanic between actors of your choice.
* Each actor has their own Friendship Points that can be increased or decreased
* multiple ways.
*
* As their Friendship Points grows, that actor's Friendship Level may level up.
* You can set some skills to be automatically learned at certain Friendship
* Level.
*
* There is also the option to store certain actor's Friendship Points or
* Friendship Level into in-game variable. You can then use that variable's
* value as a conditional trigger for new event, etc.
*
* ============================================================================
* Single Leader vs Multiple Leaders
* ============================================================================
* You are given a choice to go with Single Leader approach or Multiple Leaders
* approach.
*
* Single Leader means there is one actor who is the central of relationships.
* This actor is usually the main protagonist of your game.
* You can view other actors' Friendship Points towards this Leader, but you
* cannot view their Friendship Points towards other actors.
*
* Multiple Leaders approach take away this limitation. You can view all actors'
* Friendship Points towards any actors that you tag as "Leader". You can make
* all actors become Leader, or just a few of them.
*
* To make an actor become Leader, insert this notetag into his/her notebox:
*
* <AFS Leader>
*
* Actor's friendship value can be viewed in custom scene. You can access it
* from the main menu or simply by using this plugin command:
*
* AFS Open // Open Friendship Scene.
*
* IMPORTANT!
* There are 2 versions of Friendship Scene, Single Leader version and Multiple
* Leaders version. Single Leader one only contains Window Friend List while
* Multiple Leaders version contains both of Window Leader List and Window
* Friend List.
*
* To enable Single Leader version, simply turn on "Use Single Leader Scene"
* option in the plugin configuration.
*
* By default, no actor's friendship data will be shown. In order for it to
* show up in the scene, you must first manually "unlock" that actor by using
* these plugin commands:
*
* AFS Show Leader x // Show actor x in the leader list.
* AFS Show Friend x Leader y // Show actor x as friend in leader y's
* // friend list.
*
* If you want to hide the "unlocked" leader or friend for some reason during
* mid-game, simply use these plugin commands:
*
* AFS Hide Leader x // Hide actor x from the leader list.
* AFS Hide Friend x Leader y // Hide actor x from leader y's friend list.
*
* ============================================================================
* Setting Up Friendship Level and Exp Requirements
* ============================================================================
* Each actor has their own Max Friendship Level and Exp Requirements needed
* for each level up.
*
* You can go with the default value by editting the plugin configuration.
* Or you can make each actor has their own Max Level and Exp Requirements by
* inserting these notetags into the Actors' notebox:
*
* <AFS Max Level: x> // Maximum Friendship Level is x.
* <AFS Exp: n1, n2, n3, n4, n5> // First level up will require n1 FP, second
* // level up will require n2 FP, etc.
*
* ============================================================================
* How to Increase Friendship Points
* ============================================================================
* There are 3 methods to increase or decrease Friendship Points. The easiest
* method is using plugin command. With plugin command, you can increase or
* decrease actor's Friendship Points by certain amount.
*
* AFS Gain x Friend y Leader z // Increase actor y's FP towards Leader z
* // by x amount.
* AFS Lose x Friend y Leader z // Decrease actor y's FP towards Leader z
* // by x amount.
*
* The second method is using skills and items. By default, all skills and
* items increase actor's Friendship Points by 0 amount. You can change this by
* inserting new notetags into the skill/item's notebox. The value can be
* either positive or negative. You can make the same skill/item to have
* different effects on different actors.
*
* For example, the skill "Heal" with these notetags:
*
* <AFS Gain 2: 5>
* <AFS Gain 3: -10>
* <AFS Gain Default: 1>
*
* If the caster of this skill is a Leader, depending on who receive this
* healing...
*
* This "Heal" will increase Actor 2's FP (Friendship Points) towards this Leader
* by 2, decrease Actor 3's FP towards this Leader by 10, and increase other
* actors' FP towards this Leader by 1.
* Items also share similar notetags.
*
* The third and the last method to increase actor's FP is by having the actor
* as one of the active battle members. All actors in active battle party will
* gain certain amount of FP at the end of each battle (win only).
* The FP amount can be changed in "Friendship Gain Each Battle" option in the
* plugin configurations.
*
* ============================================================================
* Friendship Skills
* ============================================================================
* Actors are able to learn new skills when their Friendship Level is increased.
* You need to set up what skills they learn by inserting notetags into their
* respective noteboxes.
*
* <AFS Skill x Leader y: n>
*
* The above notetag means this actor will learn skill n when their Friendship
* Level towards Leader y reach level x. If you want the actor learn more than
* one skills at the same time, use this notetag instead:
*
* <AFS Skill x Leader y: n1, n2, n3, n4, n5>
*
* This actor will learn skills n1, n2, n3, n4, and n5 when their Friendship
* Level towards Leader y reach level x.
*
* ============================================================================
* EXTRA feature! "Best Friend Skill(s)"
* ============================================================================
* Actor can learn a new type of skill, called "Best Friend Skill".
* Best Friend Skill will be automatically learn when these conditions are met:
*
* 1. The actor must have the necessary notetag in their notebox.
*
* <AFS Max Skill Leader x: n> // Use it for one skill.
* <AFS Max Skill Leader x: n1, n2, n3, n4, n5> // Use this for multiple skills.
*
* 2. This actor Friendship Level towards Leader x must reach maximum level.
* 3. Leader x's Friendship Level towards this actor must ALSO reach maximum
* Level.
*
* When the above conditions are met, this actor will learn skill n (or n1, n2,
* n3, n4, n5). Keep in mind that only this actor will learn the skills.
* If Leader x doesn't have any "Best Friend Skill" notetag, that Leader won't
* learn anything.
*
* If you want Leader x to learn "Best Friend Skill" as well, you must give
* him/her the necessary notetag as well.
*
* One thing to remember. If their Friendship Level is decreased (therefore
* they are no longer "Max Level"), both actors will forget their Best Friend
* Skills.
*
* ============================================================================
* Global Level Cap
* ============================================================================
* At any point in the game, you can put a Friendship Level restriction to all
* actors in certain Leader's friend list. This "Global Level Cap" effect
* can be applied by using a plugin command:
*
* AFS Cap Leader x Level y // Put Global Level Cap at level y to
* // all actors in Leader x's friend list.
*
* For example, if you use "AFS Cap Leader 2 Level 5" plugin command.
* All actors in Leader 2's friend list cannot increase their Friendship Level
* towards Leader 2 past level 5.
*
* No matter how much FP they get, their Friendship Level towards this Leader
* cannot reach level 6 or above.
*
* IMPORTANT!!!
* This Global Level Cap effect only works on any friends that currently has
* Friendship Level 5 or lower. If there is one (or more) friend that already
* reach level 6 or higher, this particular friend can still increase his/her
* Friendship Level normally. In other word, this friend is unaffected by
* Global Level Cap effect.
*
* This situation can be used to your advantage depending on your game project.
*
* Global Level Cap effect can be removed by using plugin command:
*
* AFS Uncap Leader x // Remove Global Level Cap effect from
* // Leader x.
*
* ============================================================================
* FP Lock Effect
* ============================================================================
* You can give a FP Lock effect to certain friend in certain Leader's friend
* list. Any friend that's affected by FP Lock effect cannot increase or
* decrease his/her FP or Friendship Level towards a certain Leader.
*
* This effect can be applied by using plugin command:
*
* AFS Lock Friend x Leader y // Friend x in Leader y's friend list will
* // receive FP Lock effect.
*
* FP Lock has a special icon indicator beside the friend's name.
* You can decide the default icon by editting the "Default Lock Icon" option
* in the plugin configuration.
*
* If you prefer some actors to use different icon, insert this notetag into
* the actor's notebox:
*
* <AFS Lock Icon: x> // This actor's FP Lock Icon will be icon
* // with ID x.
*
* If you dislike the default icon position, you can adjust the new position
* by editting "FP Lock Icon Offset X" and "FP Lock Icon Offset Y" options in
* the plugin configuration.
*
* FP Lock effect can be removed anytime by using this plugin command:
*
* AFS Unlock Friend x Leader y // Remove FP Lock effect from friend x in
* // Leader y's friend list.
*
* ============================================================================
* Extra Icons
* ============================================================================
* This plugin allows you to add 3 new icon types to the Window Friend List.
* All of these icons are merely visual. They do not have any gameplay impact.
* You can use these icons as special indicator for some gameplay mechanics
* unique to your game project.
*
* 1. Friendship Icons
* This icons will show up in the window at certain Friendship Level. Each
* actor can have different Friendship Icons with other actors or other Leader.
* By default, these icons are located just above Friendship Gauge. Again, if
* you dislike the default location, simply adjust "Friendship Icons Offset X"
* and "Friendship Icons Offset Y" options in the plugin configuration.
* You can adjust actor's Friendship Icons by inserting these notetags into
* actor's notebox:
*
* <AFS Icon Level x Leader y: n> // Show icon n when this actor's Friendship
* // Level towards Leader y is currently at
* // level x.
*
* If you want to show more than one icons, use this notetag instead:
*
* <AFS Icon Level x Leader y: n1, n2, n3, n4, n5> // Same as above, but more
* // icons at the same time.
*
* 2. Custom Friend Icon
* This icon is by default located near the right most part of Friendship
* Gauge. Icon position can changed by editting "Custom Friend Icon Offset X"
* and "Custom Friend Icon Offset Y" in the plugin configuration.
* Custom Friend Icon is only 1 icon. You cannot show more than one icons for
* this icon type. To show Custom Friend Icon, simply use this plugin command:
*
* AFS CFI x Friend y Leader z // Friend y in Leader z's friend list will
* // get icon with ID x.
*
* It's up to you what kind of icon that you want to show up. This icon can
* be used for special indicator or anything. If you want to remove the icon,
* simply use this plugin command:
*
* AFS CFI Remove Friend x Leader y // Remove the Custom Friend Icon from
* // friend x in Leader y's friend list.
*
* 3. Custom Leader Icon
* This icon, unlike 2 icons above, is located in Window Leader List instead
* of Window Friend List. It's located just to the right of Leader's name.
* This icon is also merely visual. It doesn't have any gameplay impact.
* To add this icon, simply use this plugin command:
*
* AFS CLI x Leader y // Add icon x beside Leader y's name.
*
* You can remove Custom Leader Icon anytime by using this plugin command:
*
* AFS CLI Remove Leader x // Remove Custom Leader Icon beside Leader
* // x's name.
*
* ============================================================================
* Friendship Common Event
* ============================================================================
* You can also set up a certain common event to be run at specific Friendship
* Level. This common event will be triggered automatically during Friendship
* Level Up process. It does NOT triggered during "level down".
*
* To set up Friendship Common Event, put this notetag inside Actor's notebox:
*
* <AFS Event Level x Leader y: n>
*
* When this actor's Friendship Level towards Leader y level up to level x,
* common event n will be run.
*
* Example:
* <AFS Event Level 5 Leader 3: 10>
*
* When this actor's Friendship Level towards Leader 3 is increased (level up)
* to level 5. Commmon event with ID number 10 will be executed automatically.
*
* ============================================================================
* Notetags List
* ============================================================================
* Actors Notetags:
* <AFS Leader>
* <AFS Exp: n1, n2, n3, n4, n5>
* <AFS Max Level: x>
* <AFS Skill x Leader y: n>
* <AFS Skill x Leader y: n1, n2, n3, n4, n5>
* <AFS Max Skill Leader x: n>
* <AFS Max Skill Leader x: n1, n2, n3, n4, n5>
* <AFS Icon Level x Leader y: n>
* <AFS Icon Level x Leader y: n1, n2, n3, n4, n5>
* <AFS Lock Icon: x>
* <AFS Event Level x Leader y: n>
*
* Skills and Items Notetags:
* <AFS Gain x: n>
* <AFS Gain Default: n>
*
* ============================================================================
* Plugin Commands List
* ============================================================================
* AFS Open
* AFS Show Leader x
* AFS Hide Leader x
* AFS Show Friend x Leader y
* AFS Hide Friend x Leader y
* AFS Gain x Friend y Leader z
* AFS Lose x Friend y Leader z
* AFS Level Up Friend x Leader y
* AFS Level Down Friend x Leader y
* AFS Lock Friend x Leader y
* AFS Unlock Friend x Leader y
* AFS Cap Leader x Level y
* AFS Uncap Leader x
* AFS CLI x Leader y
* AFS CLI Remove Leader x
* AFS CFI x Friend y Leader z
* AFS CFI Remove Friend x Leader y
*
* SPECIAL Plugin Commands!
*
* AFS Var x FP Friend y Leader z
* "Change variable x value to be equal to the total FP that actor y have
* towards Leader z."
*
* AFS Var x Level Friend y Leader z
* "Change variable x value to be equal to the actor y's Friendship Level
* towards Leader z."
*
* AFS Var x Best FP Leader y
* "The engine will look at all the actors in Leader y's friend list. Then, it
* will search the highest FP total among all these actors. The highest FP value
* will be put inside variable x."
*
* AFS Var x Best Level Leader y
* "The engine will look at all the actors in Leader y's friend list. Then, it
* will search the highest Friendship Level among all these actors. The highest
* level will be put inside variable x."
*
* AFS Var x Best FP Friend Leader y
* "The engine will look at all the actors in Leader y's friend list. Then, it
* will search the highest FP total among all these actors. Then, it will check
* which actor has the highest FP total. This actor ID will be put inside
* variable x."
*
* AFS Var x Best Level Friend Leader y
* "The engine will look at all the actors in Leader y's friend list. Then, it
* will search the highest Friendship Level among all these actors. Then, it
* will check which actor has the highest Friendship Level. This actor ID will
* be put inside variable x."
*
* ============================================================================
* Terms of Use
* ============================================================================
* Free to use in both commercial and non-commercial project as long as credit
* is given.
*
* ============================================================================
* Change Log
* ============================================================================
* Version 2.08:
* - Added Shaz's fix for memory leak issue.
*
* Version 2.07:
* - Fixed multiple friendship common events bug (common events not stacking).
*
* Version 2.06:
* - FP Gain after battle now only occur during victory.
* - Added option to "activate" Pretty Gauges compatibility patch inside plugin
* configuration.
*
* Version 2.05:
* - Added friendship common event feature.
*
* Version 2.01:
* - Fixed a game breaking bug when using Skill or Item with FP gain effect.
*
* Version 2.0:
* - A complete rewritten of the plugin. Introduced multiple leaders feature.
* Ton of new features added.
*
* Version 1.0:
* - Completed plugin.
*
*/
//=============================================================================
(function() { // IIFE
//=============================================================================
// Parameter Variables
//=============================================================================
Moogle_X.AFS.parameters = PluginManager.parameters('Moogle_X_ActorsFriendshipSystem');
Moogle_X.AFS.defAllLeaders = Number(Moogle_X.AFS.parameters['Default All Leaders']) != 0;
Moogle_X.AFS.defMaxLevel = Number(Moogle_X.AFS.parameters['Default Max Level'] || 10);
Moogle_X.AFS.defExp = Number(Moogle_X.AFS.parameters['Default Exp for Level Up'] || 20);
Moogle_X.AFS.defExp = Moogle_X.AFS.defExp > 0 ? Moogle_X.AFS.defExp : 1;
Moogle_X.AFS.canLevelDown = Number(Moogle_X.AFS.parameters['Allows Level Down']) != 0;
Moogle_X.AFS.battleFp = Number(Moogle_X.AFS.parameters['Friendship Gain Each Battle'] || 0);
Moogle_X.AFS.singleLeaderScene = Number(Moogle_X.AFS.parameters['Use Single Leader Scene']) != 0;
Moogle_X.AFS.helpText = String(Moogle_X.AFS.parameters['Help Text'] || '');
Moogle_X.AFS.showFpMenu = Number(Moogle_X.AFS.parameters['Show in Main Menu']) != 0;
Moogle_X.AFS.fpTitle = String(Moogle_X.AFS.parameters['Menu Vocab'] || 'Friendship');
Moogle_X.AFS.fpMenuSwitch = Number(Moogle_X.AFS.parameters['Show Menu Switch ID'] || 0);
Moogle_X.AFS.backText = String(Moogle_X.AFS.parameters['Back Text'] || '');
Moogle_X.AFS.backIcon = Number(Moogle_X.AFS.parameters['Back Icon'] || 0);
Moogle_X.AFS.maxRows = Number(Moogle_X.AFS.parameters['Maximum Number of Rows'] || 4);
Moogle_X.AFS.leaderNameColor = Number(Moogle_X.AFS.parameters['Leader Name Color'] || 0);
Moogle_X.AFS.backTextColor = Number(Moogle_X.AFS.parameters['Back Text Color'] || 0);
Moogle_X.AFS.showFace = Number(Moogle_X.AFS.parameters["Show Friend's Face"]) != 0;
Moogle_X.AFS.faceOffsetX = Number(Moogle_X.AFS.parameters['Face Offset X'] || 0);
Moogle_X.AFS.faceOffsetY = Number(Moogle_X.AFS.parameters['Face Offset Y'] || 0);
Moogle_X.AFS.showName = Number(Moogle_X.AFS.parameters["Show Friend's Name"]) != 0;
Moogle_X.AFS.friendNameColor = Number(Moogle_X.AFS.parameters['Friend Name Color'] || 0);
Moogle_X.AFS.friendNameWidth = Number(Moogle_X.AFS.parameters['Friend Name Width'] || 168);
Moogle_X.AFS.friendNameAlignment = String(Moogle_X.AFS.parameters['Friend Name Alignment'] || 'left');
Moogle_X.AFS.friendNameOffsetX = Number(Moogle_X.AFS.parameters['Friend Name Offset X'] || 0);
Moogle_X.AFS.friendNameOffsetY = Number(Moogle_X.AFS.parameters['Friend Name Offset Y'] || 0);
Moogle_X.AFS.fpLvlText = String(Moogle_X.AFS.parameters['Friendship Level Text'] || '');
Moogle_X.AFS.showLevelText = Number(Moogle_X.AFS.parameters['Show Friendship Level Text']) != 0;
Moogle_X.AFS.fpLvlTextColor = Number(Moogle_X.AFS.parameters['Friendship Level Text Color'] || 0);
Moogle_X.AFS.fpLvlTextWidth = Number(Moogle_X.AFS.parameters['Friendship Level Text Width'] || 200);
Moogle_X.AFS.fpLvlTextAlignment = String(Moogle_X.AFS.parameters['Friendship Level Text Alignment'] || 'left');
Moogle_X.AFS.fpLvlTextOffsetX = Number(Moogle_X.AFS.parameters['Friendship Level Text Offset X'] || 0);
Moogle_X.AFS.fpLvlTextOffsetY = Number(Moogle_X.AFS.parameters['Friendship Level Text Offset Y'] || 0);
Moogle_X.AFS.showLevelNumber = Number(Moogle_X.AFS.parameters['Show Friendship Level Number']) != 0;
Moogle_X.AFS.fpLvlNumberColor = Number(Moogle_X.AFS.parameters['Friendship Level Number Color'] || 0);
Moogle_X.AFS.fpLvlNumberWidth = Number(Moogle_X.AFS.parameters['Friendship Level Number Width'] || 40);
Moogle_X.AFS.fpLvlNumberAlignment = String(Moogle_X.AFS.parameters['Friendship Level Number Alignment'] || 'right');
Moogle_X.AFS.fpLvlNumberOffsetX = Number(Moogle_X.AFS.parameters['Friendship Level Number Offset X'] || 0);
Moogle_X.AFS.fpLvlNumberOffsetY = Number(Moogle_X.AFS.parameters['Friendship Level Number Offset Y'] || 0);
Moogle_X.AFS.showGauge = Number(Moogle_X.AFS.parameters['Show Friendship Gauge']) != 0;
Moogle_X.AFS.fpGaugeColor1 = Number(Moogle_X.AFS.parameters['Color 1'] || 24);
Moogle_X.AFS.fpGaugeColor2 = Number(Moogle_X.AFS.parameters['Color 2'] || 29);
Moogle_X.AFS.fpGaugeWidth = Number(Moogle_X.AFS.parameters['Gauge Width'] || 382);
Moogle_X.AFS.fpGaugeHeight = Number(Moogle_X.AFS.parameters['Gauge Height'] || 6);
Moogle_X.AFS.fpGaugeOffsetX = Number(Moogle_X.AFS.parameters['Friendship Gauge Offset X'] || 0);
Moogle_X.AFS.fpGaugeOffsetY = Number(Moogle_X.AFS.parameters['Friendship Gauge Offset Y'] || 0);
Moogle_X.AFS.currentFpText = String(Moogle_X.AFS.parameters['Current FP Text'] || '');
Moogle_X.AFS.showCurrentFpText = Number(Moogle_X.AFS.parameters['Show Current FP Text']) != 0;
Moogle_X.AFS.currentFpTextColor = Number(Moogle_X.AFS.parameters['Current FP Text Color'] || 0);
Moogle_X.AFS.currentFpTextWidth = Number(Moogle_X.AFS.parameters['Current FP Text Width'] || 200);
Moogle_X.AFS.currentFpTextAlignment = String(Moogle_X.AFS.parameters['Current FP Text Alignment'] || 'left');
Moogle_X.AFS.currentFpTextOffsetX = Number(Moogle_X.AFS.parameters['Current FP Text Offset X'] || 0);
Moogle_X.AFS.currentFpTextOffsetY = Number(Moogle_X.AFS.parameters['Current FP Text Offset Y'] || 0);
Moogle_X.AFS.showCurrentFpNumber = Number(Moogle_X.AFS.parameters['Show Current FP Number']) != 0;
Moogle_X.AFS.currentFpNumberColor = Number(Moogle_X.AFS.parameters['Current FP Number Color'] || 0);
Moogle_X.AFS.currentFpNumberWidth = Number(Moogle_X.AFS.parameters['Current FP Number Width'] || 200);
Moogle_X.AFS.currentFpNumberAlignment = String(Moogle_X.AFS.parameters['Current FP Number Alignment'] || 'right');
Moogle_X.AFS.currentFpNumberOffsetX = Number(Moogle_X.AFS.parameters['Current FP Number Offset X'] || 0);
Moogle_X.AFS.currentFpNumberOffsetY = Number(Moogle_X.AFS.parameters['Current FP Number Offset Y'] || 0);
Moogle_X.AFS.nextLevelText = String(Moogle_X.AFS.parameters['To Next Level Text'] || '');
Moogle_X.AFS.showNextLevelText = Number(Moogle_X.AFS.parameters['Show To Next Level Text']) != 0;
Moogle_X.AFS.nextLevelTextColor = Number(Moogle_X.AFS.parameters['To Next Level Text Color'] || 0);
Moogle_X.AFS.nextLevelTextWidth = Number(Moogle_X.AFS.parameters['To Next Level Text Width'] || 200);
Moogle_X.AFS.nextLevelTextAlignment = String(Moogle_X.AFS.parameters['To Next Level Text Alignment'] || 'left');
Moogle_X.AFS.nextLevelTextOffsetX = Number(Moogle_X.AFS.parameters['To Next Level Text Offset X'] || 0);
Moogle_X.AFS.nextLevelTextOffsetY = Number(Moogle_X.AFS.parameters['To Next Level Text Offset Y'] || 0);
Moogle_X.AFS.showNextLevelNumber = Number(Moogle_X.AFS.parameters['Show To Next Level Number']) != 0;
Moogle_X.AFS.nextLevelNumberColor = Number(Moogle_X.AFS.parameters['To Next Level Number Color'] || 0);
Moogle_X.AFS.nextLevelNumberWidth = Number(Moogle_X.AFS.parameters['To Next Level Number Width'] || 200);
Moogle_X.AFS.nextLevelNumberAlignment = String(Moogle_X.AFS.parameters['To Next Level Number Alignment'] || 'right');
Moogle_X.AFS.nextLevelNumberOffsetX = Number(Moogle_X.AFS.parameters['To Next Level Number Offset X'] || 0);
Moogle_X.AFS.nextLevelNumberOffsetY = Number(Moogle_X.AFS.parameters['To Next Level Number Offset Y'] || 0);
Moogle_X.AFS.fpIconsOffsetX = Number(Moogle_X.AFS.parameters['Friendship Icons Offset X'] || 0);
Moogle_X.AFS.fpIconsOffsetY = Number(Moogle_X.AFS.parameters['Friendship Icons Offset Y'] || 0);
Moogle_X.AFS.defLockIcon = Number(Moogle_X.AFS.parameters['Default Lock Icon'] || 0);
Moogle_X.AFS.fpLockOffsetX = Number(Moogle_X.AFS.parameters['FP Lock Icon Offset X'] || 0);
Moogle_X.AFS.fpLockOffsetY = Number(Moogle_X.AFS.parameters['FP Lock Icon Offset Y'] || 0);
Moogle_X.AFS.customFpIconOffsetX = Number(Moogle_X.AFS.parameters['Custom Friend Icon Offset X'] || 0);
Moogle_X.AFS.customFpIconOffsetY = Number(Moogle_X.AFS.parameters['Custom Friend Icon Offset Y'] || 0);
Moogle_X.AFS.usePrettyGauges = Number(Moogle_X.AFS.parameters['Use Pretty Gauges Patch']) != 0;
//=============================================================================
// DataManager
//=============================================================================
Moogle_X.AFS.DatabaseLoaded = false;
Moogle_X.AFS.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
DataManager.isDatabaseLoaded = function() {
if (!Moogle_X.AFS.DataManager_isDatabaseLoaded.call(this)) return false;
if (!Moogle_X.AFS.DatabaseLoaded) {
DataManager.readNotetags_AFS1($dataActors);
DataManager.readNotetags_AFS2($dataItems);
DataManager.readNotetags_AFS2($dataSkills);
Moogle_X.AFS.DatabaseLoaded = true;
}
return true;
};
DataManager.readNotetags_AFS1 = function(group) {
var note1 = /<(?:AFS LEADER)>/i;
var note2 = /<(?:AFS EXP):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note3 = /<(?:AFS MAX LEVEL):[ ](\d+)>/i;
var note4 = /<(?:AFS SKILL)[ ](\d+)[ ](?:LEADER)[ ](\d+):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note5 = /<(?:AFS MAX SKILL LEADER)[ ](\d+):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note6 = /<(?:AFS ICON LEVEL)[ ](\d+)[ ](?:LEADER)[ ](\d+):[ ]*(\d+(?:\s*,\s*\d+)*)>/i;
var note7 = /<(?:AFS LOCK ICON):[ ](\d+)>/i;
var note8 = /<(?:AFS EVENT LEVEL)[ ](\d+)[ ](?:LEADER)[ ](\d+):[ ](\d+)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.isAfsLeader = Moogle_X.AFS.defAllLeaders;
obj.afsExpChart = [];
obj.afsMaxLevel =
Moogle_X.AFS.defMaxLevel > 0 ? Moogle_X.AFS.defMaxLevel : 1;
obj.afsSkills = [];
obj.afsSkills.push(null);
obj.afsMaxSkills = {};
obj.afsIcons = [];
obj.afsIcons.push(null);
obj.afsLockIcon = Moogle_X.AFS.defLockIcon;
obj.afsCommonEvents = [];
obj.afsCommonEvents.push(null);
for (var z = 1; z < group.length; z++) {
var empty = {};
obj.afsSkills.push(empty);
}
for (var c = 1; c < group.length; c++) {
var empty = {};
obj.afsIcons.push(empty);
}
for (var f = 1; f < group.length; f++) {
var empty = {};
obj.afsCommonEvents.push(empty);
}
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
obj.isAfsLeader = true;
} else if (line.match(note2)) {
var array = JSON.parse('[' + RegExp.$1.match(/\d+/g) + ']');
obj.afsExpChart = obj.afsExpChart.concat(array);
} else if (line.match(note3)) {
var maxLevel = Number(RegExp.$1);
obj.afsMaxLevel = maxLevel > 0 ? maxLevel : 1;
} else if (line.match(note4)) {
var level = Number(RegExp.$1);
var leader = Number(RegExp.$2);
var list = JSON.parse('[' + RegExp.$3.match(/\d+/g) + ']');
obj.afsSkills[leader][level] = list;
} else if (line.match(note5)) {
var bestFriend = Number(RegExp.$1);
var maxList = JSON.parse('[' + RegExp.$2.match(/\d+/g) + ']');
obj.afsMaxSkills[bestFriend] = maxList;
} else if (line.match(note6)) {
var iconLevel = Number(RegExp.$1);
var iconLeader = Number(RegExp.$2);
var iconList = JSON.parse('[' + RegExp.$3.match(/\d+/g) + ']');
obj.afsIcons[iconLeader][iconLevel] = iconList;
} else if (line.match(note7)) {
var lockIconId = Number(RegExp.$1);
obj.afsLockIcon = lockIconId;
} else if (line.match(note8)) {
var ceLevel = Number(RegExp.$1);
var ceLeaderId = Number(RegExp.$2);
var ceId = Number(RegExp.$3);
obj.afsCommonEvents[ceLeaderId][ceLevel] = ceId;
}
}
}
};
DataManager.readNotetags_AFS2 = function(group) {
var note1 = /<(?:AFS GAIN)[ ](\d+):[ ](.*)>/i;
var note2 = /<(?:AFS GAIN DEFAULT):[ ](.*)>/i;
for (var n = 1; n < group.length; n++) {
var obj = group[n];
var notedata = obj.note.split(/[\r\n]+/);
obj.afsGain = {};
for (var i = 0; i < notedata.length; i++) {
var line = notedata[i];
if (line.match(note1)) {
var actorId = Number(RegExp.$1);
var gain = Number(RegExp.$2);
obj.afsGain[actorId] = gain;
} else if (line.match(note2)) {
var defaultGain = Number(RegExp.$1);
obj.afsGain["default"] = defaultGain;
}
}
}
};
//=============================================================================
// SceneManager
//=============================================================================
Moogle_X.AFS.SceneManager_updateScene = SceneManager.updateScene;