nightowl79a

Iconic Crafting System

Jul 3rd, 2013
1,161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #################################################################################
  2. #################################################################################
  3.             #Nightowl79a Iconic Crafting System#
  4.             #     V 1.5  7/3/13                #
  5. #################################################################################
  6. #################################################################################
  7. ##################################################
  8. #     Channel Log
  9. #     V 1.0
  10. #         Initial release
  11. #     V 1.1        
  12. #         **New Feature: Toggle Between Names and just icons, see below
  13. #         **New Feature: Set Restrictions to recipes based on location, see below
  14. #         **Redesigned Recipe list to show ingredient names.
  15. #     V 1.2
  16. #         **Fixed a bug that would mess with scrolling
  17. #         **Added Sound and graphic file options
  18. #     V 1.3
  19. #         **New Feature: Can have recipes require Gold and/or Mana
  20. #         **New Feature: Fully Custom Colors for ingredients, and recipe list
  21. #           -Minor Recipe list changes, to include mana and gold.
  22. #     V1.4
  23. #         **Added compatibility with Yanfly Core engine(the screen re sizeing part)
  24. #     V1.5
  25. #         **New Feature: Can have recipes require TP
  26. #         **New Feature: Can toggle on/off ingredient order requirements.
  27. #           -Fixed a bug that would cause an error when the player had more than one of a item.
  28. #           -Recipe list font size adjustment to allow for more clean looking recipes.
  29. #           -Added a game messge to inform the player when restrictions are on
  30. #           -Added a game messge to inform the player when a certain party member can not craft
  31. #           -Added a sort command to sort items by Items, Armor, Weapons, All
  32. #           -Changed WANTED_PARTY_LEADER to CRAFTER to be more clear.
  33. ################################################################################
  34.  
  35.  
  36.  
  37. #-------------------------------------------------------------------------------#
  38. #-    I made this script because I wanted a crafting system more like mine craft
  39. #-    or Skyrim in my game. Iconic Crafting System is not exactly like either
  40. #-    of them but I'm happy with it so far. I tried to make everything flow
  41. #-    as smooth as I could, I personally hate having to press to many    
  42. #-    buttons to make stuff work. Hopefully you enjoy this script.
  43. #-    On a side note, this is my very first script, and I have
  44. #-    Tested it to my breaking point. If you have constructive criticism
  45. #-    for me I'd be happy to listen.
  46. #-------------------------------------------------------------------------------#
  47.  
  48. #-------------------------------------------------------------------------------#
  49. #     Things planned for the future:
  50. #     Add items that teach you recipes
  51. #     Add crafting times, xp, progression and bonuses
  52. #    
  53. #
  54. #
  55. #-------------------------------------------------------------------------------#
  56. # INSTRUCTIONS:
  57. # You can call the crafting scene through a script call like this:
  58. # SceneManager.call(IconicCrafting)
  59. # Add that to any event, and you should be able to craft.
  60. #
  61. # Optional: If you would like to Restrict recipes to a certain crafting area
  62. # such as you can only make this at a blacksmith, call
  63. # SceneManager.scene.prepare("black") === "black" is a keyword you set up in Recpie list
  64. # Right after SceneManager.call(IconicCrafting)
  65. #
  66. #
  67. #
  68. #Add Recipe's Below!
  69. #in the same format as
  70.  
  71.  
  72. # RECIPE[0] = {
  73. #    :name => "Fire Immunity",
  74. #    :ingredients => [20,18,19,21],
  75. #    :types => [RPG::Item,RPG::Weapon],
  76. #    :product => 22,
  77. #    :product_type => RPG::Item,
  78. #    :amount => 2,
  79. #    :discovered => true,
  80. #    :sound => "Hammer",
  81. #    :restrictions => nil,
  82. #    :goldcost => 0,
  83. #    :mpcost => 0,
  84. #    :tpcost => 0
  85. #    }
  86. #
  87. #   RECIPE[0] To add more than 3 recipes just copy the format above and replace    
  88. #   the 0 with the next number. For example, the next recipe would be RECIPE[1]
  89. #  
  90. #   :name Is the name of the recipe, It does not have to be the same as the item it makes    
  91. #
  92. #   :ingredients These are the Item Id's of the ingredients needed to make the item
  93. #   (note) Make sure they are in the correct order.
  94. #   In this exsample the player will have to put item 20 in first, followed by item 18
  95. #
  96. #   :types These are the Item types of the ingredients needed to make the item
  97. #   Make sure they are in the same order as the Item ID's
  98. #   In this exsample, the first ingredient is a Item, the Second is a weapon
  99. #   RPG::Item = Item  RPG::Armor = Armor RPG::Weapon = Weapon
  100. #  
  101. #   :product This is the Item ID for what will be made when using this recipe
  102. #
  103. #   :product_type This is the item type of the product    
  104. #
  105. #   :amount This is the amount of product that will be produced
  106. #   In this exsample the product will be 2 of item 22
  107. #
  108. #   :discovered This value defines weather the recipe is added to the recipe list
  109. #   at the start of the game. Setting it to false, will mean the player must learn
  110. #   the recipe or discover the recipe by experimentation.(note they can still use
  111. #   the recipe even if its not discovered)
  112. #  
  113. #   :sound This is the name of the sound file that will be used when the item    
  114. #   is crafted. Please put these in Audio/SE if using custom files.
  115. #  
  116. #   :restrictions This is a custom string value that will limit the crafting of
  117. #   the recipe depending on the scene call. Set this to nil for none. For example
  118. #   if you put "Blacksmith" in the restriction you will only be able to craft
  119. #   this recipe from a Blacksmith scene call.
  120. #   Make a restriction scene call like this:
  121. #   SceneManager.call(IconicCrafting)
  122. #   SceneManager.scene.prepare("Blacksmith")
  123. #   That way only recipes with blacksmith restrction can be made.
  124. #   If you dont want any resrictions set the value to nil and make the
  125. #   scene call as normal, without the prepare line
  126. #
  127. #   :goldcost This is the gold cost the the recipe. When the recipe is made
  128. #   the gold will be taken from the party.
  129. #  
  130. #   :mpcost This is the mp cost of the recipe. There are two options for mp cost,
  131. #   controlled by  SHARELOSS bellow. If SHARELOSS is true the total MP of all  
  132. #   party members will be used to check if the player has enough mp. If it is
  133. #   false, The lead party member's MP will be used to check if the player has
  134. #   enough MP.
  135. #
  136. #   :tpcost This is the tp cost of the recipe. The cost will be taken from the
  137. #   PARTYLEAD party leader. Set this to 0 for none.
  138. #  
  139. #   (NOTE: Gold cost is always done first. For example, if the recipe requires
  140. #   15 gold, and 10 mana, and the player has 11 gold and 20 mana, they will not
  141. #   be able to craft the recipe, even though they have enough MP)
  142. #
  143. #
  144. # Item Order is important!!
  145. # for example. To make a Fire Immunity Potion you must put item 20(Bottle)
  146. # and then item 18(Fire), if the player puts fire first it will not work!
  147. #
  148. # The player can add up to 6 Items, If the player adds them in the right order the
  149. # product item window will light up, and the player can press escape/cancel then press craft.
  150. #
  151. # If the player messed up the order, they can just press escape/cancel and use the reset
  152. # command to restart.
  153. #
  154. # If a recipe is less than 6 items, the item window will light up after the correct
  155. # ingredents are added, the player can then press escape/cancel key and, use the craft command to
  156. # craft the item
  157. #
  158. # After the player makes an item for the first time, it is added to a recipe list.
  159. # The player can view the recipe list from the crafting menu.
  160. #
  161. #
  162. #
  163. #
  164. #######################################################################
  165. module Recipe_List#<====Dont Edit this#################################
  166. #######################################################################    
  167. ICONONLY = false ######################################################
  168. #######################################################################    
  169. ############  Use this Value to Toggle the Names of ingredent on or off
  170. ############  ICONONLY = false   means Names and icons will be shown
  171. ############  ICONONLY = true    means only icons will be shown  
  172. #######################################################################  
  173. #######################################################################  
  174. #----------------------------------------------------------------------#    
  175. #Other Options:
  176. CORRECT_ORDER = false
  177. #Set this option false if you want to player to be able to add ingredence in any
  178. #order, set this option to true if you want to require the player to add items
  179. #in the order you place them in the recipe.
  180. #for example if the recipe needs a flask and water, if this option is false
  181. # the player can add either the water or the flast first and then add the flast
  182. # to make the recipe. If this option is set to true, the player must add the flask
  183. # first then the water(depending on how u set up the recipe) to be able to craft the
  184. #item
  185. #Picture Filename:
  186. INGREDIENTS_END = "crusor2"
  187. #This is a small sprite placed at the end of the top window, It only apreares
  188. #when the correct ingredients are added(be sure to import the correctly named
  189. #picture into Graphics/Pictures)
  190. INGREDIENTS_BACK = "crusor3"
  191. #This is a longer picture that is placed behind the top window to create a effect
  192. #of the window lighting up.(be sure to import the correctly named
  193. #picture into Graphics/Pictures)
  194. SORT = "All"
  195. #This is the starting option for the sort menu, if it is set to ALL all items/weapons/armors will be show
  196. #Or you can set it to Item, Weapon, Armor, to show only items, weapons or armors.
  197. #Sounds Should be placed in Audio/SE
  198. ADD_SOUND = "Item1"
  199. #This is the sound played when the player adds an ingredient
  200. CANCEL_SOUND = "Miss"
  201. #This is the sound played when the player preses the escape/cancel key while
  202. #adding ingredents
  203. CORRECT_SOUND = "Bell3"
  204. #This is the sound played when the player preses the escape/cancel key and
  205. #has added the correct ingredients
  206. CANT_CRAFT_SOUND = "Attack1"
  207. #This is the sound played when the player preses the craft button and does not
  208. #have the correct ingredients
  209. RESET_SOUND = "Item2"
  210. #This is the sound played when the player resets the ingredient list
  211. CRAFTER = [18,3]
  212. #This is the ID's of the actors you want to be able to use the crafting station
  213. #if actor 18 is in the party that actor will be using the crafting system, and that actor will loose the mana tp
  214. # if both actor 18 and actor 3 are in the party, actor 18 will still loose the mana
  215. FAIL_MESSAGE = "I can not craft"
  216. #This is the message that will be shown when the crafting station closes because
  217. #the wanted party leader dosnt not match the current party leader.
  218. SHARELOSS = false
  219. #This option will divide the MP cost of the recipe by the total members of the
  220. #party, so if a recipe costs 40 MP and you have 4 party members all 4 will lose
  221. # 10 mp.
  222. BAD_MANA = "Not enough Mana"
  223. #This option is displayed when the player dosn't have the correct amount of mana.
  224. BAD_GOLD = "Not enough Gold"
  225. #This option is displayed when the player dosn't have the correct amount of gold.
  226. BAD_TP = "Not enough Tp"
  227. #This option is displayed when the player dosn't have the correct amount of TP
  228. RESTRICTED = "Can't make that here"
  229. #This option is displayed when the player can't make the certain reciped due to restrictions
  230. TERM_GOLD = "Gold"
  231. #This is the term that will be displayed in the recipe list for gold.
  232. TERM_MP = "Mp"
  233. #This is the term that will be displayed in the recipe list for MP.
  234. TERM_TP = "Fp"
  235. #This is the term that will be displayed in the recipe list for TP.
  236. #(NOTE: Long Terms will Look bad!)
  237. #
  238. #Colors:
  239. # You can set the colors = to any color in your window skin
  240. # 0 to 31. (These are the little color boxes at the bottom)
  241. # (Remeber they start at 0)
  242. #
  243. NAMES_COLOR = 16
  244. #This is the color for Recipe Names
  245. TERM_GOLD_COLOR = 17
  246. #This is the color for the gold term
  247. NUMBER_GOLD_COLOR = 6
  248. #This is the color for the number amount of gold the recipe costs
  249. TERM_MP_COLOR = 9
  250. #This is the color for the MP term
  251. NUMBER_MP_COLOR = 1
  252. #This is the color for the number amount of MP the recipe costs
  253. TERM_TP_COLOR  = 1
  254. #This is the color for the tp term
  255. NUMBER_TP_COLOR = 25
  256. #This is the color for the number amount of Tp the recipe costs
  257. ITEM_NAME_COLOR = 24
  258. #This is the color used for the names of item type materials
  259. WEAPON_NAME_COLOR = 8
  260. #This is the color used for the names of weapon type materials
  261. ARMOR_NAME_COLOR = 31
  262. #This is the color used for the names of armor type materials
  263. OUT_OF_COLOR = 18
  264. #This is the color used for BAD_MANA AND BAD_GOLD messeges.
  265. #----------------------------------------------------------------------#
  266.    
  267.     RECIPE = []
  268.        
  269.  RECIPE[0] = {
  270.     :name => "Paralysis Rune",
  271.     :ingredients => [24,26],
  272.     :types => [RPG::Item,RPG::Item],
  273.     :product => 25,
  274.     :product_type => RPG::Item,
  275.     :amount => 1,
  276.     :discovered => false,
  277.     :sound => "Hammer",
  278.     :restrictions => nil,
  279.     :goldcost => 0,
  280.     :mpcost => 20,
  281.     :tpcost => 0
  282.     }
  283.     RECIPE[1] = {
  284.     :name => "Sharp HandAxe",
  285.     :ingredients => [24,26],
  286.     :types => [RPG::Weapon,RPG::Item],
  287.     :product => 1,
  288.     :product_type => RPG::Weapon,
  289.     :amount => 1,
  290.     :discovered => false,
  291.     :sound => "Hammer",
  292.     :restrictions => nil,
  293.     :goldcost => 0,
  294.     :mpcost => 0,
  295.     :tpcost => 0
  296.     }
  297.    
  298.     RECIPE[2] = {
  299.     :name => "Paralysis Rune",
  300.     :ingredients => [24,26],
  301.     :types => [RPG::Armor,RPG::Item],
  302.     :product => 25,
  303.     :product_type => RPG::Armor,
  304.     :amount => 1,
  305.     :discovered => false,
  306.     :sound => "Hammer",
  307.     :restrictions => nil,
  308.     :goldcost => 0,
  309.     :mpcost => 10,
  310.     :tpcost => 0
  311.     }
  312.  
  313. end
  314. class Game_System
  315.   attr_accessor :recipe_list_discovered
  316. alias NO79a_IconicCraftingSystem_Game_system_initialize initialize
  317.  
  318.   def initialize
  319.     @recipe_list_discovered = Recipe_List::RECIPE
  320.     NO79a_IconicCraftingSystem_Game_system_initialize()
  321.   end
  322. end
  323.  
  324.  
  325.  
  326. ##################################### Window Command Class
  327. class MyCraftCommands < Window_Command
  328.   def initialize
  329.     super(0, 0)
  330.   end
  331.   def col_max
  332.     return 1
  333.   end
  334.   def make_command_list
  335.     add_main_commands
  336.   end
  337.   def add_main_commands
  338.     add_command("Add",   :add)
  339.     add_command("Reset", :reset)
  340.     add_command("Craft", :craft)
  341.     add_command("Sort",  :sort)
  342.     add_command("Recpie", :recipie)
  343.     add_command("Exit",  :cancel)
  344.   end
  345.   def select_last(last)
  346.     select_symbol(last)
  347.   end
  348.   def set_command_sym
  349.     current_data ? current_data[:symbol] : nil
  350.   end
  351. end
  352. ############################################################
  353. ##################################### Class to Display added items
  354. class MyAddedItemsDisplay < Window_Base
  355.   def initialize()
  356.     super(Graphics.width - 394,0,Graphics.width-150,Graphics.height - 366)
  357.   end
  358.   def draw_add_item(item, slot)
  359.     remove_from_invitory(item,slot)
  360.   end
  361.  
  362.   def remove_from_invitory(item,slot)
  363.     $temp_items[slot] = item  
  364.     $game_party.lose_item(item,1)
  365.     draw_temp_items()
  366.   end
  367.  
  368.   def draw_reset(all = false)
  369.     contents.clear
  370.     @check.dispose() unless @check == nil
  371.     @box.dispose()  unless @box == nil
  372.     return if all
  373.     draw_temp_items()
  374.   end
  375.   def draw_temp_items()
  376.     ab = 0
  377.     while ab < $temp_items.length
  378.       draw_icon($temp_items[ab].icon_index,ab*65,0,true)
  379.       ab+=1
  380.     end
  381.   end
  382.  
  383.   def draw_correct()
  384.     @check = Sprite.new()
  385.     @check.bitmap = Cache.picture(Recipe_List::INGREDIENTS_END)
  386.     @check.x = 500
  387.     @check.x = Graphics.width - 44 if Graphics.width > 544
  388.     @check.y = 8
  389.     @check.z = 300
  390.     @box = Sprite.new()
  391.     @box.bitmap = Cache.picture(Recipe_List::INGREDIENTS_BACK)
  392.     @box.x = 150
  393.     @box.x = Graphics.width - 390 if Graphics.width > 544
  394.     @box.y = 0
  395.   end
  396.   def draw_mana()
  397.     change_color(text_color(Recipe_List::OUT_OF_COLOR))
  398.     contents.draw_text(0,0,300,30,Recipe_List::BAD_MANA)
  399.     change_color(normal_color)
  400.   end
  401.   def draw_gold()
  402.     change_color(text_color(Recipe_List::OUT_OF_COLOR))
  403.     contents.draw_text(0,0,300,30,Recipe_List::BAD_GOLD)
  404.     change_color(normal_color)
  405.   end
  406.   def draw_tp()
  407.     change_color(text_color(Recipe_List::OUT_OF_COLOR))
  408.     contents.draw_text(0,0,300,30,Recipe_List::BAD_TP)
  409.     change_color(normal_color)
  410.   end
  411.   def draw_restricted()
  412.     change_color(text_color(Recipe_List::OUT_OF_COLOR))
  413.     contents.draw_text(0,0,300,30,Recipe_List::RESTRICTED)
  414.     change_color(normal_color)
  415.   end
  416. end #endclass
  417. ##################################### Class Item Stats in window
  418. class MyItemsStatsDisplay < Window_Base
  419.  
  420.   def initialize(line_number = 2)
  421.     super(Graphics.width - 394, Graphics.height - 366 , Graphics.width - 150, Graphics.height - 306)
  422.   end
  423.   def clearz()
  424.     contents.clear
  425.   end
  426.   def draw_descript(x,y,text,item_type,draw_type)
  427.     if draw_type == 0
  428.     change_color(text_color(Recipe_List::ITEM_NAME_COLOR)) if item_type == RPG::Item
  429.     change_color(text_color(Recipe_List::WEAPON_NAME_COLOR)) if item_type == RPG::Weapon
  430.     change_color(text_color(Recipe_List::ARMOR_NAME_COLOR)) if item_type == RPG::Armor
  431.     contents.draw_text(x,y,400,30,text)
  432.     change_color(normal_color)
  433.     end
  434.     if draw_type == 1
  435.     draw_text_ex(x,y,text)
  436.     end
  437.   end
  438. end
  439.  
  440. ############################################################ Pop Class
  441. class MyPop < Window_Selectable
  442.   def initialize()
  443.     super(Graphics.width - 394, Graphics.height - 366 , Graphics.width - 150, Graphics.height - 306)
  444.     close
  445.   end
  446.   def draw_crafted(id, type, amount)
  447.     contents.clear
  448.     if type == RPG::Item
  449.     item = $data_items[id]
  450.     change_color(text_color(Recipe_List::ITEM_NAME_COLOR))
  451.     contents.draw_text(0,0,300,30,item.name)
  452.     end
  453.    
  454.     if type == RPG::Weapon
  455.     item = $data_weapons[id]
  456.     change_color(text_color(Recipe_List::WEAPON_NAME_COLOR))
  457.     contents.draw_text(0,0,300,30,item.name)
  458.     end
  459.    
  460.     if type == RPG::Armor
  461.     item = $data_armors[id]
  462.     change_color(text_color(Recipe_List::ARMOR_NAME_COLOR))
  463.     contents.draw_text(0,0,300,30,item.name)
  464.     end
  465.    
  466.    
  467.    
  468.     change_color(normal_color)
  469.     draw_text_ex(0,25,item.description)
  470.     draw_text_ex(300,0,"=>")
  471.     draw_text_ex(320,0,amount)
  472.   end
  473.  
  474.  
  475. end
  476. ##################################### Class to Display Item Icons in window
  477. class MyItemDisplay < Window_Selectable########################
  478.   def initialize()    ####################################JUMPHERE#####
  479.     super(0, Graphics.height - 258, Graphics.width, Graphics.height - 158) ################################
  480.     $itemsz = $game_party.items
  481.     $weaponsz = $game_party.weapons
  482.     $armorsz = $game_party.armors
  483.    
  484.     $rdyitem = {}
  485.     draw_mycons()
  486.   end
  487.  
  488. #----------------------------------------------------------------------------#
  489.  
  490.   def col_max
  491.     return 7 if Recipe_List::ICONONLY == true
  492.     return 2 if Recipe_List::ICONONLY == false
  493.   end
  494.   def spacing
  495.     return 5
  496.   end
  497.   def item_max
  498.     itemsz = $game_party.items
  499.     weaponsz = $game_party.weapons
  500.     armorsz = $game_party.armors
  501.     sort = SceneManager.scene.get_sort
  502.     item_maxx = 0
  503.     if sort == "All" || sort == "Item"
  504.     item_maxx += itemsz.length if itemsz != []
  505.     end
  506.     if sort == "All" || sort == "Armor"
  507.     item_maxx += weaponsz.length if weaponsz != []
  508.     end
  509.     if sort == "All" || sort == "Weapon"
  510.     item_maxx += armorsz.length if armorsz != []
  511.     end
  512.     item_maxx += SceneManager.scene.get_slots
  513.     return item_maxx
  514.   end
  515. #------------------------------------------------------------------------------#
  516.   def refreshz(everything = false)
  517.     contents.clear()
  518.     draw_mycons()
  519.   end
  520.  
  521. def draw_mycons()
  522.     counter = 0
  523.     sx = 0
  524.     sy = 0
  525.     $maxx = 0
  526.     $maxy = 0
  527.     item_number = 0
  528.     sort = SceneManager.scene.get_sort
  529. #-------------------------------------------------------------------#
  530. # Icons    Item-Names                                                 #
  531. #-------------------------------------------------------------------#
  532.       if sort == "All" || sort == "Item"
  533.       if $items != []
  534.       if Recipe_List::ICONONLY == true && showitems == true
  535.       maxitemsz = $itemsz.length
  536.       while counter < maxitemsz
  537.       $maxy = sy
  538.       $maxx = sx
  539.       $rdyitem[[item_number,:item]] = $itemsz[counter]
  540.       draw_icon($itemsz[counter].icon_index, sx, sy, true)
  541.       $item_amountsz = "=>" + $game_party.item_number($itemsz[counter]).to_s()
  542.       contents.draw_text(sx+25,sy,50,30,$item_amountsz,0)
  543.       sx += Graphics.width - 551 if Graphics.width > 544
  544.       sx += 76 if Graphics.width == 544
  545.       if sx > Graphics.width - 76
  546.         sy += 24
  547.         sx = 0
  548.       end
  549.       item_number +=1
  550.       counter += 1
  551.       end #while
  552.       end #items
  553.     end #Icononly
  554. #-------------------------------------------------------------------#
  555. # Icons + Names    Item-Names                                                 #
  556. #-------------------------------------------------------------------#
  557.     if $items != []
  558.       if Recipe_List::ICONONLY == false
  559.       maxitemsz = $itemsz.length
  560.       while counter < maxitemsz
  561.       $maxy = sy
  562.       $maxx = sx
  563.       change_color(text_color(Recipe_List::ITEM_NAME_COLOR))
  564.       $rdyitem[[item_number,:item]] = $itemsz[counter]
  565.       contents.draw_text(sx, sy, 150, 25, $itemsz[counter].name)
  566.       draw_icon($itemsz[counter].icon_index, sx+185, sy, true)
  567.       $item_amountsz = "=>" + $game_party.item_number($itemsz[counter]).to_s()
  568.       contents.draw_text(sx+210,sy,50,30,$item_amountsz,0)
  569.       sx += Graphics.width - 284  
  570.       if sx > Graphics.width - 200
  571.         sy += 24
  572.         sx = 0
  573.       end
  574.       item_number +=1
  575.       counter += 1
  576.       end #while
  577.       end #items
  578.     end #Icononly
  579.     end #if sort
  580. #-------------------------------------------------------------------#
  581. # Icons + Names   Weapon-Names                                                 #
  582. #-------------------------------------------------------------------#
  583.  
  584.     if sort == "All" || sort == "Weapon"
  585.     if $weaponsz != []
  586.       if Recipe_List::ICONONLY == false
  587.       $maxy = sy
  588.       $maxx = sx
  589.  
  590.      
  591.       maxweaponsz = $weaponsz.length
  592.         if sx > Graphics.width - 200  
  593.           sx = 0
  594.           sy += 24
  595.         end
  596.      
  597.        
  598.       counter = 0
  599.       change_color(text_color(Recipe_List::WEAPON_NAME_COLOR))
  600.       while counter < maxweaponsz
  601.       $maxy = sy
  602.       $maxx = sx
  603.       $rdyitem[[item_number,:item]] = $weaponsz[counter]
  604.       contents.draw_text(sx, sy, Graphics.width - 394 , 25, $weaponsz[counter].name)
  605.       draw_icon($weaponsz[counter].icon_index, sx+185, sy, true)
  606.       $wep_amountsz = "=>" + $game_party.item_number($weaponsz[counter]).to_s()
  607.       contents.draw_text(sx+210,sy,50,30,$wep_amountsz,0)
  608.       sx += Graphics.width - 284  
  609.       if sx > Graphics.width - 200
  610.         sy += 24
  611.         sx = 0
  612.       end
  613.       item_number +=1
  614.       counter += 1
  615.       end
  616.     end #weaponsz if
  617.     end #iconsonly if
  618.    
  619. #-------------------------------------------------------------------#
  620. # Icons        Weapon-Names                                              #
  621. #-------------------------------------------------------------------#
  622. if $weaponsz != []
  623.       if Recipe_List::ICONONLY == true
  624.       $maxy = sy
  625.       $maxx = sx
  626.  
  627.      
  628.       maxweaponsz = $weaponsz.length
  629.         if sx > Graphics.width - 76  
  630.           sx = 0
  631.           sy += 24
  632.         end
  633.      
  634.        
  635.       counter = 0
  636.       while counter < maxweaponsz
  637.       $maxy = sy
  638.       $maxx = sx
  639.       $rdyitem[[item_number,:item]] = $weaponsz[counter]
  640.       draw_icon($weaponsz[counter].icon_index, sx, sy, true)
  641.       $wep_amountsz = "=>" + $game_party.item_number($weaponsz[counter]).to_s()
  642.       contents.draw_text(sx+25,sy,50,30,$wep_amountsz,0)
  643.       sx += Graphics.width - 551 if Graphics.width > 544
  644.       sx += 76 if Graphics.width == 544
  645.       if sx > Graphics.width - 76
  646.         sy += 24
  647.         sx = 0
  648.       end
  649.       item_number +=1
  650.       counter += 1
  651.       end
  652.     end #weaponsz if
  653.     end #iconsonly if
  654.    end # sort
  655. #-------------------------------------------------------------------------#
  656. #  Icons        Armor-Names                                               #
  657. #-------------------------------------------------------------------------#
  658.    
  659. if sort == "All" || sort == "Armor"
  660.   if $armorsz != []
  661.     if Recipe_List::ICONONLY == true
  662.       $maxy = sy
  663.       $maxx = sx
  664.      
  665.       maxarmorsz = $armorsz.length
  666.      
  667.       if sx > Graphics.width - 76
  668.           sx = 0
  669.           sy += 24
  670.       end
  671.      
  672.      
  673.       counter = 0
  674.       while counter < maxarmorsz
  675.       $maxy = sy
  676.       $maxx = sx
  677.       $rdyitem[[item_number,:item]] = $armorsz[counter]
  678.       draw_icon($armorsz[counter].icon_index, sx, sy, true)
  679.       $arm_amountsz = "=>" + $game_party.item_number($armorsz[counter]).to_s()
  680.       contents.draw_text(sx+25,sy,50,30,$arm_amountsz,0)
  681.       sx += Graphics.width - 551 if Graphics.width > 544
  682.       sx += 76 if Graphics.width == 544
  683.       if sx > Graphics.width - 76
  684.         sy += 24
  685.         sx = 0
  686.       end
  687.       item_number +=1
  688.       counter += 1
  689.       end
  690.     end #armors if
  691.     end #icononly if
  692. #-------------------------------------------------------------------------#
  693. #  Icons + Names      Armor-Names                                               #
  694. #-------------------------------------------------------------------------#
  695. if $armorsz != []
  696.     if Recipe_List::ICONONLY == false
  697.       $maxy = sy
  698.       $maxx = sx
  699.      
  700.       maxarmorsz = $armorsz.length
  701.      
  702.       if sx > Graphics.width - 200
  703.           sx = 0
  704.           sy += 24
  705.       end
  706.      
  707.      change_color(text_color(Recipe_List::ARMOR_NAME_COLOR))
  708.       counter = 0
  709.       while counter < maxarmorsz
  710.       $maxy = sy
  711.       $maxx = sx
  712.       $rdyitem[[item_number,:item]] = $armorsz[counter]
  713.       contents.draw_text(sx, sy, 150, 25, $armorsz[counter].name)
  714.       draw_icon($armorsz[counter].icon_index, sx+185, sy, true)
  715.       $arm_amountsz = "=>" + $game_party.item_number($armorsz[counter]).to_s()
  716.       contents.draw_text(sx+210,sy,50,30,$arm_amountsz,0)
  717.       sx += Graphics.width - 284  
  718.       if sx > Graphics.width - 200
  719.         sy += 24
  720.         sx = 0
  721.       end
  722.       item_number +=1
  723.       counter += 1
  724.       end
  725.     end #armors if
  726.   end #icononly if
  727.   end #sort
  728.   change_color(normal_color)
  729. #--------------------------------------------------------------------------#
  730.  
  731.     end#def end
  732. end#class end
  733. ##################################### Main Scene Class
  734. class IconicCrafting < Scene_MenuBase
  735.   def prepare(restrictions = nil)
  736.     @restrictions = restrictions
  737.   end
  738.  
  739.   def start
  740.     super()
  741.     @sort = Recipe_List::SORT
  742.     @slot = 0
  743.     @addslot = 0
  744.     @last = nil
  745.     $itemsz = []
  746.     $armorsz = []
  747.     $weapons = []
  748.     $temp_items = {}
  749.     @product = 0
  750.     @product_type = 0
  751.     @product_amount = 0
  752.     @sound_p = 0
  753.     @pop_open = false
  754.     get_party_lead
  755.     draw_display_window()
  756.     create_command_window()
  757.   end #end start
  758. #########################################
  759. def get_slots
  760.   return @addslot
  761. end
  762. def get_party_lead
  763.   a = 0
  764.       Recipe_List::CRAFTER.each do |key|
  765.       $game_party.members.each do |key2|
  766.         if key2.id == key
  767.           @partylead = a
  768.           return
  769.         end
  770.         a+=1
  771.       end#key1
  772.       a=0
  773.       end#key2
  774. end#def
  775. def get_sort
  776.   return @sort
  777. end
  778.   def give_items_back(exit)
  779.     counter = 0
  780.     while counter < 6
  781.       $game_party.gain_item($temp_items[counter], 1)
  782.       counter +=1
  783.     end#while end
  784.     $temp_items = {}
  785.     @item_display.refreshz(false) if exit == false
  786.   end
  787. #########################################
  788.   def has_items?
  789.     if $itemsz == [] && $armorsz == [] && $weaponsz == []
  790.       return false
  791.     else
  792.       return true
  793.     end #if itemsz
  794.   end
  795. ########################################
  796.   def terminate
  797.     super()
  798.     give_items_back(true)#do first
  799.     @item_display.dispose()
  800.     @command_window.dispose()
  801.     @item_display_add.dispose()
  802.     @item_display_stats.dispose()
  803.     @window_mypop.dispose()
  804.   end
  805. #########################################
  806.   def draw_display_window()
  807.     @item_display = MyItemDisplay.new
  808.     @item_display_add = MyAddedItemsDisplay.new
  809.     @item_display_stats = MyItemsStatsDisplay.new
  810.     @window_mypop = MyPop.new
  811.   end
  812. ###################################################
  813. ##########################################
  814.   def create_command_window
  815.     @command_window = MyCraftCommands.new
  816.     @command_window.width = Graphics.width - 394
  817.     @command_window.height = Graphics.height - 256
  818.     @command_window.set_handler(:add,    method(:select_items))
  819.     @command_window.set_handler(:reset,    method(:command_reset))
  820.     @command_window.set_handler(:craft,    method(:command_craft))
  821.     @command_window.set_handler(:sort,     method(:command_sort))
  822.     @command_window.set_handler(:recipie, method(:recipie_book))
  823.     @command_window.set_handler(:cancel,    method(:return_scene))
  824.   end
  825. #############################################
  826.   def select_items
  827.     if has_items?
  828.       @window_mypop.close
  829.        @pop_open = false
  830.        @item_display_stats.open
  831.        @item_display_stats.clearz
  832.       @item_display.activate()
  833.       @item_display.select(0)
  834.       @command_window.deactivate
  835.     else
  836.       @command_window.activate
  837.     end
  838.   end
  839. ##########################################
  840. def window_alter(com)
  841.   RPG::SE.new(Recipe_List::CORRECT_SOUND,100,100).play if com == 2
  842.   RPG::SE.new(Recipe_List::CANCEL_SOUND,100,100).play if com == 1
  843.   @item_display.unselect
  844.   @item_display.deactivate
  845.   @command_window.activate
  846.   @command_window.select(com)
  847. end
  848.  
  849. ##################################################view_known  
  850.   def recipie_book
  851.     SceneManager.call(The_Recipie_Book)
  852.   end
  853. ##################################################Sort Command
  854.   def command_sort
  855.    if has_items?
  856.     if @sort == "All"
  857.     @sort = "Item"
  858.     @item_display.refreshz(false)
  859.     window_alter(3)
  860.     return
  861.     end
  862.     if @sort == "Item"
  863.     @sort = "Weapon"
  864.     @item_display.refreshz(false)
  865.     window_alter(3)
  866.     return
  867.     end
  868.     if @sort == "Weapon"
  869.     @sort = "Armor"
  870.     @item_display.refreshz(false)
  871.     window_alter(3)
  872.     return
  873.     end
  874.     if @sort == "Armor"
  875.     @sort = "All"
  876.     @item_display.refreshz(false)
  877.     window_alter(3)
  878.     return
  879.     end
  880.    end
  881.    @command_window.activate
  882.   end
  883. ############################################Command Add
  884. def command_add(index)
  885.     if has_items?
  886.       RPG::SE.stop
  887.       if @slot <= 5
  888.        
  889.         item = $rdyitem[[index,:item]]
  890.         if $game_party.item_number(item) > 0
  891.           @item_display_add.draw_add_item(item, @slot)
  892.           @slot += 1
  893.           @addslot += 1 if $game_party.item_number(item) <= 0
  894.           @item_display.refreshz(false)
  895.           RPG::SE.new(Recipe_List::ADD_SOUND,100,100).play
  896.           @item_display_add.draw_correct() if check_recipie == "true"
  897.           @item_display_add.draw_mana() if check_recipie == "mp"
  898.           @item_display_add.draw_gold() if check_recipie == "gold"
  899.           @item_display_add.draw_restricted() if check_recipie == "restrected"
  900.           @item_display_add.draw_tp() if check_recipie == "tp"
  901.           @item_display_add.draw_reset(false) if check_recipie == ""
  902.           if @slot == 6
  903.             window_alter(1) if check_recipie == ""
  904.             window_alter(2) if check_recipie == "true"
  905.           end
  906.         elsif $game_party.item_number(item) <= 0
  907.           RPG::SE.new(Recipe_List::CANCEL_SOUND,100,100).play
  908.         end
  909.       else
  910.             window_alter(1) if check_recipie == ""
  911.             window_alter(2) if check_recipie == "true"
  912.       end
  913.     end
  914. end
  915.  ##################################### Code for add item
  916. def command_reset
  917.    if has_items?
  918.     RPG::SE.stop
  919.     RPG::SE.new(Recipe_List::CANCEL_SOUND,100,100).play if @slot == 0
  920.     RPG::SE.new(Recipe_List::RESET_SOUND,100,100).play if @slot > 0
  921.     @item_display.refreshz(false)
  922.     give_items_back(false)
  923.     @item_display_add.draw_reset(true)
  924.     @slot = 0
  925.     @addslot = 0
  926.     window_alter(0)
  927.    end
  928.    @command_window.activate
  929. end
  930. ###############################################################
  931.   def command_craft
  932.       if has_items?
  933.       if check_recipie == "true"
  934.       RPG::SE.stop
  935.       RPG::SE.new(@sound_p,100,100).play
  936.       $game_party.members[@partylead].mp -= @mploss if Recipe_List::SHARELOSS == false
  937.       if Recipe_List::SHARELOSS == true
  938.         lossit = 0
  939.         while lossit < $game_party.members.length
  940.           $game_party.members[lossit].mp -= @mploss
  941.           lossit+=1
  942.         end
  943.       end
  944.       $game_party.lose_gold(@goldloss)
  945.       $game_party.members[@partylead].tp -= @tploss
  946.       $game_party.gain_item($data_items[@product],@product_amount) if @product_type == RPG::Item
  947.       $game_party.gain_item($data_weapons[@product],@product_amount) if @product_type == RPG::Weapon
  948.       $game_party.gain_item($data_armors[@product],@product_amount) if @product_type == RPG::Armor
  949.       @item_display_add.draw_reset(true)
  950.       $temp_items = {}
  951.       @slot = 0
  952.       @addslot = 0
  953.       $itemsz = $game_party.items
  954.       $weaponsz = $game_party.weapons
  955.       $armorsz = $game_party.armors
  956.       @item_display.refreshz(true)
  957.       @command_window.activate
  958.       @command_window.select(0)
  959.       @command_window.activate
  960.       @item_display_stats.close()
  961.       @window_mypop.open()
  962.       @pop_open = true
  963.       @window_mypop.draw_crafted(@product,@product_type,@product_amount)
  964.       return
  965.       end #if check
  966.       RPG::SE.stop
  967.       RPG::SE.new(Recipe_List::CANT_CRAFT_SOUND,100,100).play
  968.       @command_window.activate
  969.       @command_window.select(0)
  970.       end #if has items
  971.     @command_window.activate
  972.   end #def end
  973. ############################################################
  974.   def check_recipie
  975.         if $temp_items == nil
  976.          return
  977.         end
  978.       total_recipe = Recipe_List::RECIPE.length
  979.       rlist = Recipe_List::RECIPE
  980.       @tempids = Array.new
  981.       @temptyps = Array.new
  982.       @temprecs = nil
  983.       @Product = 0
  984.       @Product_type = 0
  985.       @mploss = 0
  986.       @goldloss = 0
  987.       @tploss = 0
  988.       make = ""
  989.       a = 0
  990.       b = 0
  991.       while a < $temp_items.length      
  992.       @tempids.push($temp_items[a].id)
  993.       @temptyps.push($temp_items[a].class)
  994.       a+=1
  995.       end
  996.       while b < total_recipe
  997.         tot1 = 0; tot2 = 0
  998.       if Recipe_List::CORRECT_ORDER == false
  999.           @tempids.each do |key|
  1000.             tot1 += key
  1001.           end
  1002.           rlist[b][:ingredients].each do |key2|
  1003.             tot2 += key2
  1004.           end
  1005.         if tot1 == tot2
  1006.           tot3 = 0; tot4 = 0
  1007.           @temptyps.each do |key|
  1008.             tot3 += 1 if key == RPG::Item
  1009.             tot3 += 2 if key == RPG::Weapon
  1010.             tot3 += 2 if key == RPG::Armor
  1011.           end
  1012.           rlist[b][:types].each do |key|
  1013.             tot4 += 1 if key == RPG::Item
  1014.             tot4 += 2 if key == RPG::Weapon
  1015.             tot4 += 2 if key == RPG::Armor
  1016.           end
  1017.        if tot3 == tot4
  1018.   ######################################This is if orders are not true        
  1019.         if rlist[b][:restrictions] == @restrictions &&
  1020.         $game_party.gold >= rlist[b][:goldcost]
  1021.         if Recipe_List::SHARELOSS == false &&
  1022.         $game_party.members[@partylead].mp < rlist[b][:mpcost]
  1023.         make = "mp"
  1024.         end
  1025.    
  1026.         if Recipe_List::SHARELOSS == false &&
  1027.         $game_party.members[@partylead].mp >= rlist[b][:mpcost]
  1028.         return "tp" if $game_party.members[@partylead].tp < rlist[b][:tpcost]
  1029.         @goldloss = rlist[b][:goldcost]
  1030.         @mploss = rlist[b][:mpcost]
  1031.         @tploss = rlist[b][:tpcost]
  1032.         @product = rlist[b][:product]
  1033.         @product_type = rlist[b][:product_type]
  1034.         @product_amount = rlist[b][:amount]
  1035.         @sound_p = rlist[b][:sound]
  1036.         $game_system.recipe_list_discovered[b][:discovered] = true
  1037.         Recipe_List::RECIPE[b][:discovered] = true
  1038.         make = "true"
  1039.         end
  1040.        
  1041.       if Recipe_List::SHARELOSS == true
  1042.           i = 0
  1043.           fz = 0
  1044.           while i < $game_party.members.length
  1045.             fz += $game_party.members[i].mp
  1046.             i+=1
  1047.           end
  1048.         if fz < rlist[b][:mpcost]
  1049.         make = "mp"
  1050.         end
  1051.        
  1052.         if fz > rlist[b][:mpcost]
  1053.         return "tp" if $game_party.members[@partylead].tp < rlist[b][:tpcost]
  1054.         @goldloss = rlist[b][:goldcost]
  1055.         @mploss = rlist[b][:mpcost] / $game_party.members.length
  1056.         @tploss = rlist[b][:tpcost]
  1057.         @product = rlist[b][:product]
  1058.         @product_type = rlist[b][:product_type]
  1059.         @product_amount = rlist[b][:amount]
  1060.         @sound_p = rlist[b][:sound]
  1061.         $game_system.recipe_list_discovered[b][:discovered] = true
  1062.         Recipe_List::RECIPE[b][:discovered] = true
  1063.         make = "true"
  1064.         end
  1065.       end#Recipe_List::SHARELOSS == true
  1066.       end#gold and restrictions are met
  1067.       if rlist[b][:restrictions] == @restrictions &&
  1068.         $game_party.gold < rlist[b][:goldcost]
  1069.         make = "gold"
  1070.       end
  1071.       make = "restrected" if rlist[b][:restrictions] != @restrictions
  1072.          
  1073.          
  1074.          
  1075.       end#if tot1 == tot2(types)    
  1076.       end#if tot1 == tot2(id's)    
  1077.       end#if correct order
  1078.  #############################################        
  1079.       if @tempids == rlist[b][:ingredients] &&
  1080.         @temptyps == rlist[b][:types] &&
  1081.         rlist[b][:restrictions] == @restrictions &&
  1082.         $game_party.gold >= rlist[b][:goldcost]
  1083.  
  1084.         if Recipe_List::SHARELOSS == false &&
  1085.         $game_party.members[@partylead].mp < rlist[b][:mpcost]
  1086.         make = "mp"
  1087.         end
  1088.        
  1089.         if Recipe_List::SHARELOSS == false &&
  1090.         $game_party.members[@partylead].mp >= rlist[b][:mpcost]
  1091.         return "tp" if $game_party.members[@partylead].tp < rlist[b][:tpcost]
  1092.         @goldloss = rlist[b][:goldcost]
  1093.         @mploss = rlist[b][:mpcost]
  1094.         @tploss = rlist[b][:tpcost]
  1095.         @product = rlist[b][:product]
  1096.         @product_type = rlist[b][:product_type]
  1097.         @product_amount = rlist[b][:amount]
  1098.         @sound_p = rlist[b][:sound]
  1099.         $game_system.recipe_list_discovered[b][:discovered] = true
  1100.         Recipe_List::RECIPE[b][:discovered] = true
  1101.         make = "true"
  1102.       end
  1103.      
  1104.       if Recipe_List::SHARELOSS == true
  1105.           i = 0
  1106.           fz = 0
  1107.           while i < $game_party.members.length
  1108.             fz += $game_party.members[i].mp
  1109.             i+=1
  1110.           end
  1111.         if fz < rlist[b][:mpcost]
  1112.         make = "mp"
  1113.         end
  1114.        
  1115.         if fz > rlist[b][:mpcost]
  1116.         return "tp" if $game_party.members[@partylead].tp < rlist[b][:tpcost]
  1117.         @goldloss = rlist[b][:goldcost]
  1118.         @mploss = rlist[b][:mpcost] / $game_party.members.length
  1119.         @tploss = rlist[b][:tpcost]
  1120.         @product = rlist[b][:product]
  1121.         @product_type = rlist[b][:product_type]
  1122.         @product_amount = rlist[b][:amount]
  1123.         @sound_p = rlist[b][:sound]
  1124.         $game_system.recipe_list_discovered[b][:discovered] = true
  1125.         Recipe_List::RECIPE[b][:discovered] = true
  1126.         make = "true"
  1127.         end
  1128.         end#Recipe_List::SHARELOSS == true
  1129.       end
  1130.       if @tempids == rlist[b][:ingredients] &&
  1131.         @temptyps == rlist[b][:types] &&
  1132.         rlist[b][:restrictions] == @restrictions &&
  1133.         $game_party.gold < rlist[b][:goldcost]
  1134.         make = "gold"
  1135.       end
  1136.       make = "restrected" if rlist[b][:restrictions] != @restrictions
  1137.       b+=1
  1138.       end
  1139.     return make
  1140.  
  1141.   end
  1142.  
  1143.  
  1144.   def update
  1145.     super
  1146.     if @item_display.active
  1147.       @item_display_stats.clearz
  1148.       @item_display_stats.draw_descript(0,0,$rdyitem[[@item_display.index,:item]].name,
  1149.       $rdyitem[[@item_display.index,:item]].class,0)
  1150.      
  1151.       @item_display_stats.draw_descript(0,30,$rdyitem[[@item_display.index,:item]].description,
  1152.       $rdyitem[[@item_display.index,:item]].class,1)
  1153.      
  1154.     end
  1155.     if Input.trigger?(:B) && has_items?
  1156.      window_alter(1) if check_recipie == "" || check_recipie == "mp" ||
  1157.      check_recipie == "gold" || check_recipie == "restrected" ||
  1158.      check_recipie == "tp"
  1159.      
  1160.      window_alter(2) if check_recipie == "true"
  1161.     end
  1162.     if Input.trigger?(:C) && @item_display.active
  1163.       command_add(@item_display.index)
  1164.     end
  1165.      if $game_party.members[0].id != Recipe_List::CRAFTER
  1166.       $game_party.members.each do |key|
  1167.         Recipe_List::CRAFTER.each do |key2|
  1168.         if key.id == key2
  1169.           return
  1170.         end
  1171.       end#do
  1172.     end#do2
  1173.       RPG::SE.new(Recipe_List::CANT_CRAFT_SOUND,100,100).play
  1174.       $game_message.face_name = ($game_party.members[0].face_name)
  1175.       $game_message.face_index = ($game_party.members[0].face_index)
  1176.       $game_message.add(Recipe_List::FAIL_MESSAGE)
  1177.       return_scene
  1178.     end
  1179.     end
  1180.  
  1181. end #class
  1182.  
  1183.  
  1184. ##################################### End of Main Class
  1185.  
  1186. class The_Recipie_Book < Scene_MenuBase
  1187.     def start
  1188.     super()
  1189.     @sort = Recipe_List::SORT
  1190.     draw_windows_r()
  1191.     create_command_window()
  1192.     end
  1193.     def create_command_window
  1194.     @command_window = MyRecipieBookCommands.new
  1195.     @command_window.width = Graphics.width
  1196.     @command_window.height = 50
  1197.     @command_window.set_handler(:view,    method(:view_me))
  1198.     @command_window.set_handler(:sort,    method(:sort_command))
  1199.     @command_window.set_handler(:cancel,    method(:return_scene))
  1200.   end
  1201.   def draw_windows_r
  1202.   @my_recipie_dis = My_recipie_display.new
  1203.   end
  1204.   def view_me
  1205.       @my_recipie_dis.activate()
  1206.       @command_window.unselect
  1207.       @my_recipie_dis.select(0)
  1208.       @command_window.deactivate
  1209.   end
  1210.   def sort_command
  1211.     if @sort == "All"
  1212.       @sort = "Item"
  1213.       @my_recipie_dis.set_sort(@sort)
  1214.       @command_window.activate
  1215.       @command_window.select(1)
  1216.       return
  1217.     end
  1218.     if @sort == "Item"
  1219.       @sort = "Weapon"
  1220.       @my_recipie_dis.set_sort(@sort)
  1221.       @command_window.activate
  1222.       @command_window.select(1)
  1223.       return
  1224.     end
  1225.     if @sort == "Weapon"
  1226.       @sort = "Armor"
  1227.       @my_recipie_dis.set_sort(@sort)
  1228.       @command_window.activate
  1229.       @command_window.select(1)
  1230.       return
  1231.     end
  1232.     if @sort == "Armor"
  1233.       @sort = "All"
  1234.       @my_recipie_dis.set_sort(@sort)
  1235.       @command_window.activate
  1236.       @command_window.select(1)
  1237.       return
  1238.     end
  1239.   end
  1240.     def update
  1241.       super
  1242.       if Input.trigger?(:B)
  1243.         @my_recipie_dis.unselect
  1244.         @my_recipie_dis.deactivate
  1245.         @command_window.activate
  1246.         @command_window.select(0)
  1247.       end
  1248.     end
  1249.  
  1250.  
  1251. end
  1252. ###########################################End of The Recipie Book
  1253.  
  1254. class MyRecipieBookCommands < Window_Command
  1255.     def initialize
  1256.     super(0, 0)
  1257.     end
  1258.     def make_command_list
  1259.     add_main_commands
  1260.     end
  1261.     def add_main_commands
  1262.     add_command("View",  :view)
  1263.     add_command("Sort",  :sort)
  1264.     add_command("Exit",  :cancel)
  1265.     end
  1266.     def select_last(last)
  1267.     select_symbol(last)
  1268.     end
  1269.     def set_command_sym
  1270.     current_data ? current_data[:symbol] : nil
  1271.     end
  1272. end #end of class myre
  1273. #################################################
  1274. class My_recipie_display < Window_Selectable
  1275.   def initialize()
  1276.     super(0,Graphics.height-365,Graphics.width,Graphics.height)
  1277.     @sort = Recipe_List::SORT
  1278.     draw_recipies_to_window()
  1279.   end
  1280.   def col_max
  1281.     return 1
  1282.   end
  1283.   def item_height
  1284.     return 96
  1285.   end
  1286.   def item_max
  1287.     b = 0
  1288.     a = 0
  1289.     rec_len = Recipe_List::RECIPE.length
  1290.     while a < rec_len
  1291.      
  1292.       if Recipe_List::RECIPE[a][:product_type] == RPG::Item
  1293.       if @sort == "All" || @sort == "Item"
  1294.       if Recipe_List::RECIPE[a][:discovered] == true || $game_system.recipe_list_discovered[b][:discovered] == true
  1295.       b+=1
  1296.       end#recipe_list
  1297.       end#sort
  1298.       end#producttype
  1299.    
  1300.       if Recipe_List::RECIPE[a][:product_type] == RPG::Weapon
  1301.       if @sort == "All" || @sort == "Weapon"
  1302.       if Recipe_List::RECIPE[a][:discovered] == true || $game_system.recipe_list_discovered[b][:discovered] == true
  1303.       b+=1
  1304.       end#recipe_list
  1305.       end#sort
  1306.       end#producttype
  1307.      
  1308.       if Recipe_List::RECIPE[a][:product_type] == RPG::Armor
  1309.       if @sort == "All" || @sort == "Armor"
  1310.       if Recipe_List::RECIPE[a][:discovered] == true || $game_system.recipe_list_discovered[b][:discovered] == true
  1311.       b+=1
  1312.       end#recipe_list
  1313.       end#sort
  1314.       end#producttype
  1315.      
  1316.       a+=1
  1317.     end
  1318.     return b
  1319.   end
  1320.   def set_sort(sort)
  1321.     @sort = sort
  1322.     contents.clear
  1323.     draw_recipies_to_window
  1324.   end
  1325.  
  1326.  
  1327.   def draw_recipies_to_window
  1328.     contents.font.size = 20
  1329.     @repie = []
  1330.     @repie = Recipe_List::RECIPE
  1331.     @repie_len = 0
  1332.     @rapie_len = Recipe_List::RECIPE.length
  1333.     skip = false
  1334.     a = 0
  1335.     b = 0
  1336.     yy = 0
  1337.     iconx = 200
  1338.     icony = 0
  1339.     tab1 = Graphics.width-354
  1340.     tab2 = Graphics.width-184
  1341.     tab1 = Graphics.width-450 if Graphics.width > 544
  1342.     tab2 = Graphics.width-280 if Graphics.width > 544
  1343.    while b < @rapie_len
  1344.     if Recipe_List::RECIPE[b][:discovered] == true || $game_system.recipe_list_discovered[b][:discovered] == true
  1345.     if @sort == "Item"
  1346.       skip = true unless @repie[b][:product_type] == RPG::Item
  1347.     end
  1348.     if @sort == "Weapon"
  1349.       skip = true unless @repie[b][:product_type] == RPG::Weapon
  1350.     end
  1351.     if @sort == "Armor"
  1352.       skip = true unless @repie[b][:product_type] == RPG::Armor
  1353.     end
  1354.     skip = false if @sort == "All"
  1355.     if skip == false  
  1356.     while a < @repie[b][:ingredients].length
  1357.       iconx=tab1 if a==0
  1358.       iconx=tab2 if a==1
  1359.       if a==2
  1360.       iconx=tab1
  1361.       icony+=32
  1362.       end
  1363.       iconx=tab2 if a==3
  1364.       if a==4
  1365.       iconx=tab1
  1366.       icony+=32
  1367.       end
  1368.       iconx=340 if a==5
  1369.       if @repie[b][:types][a] == RPG::Item
  1370.       change_color(text_color(Recipe_List::ITEM_NAME_COLOR))
  1371.       draw_icon($data_items[@repie[b][:ingredients][a]].icon_index,iconx,icony,true)
  1372.       contents.draw_text(iconx+23, icony, 170, 25,$data_items[@repie[b][:ingredients][a]].name)
  1373.       elsif @repie[b][:types][a] == RPG::Weapon
  1374.       change_color(text_color(Recipe_List::WEAPON_NAME_COLOR))
  1375.       draw_icon($data_weapons[@repie[b][:ingredients][a]].icon_index,iconx,icony,true)
  1376.       contents.draw_text(iconx+23, icony, 170, 25,$data_weapons[@repie[b][:ingredients][a]].name)
  1377.       elsif @repie[b][:types][a] == RPG::Armor
  1378.       change_color(text_color(Recipe_List::ARMOR_NAME_COLOR))
  1379.       draw_icon($data_armors[@repie[b][:ingredients][a]].icon_index,iconx,icony,true)
  1380.       contents.draw_text(iconx+23, icony, 170, 25,$data_armors[@repie[b][:ingredients][a]].name)
  1381.       end
  1382.       a=a+1
  1383.     end
  1384.      
  1385.       change_color(normal_color)
  1386.       contents.draw_text(0,yy-20,500,25,"--------------------------------------------")
  1387.      
  1388.       change_color(text_color(Recipe_List::NAMES_COLOR))
  1389.       contents.draw_text(23,yy,170,25,@repie[b][:name])#draw name
  1390.      
  1391.       change_color(text_color(Recipe_List::NUMBER_GOLD_COLOR))
  1392.       contents.draw_text(Recipe_List::TERM_GOLD.length * 12,
  1393.       yy+20,60,25,@repie[b][:goldcost].to_s)#draw goldnumber
  1394.      
  1395.       change_color(text_color(Recipe_List::TERM_GOLD_COLOR))
  1396.       contents.draw_text(5,yy+20,60,25, Recipe_List::TERM_GOLD + "=")#draw goldname
  1397.      
  1398.       change_color(text_color(Recipe_List::NUMBER_MP_COLOR))
  1399.       contents.draw_text(Recipe_List::TERM_MP.length * 15,
  1400.       yy+40,60,25,@repie[b][:mpcost].to_s)
  1401.      
  1402.       change_color(text_color(Recipe_List::TERM_MP_COLOR))
  1403.       contents.draw_text(5,yy+40,60,25,Recipe_List::TERM_MP + "=")
  1404.      
  1405.       change_color(text_color(Recipe_List::NUMBER_TP_COLOR))
  1406.       contents.draw_text(Recipe_List::TERM_TP.length * 15,
  1407.       yy+60,60,25,@repie[b][:tpcost].to_s)
  1408.  
  1409.       change_color(text_color(Recipe_List::TERM_TP_COLOR))
  1410.       contents.draw_text(5,yy+60,60,25,Recipe_List::TERM_TP + "=")
  1411.      
  1412.       draw_icon($data_items[@repie[b][:product]].icon_index,0,yy,true) if @repie[b][:product_type] == RPG::Item
  1413.       draw_icon($data_weapons[@repie[b][:product]].icon_index,0,yy,true) if @repie[b][:product_type] == RPG::Weapon
  1414.       draw_icon($data_armors[@repie[b][:product]].icon_index,0,yy,true) if @repie[b][:product_type] == RPG::Armor
  1415.       change_color(normal_color)
  1416.      
  1417.       yy+=96
  1418.       icony=yy
  1419.       a=0
  1420.     end
  1421.     end#skip
  1422.     b+=1
  1423.     skip = false
  1424.     end#whileb
  1425.   end#def
  1426. end#class
RAW Paste Data