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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
| #==============================================================================#
# #*****************# #
# #*** By Falcao ***# * Falcao Mmorpg Alchemy and Extraction System #
# #*****************# This script allows the player to learn two new #
# skills, Alchemy and extraction, both of them #
# RMVXACE used to create Items. Date: March 25 2013 #
# #
# Falcao RGSS site: http://falcaorgss.wordpress.com #
# Falcao Forum site: http://makerpalace.com #
#==============================================================================#
#-------------------------------------------------------------------------------
# What is this?
#
# - Alchemy is a system that allows you create Items, Weapons and armors by
# combining a list of ingredients.
# - Extraction is a system that allows you extract ingredients from things like
# plants, rocks etc.
#
# It is called Crafting
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# * Features
#
# - Full Alchemy skill system
# - Full Extraction skill system
# - Alchemy and extraction Leveling system
# - Full alchemy and extraction variance system
# - Alchemy can create Weapons, Armors and Items
# - In game maximun Alchemy and extraction levels enabled
# - Alchemy Support up to 20 ingredients mix
# - Alchemy and Extraction, speed, quantity, chance enabled
# - Recipes levels enabled
# - Extraction plants levels enabled
# - Extractions plants respawn enabled
# - Recipes system
# - Flexible and easy recipe creation
# - Easy to use
#-------------------------------------------------------------------------------
# * Terms and license
# - Do credit me Falcao as the creator of this system
# - You can modify anything you want
# - You are allowed to distribute this material in any webpage
# - Do not remove the header of any script shelf
# - You are free to use this script in non-comercial projects, for comercial
# projects contact me falmc99@gmail.com
=begin
===============================================================================
* Script Manual
*************************
* Alchemy skill set up *
Use the following script call to display the alchemy GUI
SceneManager.call(Scene_Alchemy)
You will see an empty GUI, the first thing you have to do is create a recipe
in the database item section using the following notetags
- Here a normal recipe set up
<Output Item Type: Item>
<Output Item Id: 2>
<Output Item Chance: 50>
<Output Item Quantity: 2>
<Recipe Speed: 1.5>
<Recipe Level: 1>
<Recipe Item Mixs: 17, 18, 19>
<Recipe Item Cost: 3, 2, 2>
- Tags explanation
<Output Item Type: Item>
recipe output item type, it can be Item, Weapon or Armor
<Output Item Id: 2>
Item Type id you choose
<Output Item Chance: 50>
Chance to produce the item, it can be a number form 1 to 100 percent of chance
<Output Item Quantity: 2>
How many items you want to get when succes producing?
<Recipe Speed: 1.5>
production speed, it display a hud. it support decimals
<Recipe Level: 1>
Level of the recipe (if the player alchemy level is below he cant learn it)
<Recipe Item Mixs: 17, 18, 19>
Ingredients items ids required to produce the output item
<Recipe Item Cost: 3, 2, 2>
Quantity of item Mixs required to produce the Ouput item, MUST be in the same
order of Item Mixs. In this case item id 17 require 3 or more, item id 18
require 2 and item id 19 require 2.
* IMPORTANT
Once the game party gets the Item recipe, the game player has to learn the
recipe from the inventory menu in order to be displayed in the alchemy GUI
-------------------------------------
* Extraction skill set up *
In order to extract items plants, rocks or whatever you need, create an event
with the following comment tags.
Here a regular plant creation
<extract_item: 19>
<extract_quantity: 3>
<extract_chance: 70>
<extract_speed: 1.0>
<extract_level: 1>
<extract_times: 3>
<extract_respawn: 10>
Tags explanation
<extract_item: 19>
Which item id do you want to extract?
<extract_quantity: 3>
How many items will be extracted?
<extract_chance: 70>
Extraction success chance, it can be a number between 1 to 100 percent
<extract_speed: 1.0>
Extraction speed, it support decimals
<extract_level: 1>
item extraction level, if player extraction skill is below this level it cannot
be extracted
<extract_times: 3>
How many times you want this plant to be extracted before dissapear?
<extract_respawn: 10>
Time in seconds this plant takes to respawn
IMPORTANT NOTE!
I strongly recomend to see this script demo examples for the correct usage of
this complex system
=end
#===============================================================================
# * Alchemy skill settings
#===============================================================================
module FalcaoAlchemy
# After how many production times get a chance to level up
ProductionTimesLevelUp = 5
# Chance to level up when the production times match
AlchemyLevelUpChance = 50
# After how many party alchemy skill level above of Recipe level have a chance
# to level up the alchemy skill. Example: Alchemy level = 20
# Recipe level = 9, there are 11 levels above so party can not level up skill
SeparateLevel = 10
# Default alchemy maximun level (can be changed in game)
DefaultMaxLevel = 100
# Sound played when succes produce an item
SuccesProduceSe = "Ice8"
# Sound played when fail producing an item
FailProduceSe = "Down1"
# Sound played when succes level up the alchemy skill
AlchemyLevelUpSe = "Applause2"
end
#===============================================================================
# * Extraction skill settings
#===============================================================================
module FalExtract
# After how many extraction times get a chance to level up
ExtracTimesLevelUp = 7
# Chance to level up when the production times match
ExtracLevelUpChance = 60
# After how many party extraction skill level above of Plant level have a
# chance to level up the extraction skill. Example: Extraction level = 20
# Plant level = 9, there are 11 levels above so party can not level up skill
SeparateLevell = 5
# Default extraction maximun level (can be changed in game)
DefaultMaxLevel = 100
# Animation id played while extracting
ExAnimation = 184
# Sound played when succes extrac an item
SuccesExtractSe = "Up1"
# Sound played when fail extract an item
FailExtractSe = "Down1"
# Sound played when level up extraction skill
AlchemyLevelUpSe = "Thunder11"
#-----------------------------------------------
def self.check_extracted_ones
$game_map.events.values.each do |event|
break if $game_party.ev_extdata[$game_map.map_id].nil?
if !$game_party.ev_extdata[$game_map.map_id][event.id].nil?
event.erase if $game_party.ev_extdata[$game_map.map_id][event.id][2]
end
end
end
end
#Do you want to add the alchemy scene to the game menu? true / false
FalcaoRGSS_AddAlchemy_to_menu = true
#-----------------------------------------------------------------------------
# * Script calls
#
# Use this script call only if you want to change the extraction and alchemy
# levels manually
#
# $game_party.alchemy_maxlv(x) If you want to change the alchemy maximun level
# in game change x for the new maximun level
# $game_party.alchemy_lv = x if you want to change the current alchemy level
# change x for the new level
# $game_party.extraction_maxlv(x) Extraction max level, change x for the new
# maximun level
# $game_party.extract_lv = x Extraction current level, change x for any
# integer
#-------------------------------------------------------------------------------
($imported ||= {})['Falcao Mmorpg Alchemy And Extraction'] = 1.0
#===============================================================================
# * Falcao Alchemy skill END OF SETINGS
#===============================================================================
class RecipeData
attr_accessor :recipes
def initialize
@recipes = {}
@ingredients = {}
register_values
end
def register_values
for item in $data_items
next if item.nil?
id = item.recipedata("<Output Item Id: ")
next if id.nil?
type = item.recipedata("<Output Item Type: ", false)
chance = item.recipedata("<Output Item Chance: ")
quanti = item.recipedata("<Output Item Quantity: ")
sp = item.recipedata("<Recipe Speed: ", true, true)
lv = item.recipedata("<Recipe Level: ")
mix = item.recipedata("<Recipe Item Mixs: ", false)
@recipes[item.id] = [item.name, type, id, chance, quanti, sp, lv, item.id]
@ingredients[item.id] = mix.split(",").map { |s| s.to_i }
end
end
def recipes
@recipes
end
def ingredients
@ingredients
end
end
class RPG::BaseItem
def recipedata(comment, s=true, f=false)
if @note =~ /#{comment}(.*)>/i
return $1.to_f if f
return s ? $1.to_i : $1.to_s.sub("\r","")
end
end
def costitem
if @costitemm.nil?
@costitemm = {}
if @note =~ /<Recipe Item Mixs: (.*)>/i
key = $1.to_s.sub("\r","").split(",").map { |s| s.to_i }
end
if @note =~ /<Recipe Item Cost: (.*)>/i
value = $1.to_s.sub("\r","").split(",").map { |s| s.to_i }
end
if key != nil
index = 0
key.each {|k|
@costitemm[k] = value[index]
index += 1}
end
return @costitemm
else
return @costitemm
end
end
end
class Game_Party < Game_Unit
attr_reader :recipes
attr_accessor :extract_data, :extract_lv, :extrat_count, :ev_extdata
attr_accessor :alchemy_lv, :alchemy_count, :pop_windowdata
attr_accessor :al_maxlv, :ex_maxlv
alias falcaoalchemy_ini initialize
def initialize
@recipes = []
@extract_lv = 1
@extrat_count = 0
@ev_extdata = {}
@alchemy_lv = 1
@alchemy_count = 0
@al_maxlv = FalcaoAlchemy::DefaultMaxLevel
@ex_maxlv = FalExtract::DefaultMaxLevel
falcaoalchemy_ini
end
def alchemy_maxlv(lv)
@al_maxlv = lv if lv >= @al_maxlv
end
def extraction_maxlv(lv)
@ex_maxlv = lv if lv >= @ex_maxlv
end
def add_recipe(id)
@recipes.push(id) unless @recipes.include?(id)
end
def pop_w(time, name, text)
return unless @pop_windowdata.nil?
@pop_windowdata = [time, text, name]
end
end
class Game_Battler < Game_BattlerBase
alias falcaoalchemy_mm_item consume_item
def consume_item(item)
if item.is_a?(RPG::Item) and !item.recipedata("<Output Item Id: ").nil?
level = item.recipedata("<Recipe Level: ")
if $game_party.alchemy_lv >= level
$game_party.add_recipe(item.id)
$game_party.pop_w(
180, 'Fusion', " #{item.name} assimilé!")
else
$game_party.gain_item(item, 1)
$game_party.pop_w(
180,'Fusion',"Niveau #{level} requis")
Sound.play_buzzer
end
end
falcaoalchemy_mm_item(item)
end
def on_actor_ok
if item_usable?
use_item
refresh_window
@item_window.refresh
else
Sound.play_buzzer
end
refresh
end
#--------------------------------------------------------------------------
# ● Refresh Window
#--------------------------------------------------------------------------
def refresh_window
if @command_index == 0
old_item = @item_window.item
@item_window.refresh
# set_actor_for_members_menu
if @item_window.item == nil
@item_window.index -= 1
@item_window.index = 0 if @item_window.index < 0
@item_window.update
end
if old_item != @item_window.item
on_actor_cancel
cancel_selection
@item_window_2.refresh
@item_window.update_help
end
elsif @command_index == 1
@weapon_window.refresh
elsif @command_index == 2
@armor_window.refresh
elsif @command_index == 3
@key_window.refresh
end
end
end
#-------------------------------------------------------------------------------
class Window_AlRecipes < Window_Selectable
def initialize(x, y, w, h, rdata)
super(x, y, w, h)
@rdata = rdata
refresh ; select(0)
end
def item() return @data[self.index] end
def refresh
self.contents.clear if self.contents != nil
@data = []
@rdata.recipes.each {|id, recipe| @data.push(recipe) if
$game_party.recipes.include?(id)}
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 26)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
x, y = index % col_max * (90), index / col_max * 24
self.contents.font.size = 18
draw_icon($data_items[item[7]].icon_index, x, y)
contents.draw_text(x + 25, y, self.width, 32, item[0])
end
def item_max
return @item_max.nil? ? 0 : @item_max
end
end
class Window_StartProducing < Window_HorzCommand
def initialize(dark)
@darked = dark
super(200, 350)
end
def window_width() return 440 end
def window_height() return 60 end
def col_max
return 2
end
def make_command_list
add_command("Fusionner", :start, @darked.items_ready?)
add_command("Arrêter", :stop)
end
def process_cancel
@darked.meter > 0 ? return : super
end
end
class FalcaoExtraction
include FalExtract
def initialize
@col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)]
@running = false
@anitimer = 0
end
def update
update_extraction_trigger if Input.trigger?(:C)
update_display_window if $game_party.extract_data != nil
update_respawn
end
def update_respawn
return if $game_party.ev_extdata[$game_map.map_id].nil?
$game_map.events.values.each do |event|
break if $game_party.ev_extdata[$game_map.map_id].nil?
if !$game_party.ev_extdata[$game_map.map_id][event.id].nil?
if $game_party.ev_extdata[$game_map.map_id][event.id][2]
$game_party.ev_extdata[$game_map.map_id][event.id][1] -= 1 if
$game_party.ev_extdata[$game_map.map_id][event.id][1] > 0
if $game_party.ev_extdata[$game_map.map_id][event.id][1] == 0
event.fading = [:fade_out, 60]
$game_party.ev_extdata[$game_map.map_id].delete(event.id)
if $game_party.ev_extdata[$game_map.map_id].empty?
$game_party.ev_extdata.delete($game_map.map_id)
end
next
end
end
end
end
end
def update_display_window
create_window
if $game_party.extract_data[5] > 0
$game_party.extract_data[5] -= 1
if $game_party.extract_data[5] == 0
$game_party.extract_data = nil
dispose_window
@running = false
return
end
end
return if $game_party.extract_data[5] > 0
if @running
if $game_party.extract_data[5] == 0
refresh_contents
$game_party.extract_data[4] += 1
end
if $game_party.extract_data[4] >= $game_party.extract_data[3] * 60
$game_party.extract_data[5] = 60
refresh_contents
end
end
end
def create_window
return if !@ext_window.nil?
@ext_window = Window_Base.new(544 / 2 - 200 / 10, 415, 200, 66)
if $game_party.extract_lv >= $game_party.extract_data[6]
@running = true
end
refresh_contents
end
def refresh_contents
@ext_window.contents.clear
@ext_window.contents.fill_rect(0, 10, 26, 38, Color.new(0, 0, 0, 60))
item = $game_party.extract_data[0]
@ext_window.draw_icon(item.icon_index, 1, 11)
@ext_window.contents.font.size = 18
@ext_window.contents.font.color = @ext_window.normal_color
@ext_window.contents.font.shadow = true
string = item.name
@ext_window.draw_text(-4, -6, @ext_window.width, 32, string, 1)
@ext_window.contents.font.size = 15
@ext_window.draw_text(0, 22, 26, 32, $game_party.extract_data[1].to_s, 1)
@ext_window.contents.font.size = 18
if @running
if $game_party.extract_data[5] == 60
r = rand(101)
@ext_window.contents.font.color = Color.new(0, 255, 0, 255)
if r <= $game_party.extract_data[2]
$game_party.gain_item($game_party.extract_data[0],
$game_party.extract_data[1])
RPG::SE.new(SuccesExtractSe, 80,).play
@ext_window.draw_text(-30, 20, @ext_window.width, 32, 'Extré', 2)
if $game_party.extrat_count == ExtracTimesLevelUp - 1
r2 = rand(101)
if r2 <= ExtracLevelUpChance
leveling = true unless stop_growing?
apply_extraction_growing
end
else
$game_party.extrat_count += 1
end
@anitimer = 0
else
@ext_window.contents.font.color = Color.new(255, 0, 0, 255)
RPG::SE.new(FailExtractSe, 80,).play
@ext_window.draw_text(-30, 20, @ext_window.width, 32, 'Raté', 2)
end
apply_variance
@running = false
end
run_extractor if leveling.nil?
else
@ext_window.contents.font.color = Color.new(255, 0, 0, 255)
@ext_window.draw_text(0, 16, @ext_window.width, 32,
"Ext Nv #{$game_party.extract_data[6]} requis", 1)
Sound.play_buzzer
$game_party.extract_data[5] = 120
end
end
def stop_growing?
lv = $game_party.extract_data[6]
return true if $game_party.extract_lv == $game_party.ex_maxlv
return true unless $game_party.extract_lv <= lv + SeparateLevell - 1
return false
end
# growing
def apply_extraction_growing
return if stop_growing?
RPG::SE.new(AlchemyLevelUpSe, 80,).play
$game_party.extract_lv += 1
$game_party.extrat_count = 0
@ext_window.draw_text(30, 20, @ext_window.width, 32,
"Comp- Nv #{$game_party.extract_lv}!")
end
def apply_variance
$game_party.ev_extdata[$game_map.map_id] = {} if
$game_party.ev_extdata[$game_map.map_id].nil?
event = $game_party.extract_data[7]
times = event.check_ext("<extract_times: ")
res = event.check_ext("<extract_respawn: ") * 60
if $game_party.ev_extdata[$game_map.map_id][event.id].nil?
$game_party.ev_extdata[$game_map.map_id][event.id] = [times, res, false]
end
$game_party.ev_extdata[$game_map.map_id][event.id][0] -= 1
if $game_party.ev_extdata[$game_map.map_id][event.id][0] == 0
event.fading = [:fade_in, 60]
$game_party.ev_extdata[$game_map.map_id][event.id][2] = true
end
end
def run_extractor
x, y = 30, 30
@ext_window.contents.fill_rect(x, y, 102, 12, @col[2])
max = $game_party.extract_data[3] * 60
meter = $game_party.extract_data[4]
@ext_window.contents.fill_rect(x+1, y+1, 100 *meter / max, 5, @col[0])
@ext_window.contents.fill_rect(x+1, y+6, 100 *meter / max, 5, @col[1])
@anitimer += 1
@anitimer = 0 if @anitimer == 6
$game_party.extract_data[7].animation_id = ExAnimation if @anitimer == 2
$game_player.pattern = 2
end
def dispose_window
return if @ext_window.nil?
@ext_window.dispose
@ext_window = nil
end
def update_extraction_trigger
return if $game_party.extract_data != nil
$game_map.events.values.each do |event|
next if event.fading[1] > 0
next unless $game_player.in_front_ext?(event)
item = event.check_ext("<extract_item: ")
weapon = event.check_ext("<extract_weapon: ")
armor = event.check_ext("<extract_weapon: ")
if item != 0 then kind = $data_items[item]
elsif weapon != 0 then kind = $data_weapons[weapon]
elsif armor != 0 then kind = $data_armor[armor]
end
if kind != nil
quantity = event.check_ext("<extract_quantity: ")
chance = event.check_ext("<extract_chance: ")
speed = event.check_ext("<extract_speed: ", false)
lv = event.check_ext("<extract_level: ")
$game_party.extract_data = [kind,quantity,chance,speed,meter=0, t=0,
lv, event]
break
end
end
end
def dispose
dispose_window
end
end
class Spriteset_Map
alias falcaoextraction_create_p create_pictures
def create_pictures
falcaoextraction_create_p
@falextraction = FalcaoExtraction.new
end
alias falcaoextraction_update update
def update
falcaoextraction_update
@falextraction.update
end
alias falcaoextraction_dispose dispose
def dispose
falcaoextraction_dispose
@falextraction.dispose
end
end
class Game_Event < Game_Character
attr_accessor :opacity, :erased, :fading
def check_ext(comment, f=true)
return 0 if @list.nil? or @list.size <= 0
for item in @list
if item.code == 108 or item.code == 408
return f ? $1.to_i : $1.to_f if item.parameters[0] =~ /#{comment}(.*)>/i
end
end
return 0
end
alias falcaoexts_ini initialize
def initialize(map_id, event)
@fading = [:fade_in, time=0]
falcaoexts_ini(map_id, event)
end
alias falcaoexts_up update
def update
if @fading[1] > 0
@fading[1] -= 1
if @fading[0] == :fade_in
@opacity -= 4 if @opacity >= 0
erase if @fading[1] == 0
elsif @fading[0] == :fade_out
if @erased
@erased = false
refresh ; @opacity = 0
end
@opacity += 4 if @opacity <= 255
end
end
falcaoexts_up
end
end
class Game_Player < Game_Character
attr_accessor :pattern
def in_front_ext?(target)
return true if @direction == 2 and @x == target.x and (@y+1) == target.y
return true if @direction == 4 and (@x-1) == target.x and @y == target.y
return true if @direction == 6 and (@x+1) == target.x and @y == target.y
return true if @direction == 8 and @x == target.x and (@y-1) == target.y
return false
end
def update_anime_pattern
return if !$game_party.extract_data.nil?
super
end
alias falcaoextraction_mov movable?
def movable?
return false if $game_party.extract_data != nil
falcaoextraction_mov
end
alias falcaoext_perform_transfer perform_transfer
def perform_transfer
falcaoext_perform_transfer
FalExtract.check_extracted_ones if $game_map.map_id != @new_map_id
end
end
class << DataManager
alias falcaoalchemy_mmo_load load_normal_database
def DataManager.load_normal_database
falcaoalchemy_mmo_load
for item in $data_items
next if item.nil?
if item.recipedata("<Output Item Id: ") != nil
item.name = item.name
item.consumable = true
item.scope = 0
end
end
end
alias falcaoalchemy_reloadmap reload_map_if_updated
def DataManager.reload_map_if_updated
falcaoalchemy_reloadmap
FalExtract.check_extracted_ones if
$game_system.version_id != $data_system.version_id
end
end
# ingredients
class AlIngredients
attr_accessor :meter
def initialize(rdata)
@ingredients = Window_Base.new(200, 40, 440, 330)
@ingredients.opacity = 0
@recipe = []
@meter = 0
@rdata = rdata
end
def refresh(recipe)
@recipe = recipe
@ingredients.contents.clear
@ingredients.contents.font.size = 24 ; w = @ingredients.width
@ingredients.contents.fill_rect(0, 24, w, 220, Color.new(0, 0, 0, 60))
apply_color(1)
@ingredients.draw_text(-16, -6, w, 32, 'Ingrédients', 1)
draw_ingredients
end
def draw_ingredients
manager = y = 0
for i in ingredients
item = $data_items[i]
manager += 1
(manager%2 == 0) ? x = 156 : y += 24
x = 0 unless (manager%2 == 0)
enable = $game_party.item_number(item) >= cost[item.id]
enable ? apply_color(1) : apply_color(2)
@ingredients.draw_icon(item.icon_index, x, y, enable)
@ingredients.contents.font.size = 15
number = $game_party.item_number(item)
@ingredients.draw_text(x - 2, y + 6, 32, 32, number.to_s, 1)
@ingredients.contents.font.size = 18
@ingredients.draw_text(x + 24, y,212,32, item.name + " X#{cost[item.id]}")
end
end
def items_ready?
return false if @meter > 0
combi = ingredients ; item = [] ; combi = [] if combi.nil?
combi.each {|i|
it =$data_items[i]; item << i if $game_party.item_number(it) >= cost[it.id]}
item.size == combi.size
end
def apply_color(c)
@ingredients.contents.font.color = @ingredients.normal_color if c == 1
@ingredients.contents.font.color = Color.new(255,255,255,255) if c == 2
end
def ingredients
return @rdata.ingredients[@recipe.last]
end
def dispose
@ingredients.dispose
end
def update_index(recipe_index)
@recipe_index = recipe_index
end
def cost
return $data_items[@recipe_index].costitem
end
end
#----------
class Scene_Alchemy < Scene_MenuBase
include FalcaoAlchemy
#--------------------------------------------------------------------------
# * Create Background
#--------------------------------------------------------------------------
def create_background
@sprite = Sprite.new
@sprite.bitmap = Cache.system("Fusion")
end
#--------------------------------------------------------------------------
# * Free Background
#--------------------------------------------------------------------------
def dispose_background
@sprite.bitmap.dispose
@sprite.dispose
end
def start
super
recipedata = RecipeData.new
@col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)]
@meter = 0
@infow = Window_Base.new(0, 0, 200, 60)
@alstatus = Window_Base.new(0, 390, 200, 90)
refresh_alstatus
@infow.opacity = 0
@infow.contents.font.size = 20
@infow.draw_text(-16, 0, @infow.width, 32, 'Recette/Formule/Plan', 1)
@recipes = Window_AlRecipes.new(0, 60, 200, 330, recipedata)
@recipes.opacity = 0
@ngrewindow = AlIngredients.new(recipedata)
update_rindex
@oven = Window_Base.new(200, 390, 440, 90)
@oven.opacity = 0
@pop_timer = 0
update_recipe
@start_window = Window_StartProducing.new(@ngrewindow)
update_cancel
@start_window.set_handler(:start, method(:update_start))
@start_window.set_handler(:stop, method(:update_stop))
@start_window.set_handler(:cancel, method(:update_cancel))
@start_window.opacity = 0
end
def refresh_alstatus
@alstatus.contents.clear
@alstatus.contents.font.size = 18; w = @alstatus.width ; g = $game_party
@alstatus.draw_icon(218, 0, 16) ; arr = [g.al_maxlv.to_s, g.ex_maxlv.to_s]
@alstatus.draw_icon(482, 0, 40)
@alstatus.draw_text(-16, -8, w, 32, " -Niveau de compétence-", 1)
@alstatus.draw_text(26, 16, w, 32,"Fusion: #{g.alchemy_lv}/" + arr[0])
@alstatus.draw_text(26, 40, w, 32,"Extraction: #{g.extract_lv}/" + arr[1])
@alstatus.opacity = 0
end
def update_start
@ngrewindow.meter = 1
end
def update_stop
@ngrewindow.meter = 0
@start_window.refresh
@start_window.activate
refresh_oven
end
def output_item
item = @recipes.item
kind = $data_items[item[2]] if item[1]=='Item' || item[1]=='item'
kind = $data_weapons[item[2]] if item[1]=='Weapon' || item[1]=='weapon'
kind = $data_armors[item[2]] if item[1]=='Armor' || item[1]=='armor'
kind
end
def update_cancel
@start_window.unselect
@start_window.deactivate
@recipes.activate
end
def refresh_ingredients
@ngrewindow.refresh(@recipes.item)
end
def refresh_oven
@oven.contents.clear
@oven.contents.font.size = 18
@oven.contents.fill_rect(0, 31, 31, 36, Color.new(0, 200, 200, 60))
@oven.draw_text(-16, -6, @oven.width, 32, 'Processus', 1)
if @pop_timer > 0
@oven.contents.font.color = Color.new(200, 200, 0, 255)
@oven.draw_text(0, -6, @oven.width, 32, @type)
end
@oven.contents.font.color = @oven.normal_color
@oven.draw_icon(output_item.icon_index, 4, 34)
@oven.contents.font.size = 15
@oven.draw_text(0, 45, 33, 32, @recipes.item[4], 1)
@oven.contents.font.size = 18
@oven.draw_text(34, 23, 250, 32, output_item.name)
@oven.draw_text(-26, 5, @oven.width, 32, 'Chance de réussite', 2)
@oven.draw_text(-26, 20, @oven.width, 32, @recipes.item[3].to_s + '%', 2)
x, y = 33, 52
@oven.contents.fill_rect(x, y, 150, 12, @col[2])
max = @recipes.item[5] * 60
@oven.contents.fill_rect(x+1, y+1, 152 *@ngrewindow.meter / max, 5, @col[0])
@oven.contents.fill_rect(x+1, y+6, 152 *@ngrewindow.meter / max, 5, @col[1])
end
def update_rindex
@ngrewindow.update_index(@recipes.item[7]) unless @recipes.item.nil?
end
def update
super
update_rindex
update_recipe
SceneManager.return if Input.trigger?(:B) and @recipes.active
update_selection if Input.trigger?(:C) and @recipes.active and
!@recipes.item.nil?
update_meter
end
def update_meter
if @pop_timer > 0
@pop_timer -= 1
refresh_oven if @pop_timer == 0
end
if @ngrewindow.meter != 0
@start_window.refresh if @ngrewindow.meter == 1
@start_window.activate if @ngrewindow.meter == 1
@ngrewindow.meter += 1
refresh_oven
if @ngrewindow.meter >= @recipes.item[5] * 60
@ngrewindow.meter = 0
random = rand(101)
random <= @recipes.item[3] ? success_producing : fail_producing
end
end
end
def success_producing
RPG::SE.new(SuccesProduceSe, 80,).play
$game_party.gain_item(output_item, @recipes.item[4])
@type = 'Réussi!' ; @pop_timer = 60
destroy_items
apply_alchemy_growing
end
def apply_alchemy_growing
return if $game_party.alchemy_lv == $game_party.al_maxlv
return unless $game_party.alchemy_lv <= @recipes.item[6] + SeparateLevel - 1
if $game_party.alchemy_count == ProductionTimesLevelUp - 1
r2 = rand(101)
if r2 <= AlchemyLevelUpChance
$game_party.alchemy_lv += 1
RPG::SE.new(AlchemyLevelUpSe, 80,).play
$game_party.alchemy_count = 0
refresh_alstatus
end
else
$game_party.alchemy_count += 1
end
end
def fail_producing
RPG::SE.new(FailProduceSe, 80,).play
@type = 'Raté!' ; @pop_timer = 60
destroy_items
end
def destroy_items
c = $data_items[@recipes.item[7]].costitem
@ngrewindow.ingredients.each {|i|$game_party.lose_item($data_items[i],c[i])}
refresh_ingredients
refresh_oven
@ngrewindow.items_ready? ? update_start : @start_window.refresh
end
def update_selection
Sound.play_ok
@start_window.select(0)
@start_window.activate
@recipes.deactivate
end
def update_recipe
return if @recipes.item.nil?
if @recipe_index != @recipes.index
@recipe_index = @recipes.index
refresh_ingredients
@start_window.refresh if !@start_window.nil?
refresh_oven
end
end
def terminate
super
@recipes.dispose
@infow.dispose
@ngrewindow.dispose
@start_window.dispose
@oven.dispose
@alstatus.dispose
end
end
# Input module update engine
class << Input
alias falcaoalchemy_mmo_update update
def Input.update
update_popwindow2 if !$game_party.nil? and !$game_party.pop_windowdata.nil?
falcaoalchemy_mmo_update
end
# pop window global
def update_popwindow2
$game_party.pop_windowdata[0] -= 1 if $game_party.pop_windowdata[0] > 0
if @temp_window.nil?
tag = $game_party.pop_windowdata[2]
string = $game_party.pop_windowdata[1] + tag
width = (string.length * 9) - 10
x, y = Graphics.width / 2 - width / 2, Graphics.height / 2 - 64 / 2
@temp_window = Window_Base.new(x, y, width, 64)
@temp_window.contents.font.size = 20
@temp_window.z = 9999
@temp_window.draw_text(-10, -6, width, 32, tag, 1)
@temp_window.draw_text(-10,14, width, 32, $game_party.pop_windowdata[1],1)
@current_scene = SceneManager.scene.class
end
if $game_party.pop_windowdata[0] == 0 ||
@current_scene != SceneManager.scene.class
@temp_window.dispose
@temp_window = nil
$game_party.pop_windowdata = nil
end
end
end
if FalcaoRGSS_AddAlchemy_to_menu
class Window_MenuCommand < Window_Command
alias falcaoadd_alchemy add_original_commands
def add_original_commands
add_command('Fusion', :alchemy, main_commands_enabled)
falcaoadd_alchemy
end
end
class Scene_Menu < Scene_MenuBase
alias falcao_alchemy_command create_command_window
def create_command_window
falcao_alchemy_command
@command_window.set_handler(:alchemy, method(:call_alchemy_scene))
end
def call_alchemy_scene
SceneManager.call(Scene_Alchemy)
end
end
end |