Panel Equip System

Panel Equip SystemVersion: 1
By: CottonJ

Introduction

Sorry but the script is pretty large. and due to the fact that the script isn't tested to work without some of the scripts in the demo, I feel it unneccisary to post the script. I will try to post as many screenshots as I can to make up for it. Also... there is nudity in the demo..... but I doubt that'll matter. It's pixel nudity.

Features
<Post a bulleted list of features here. This section is optional.>
  • Kingdom Hearts 358/2 Days Style Panelling System
  • Equip Level Ups, instead of Leveling Up through experience (Gain a Level Up Item through experience.)
  • Equip Weapon and Armor Attachments.
  • Assign Items to specific actors.
  • Learn Skills through Weapon Panels.
  • "There is also more !!"

Screenshots

Image

Image

I would post more but I'm insanely sleepy right now... I got like no sleep workin on that last night and there are still bugs.
Demo

The Demo Contains the RTAB and a few add-ons (Made By Others),

Edits to the system, The Actual Panel Script, Actor Bags, Visual Equipment for Battlers, and a Debug System to help you figure out if an item hasn't been written in the database... so to speak.


http://www.zshare.net/download/71547602cff69959/

Script

Content Hidden Spoiler
  1. #o = panel
  2. #l = link
  3. #x = space
  4. #+==============================================================================
  5. #
  6. #+------------------------------------------------------------------------------
  7. #
  8. #+------------------------------------------------------------------------------
  9. #   Item Database
  10. #+------------------------------------------------------------------------------
  11. #
  12. #+------------------------------------------------------------------------------
  13. #
  14. #+==============================================================================
  15.  
  16. #+==============================================================================
  17. # Module COTTONJJ
  18. #+------------------------------------------------------------------------------
  19. # Sets up Special Item IDs
  20. #+==============================================================================
  21. module COTTONJJ
  22.   LEVELUP = 1                #Item ID of Level Up Item.
  23.   LEVELUPDOUBLER = 2         #Item ID of Level Up Doubler
  24.   LEVELUPTRIPLER = 3         #Item ID of Level Up Tripler
  25.   ASSISTITEMS = [1,2,3]      #ID Hash of Assist Item IDs (Level Ups)
  26.   ASSISTARMORS = [1,2,3,4]   #ID Hash of Assist Armor IDs (Weapon Accessories
  27.   ABILITYVAR = 1             #ID of Ability Armor
  28.  
  29.   ITEMBAG = false            #Set to true if actors are allowed individual bags.
  30.   BLANKICON = ""             #Name of Icon on Link Panels
  31.   RTAB = false               #Set true if using RTAB
  32.   CUSTOMXY = false           #Set true only if you want your battlers sideview.
  33.   GAINLEVELITEM = false      #Set true if actors gain level ups through exp.
  34. end
  35.  
  36.  
  37.  
  38.  
  39.  
  40. #+==============================================================================
  41. # Global Panel Variables
  42. #+==============================================================================
  43. $panels = []
  44. $panels2 = []
  45. $panels3 = []
  46. $panels[0] = []
  47. $panels[1] = []
  48. $panels[2] = []
  49. $panels[3] = []
  50. $panels[4] = []
  51. $panels2[0] = []
  52. $panels2[1] = []
  53. $panels2[2] = []
  54. $panels2[3] = []
  55. $panels2[4] = []
  56. $panels3[0] = []
  57. $panels3[1] = []
  58. $panels3[2] = []
  59. $panels3[3] = []
  60. $panels3[4] = []
  61.  
  62.  
  63.  
  64.  
  65. $item_panels = []
  66. #+==============================================================================
  67. # Weapon Panels [1]
  68. #+------------------------------------------------------------------------------
  69. # [1] Devestation Blade
  70. #+==============================================================================
  71. #Panel Size, (Item Class), EquippedHash, (Item ID)
  72. $item_panels.push([[
  73. "o",
  74. "l",
  75. "l",
  76. "l"], "Weapon", [[-1,[]]], 1])
  77. #+==============================================================================
  78. # [2] Soul of the Blacksmith
  79. #+==============================================================================
  80. $item_panels.push([[
  81. "xxl",
  82. "lloll",
  83. "xxl"], "Weapon", [[-1,[]]], 2])
  84. #+==============================================================================
  85. # [3] 9mm Pistol
  86. #+==============================================================================
  87. $item_panels.push([[
  88. "ollll",
  89. "llxx",
  90. "lxxx",
  91. "xxxx"], "Weapon", [[-1,[]]], 3])
  92. #+==============================================================================
  93. # [4] Key Blade
  94. #+==============================================================================
  95. $item_panels.push([[
  96. "xl",
  97. "lol",
  98. "xl",
  99. "xl",
  100. "xl"], "Weapon", [[-1,[]]], 4])
  101.  
  102.  
  103.  
  104.  
  105.  
  106. #+==============================================================================
  107. # Armor Panels [1]
  108. #+------------------------------------------------------------------------------
  109. # Panel Size, (Item Class), EquippedHash, (Item ID), LinkType1, [LinkType2]
  110. #+------------------------------------------------------------------------------
  111. # [1] Ability Chain
  112. #+==============================================================================
  113. $item_panels.push([[
  114. "oxxx",
  115. "xxxx",
  116. "xxxx",
  117. "xxxx"], "Armor", [[-1,[]]], 1, "WeaponLink", "Ability"])
  118.  
  119. #+==============================================================================
  120. # [2] Power Chain
  121. #+==============================================================================
  122. $item_panels.push([[
  123. "oxxx",
  124. "xxxx",
  125. "xxxx",
  126. "xxxx"], "Armor", [[-1,[]]], 2, "WeaponLink", "AddStat", [[1,"atk"],[1,"str"]]])
  127.  
  128. #+==============================================================================
  129. # [3] Defense Chain
  130. #+==============================================================================
  131. $item_panels.push([[
  132. "oxxx",
  133. "xxxx",
  134. "xxxx",
  135. "xxxx"], "Armor", [[-1,[]]], 3, "WeaponLink", "AddStat", [[1,"def"],[1,"mdef"]]])
  136.  
  137. #+==============================================================================
  138. # [4] Speed Chain
  139. #+==============================================================================
  140. $item_panels.push([[
  141. "oxxx",
  142. "xxxx",
  143. "xxxx",
  144. "xxxx"], "Armor", [[-1,[]]], 4, "WeaponLink", "AddStat", [[1,"agi_plus"],[1,"dex_plus"]]])
  145.  
  146. #+==============================================================================
  147. # [5] Lollipop Outfit
  148. #+==============================================================================
  149. $item_panels.push([[
  150. "oxxx",
  151. "xxxx",
  152. "xxxx",
  153. "xxxx"], "Armor", [[-1,[]]], 5])
  154.  
  155. #+==============================================================================
  156. # [6] Basic Outfit
  157. #+==============================================================================
  158. $item_panels.push([[
  159. "olxx",
  160. "xxxx",
  161. "xxxx",
  162. "xxxx"], "Armor", [[-1,[]]], 6])
  163.  
  164. #+==============================================================================
  165. # [7] Off Gucci Outfit
  166. #+==============================================================================
  167. $item_panels.push([[
  168. "oxxx",
  169. "lxxx",
  170. "xxxx",
  171. "xxxx"], "Armor", [[-1,[]]], 7])
  172.  
  173. #+==============================================================================
  174. # [8] Wonder Woman Costume
  175. #+==============================================================================
  176. $item_panels.push([[
  177. "olxx",
  178. "lxxx",
  179. "xxxx",
  180. "xxxx"], "Armor", [[-1,[]]], 8])
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187. #+==============================================================================
  188. # Item Panels
  189. #+------------------------------------------------------------------------------
  190. # Panel Size, (Item Class), [EquippedHash], (Item ID), LinkType1, [LinkType2]
  191. #+------------------------------------------------------------------------------
  192. # [1] Level Up
  193. #+==============================================================================
  194. $item_panels.push([[
  195. "o"], "Item", [[-1,[]]], 1, "LevelUp"])
  196. #+==============================================================================
  197. # [2] Level Up Doubler
  198. #+==============================================================================
  199. $item_panels.push([[
  200. "xol",
  201. "ll"], "Item", [[-1,[]]], 2, "2x", "Level"])
  202. #+==============================================================================
  203. # [3] Level Up Tripler
  204. #+==============================================================================
  205. $item_panels.push([[
  206. "l",
  207. "ol",
  208. "xl"], "Item", [[-1,[]]], 3, "3x", "Level"])
  209. #+==============================================================================
  210. # [4] Revitalize
  211. #+==============================================================================
  212. $item_panels.push([[
  213. "o"], "Item", [[-1,[]]], 4])
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220. #+==============================================================================
  221. # Skill Panels
  222. #+------------------------------------------------------------------------------
  223. # Panel Size, (Item Class), [EquippedHash], (Item ID), LinkType1, [LinkType2]
  224. #+------------------------------------------------------------------------------
  225. # [1] Struggle
  226. #+==============================================================================
  227. #$item_panels.push([[
  228. #"o"], "Skill", [[-1,[]]], 1])
  229.  
  230.  
  231.  
  232.  
  233.  
  234. #+==============================================================================
  235. # Weapon Abilities
  236. #+------------------------------------------------------------------------------
  237. # Weapon_ID = [SkillIDs]
  238. #+==============================================================================
  239. $weapon_abilities = []
  240. $weapon_abilities[1] = [2,3,4]
  241. $weapon_abilities[2] = [5,7,9]
  242. $armor_abilities = []
  243. #$armor_abilities[8] = [9]
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257. class Scene_Menu
  258.   def update_status
  259.     # If B button was pressed
  260.     if Input.trigger?(Input::B)
  261.       # Play cancel SE
  262.       $game_system.se_play($data_system.cancel_se)
  263.       # Make command window active
  264.       @command_window.active = true
  265.       @status_window.active = false
  266.       @status_window.index = -1
  267.       return
  268.     end
  269.     # If C button was pressed
  270.     if Input.trigger?(Input::C)
  271.       # Branch by command window cursor position
  272.       case @command_window.index
  273.       when 1  # skill
  274.         # If this actor's action limit is 2 or more
  275.         if $game_party.actors[@status_window.index].restriction >= 2
  276.           # Play buzzer SE
  277.           $game_system.se_play($data_system.buzzer_se)
  278.           return
  279.         end
  280.         # Play decision SE
  281.         $game_system.se_play($data_system.decision_se)
  282.         # Switch to skill screen
  283.         $scene = Scene_Skill.new(@status_window.index)
  284.       when 2  # equipment
  285.         # Play decision SE
  286.         $game_system.se_play($data_system.decision_se)
  287.         # Switch to equipment screen
  288.         $scene = Scene_Panels.new(@status_window.index)
  289.       when 3  # status
  290.         # Play decision SE
  291.         $game_system.se_play($data_system.decision_se)
  292.         # Switch to status screen
  293.         $scene = Scene_Status.new(@status_window.index)
  294.       end
  295.       return
  296.     end
  297.   end
  298. end
  299. class Scene_Panels
  300.   attr_accessor :window_panels
  301.   attr_accessor :window
  302.   attr_accessor :window_itempanel
  303.   def initialize(actor_index = 0, equip_index = 0)
  304.     @actor_index = actor_index
  305.     @equip_index = equip_index
  306.   end
  307.   def main
  308.     @window = true
  309.     @wait = 0
  310.     @actor = $game_party.actors[@actor_index]
  311.     draw_windows
  312.     Graphics.transition
  313.     loop do
  314.       Input.update
  315.       Graphics.update
  316.       update
  317.       break if $scene != self
  318.     end
  319.     Graphics.freeze
  320.     dispose
  321.   end
  322.   def draw_windows
  323.     @help_window = Window_Help.new
  324.     @window_panels = Window_Panels.new(@actor)
  325.     @window_panels.help_window = @help_window
  326.     @window_equipped = Window_Equipped.new(@actor)
  327.     @window_equipped.draw_oldpanels
  328.     @window_itempanel = Window_ItemPanel.new
  329.     @window_equipped.active = false
  330.     @window_itempanel.active = false
  331.     @window_category = Window_Category.new
  332.   end
  333.   def dispose
  334.     @window_equipped.save_panels
  335.     @help_window.dispose
  336.     @window_panels.dispose
  337.     @window_equipped.dispose
  338.     @window_itempanel.dispose
  339.     @window_category.dispose
  340.   end
  341.   def update
  342.     if @wait > 0
  343.       @wait -= 1
  344.       return
  345.     end
  346.     @window_panels.update
  347.     @help_window.update
  348.     @window_equipped.update
  349.     @window_itempanel.update
  350.     @window_category.update
  351.     @window_panels.index = 0 if @window_panels.index < 0
  352.     if @window_panels.active == true
  353.       @window_panels.update_help
  354.       update_right
  355.     elsif @window_equipped.active == true && @window_itempanel.active == true
  356.       @window_panels.update_help("Place Panel(s)")
  357.       #@window = true
  358.       update_left
  359.     elsif @window_equipped.active == true
  360.       @window_panels.update_help("Pick Up Panel(s)")
  361.       update_left_delete
  362.     elsif @window_category.active == true
  363.       @window_panels.update_help("Change Category")
  364.       update_category
  365.     end
  366.   end
  367.   def run_equip(equip,id)
  368.     return @actor.run_equip(equip,id)
  369.   end
  370.   def update_category
  371.     @window_panels.refresh(@window_category.index)
  372.     if Input.trigger?(Input::DOWN)
  373.       $game_system.se_play($data_system.cursor_se)
  374.       @window_panels.index = 0
  375.       @window_panels.active = true
  376.       @window_equipped.active = false
  377.       @window_category.active = false
  378.     end
  379.     if Input.trigger?(Input::B)
  380.       $game_system.se_play($data_system.cancel_se)
  381.       # Switch to menu screen
  382.       $scene = Scene_Menu.new(2)
  383.       return
  384.     end
  385.   end
  386.   def update_to_category
  387.     @window_panels.active = false
  388.     @window_equipped.active = false
  389.     #@window_equipped.active = false
  390.     @window_category.active = true
  391.     return
  392.   end
  393.   def update_left(window = @window)
  394.     @window_itempanel.refresh(@window_equipped.index)
  395.     if Input.trigger?(Input::C)
  396.       if window == true
  397.         @item = get_item(@window_panels.index)
  398.       else
  399.         @item = @window_itempanel.item
  400.       end
  401.       if @item != false
  402.         if @item[4] == nil
  403.           if can_be_placed?(@item, @window_equipped.index)
  404.             if @item[1] == "Weapon"
  405.               #if @actor.weapon != nil and @actor.weapon.weapon_accessories.empty?
  406.                 if @actor.weapon_id < 1
  407.                   panel_weapon
  408.                   @jj = nil
  409.                   return
  410.                 end
  411.               #end
  412.             elsif @item[1] == "Item"
  413.               panel_weapon
  414.               @jj = nil
  415.               return
  416.             else
  417.               if window == true
  418.                 m = @window_panels.item
  419.               else
  420.                 #print(get_item3(@window_itempanel.item))
  421.                 m = get_item3(@window_itempanel.item)
  422.               end
  423.               if window == true
  424.                 @item = get_item(@window_panels.index)
  425.               else
  426.                 @item = @window_itempanel.item
  427.                 #print(@item)
  428.               end
  429.               if @item[1] == "Armor"
  430.                 if @item[4] == nil
  431.                   m = $data_armors[@item[3]].kind
  432.                   case m
  433.                   when 0
  434.                     if @actor.armor1_id < 1
  435.                       panel_weapon
  436.                       @jj = nil
  437.                       return
  438.                     end
  439.                   when 1
  440.                     if @actor.armor2_id < 1
  441.                       panel_weapon
  442.                       @jj = nil
  443.                       return
  444.                     end
  445.                   when 2
  446.                     if @actor.armor3_id < 1
  447.                       panel_weapon
  448.                       @jj = nil
  449.                       return
  450.                     end
  451.                   when 3
  452.                     if @actor.armor4_id < 1
  453.                       panel_weapon
  454.                       @jj = nil
  455.                       return
  456.                     end
  457.                   end
  458.                 end
  459.               else
  460.                 #print("a")
  461.               end
  462.             end
  463.             $game_system.se_play($data_system.buzzer_se)
  464.             return
  465.           end
  466.         else
  467.           case @item[4]
  468.           when "WeaponLink"
  469.             if can_be_placed?(@item, @window_equipped.index, "Weapon")
  470.               panel_weaponlink
  471.               @jj = nil
  472.               return
  473.             end
  474.           when "LevelUp"
  475.             o = can_be_placed?(@item, @window_equipped.index, true)
  476.             if o.is_a?(Array)
  477.               if o[0] == true
  478.                 panel_levellink(o)
  479.                 @jj = nil
  480.                 return
  481.               end
  482.             elsif can_be_placed?(@item, @window_equipped.index)
  483.               panel_level
  484.               @jj = nil
  485.               return
  486.             end
  487.           when "2x"
  488.             if can_be_placed?(@item, @window_equipped.index)
  489.               panel_doubler
  490.               @jj = nil
  491.               return
  492.             end
  493.           when "3x"
  494.             if can_be_placed?(@item, @window_equipped.index)
  495.               panel_tripler
  496.               @jj = nil
  497.               return
  498.             end
  499.           end
  500.         end
  501.       end
  502.       $game_system.se_play($data_system.buzzer_se)
  503.       @item = false
  504.     end
  505.     if Input.trigger?(Input::B)
  506.       $game_system.se_play($data_system.cancel_se)
  507.       @window_itempanel.clear_panels
  508.       #@window_panels.index = @window_panels.index - 1
  509.       #@window_panels.index = 0 if @window_panels.index == -1
  510.       @window_panels.refresh(@window_category.index)
  511.       @window_panels.active = true
  512.       @window_equipped.active = false
  513.       @window_itempanel.active = false
  514.       @item = false
  515.       return
  516.     end
  517.   end
  518.   def update_return_right(index)
  519.     $game_system.se_play($data_system.cancel_se)
  520.     @window_itempanel.clear_panels
  521.     @window_panels.active = true
  522.     @window_equipped.active = false
  523.     if index / 9 > (@window_panels.data.size - 1)
  524.       @window_panels.index = (@window_panels.data.size - 1)
  525.       if @window_panels.index < 0
  526.         @window_panels.index = 0
  527.       end
  528.     else
  529.       @window_panels.index = (index / 9) - 2
  530.       if @window_panels.index < 0
  531.         @window_panels.index = 0
  532.       end
  533.     end
  534.     @window_panels.refresh(@window_category.index)
  535.     @window_itempanel.active = false
  536.     @item = false
  537.     return
  538.   end
  539.   def unequip(item,equip_type = 0,link_panel = nil)
  540.     case item
  541.     when RPG::Item
  542.       @actor.bag.remove(item)
  543.     when RPG::Skill
  544.       pr = "Skill"
  545.     else
  546.       if equip_type == 4
  547.         g = get_item2(item)
  548.         if g[4] == "WeaponLink"
  549.           if link_panel.is_a?(RPG::Weapon)
  550.             @actor.unequip_weaponaccessory(item)
  551.           elsif link_panel.is_a?(RPG::Armor)
  552.             @actor.unequip_armoraccessory(link_panel.kind,item)
  553.           end
  554.           if g[5] == "Ability"
  555.             if link_panel.is_a?(RPG::Weapon)
  556.               a = @actor.weapon.weapon_accessories.dup
  557.               v = @actor.weapon.weapon_accessories.size
  558.               o = 0
  559.               for i in 0...v
  560.                 if a[i].id == COTTONJJ::ABILITYVAR
  561.                   o += 1
  562.                 end
  563.               end
  564.               @actor.forget_skill($weapon_abilities[@actor.weapon_id][o])
  565.             elsif link_panel.is_a?(RPG::Armor)
  566.               case link_panel.kind
  567.               when 0
  568.                 g = @actor.armor1_id
  569.               when 1
  570.                 g = @actor.armor2_id
  571.               when 2
  572.                 g = @actor.armor3_id
  573.               when 3
  574.                 g = @actor.armor4_id
  575.               end
  576.               a = @actor.armors[link_panel.kind].armor_accessories.dup
  577.               v = @actor.armors[link_panel.kind].armor_accessories.size
  578.               o = 0
  579.               for i in 0...v
  580.                 if a[i].id == COTTONJJ::ABILITYVAR
  581.                   o += 1
  582.                 end
  583.               end
  584.               @actor.forget_skill($armor_abilities[g][o])
  585.             end
  586.           elsif g[5] == "AddStat"
  587.             if link_panel.is_a?(RPG::Weapon)
  588.               for i in 0...@item[6].size
  589.                 case @item[6][i][1]
  590.                 when "name"
  591.                   $data_weapons[@actor.weapon_id].name = @item[6][i][2]
  592.                 when "icon_name"
  593.                   $data_weapons[@actor.weapon_id].icon_name = @item[6][i][2]
  594.                 when "description"
  595.                   $data_weapons[@actor.weapon_id].description = @item[6][i][2]
  596.                 when "animation1_id"
  597.                   $data_weapons[@actor.weapon_id].animation1_id = @item[6][i][2]
  598.                 when "animation2_id"
  599.                   $data_weapons[@actor.weapon_id].animation2_id = @item[6][i][2]
  600.                 when "atk"
  601.                   $data_weapons[@actor.weapon_id].atk -= @item[6][i][0]
  602.                 when "def"
  603.                   $data_weapons[@actor.weapon_id].pdef -= @item[6][i][0]
  604.                 when "mdef"
  605.                   $data_weapons[@actor.weapon_id].mdef -= @item[6][i][0]
  606.                 when "str"
  607.                   $data_weapons[@actor.weapon_id].str_plus -= @item[6][i][0]
  608.                 when "dex_plus"
  609.                   $data_weapons[@actor.weapon_id].dex_plus -= @item[6][i][0]
  610.                 when "agi_plus"
  611.                   $data_weapons[@actor.weapon_id].agi_plus -= @item[6][i][0]
  612.                 when "int_plus"
  613.                   $data_weapons[@actor.weapon_id].int_plus -= @item[6][i][0]
  614.                 when "element_set"
  615.                   $data_weapons[@actor.weapon_id].element_set.delete(@item[6][i][0])
  616.                 when "plus_state_set"
  617.                   $data_weapons[@actor.weapon_id].plus_state_set.delete(@item[6][i][0])
  618.                 when "minus_state_set"
  619.                   $data_weapons[@actor.weapon_id].minus_state_set.delete(@item[6][i][0])
  620.                 end
  621.               end
  622.             elsif link_panel.is_a?(RPG::Armor)
  623.               case link_panel.kind
  624.               when 0
  625.                 g = @actor.armor1_id
  626.               when 1
  627.                 g = @actor.armor2_id
  628.               when 2
  629.                 g = @actor.armor3_id
  630.               when 3
  631.                 g = @actor.armor4_id
  632.               end
  633.               for i in 0...@item[6].size
  634.                 case @item[6][i][1]
  635.                 when "name"
  636.                   $data_armors[g].name = @item[6][i][2]
  637.                 when "icon_name"
  638.                   $data_armors[g].icon_name = @item[6][i][2]
  639.                 when "description"
  640.                   $data_armors[g].description = @item[6][i][2]
  641.                 when "kind"
  642.                   $data_armors[g].kind = @item[6][i][2]
  643.                 when "auto_state_id"
  644.                   $data_armors[g].auto_state_id = @item[6][i][2]
  645.                 when "def"
  646.                   $data_armors[g].pdef -= @item[6][i][0]
  647.                 when "mdef"
  648.                   $data_armors[g].mdef -= @item[6][i][0]
  649.                 when "str"
  650.                   $data_armors[g].str_plus -= @item[6][i][0]
  651.                 when "dex_plus"
  652.                   $data_armors[g].dex_plus -= @item[6][i][0]
  653.                 when "agi_plus"
  654.                   $data_armors[g].agi_plus -= @item[6][i][0]
  655.                 when "int_plus"
  656.                   $data_armors[g].int_plus -= @item[6][i][0]
  657.                 when "element_set"
  658.                   $data_armors[g].element_set.remove(@item[6][i][0])
  659.                 when "plus_state_set"
  660.                   $data_armors[g].plus_state_set.remove(@item[6][i][0])
  661.                 when "minus_state_set"
  662.                   $data_armors[g].minus_state_set.remove(@item[6][i][0])
  663.                 end
  664.               end
  665.             end
  666.           end
  667.         end
  668.       else
  669.         @actor.equip(equip_type, 0)
  670.       end
  671.     end
  672.   end
  673.   def update_left_delete
  674.     if Input.trigger?(Input::C)
  675.       if @window_equipped.data[@window_equipped.index] != nil
  676.         if not @window_equipped.data[@window_equipped.index].is_a?(Array)
  677.           $game_system.se_play($data_system.cancel_se)
  678.           @item = get_itemequipped(@window_equipped.index)
  679.           @item2 = @window_equipped.item
  680.           if @item2.is_a?(RPG::Weapon)
  681.             if @actor.weapon != nil
  682.               if @actor.weapon.weapon_accessories != nil
  683.                 if @actor.weapon.weapon_accessories.empty? == false
  684.                   @window_panels.help_window.set_text("The weapon is occupied.")
  685.                   @wait = 25
  686.                   $game_system.se_play($data_system.buzzer_se)
  687.                   return
  688.                 end
  689.               end
  690.             end
  691.           end
  692.           if @item[2].include?([@actor.id,@window_equipped.index])
  693.             @item[2].delete([@actor.id,@window_equipped.index])
  694.           end
  695.           g = 0
  696.           if @item2.is_a?(RPG::Armor)
  697.             g = @item2.kind + 1
  698.             if COTTONJJ::ASSISTARMORS.include?(@item2.id)
  699.               if @actor.weapon != nil
  700.                 if @actor.weapon.weapon_accessories != nil
  701.                   #if @actor.weapon.weapon_accessories.empty? == false
  702.                     l = @actor.weapon
  703.                   #end
  704.                 end
  705.               end
  706.             end
  707.           end
  708.           unequip(@item2,g,l)
  709.           @window_itempanel.draw_panels(@item,@window_equipped.index,@window_equipped.item)
  710.           @window_itempanel.refresh(@window_equipped.index)
  711.           @window_equipped.clear_panel(@item,@window_equipped.index,@item2)
  712.           @window_panels.refresh(@window_category.index)
  713.           @window_itempanel.active = true
  714.           @window = false
  715.           return
  716.         end
  717.       end
  718.       $game_system.se_play($data_system.buzzer_se)
  719.     end
  720.     if Input.trigger?(Input::B)
  721.       $game_system.se_play($data_system.cancel_se)
  722.       # Switch to menu screen
  723.       $scene = Scene_Menu.new(2)
  724.       return
  725.     end
  726.   end
  727.   def update_right
  728.     if @window_panels.index < 0 or @window_panels.data[@window_panels.index] == nil
  729.       update_to_category
  730.     end
  731.     if Input.trigger?(Input::B)
  732.       $game_system.se_play($data_system.cancel_se)
  733.       # Switch to menu screen
  734.       $scene = Scene_Menu.new(2)
  735.       return
  736.     end
  737.     if Input.trigger?(Input::C)
  738.       @item = get_item(@window_panels.index)
  739.       if @item != false
  740.         $game_system.se_play($data_system.decision_se)
  741.         @window_panels.active = false
  742.         @window_equipped.active = true
  743.         @window_itempanel.draw_panels(@item,@window_equipped.index,@window_panels.item)
  744.         @window_itempanel.active = true
  745.         @window = true
  746.         return
  747.       end
  748.       $game_system.se_play($data_system.buzzer_se)
  749.     end
  750.     if Input.trigger?(Input::LEFT)
  751.       $game_system.se_play($data_system.cancel_se)
  752.       @window_panels.active = false
  753.       @window_equipped.active = true
  754.       @window = false
  755.       a = @window_panels.index
  756.       @window_equipped.index = ((a * 9) + 8) + (9*2)
  757.     end
  758.   end
  759. end
  760. class Scene_Panels
  761.   def panel_weapon
  762.     @item[2].push([@actor.id,@window_equipped.index])
  763.     if @window == true
  764.       m = @window_panels.item
  765.     else
  766.       m = get_item3(@window_itempanel.item)
  767.     end
  768.     @window_equipped.set_panel(@item,@window_equipped.index,m)
  769.     @window_itempanel.clear_panels
  770.     #item = @window_panels.item
  771.     if @window == true
  772.       item = @window_panels.item
  773.     else
  774.       item = get_item3(@window_itempanel.item)
  775.     end
  776.     $game_system.se_play($data_system.equip_se)
  777.     if item.is_a?(RPG::Weapon)
  778.       @actor.equip(0, item.id)
  779.     end
  780.     if item.is_a?(RPG::Armor)
  781.       item_type = item.kind + 1
  782.       @actor.equip(item_type, item.id)
  783.     end
  784.     if item.is_a?(RPG::Item)
  785.       @actor.equip_item(item.id)
  786.     end
  787.     @window_panels.refresh(@window_category.index)
  788.     @window_panels.active = true
  789.     @window_equipped.active = false
  790.     @window_itempanel.active = false
  791.     if @window_panels.index == -1
  792.       @window_panels.index = 0
  793.     end
  794.     if @window_panels.index > @window_panels.data.size
  795.       @window_panels.index = @window_panels.data.size
  796.     end
  797.     @window_panels.refresh(@window_category.index)
  798.     @window_panels.index -= 1 if @window_panels.item == nil
  799.   end
  800.   def panel_weaponlink
  801.     @item[2].push([@actor.id,@window_equipped.index])
  802.     g = @window_equipped.item[1]
  803.     k = @window_equipped.item[6]
  804.     #print(@window_equipped.item[6])
  805.     @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item,true,k)
  806.     @window_itempanel.clear_panels
  807.     item = @window_panels.item
  808.     $game_system.se_play($data_system.equip_se)
  809.     if item.is_a?(RPG::Armor)
  810.       if k.is_a?(RPG::Weapon)
  811.         @actor.equip_weaponaccessory(item)
  812.       elsif k.is_a?(RPG::Armor)
  813.         @actor.equip_armoraccessory($data_armors[g].kind,item)
  814.       end
  815.     end
  816.     case @item[5]
  817.     when "Ability"
  818.       #Learn Skill based on Panel
  819.       if k.is_a?(RPG::Weapon)
  820.         a = @actor.weapon.weapon_accessories.dup
  821.         v = @actor.weapon.weapon_accessories.size
  822.         o = 0
  823.         for i in 0...v
  824.           if a[i].id == COTTONJJ::ABILITYVAR
  825.             o += 1
  826.           end
  827.         end
  828.         if $weapon_abilities[@actor.weapon_id] != nil
  829.           if $weapon_abilities[@actor.weapon_id][o-1] != nil
  830.             @actor.learn_skill($weapon_abilities[@actor.weapon_id][o-1])
  831.           end
  832.         end
  833.       elsif k.is_a?(RPG::Armor)
  834.         kind = k.kind#@var_kind if @var_kind != nil #@window_equipped.item.kind
  835.         a = @actor.armors[kind].armor_accessories.dup
  836.         v = @actor.armors[kind].armor_accessories.size
  837.         o = 0
  838.         for i in 0...v
  839.           if a[i].id == COTTONJJ::ABILITYVAR
  840.             o += 1
  841.           end
  842.         end
  843.         case kind
  844.         when 0
  845.           g = @actor.armor1_id
  846.         when 1
  847.           g = @actor.armor2_id
  848.         when 2
  849.           g = @actor.armor3_id
  850.         when 3
  851.           g = @actor.armor4_id
  852.         end
  853.         if $armor_abilities[g] != nil
  854.           if $armor_abilities[g][o-1] != nil
  855.             @actor.learn_skill($armor_abilities[g][o-1])
  856.           end
  857.         end
  858.         @var_kind = nil
  859.       else
  860.         if @window_panels.index == -1
  861.           @window_panels.index = 0
  862.         end
  863.         if @window_panels.index > @window_panels.data.size
  864.           @window_panels.index = @window_panels.data.size
  865.         end
  866.         @window_panels.refresh(@window_category.index)
  867.         @window_panels.index -= 1 if @window_panels.item == nil
  868.         @window_panels.active = true
  869.         @window_equipped.active = false
  870.         @window_itempanel.active = false
  871.         return
  872.       end
  873.     when "AddStat"
  874.       if k.is_a?(RPG::Weapon)
  875.         #Learn Skill based on Panel
  876.         for i in 0...@item[6].size
  877.           case @item[6][i][1]
  878.           when "name"
  879.             $data_weapons[@actor.weapon_id].name = @item[6][i][0]
  880.           when "icon_name"
  881.             $data_weapons[@actor.weapon_id].icon_name = @item[6][i][0]
  882.           when "description"
  883.             $data_weapons[@actor.weapon_id].description = @item[6][i][0]
  884.           when "animation1_id"
  885.             $data_weapons[@actor.weapon_id].animation1_id = @item[6][i][0]
  886.           when "animation2_id"
  887.             $data_weapons[@actor.weapon_id].animation2_id = @item[6][i][0]
  888.           when "atk"
  889.             $data_weapons[@actor.weapon_id].atk += @item[6][i][0]
  890.           when "def"
  891.             $data_weapons[@actor.weapon_id].pdef += @item[6][i][0]
  892.           when "mdef"
  893.             $data_weapons[@actor.weapon_id].mdef += @item[6][i][0]
  894.           when "str"
  895.             $data_weapons[@actor.weapon_id].str_plus += @item[6][i][0]
  896.           when "dex_plus"
  897.             $data_weapons[@actor.weapon_id].dex_plus += @item[6][i][0]
  898.           when "agi_plus"
  899.             $data_weapons[@actor.weapon_id].agi_plus += @item[6][i][0]
  900.           when "int_plus"
  901.             $data_weapons[@actor.weapon_id].int_plus += @item[6][i][0]
  902.           when "element_set"
  903.             $data_weapons[@actor.weapon_id].element_set.push(@item[6][i][0])
  904.           when "plus_state_set"
  905.             $data_weapons[@actor.weapon_id].plus_state_set.push(@item[6][i][0])
  906.           when "minus_state_set"
  907.             $data_weapons[@actor.weapon_id].minus_state_set.push(@item[6][i][0])
  908.           end
  909.         end
  910.       elsif k.is_a?(RPG::Armor)
  911.         kind = @var_kind if @var_kind != nil
  912.         case kind
  913.         when 0
  914.           g = @actor.armor1_id
  915.         when 1
  916.           g = @actor.armor2_id
  917.         when 2
  918.           g = @actor.armor3_id
  919.         when 3
  920.           g = @actor.armor4_id
  921.         end
  922.         for i in 0...@item[6].size
  923.           case @item[6][i][1]
  924.           when "name"
  925.             $data_armors[g].name = @item[6][i][0]
  926.           when "icon_name"
  927.             $data_armors[g].icon_name = @item[6][i][0]
  928.           when "description"
  929.             $data_armors[g].description = @item[6][i][0]
  930.           when "kind"
  931.             $data_armors[g].kind = @item[6][i][0]
  932.           when "auto_state_id"
  933.             $data_armors[g].auto_state_id = @item[6][i][0]
  934.           when "def"
  935.             $data_armors[g].pdef += @item[6][i][0]
  936.           when "mdef"
  937.             $data_armors[g].mdef += @item[6][i][0]
  938.           when "str"
  939.             $data_armors[g].str_plus += @item[6][i][0]
  940.           when "dex_plus"
  941.             $data_armors[g].dex_plus += @item[6][i][0]
  942.           when "agi_plus"
  943.             $data_armors[g].agi_plus += @item[6][i][0]
  944.           when "int_plus"
  945.             $data_armors[g].int_plus += @item[6][i][0]
  946.           when "element_set"
  947.             $data_armors[g].guard_element_set.push(@item[6][i][0])
  948.           when "plus_state_set"
  949.             $data_armors[g].guard_state_set.push(@item[6][i][0])
  950.           when "minus_state_set"
  951.             $data_armors[g].guard_state_set.remove(@item[6][i][0])
  952.           end
  953.         end
  954.         @var_kind = nil
  955.       else
  956.         if @window_panels.index == -1
  957.           @window_panels.index = 0
  958.         end
  959.         if @window_panels.index > @window_panels.data.size
  960.           @window_panels.index = @window_panels.data.size
  961.         end
  962.         @window_panels.refresh(@window_category.index)
  963.         @window_panels.index -= 1 if @window_panels.item == nil
  964.         @window_panels.active = true
  965.         @window_equipped.active = false
  966.         @window_itempanel.active = false
  967.         return
  968.       end
  969.     end
  970.     if @window_panels.index == -1
  971.       @window_panels.index = 0
  972.     end
  973.     if @window_panels.index > @window_panels.data.size
  974.       @window_panels.index = @window_panels.data.size
  975.     end
  976.     @window_panels.refresh(@window_category.index)
  977.     @window_panels.index -= 1 if @window_panels.item == nil
  978.     @window_panels.active = true
  979.     @window_equipped.active = false
  980.     @window_itempanel.active = false
  981.   end
  982.   def panel_levellink(o)
  983.     k = @window_equipped.data[@window_equipped.index]
  984.     @item[2].push([@actor.id,@window_equipped.index])
  985.     @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item,true)
  986.     @window_itempanel.clear_panels
  987.     item = @window_panels.item
  988.     $game_system.se_play($data_system.equip_se)
  989.     if item.is_a?(RPG::Item)
  990.       a = @actor.level
  991.       case k[3]
  992.       when "2x"
  993.         @actor.level = @actor.level + 2
  994.       when "3x"
  995.         @actor.level = @actor.level + 3
  996.       else
  997.         @actor.level = @actor.level + 1
  998.       end
  999.       $game_party.lose_item(COTTONJJ::LEVELUP,1)
  1000.     end
  1001.     if @window_panels.index == -1
  1002.       @window_panels.index = 0
  1003.     end
  1004.     if @window_panels.index > @window_panels.data.size
  1005.       @window_panels.index = @window_panels.data.size
  1006.     end
  1007.     @window_panels.refresh(@window_category.index)
  1008.     @window_panels.index -= 1 if @window_panels.item == nil
  1009.     @window_panels.active = true
  1010.     @window_equipped.active = false
  1011.     @window_itempanel.active = false
  1012.   end
  1013.   def panel_level
  1014.     @item[2].push([@actor.id,@window_equipped.index])
  1015.     @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
  1016.     @window_itempanel.clear_panels
  1017.     item = @window_panels.item
  1018.     $game_system.se_play($data_system.equip_se)
  1019.     if item.is_a?(RPG::Item)
  1020.       a = @actor.level
  1021.       @actor.level = @actor.level + 1
  1022.       $game_party.lose_item(COTTONJJ::LEVELUP,1)
  1023.     end
  1024.     if @window_panels.index == -1
  1025.       @window_panels.index = 0
  1026.     end
  1027.     if @window_panels.index > @window_panels.data.size
  1028.       @window_panels.index = @window_panels.data.size
  1029.     end
  1030.     @window_panels.refresh(@window_category.index)
  1031.     @window_panels.index -= 1 if @window_panels.item == nil
  1032.     @window_panels.active = true
  1033.     @window_equipped.active = false
  1034.     @window_itempanel.active = false
  1035.   end
  1036.   def panel_doubler
  1037.     @item[2].push([@actor.id,@window_equipped.index])
  1038.     @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
  1039.     @window_itempanel.clear_panels
  1040.     item = @window_panels.item
  1041.     $game_system.se_play($data_system.equip_se)
  1042.     if item.is_a?(RPG::Item)
  1043.       a = @actor.level
  1044.       $game_party.lose_item(COTTONJJ::LEVELUPDOUBLER,1)
  1045.     end
  1046.     if @window_panels.index == -1
  1047.       @window_panels.index = 0
  1048.     end
  1049.     if @window_panels.index > @window_panels.data.size
  1050.       @window_panels.index = @window_panels.data.size
  1051.     end
  1052.     @window_panels.refresh(@window_category.index)
  1053.     @window_panels.index -= 1 if @window_panels.item == nil
  1054.     @window_panels.active = true
  1055.     @window_equipped.active = false
  1056.     @window_itempanel.active = false
  1057.   end
  1058.   def panel_tripler
  1059.     @item[2].push([@actor.id,@window_equipped.index])
  1060.     @window_equipped.set_panel(@item,@window_equipped.index,@window_panels.item)
  1061.     @window_itempanel.clear_panels
  1062.     item = @window_panels.item
  1063.     $game_system.se_play($data_system.equip_se)
  1064.     if item.is_a?(RPG::Item)
  1065.       a = @actor.level
  1066.       $game_party.lose_item(COTTONJJ::LEVELUPTRIPLER,1)
  1067.     end
  1068.     if @window_panels.index == -1
  1069.       @window_panels.index = 0
  1070.     end
  1071.     if @window_panels.index > @window_panels.data.size
  1072.       @window_panels.index = @window_panels.data.size
  1073.     end
  1074.     @window_panels.refresh(@window_category.index)
  1075.     @window_panels.index -= 1 if @window_panels.item == nil
  1076.     @window_panels.active = true
  1077.     @window_equipped.active = false
  1078.     @window_itempanel.active = false
  1079.   end
  1080.   def can_be_placed?(item, index, link = false)
  1081.     size = []
  1082.     #if not item[2].include?(@actor.id)
  1083.       #if not item[2].include?(index)
  1084.         #size.push(index)
  1085.         #Determine string settings
  1086.         for k in 0...item[0].size
  1087.           string = item[0][k]
  1088.           for i in 0...string.size
  1089.             string += string.slice(0,1)
  1090.             case string.slice!(0,1)
  1091.             when "x"
  1092.             else
  1093.               size.push(index + i + (k*9))
  1094.             end
  1095.           end
  1096.         end
  1097.         if size.size > 1
  1098.           for i in 0...size.size
  1099.             if size[i] > 108
  1100.               return false
  1101.             end
  1102.             for k in 0...size.size
  1103.               if (size[i] % 9) == 8
  1104.                 if (size[k] % 9) == 0
  1105.                   return false
  1106.                 end
  1107.               end
  1108.             end
  1109.           end
  1110.         end
  1111.         equip = 0 if link == false
  1112.         if link != false
  1113.           equip = 0 if link == "Weapon"
  1114.           equip = 1 if link == "Shield"
  1115.           equip = 2 if link == "Head"
  1116.           equip = 3 if link == "Body"
  1117.           equip = 4 if link == "Accessory"
  1118.         end
  1119.         @size = size
  1120.         @link = link
  1121.         @plink = item
  1122.         @glink = index
  1123.         loop do
  1124.           size = @size
  1125.           link = @link
  1126.           Graphics.update
  1127.           Input.update
  1128.           if @window_equipped.item.is_a?(Array)
  1129.             item = run_equip(equip,@window_equipped.item[1])
  1130.             if @window_equipped.item[0] == "Link"
  1131.               if @plink[4] == "LevelUp"
  1132.                 if @window_equipped.item[2] == "Level"
  1133.                   return [true,@plink[4]]
  1134.                 end
  1135.               end
  1136.               if @link != false
  1137.                 if @window_equipped.item[2] == nil
  1138.                   if get_item3(item).is_a?(RPG::Weapon)
  1139.                     if $weapon_abilities[@window_equipped.item[1]] != nil
  1140.                       case @window_itempanel.item[5]
  1141.                       when "Ability"
  1142.                         if @actor.weapon.weapon_accessories == nil
  1143.                           @actor.weapon.weapon_accessories = []
  1144.                         end
  1145.                         a = @actor.weapon.weapon_accessories.dup
  1146.                         v = @actor.weapon.weapon_accessories.size
  1147.                         o = 0
  1148.                         for i in 0...v
  1149.                           if a[i].id == COTTONJJ::ABILITYVAR
  1150.                             o += 1
  1151.                           end
  1152.                         end
  1153.                         if $weapon_abilities[@window_equipped.item[1]][o] != nil
  1154.                           return true
  1155.                         else
  1156.                         end
  1157.                       else
  1158.                         return true
  1159.                       end
  1160.                     else
  1161.                       case @window_itempanel.item[5]
  1162.                       when "Ability"
  1163.                         @window_panels.update_help("No More Available Abilities")
  1164.                         @wait = 25
  1165.                         return false
  1166.                       else
  1167.                         return true
  1168.                       end
  1169.                     end
  1170.                   elsif get_item3(item).is_a?(RPG::Armor)
  1171.                     if $armor_abilities[@window_equipped.item[1]] != nil
  1172.                       case @window_itempanel.item[5]
  1173.                       when "Ability"
  1174.                         kind = get_item3(item).kind
  1175.                         @var_kind = kind
  1176.                         #print(kind)
  1177.                         if @actor.armors[kind].armor_accessories == nil
  1178.                           @actor.armors[kind].armor_accessories = []
  1179.                         end
  1180.                         a = @actor.armors[kind].armor_accessories.dup
  1181.                         v = @actor.armors[kind].armor_accessories.size
  1182.                         o = 0
  1183.                         for i in 0...v
  1184.                           if a[i].id == COTTONJJ::ABILITYVAR
  1185.                             o += 1
  1186.                           end
  1187.                         end
  1188.                         if $armor_abilities[@window_equipped.item[1]][o] != nil
  1189.                           return true
  1190.                         else
  1191.                         end
  1192.                       else
  1193.                         return true
  1194.                       end
  1195.                     else
  1196.                       case @window_itempanel.item[5]
  1197.                       when "Ability"
  1198.                         @window_panels.update_help("No More Available Abilities")
  1199.                         @wait = 25
  1200.                         return false
  1201.                       else
  1202.                         return true
  1203.                       end
  1204.                     end
  1205.                   end
  1206.                   @window_panels.update_help("No More Available Abilities")
  1207.                   @wait = 25
  1208.                   return false
  1209.                 end
  1210.               end
  1211.             else
  1212.               if @link != false
  1213.                 return false
  1214.               end
  1215.             end
  1216.           else
  1217.             if @link != false
  1218.               return false
  1219.             end
  1220.           end
  1221.           if @window_equipped.item.is_a?(RPG::Item)
  1222.             if get_itemequipped(@window_equipped.index) != nil
  1223.               return false
  1224.             end
  1225.           end
  1226.           equip = 0 if equip == nil
  1227.           item = run_equip(equip,@window_equipped.item.id)
  1228.           for k in 0...108
  1229.             size2 = []
  1230.             item = get_itemequipped(k)
  1231.             #item = @window_itempanel.item if item == false
  1232.             #item = [["oxxx","xxxx","xxxx","xxxx"],"x",["x","x",["x",k]]] if item == false
  1233.             if item != false
  1234.               #if item[2]
  1235.               for i in 0...item[2].size
  1236.                 if item[2][i][0] == @actor.id
  1237.                   index = item[2][i][1]
  1238.                 end
  1239.               end
  1240.               for k in 0...item[0].size
  1241.                 string = item[0][k]
  1242.                 for i in 0...string.size
  1243.                   string += string.slice(0,1)
  1244.                   case string.slice!(0,1)
  1245.                   when "x"
  1246.                   else
  1247.                     size2.push(index + i+(k*9))
  1248.                   end
  1249.                 end
  1250.               end
  1251.               pr = 108
  1252.               for i in 0...108
  1253.                 if size2.include?(size[i])
  1254.                   pr -= 1
  1255.                 end
  1256.               end
  1257.               if link != false
  1258.                 if pr >= 108
  1259.                   @jj = true
  1260.                 else
  1261.                   return false
  1262.                 end
  1263.               else
  1264.                 if pr < 108
  1265.                   return false
  1266.                 else
  1267.                   #print("a")
  1268.                   @jj = true
  1269.                 end
  1270.               end
  1271.             else
  1272.               #return false
  1273.             end
  1274.           end
  1275.           break if equip >= 5
  1276.           if link == false
  1277.             equip += 1
  1278.           end
  1279.         end
  1280.         #print("a")
  1281.         return @jj if @jj != nil
  1282.         #print("c")
  1283.         return true
  1284.       #end
  1285.     #end
  1286.     return @jj if @jj != nil
  1287.     return false
  1288.   end
  1289.   def get_item(index)
  1290.     item = @window_panels.data[index]
  1291.     case item
  1292.     when RPG::Item
  1293.       pr = "Item"
  1294.     when RPG::Weapon
  1295.       pr = "Weapon"
  1296.     when RPG::Armor
  1297.       pr = "Armor"
  1298.     when RPG::Skill
  1299.       pr = "Skill"
  1300.     end
  1301.     id = item.id
  1302.     #If Weapon is in Database
  1303.     for i in 0...$item_panels.size
  1304.       if pr == $item_panels[i][1]
  1305.         if $item_panels[i][3] == item.id
  1306.           return $item_panels[i]
  1307.         end
  1308.       end
  1309.     end
  1310.     return false
  1311.   end
  1312.   def get_itemequipped(index)
  1313.     item = @window_equipped.data[index]
  1314.     case item
  1315.     when RPG::Item
  1316.       pr = "Item"
  1317.     when RPG::Weapon
  1318.       pr = "Weapon"
  1319.     when RPG::Armor
  1320.       pr = "Armor"
  1321.     when RPG::Skill
  1322.       pr = "Skill"
  1323.     end
  1324.     id = item.id
  1325.     #If Weapon is in Database
  1326.     for i in 0...$item_panels.size
  1327.       if pr == $item_panels[i][1]
  1328.         if $item_panels[i][3] == item.id
  1329.           return $item_panels[i]
  1330.         end
  1331.       end
  1332.     end
  1333.     if @window_equipped.data[index].is_a?(Array)
  1334.       #[2][2][1]
  1335.       return [["oxxx","xxxx","xxxx","xxxx"],"x",["x","x",["x",index]]]
  1336.     end
  1337.     return false
  1338.   end
  1339.   def get_item2(item)
  1340.     case item
  1341.     when RPG::Item
  1342.       pr = "Item"
  1343.     when RPG::Weapon
  1344.       pr = "Weapon"
  1345.     when RPG::Armor
  1346.       pr = "Armor"
  1347.     when RPG::Skill
  1348.       pr = "Skill"
  1349.     end
  1350.     id = item.id
  1351.     #If Weapon is in Database
  1352.     for i in 0...$item_panels.size
  1353.       if pr == $item_panels[i][1]
  1354.         if $item_panels[i][3] == item.id
  1355.           return $item_panels[i]
  1356.         end
  1357.       end
  1358.     end
  1359.     return false
  1360.   end
  1361.   def get_item3(item)
  1362.     case item[1]
  1363.     when "Item"
  1364.       return $data_items[item[3]]
  1365.     when "Weapon"
  1366.       return $data_weapons[item[3]]
  1367.     when "Armor"
  1368.       return $data_armors[item[3]]
  1369.     when "Skill"
  1370.       return $data_skills[item[3]]
  1371.     end
  1372.     return false
  1373.   end
  1374. end
  1375. class Window_Base < Window
  1376.   def black_color
  1377.     return Color.new(0, 0, 0)
  1378.   end
  1379.   def activepanel_color
  1380.     return Color.new(200, 200, 200)
  1381.   end
  1382.   def activelink_color
  1383.     return Color.new(100, 200, 100)
  1384.   end
  1385.   def linkpanel_color
  1386.     return Color.new(50, 100, 50)
  1387.   end
  1388. end
  1389. #==============================================================================
  1390. # ** Window_Panels
  1391. #------------------------------------------------------------------------------
  1392. #  This window displays items in possession on the item and battle screens.
  1393. #==============================================================================
  1394.  
  1395. class Window_Panels < Window_Base
  1396.   attr_accessor :data
  1397.   attr_reader   :index                    # cursor position
  1398.   attr_reader   :help_window              # help window
  1399.   #--------------------------------------------------------------------------
  1400.   # * Object Initialization
  1401.   #--------------------------------------------------------------------------
  1402.   def initialize(actor)
  1403.     super(320, 64 + 64, 320, (416) - 64)
  1404.     @actor = actor
  1405.     @column_max = 1
  1406.     @item_max = 99999
  1407.     @column_max = 1
  1408.     #@index = -1
  1409.     @data = []
  1410.     refresh
  1411.     @index = 0
  1412.     # If in battle, move window to center of screen
  1413.     # and make it semi-transparent
  1414.     if $game_temp.in_battle
  1415.       self.y = 64
  1416.       self.height = 256
  1417.       self.back_opacity = 160
  1418.     end
  1419.   end
  1420.   #--------------------------------------------------------------------------
  1421.   # * Get Item
  1422.   #--------------------------------------------------------------------------
  1423.   def item
  1424.     return @data[@index]
  1425.   end
  1426.   #--------------------------------------------------------------------------
  1427.   # * Refresh
  1428.   #--------------------------------------------------------------------------
  1429.   def refresh(k=0)
  1430.     if self.contents != nil
  1431.       self.contents.dispose
  1432.       self.contents = nil
  1433.     end
  1434.     @data = []
  1435.     # Add item
  1436.     # Add equippable weapons
  1437.     #for i in [email hidden]
  1438.     #  skill = $data_skills[@actor.skills[i]]
  1439.     #  if skill != nil
  1440.     #    @data.push(skill)
  1441.     #  end
  1442.     #end
  1443.     #s1 = "All"
  1444.     #s2 = "Weapons"
  1445.     #s3 = "Armors"
  1446.     #s4 = "Assist"
  1447.     #s5 = "Items"
  1448.     #@commands = [s1,s2,s3,s4,s5]
  1449.     if k == 0 or k == 4 or k == 3
  1450.       for i in 1...$data_items.size
  1451.         if $game_party.item_number(i) > 0
  1452.           if k == 3
  1453.             if COTTONJJ::ASSISTITEMS.include?(i)
  1454.               @data.push($data_items[i])
  1455.             end
  1456.           elsif k == 4
  1457.             if COTTONJJ::ASSISTITEMS.include?(i)
  1458.             else
  1459.               @data.push($data_items[i])
  1460.             end
  1461.           else
  1462.             @data.push($data_items[i])
  1463.           end
  1464.         end
  1465.       end
  1466.     end
  1467.     # Also add weapons and items if outside of battle
  1468.     unless $game_temp.in_battle
  1469.       if k == 0 or k == 1
  1470.         for i in 1...$data_weapons.size
  1471.           if $game_party.weapon_number(i) > 0
  1472.             if @actor.equippable?($data_weapons[i])
  1473.               @data.push($data_weapons[i])
  1474.             end
  1475.           end
  1476.         end
  1477.       end
  1478.       if k == 0 or k == 2 or k == 3
  1479.         for i in 1...$data_armors.size
  1480.           if $game_party.armor_number(i) > 0
  1481.             if @actor.equippable?($data_armors[i])
  1482.               if k == 3
  1483.                 if COTTONJJ::ASSISTARMORS.include?(i)
  1484.                   @data.push($data_armors[i])
  1485.                 end
  1486.               elsif  k == 2
  1487.                 if COTTONJJ::ASSISTARMORS.include?(i)
  1488.                 else
  1489.                   @data.push($data_armors[i])
  1490.                 end
  1491.               else
  1492.                 @data.push($data_armors[i])
  1493.               end
  1494.             end
  1495.           end
  1496.         end
  1497.       end
  1498.     end
  1499.     @data = @data.compact
  1500.     # If item count is not 0, make a bit map and draw all items
  1501.     @item_max = @data.size
  1502.     if @item_max > 0
  1503.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1504.       for i in 0...@item_max
  1505.         draw_item(i)
  1506.       end
  1507.     end
  1508.   end
  1509.   #--------------------------------------------------------------------------
  1510.   # * Draw Item
  1511.   #     index : item number
  1512.   #--------------------------------------------------------------------------
  1513.   def draw_item(index)
  1514.     item = @data[index]
  1515.     case item
  1516.     when RPG::Item
  1517.       number = $game_party.item_number(item.id)
  1518.     when RPG::Weapon
  1519.       number = $game_party.weapon_number(item.id)
  1520.     when RPG::Armor
  1521.       number = $game_party.armor_number(item.id)
  1522.     end
  1523.     if item.is_a?(RPG::Item) and
  1524.        $game_party.item_can_use?(item.id)
  1525.       self.contents.font.color = normal_color
  1526.     elsif @actor.skill_can_use?(item.id)
  1527.       self.contents.font.color = normal_color
  1528.     elsif @actor.equippable?(item)
  1529.       self.contents.font.color = normal_color
  1530.     else
  1531.       self.contents.font.color = disabled_color
  1532.     end
  1533.     x = index % @column_max * (320 + 32)
  1534.     y = index / @column_max * 32# - self.oy
  1535.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1536.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1537.     bitmap = RPG::Cache.icon(item.icon_name)
  1538.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1539.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1540.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1541.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  1542.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  1543.   end
  1544.   #--------------------------------------------------------------------------
  1545.   # * Help Text Update
  1546.   #--------------------------------------------------------------------------
  1547.   def update_help(text = nil)
  1548.     if text != nil
  1549.       @help_window.set_text(text)
  1550.     else
  1551.       @help_window.set_text(self.item == nil ? "" : self.item.description)
  1552.     end
  1553.   end
  1554.   def update
  1555.     super
  1556.     # If cursor is movable
  1557.     if self.active and @item_max > 0 and @index >= 0
  1558.       # If pressing down on the directional buttons
  1559.       if Input.repeat?(Input::DOWN)
  1560.         # If column count is 1 and directional button was pressed down with no
  1561.         # repeat, or if cursor position is more to the front than
  1562.         # (item count - column count)
  1563.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  1564.            @index < @item_max - @column_max
  1565.           # Move cursor down
  1566.           $game_system.se_play($data_system.cursor_se)
  1567.           @index = (@index + @column_max) % @item_max
  1568.         end
  1569.       end
  1570.       # If the up directional button was pressed
  1571.       if Input.repeat?(Input::UP)
  1572.         # If column count is 1 and directional button was pressed up with no
  1573.         # repeat, or if cursor position is more to the back than column count
  1574.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  1575.            @index >= @column_max
  1576.           # Move cursor up
  1577.           $game_system.se_play($data_system.cursor_se)
  1578.           if (@index - 1) == -1
  1579.             $scene.update_to_category
  1580.             @index = 0
  1581.             return
  1582.           end
  1583.           @index = (@index - @column_max + @item_max) % @item_max
  1584.         end
  1585.       end
  1586.       # If the right directional button was pressed
  1587.       if Input.repeat?(Input::RIGHT)
  1588.         # If column count is 2 or more, and cursor position is closer to front
  1589.         # than (item count -1)
  1590.         if @column_max >= 2 and @index < @item_max - 1
  1591.           # Move cursor right
  1592.           $game_system.se_play($data_system.cursor_se)
  1593.           @index += 1
  1594.         end
  1595.       end
  1596.       # If the left directional button was pressed
  1597.       if Input.repeat?(Input::LEFT)
  1598.         # If column count is 2 or more, and cursor position is more back than 0
  1599.         if @column_max >= 2 and @index > 0
  1600.           # Move cursor left
  1601.           $game_system.se_play($data_system.cursor_se)
  1602.           @index -= 1
  1603.         end
  1604.       end
  1605.       # If R button was pressed
  1606.       if Input.repeat?(Input::R)
  1607.         # If bottom row being displayed is more to front than bottom data row
  1608.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  1609.           # Move cursor 1 page back
  1610.           $game_system.se_play($data_system.cursor_se)
  1611.           @index = [@index + self.page_item_max, @item_max - 1].min
  1612.           self.top_row += self.page_row_max
  1613.         end
  1614.       end
  1615.       # If L button was pressed
  1616.       if Input.repeat?(Input::L)
  1617.         # If top row being displayed is more to back than 0
  1618.         if self.top_row > 0
  1619.           # Move cursor 1 page forward
  1620.           $game_system.se_play($data_system.cursor_se)
  1621.           @index = [@index - self.page_item_max, 0].max
  1622.           self.top_row -= self.page_row_max
  1623.         end
  1624.       end
  1625.     end
  1626.     # Update help text (update_help is defined by the subclasses)
  1627.     if self.active and @help_window != nil
  1628.       update_help
  1629.     end
  1630.     # Update cursor rectangle
  1631.     update_cursor_rect
  1632.   end
  1633.   #--------------------------------------------------------------------------
  1634.   # * Set Cursor Position
  1635.   #     index : new cursor position
  1636.   #--------------------------------------------------------------------------
  1637.   def index=(index)
  1638.     @index = index
  1639.     # Update Help Text (update_help is defined by the subclasses)
  1640.     if self.active and @help_window != nil
  1641.       update_help
  1642.     end
  1643.     # Update cursor rectangle
  1644.     update_cursor_rect
  1645.   end
  1646.   #--------------------------------------------------------------------------
  1647.   # * Get Row Count
  1648.   #--------------------------------------------------------------------------
  1649.   def row_max
  1650.     # Compute rows from number of items and columns
  1651.     return (@item_max + @column_max - 1) / @column_max
  1652.   end
  1653.   #--------------------------------------------------------------------------
  1654.   # * Get Top Row
  1655.   #--------------------------------------------------------------------------
  1656.   def top_row
  1657.     # Divide y-coordinate of window contents transfer origin by 1 row
  1658.     # height of 32
  1659.     return self.oy / 32
  1660.   end
  1661.   #--------------------------------------------------------------------------
  1662.   # * Set Top Row
  1663.   #     row : row shown on top
  1664.   #--------------------------------------------------------------------------
  1665.   def top_row=(row)
  1666.     # If row is less than 0, change it to 0
  1667.     if row < 0
  1668.       row = 0
  1669.     end
  1670.     # If row exceeds row_max - 1, change it to row_max - 1
  1671.     if row > row_max - 1
  1672.       row = row_max - 1
  1673.     end
  1674.     # Multiply 1 row height by 32 for y-coordinate of window contents
  1675.     # transfer origin
  1676.     self.oy = row * 32
  1677.   end
  1678.   #--------------------------------------------------------------------------
  1679.   # * Get Number of Rows Displayable on 1 Page
  1680.   #--------------------------------------------------------------------------
  1681.   def page_row_max
  1682.     # Subtract a frame height of 32 from the window height, and divide it by
  1683.     # 1 row height of 32
  1684.     return (self.height - 32) / 32
  1685.   end
  1686.   #--------------------------------------------------------------------------
  1687.   # * Get Number of Items Displayable on 1 Page
  1688.   #--------------------------------------------------------------------------
  1689.   def page_item_max
  1690.     # Multiply row count (page_row_max) times column count (@column_max)
  1691.     return page_row_max * @column_max
  1692.   end
  1693.   #--------------------------------------------------------------------------
  1694.   # * Set Help Window
  1695.   #     help_window : new help window
  1696.   #--------------------------------------------------------------------------
  1697.   def help_window=(help_window)
  1698.     @help_window = help_window
  1699.     # Update help text (update_help is defined by the subclasses)
  1700.     if self.active and @help_window != nil
  1701.       update_help
  1702.     end
  1703.   end
  1704.   #--------------------------------------------------------------------------
  1705.   # * Update Cursor Rectangle
  1706.   #--------------------------------------------------------------------------
  1707.   def update_cursor_rect
  1708.     # If cursor position is less than 0
  1709.     if @index < 0
  1710.       self.cursor_rect.empty
  1711.       return
  1712.     end
  1713.     # Get current row
  1714.     row = @index / @column_max
  1715.     # If current row is before top row
  1716.     if row < self.top_row
  1717.       # Scroll so that current row becomes top row
  1718.       self.top_row = row
  1719.     end
  1720.     # If current row is more to back than back row
  1721.     if row > self.top_row + (self.page_row_max - 1)
  1722.       # Scroll so that current row becomes back row
  1723.       self.top_row = row - (self.page_row_max - 1)
  1724.     end
  1725.     # Calculate cursor width
  1726.     cursor_width = self.width / @column_max - 32
  1727.     # Calculate cursor coordinates
  1728.     x = @index % @column_max * (cursor_width + 32)
  1729.     y = @index / @column_max * 32 - self.oy
  1730.     # Update cursor rectangle
  1731.     self.cursor_rect.set(x, y, cursor_width, 32)
  1732.   end
  1733. end
  1734. #==============================================================================
  1735. # ** Window_Panels
  1736. #------------------------------------------------------------------------------
  1737. #  This window displays items in possession on the item and battle screens.
  1738. #==============================================================================
  1739.  
  1740. class Window_Equipped < Window_Base
  1741.   attr_accessor :data
  1742.   attr_reader   :index                    # cursor position
  1743.   attr_reader   :help_window              # help window
  1744.   #--------------------------------------------------------------------------
  1745.   # * Object Initialization
  1746.   #--------------------------------------------------------------------------
  1747.   def initialize(actor)
  1748.     super(0, 64, 320, 416)
  1749.     @item_max = 99999
  1750.     @actor = actor
  1751.     @column_max = 9
  1752.     @data = []
  1753.     @data2 = []
  1754.     @data3 = []
  1755.     refresh
  1756.     @index = 0
  1757.     # If in battle, move window to center of screen
  1758.     # and make it semi-transparent
  1759.     if $game_temp.in_battle
  1760.       self.y = 64
  1761.       self.height = 256
  1762.       self.back_opacity = 160
  1763.     end
  1764.   end
  1765.   #--------------------------------------------------------------------------
  1766.   # * Set Cursor Position
  1767.   #     index : new cursor position
  1768.   #--------------------------------------------------------------------------
  1769.   def index=(index)
  1770.     @index = index
  1771.     # Update Help Text (update_help is defined by the subclasses)
  1772.     if self.active and @help_window != nil
  1773.       update_help
  1774.     end
  1775.     # Update cursor rectangle
  1776.     update_cursor_rect
  1777.   end
  1778.   #--------------------------------------------------------------------------
  1779.   # * Get Row Count
  1780.   #--------------------------------------------------------------------------
  1781.   def row_max
  1782.     # Compute rows from number of items and columns
  1783.     return (@item_max + @column_max - 1) / @column_max
  1784.   end
  1785.   #--------------------------------------------------------------------------
  1786.   # * Get Top Row
  1787.   #--------------------------------------------------------------------------
  1788.   def top_row
  1789.     # Divide y-coordinate of window contents transfer origin by 1 row
  1790.     # height of 32
  1791.     return self.oy / 32
  1792.   end
  1793.   #--------------------------------------------------------------------------
  1794.   # * Set Top Row
  1795.   #     row : row shown on top
  1796.   #--------------------------------------------------------------------------
  1797.   def top_row=(row)
  1798.     # If row is less than 0, change it to 0
  1799.     if row < 0
  1800.       row = 0
  1801.     end
  1802.     # If row exceeds row_max - 1, change it to row_max - 1
  1803.     if row > row_max - 1
  1804.       row = row_max - 1
  1805.     end
  1806.     # Multiply 1 row height by 32 for y-coordinate of window contents
  1807.     # transfer origin
  1808.     self.oy = row * 32
  1809.   end
  1810.   #--------------------------------------------------------------------------
  1811.   # * Get Number of Rows Displayable on 1 Page
  1812.   #--------------------------------------------------------------------------
  1813.   def page_row_max
  1814.     # Subtract a frame height of 32 from the window height, and divide it by
  1815.     # 1 row height of 32
  1816.     return (self.height - 32) / 32
  1817.   end
  1818.   #--------------------------------------------------------------------------
  1819.   # * Get Number of Items Displayable on 1 Page
  1820.   #--------------------------------------------------------------------------
  1821.   def page_item_max
  1822.     # Multiply row count (page_row_max) times column count (@column_max)
  1823.     return page_row_max * @column_max
  1824.   end
  1825.   #--------------------------------------------------------------------------
  1826.   # * Set Help Window
  1827.   #     help_window : new help window
  1828.   #--------------------------------------------------------------------------
  1829.   def help_window=(help_window)
  1830.     @help_window = help_window
  1831.     # Update help text (update_help is defined by the subclasses)
  1832.     if self.active and @help_window != nil
  1833.       update_help
  1834.     end
  1835.   end
  1836.   #--------------------------------------------------------------------------
  1837.   # * Get Item
  1838.   #--------------------------------------------------------------------------
  1839.   def item
  1840.     return @data[@index]
  1841.   end
  1842.   #--------------------------------------------------------------------------
  1843.   # * Refresh
  1844.   #--------------------------------------------------------------------------
  1845.   def refresh
  1846.     if self.contents != nil
  1847.       self.contents.dispose
  1848.       self.contents = nil
  1849.     end
  1850.     # Add item
  1851.     # If item count is not 0, make a bit map and draw all items
  1852.     @item_max = 108
  1853.     @data = []
  1854.     if @item_max > 0
  1855.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1856.       for i in 0...@item_max
  1857.         draw_item(i)
  1858.       end
  1859.     end
  1860.   end
  1861.   #--------------------------------------------------------------------------
  1862.   # * Draw Item
  1863.   #     index : item number
  1864.   #--------------------------------------------------------------------------
  1865.   def draw_item(index)
  1866.     @data[index] = []
  1867.     x = index % @column_max * 32
  1868.     y = index / @column_max * 32 - self.oy
  1869.     rect = Rect.new(x + 2, y + 2, 28, 28)
  1870.     self.contents.fill_rect(rect, Color.new(0, 0, 0))
  1871.   end
  1872.   def clear_panel(item,index,item2)
  1873.     panels = item[0].dup
  1874.     @string = []
  1875.     item2 = item2
  1876.     #if index != nil
  1877.       for i in 0...item[2].size
  1878.         if item[2][i][0] == @actor.id
  1879.           if item[2][i][1] != index
  1880.             if panels[0].slice(0,1) != "o"
  1881.               index = item[2][i][1]
  1882.               #print(item[2][i][1])
  1883.             end
  1884.           end
  1885.         end
  1886.       end
  1887.     #else
  1888.       #index = @window_equipped.index
  1889.     #end
  1890.     for k in 0...item[0].size
  1891.       @string[k] = panels[k]
  1892.       for i in 0...@string[k].size
  1893.         @string[k] += @string[k].slice(0,1)
  1894.         case @string[k].slice!(0,1)
  1895.         when "x"
  1896.         else
  1897.           x = (index + i + (k * 9)) % @column_max * 32
  1898.           y = (index + i + (k * 9)) / @column_max * 32 - self.oy
  1899.           rect = Rect.new(x + 2, y + 2, 28, 28)
  1900.           color = black_color
  1901.           g = index + i + (k * 9)
  1902.           if @data[g] != nil
  1903.             #if @data[g].is_a?(Array)
  1904.             if $scene.get_item2(item2)[4] == "WeaponLink" or
  1905.                 $scene.get_item2(item2)[4] == "LevelUp"
  1906.               bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
  1907.               color = linkpanel_color
  1908.             end
  1909.           end
  1910.           self.contents.fill_rect(rect, color)
  1911.           if bitmap != nil
  1912.             opacity = self.contents.font.color == normal_color ? 255 : 128
  1913.             self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1914.             @data2[index + i + 27] = true# if new_color == true
  1915.             if $scene.window == true
  1916.               m = $scene.window_panels.item
  1917.             else
  1918.               m = $scene.get_item3($scene.window_itempanel.item)
  1919.             end
  1920.             m = @data3[g]
  1921.             print(@data3[g])
  1922.             @data[g] = ["Link",m.id,nil,nil,nil,nil,m]
  1923.             if item[5] == "Level"
  1924.               @data[g] = ["Link",m.id,"Level",item[4]]
  1925.             end
  1926.           else
  1927.             @data[g] = nil
  1928.           end
  1929.         end
  1930.       end
  1931.     end
  1932.   end
  1933.   def set_panel(item,index,item2,new_color = false,m = nil)
  1934.     panels = item[0]
  1935.     item2 = item2
  1936.     @string = []
  1937.     for k in 0...item[0].size
  1938.       @string[k] = panels[k]
  1939.       for i in 0...@string[k].size
  1940.         @string[k] += @string[k].slice(0,1)
  1941.         case @string[k].slice!(0,1)
  1942.         when "o"
  1943.           x = (index + i+(k * 9)) % @column_max * 32
  1944.           y = (index + i+(k * 9)) / @column_max * 32 - self.oy
  1945.           rect = Rect.new(x + 2, y + 2, 28, 28)
  1946.           color = activepanel_color
  1947.           color = activelink_color if new_color == true
  1948.           self.contents.fill_rect(rect, color)
  1949.           bitmap = RPG::Cache.icon(item2.icon_name)
  1950.           opacity = self.contents.font.color == normal_color ? 255 : 128
  1951.           self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1952.           @data2[index + i+(k * 9)] = true if new_color == true
  1953.           @data[index + i+(k * 9)] = $scene.window_panels.item
  1954.           @data3[index + i+(k * 9)] = m
  1955.         when "l"
  1956.           x = (index + i+(k * 9)) % @column_max * 32
  1957.           y = (index + i+(k * 9)) / @column_max * 32 - self.oy
  1958.           rect = Rect.new(x + 2, y + 2, 28, 28)
  1959.           self.contents.fill_rect(rect, linkpanel_color)
  1960.           bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
  1961.           opacity = self.contents.font.color == normal_color ? 255 : 128
  1962.           self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1963.           if $scene.window == true
  1964.             m = $scene.window_panels.item
  1965.           else
  1966.             m = $scene.get_item3($scene.window_itempanel.item)
  1967.           end
  1968.           @data2[index + i+(k * 9)] = true if new_color == true
  1969.           @data[index + i+(k * 9)] = ["Link",$scene.window_panels.item.id,nil,nil,nil,nil,m]
  1970.           if item[5] == "Level"
  1971.             @data[index + i+(k * 9)] = ["Link",$scene.window_panels.item.id,"Level",item[4]]
  1972.           end
  1973.         when "x"
  1974.         end
  1975.       end
  1976.     end
  1977.   end
  1978.   def draw_oldpanels
  1979.     @data = $panels[@actor.id]
  1980.     @data2 = $panels2[@actor.id]
  1981.     for i in 0...@item_max
  1982.       o = $panels[@actor.id][i]
  1983.         if o != nil
  1984.         if o.is_a?(Array)
  1985.           if o[0] == "Link"
  1986.             draw_panelicon(i - (9*3),true,"Level")
  1987.           end
  1988.         else
  1989.           if o.is_a?(RPG::Item) or o.is_a?(RPG::Weapon) or o.is_a?(RPG::Armor)
  1990.             if @actor.weapon != nil
  1991.               if @actor.weapon.weapon_accessories != nil
  1992.                 if @actor.weapon.weapon_accessories.include?(o)
  1993.                   draw_panelicon(i-(9*3),false,o,true)
  1994.                 else
  1995.                   if $panels2[@actor.id][i]
  1996.                     draw_panelicon(i-(9*3),false,o,true)
  1997.                   else
  1998.                     draw_panelicon(i-(9*3),false,o)
  1999.                   end
  2000.                 end
  2001.               else
  2002.                 draw_panelicon(i-(9*3),false,o)
  2003.               end
  2004.             else
  2005.               draw_panelicon(i-(9*3),false,o)
  2006.             end
  2007.           end
  2008.         end
  2009.       end
  2010.     end
  2011.   end
  2012.   def level_on_levelink(o,index)
  2013.     for i in 0...@item_max
  2014.       if $panels[@actor.id][i].is_a?(RPG::Item)
  2015.         if $panels[@actor.id][i].id == 2
  2016.           if $panels2[@actor.id][i] == true
  2017.             return true
  2018.           end
  2019.         end
  2020.       end
  2021.     end
  2022.   end
  2023.   def draw_panelicon(index,link = false,item = nil,new_color = false)
  2024.     if link == true
  2025.       x = (index) % @column_max * 32
  2026.       y = ((index) / @column_max * 32 - self.oy) + 96
  2027.       rect = Rect.new(x + 2, y + 2, 28, 28)
  2028.       self.contents.fill_rect(rect, linkpanel_color)
  2029.       bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
  2030.       opacity = self.contents.font.color == normal_color ? 255 : 128
  2031.       self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2032.       return
  2033.     end
  2034.     x = (index) % @column_max * 32
  2035.     y = ((index) / @column_max * 32 - self.oy) + 96
  2036.     rect = Rect.new(x + 2, y + 2, 28, 28)
  2037.     color = activepanel_color
  2038.     color = activelink_color if new_color == true
  2039.     self.contents.fill_rect(rect, color)
  2040.     bitmap = RPG::Cache.icon(item.icon_name)
  2041.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2042.     self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2043.   end
  2044.   def save_panels
  2045.     $panels[@actor.id] = @data
  2046.     $panels2[@actor.id] = @data2
  2047.     $panels3[@actor.id] = @data3
  2048.   end
  2049.   #--------------------------------------------------------------------------
  2050.   # * Help Text Update
  2051.   #--------------------------------------------------------------------------
  2052.   def update_help
  2053.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2054.   end
  2055.   def update_cursor_rect
  2056.     # If cursor position is less than 0
  2057.     if @index < 0
  2058.       self.cursor_rect.empty
  2059.       return
  2060.     end
  2061.     # Get current row
  2062.     row = @index / @column_max
  2063.     # If current row is before top row
  2064.     if row < self.top_row
  2065.       # Scroll so that current row becomes top row
  2066.       self.top_row = row
  2067.     end
  2068.     # If current row is more to back than back row
  2069.     if row > self.top_row + (self.page_row_max - 1)
  2070.       # Scroll so that current row becomes back row
  2071.       self.top_row = row - (self.page_row_max - 1)
  2072.     end
  2073.     # Calculate cursor width
  2074.     cursor_width = 32
  2075.     # Calculate cursor coordinates
  2076.     x = @index % @column_max * (cursor_width)
  2077.     y = @index / @column_max * 32 - self.oy
  2078.     # Update cursor rectangle
  2079.     self.cursor_rect.set(x, y, cursor_width, 32)
  2080.   end
  2081.   def update
  2082.     super
  2083.     # If cursor is movable
  2084.     if self.active and @item_max > 0 and @index >= 0
  2085.       # If pressing down on the directional buttons
  2086.       if Input.repeat?(Input::DOWN)
  2087.         # If column count is 1 and directional button was pressed down with no
  2088.         # repeat, or if cursor position is more to the front than
  2089.         # (item count - column count)
  2090.         if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
  2091.            @index < @item_max - @column_max
  2092.           # Move cursor down
  2093.           $game_system.se_play($data_system.cursor_se)
  2094.           @index = (@index + @column_max) % @item_max
  2095.         end
  2096.       end
  2097.       # If the up directional button was pressed
  2098.       if Input.repeat?(Input::UP)
  2099.         # If column count is 1 and directional button was pressed up with no
  2100.         # repeat, or if cursor position is more to the back than column count
  2101.         if (@column_max == 1 and Input.trigger?(Input::UP)) or
  2102.            @index >= @column_max
  2103.           # Move cursor up
  2104.           $game_system.se_play($data_system.cursor_se)
  2105.           @index = (@index - @column_max + @item_max) % @item_max
  2106.         end
  2107.       end
  2108.       # If the right directional button was pressed
  2109.       if Input.repeat?(Input::RIGHT)
  2110.         # If column count is 2 or more, and cursor position is closer to front
  2111.         # than (item count -1)
  2112.         if @column_max >= 2 and @index < @item_max - 1
  2113.           # Move cursor right
  2114.           $game_system.se_play($data_system.cursor_se)
  2115.           o = @index % 9
  2116.           if (o) == 8
  2117.             $scene.update_return_right(@index)
  2118.             #@index = @index - 8
  2119.             return
  2120.           end
  2121.           @index += 1
  2122.         else
  2123.           #@index = @index - 8
  2124.           $scene.update_return_right(@index)
  2125.           return
  2126.         end
  2127.       end
  2128.       # If the left directional button was pressed
  2129.       if Input.repeat?(Input::LEFT)
  2130.         # If column count is 2 or more, and cursor position is more back than 0
  2131.         if @column_max >= 2 and @index > 0
  2132.           # Move cursor left
  2133.           $game_system.se_play($data_system.cursor_se)
  2134.           o = @index % 9
  2135.           if (o) == 0
  2136.             #@index = @index + 8
  2137.             return
  2138.           end
  2139.           @index -= 1
  2140.         end
  2141.       end
  2142.       # If R button was pressed
  2143.       if Input.repeat?(Input::R)
  2144.         # If bottom row being displayed is more to front than bottom data row
  2145.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  2146.           # Move cursor 1 page back
  2147.           $game_system.se_play($data_system.cursor_se)
  2148.           @index = [@index + self.page_item_max, @item_max - 1].min
  2149.           self.top_row += self.page_row_max
  2150.         end
  2151.       end
  2152.       # If L button was pressed
  2153.       if Input.repeat?(Input::L)
  2154.         # If top row being displayed is more to back than 0
  2155.         if self.top_row > 0
  2156.           # Move cursor 1 page forward
  2157.           $game_system.se_play($data_system.cursor_se)
  2158.           @index = [@index - self.page_item_max, 0].max
  2159.           self.top_row -= self.page_row_max
  2160.         end
  2161.       end
  2162.     end
  2163.     # Update help text (update_help is defined by the subclasses)
  2164.     if self.active and @help_window != nil
  2165.       update_help
  2166.     end
  2167.     # Update cursor rectangle
  2168.     update_cursor_rect
  2169.   end
  2170. end
  2171. #==============================================================================
  2172. # ** Window_PartyCommand
  2173. #------------------------------------------------------------------------------
  2174. #  This window is used to select whether to fight or escape on the battle
  2175. #  screen.
  2176. #==============================================================================
  2177.  
  2178. class Window_Category < Window_Base
  2179.   attr_reader   :index                    # cursor position
  2180.   attr_reader   :help_window              # help window
  2181.   #--------------------------------------------------------------------------
  2182.   # * Object Initialization
  2183.   #--------------------------------------------------------------------------
  2184.   def initialize
  2185.     super(320, 64, 320, 64)
  2186.     self.contents = Bitmap.new(width - 32, height - 32)
  2187.     #self.back_opacity = 160
  2188.     s1 = "All"
  2189.     s2 = "Weapons"
  2190.     s3 = "Armors"
  2191.     s4 = "Assist"
  2192.     s5 = "Items"
  2193.     @commands = [s1,s2,s3,s4,s5]
  2194.     @item_max = 5
  2195.     @column_max = 5
  2196.     @index = 0
  2197.     self.active = false
  2198.     draw_item(0, normal_color)
  2199.     draw_item(1, normal_color)
  2200.     draw_item(2, normal_color)
  2201.     draw_item(3, normal_color)
  2202.     draw_item(4, normal_color)
  2203.   end
  2204.   #--------------------------------------------------------------------------
  2205.   # * Set Cursor Position
  2206.   #     index : new cursor position
  2207.   #--------------------------------------------------------------------------
  2208.   def index=(index)
  2209.     @index = index
  2210.     # Update Help Text (update_help is defined by the subclasses)
  2211.     if self.active and @help_window != nil
  2212.       update_help
  2213.     end
  2214.     # Update cursor rectangle
  2215.     update_cursor_rect
  2216.   end
  2217.   #--------------------------------------------------------------------------
  2218.   # * Get Row Count
  2219.   #--------------------------------------------------------------------------
  2220.   def row_max
  2221.     # Compute rows from number of items and columns
  2222.     return (@item_max + @column_max - 1) / @column_max
  2223.   end
  2224.   #--------------------------------------------------------------------------
  2225.   # * Get Top Row
  2226.   #--------------------------------------------------------------------------
  2227.   def top_row
  2228.     # Divide y-coordinate of window contents transfer origin by 1 row
  2229.     # height of 32
  2230.     return self.oy / 32
  2231.   end
  2232.   #--------------------------------------------------------------------------
  2233.   # * Set Top Row
  2234.   #     row : row shown on top
  2235.   #--------------------------------------------------------------------------
  2236.   def top_row=(row)
  2237.     # If row is less than 0, change it to 0
  2238.     if row < 0
  2239.       row = 0
  2240.     end
  2241.     # If row exceeds row_max - 1, change it to row_max - 1
  2242.     if row > row_max - 1
  2243.       row = row_max - 1
  2244.     end
  2245.     # Multiply 1 row height by 32 for y-coordinate of window contents
  2246.     # transfer origin
  2247.     self.oy = row * 32
  2248.   end
  2249.   #--------------------------------------------------------------------------
  2250.   # * Get Number of Rows Displayable on 1 Page
  2251.   #--------------------------------------------------------------------------
  2252.   def page_row_max
  2253.     # Subtract a frame height of 32 from the window height, and divide it by
  2254.     # 1 row height of 32
  2255.     return (self.height - 32) / 32
  2256.   end
  2257.   #--------------------------------------------------------------------------
  2258.   # * Get Number of Items Displayable on 1 Page
  2259.   #--------------------------------------------------------------------------
  2260.   def page_item_max
  2261.     # Multiply row count (page_row_max) times column count (@column_max)
  2262.     return page_row_max * @column_max
  2263.   end
  2264.   #--------------------------------------------------------------------------
  2265.   # * Set Help Window
  2266.   #     help_window : new help window
  2267.   #--------------------------------------------------------------------------
  2268.   def help_window=(help_window)
  2269.     @help_window = help_window
  2270.     # Update help text (update_help is defined by the subclasses)
  2271.     if self.active and @help_window != nil
  2272.       update_help
  2273.     end
  2274.   end
  2275.   #--------------------------------------------------------------------------
  2276.   # * Draw Item
  2277.   #     index : item number
  2278.   #     color : text character color
  2279.   #--------------------------------------------------------------------------
  2280.   def draw_item(index, color)
  2281.     self.contents.font.color = color
  2282.     g = (320 - 32) / @item_max
  2283.     rect = Rect.new(index * g, 0, g - 5, 32)
  2284.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2285.     self.contents.draw_text(rect, @commands[index], 1)
  2286.   end
  2287.   #--------------------------------------------------------------------------
  2288.   # * Cursor Rectangle Update
  2289.   #--------------------------------------------------------------------------
  2290.   def update_cursor_rect
  2291.     g = (320 - 32) / @item_max
  2292.     self.cursor_rect.set(@index * g, 0, g - 5, 32)
  2293.   end
  2294.   def update
  2295.     super
  2296.     # If cursor is movable
  2297.     if self.active and @item_max > 0 and @index >= 0
  2298.       # If pressing down on the directional buttons
  2299.       # If the right directional button was pressed
  2300.       if Input.repeat?(Input::RIGHT)
  2301.         # If column count is 2 or more, and cursor position is closer to front
  2302.         # than (item count -1)
  2303.         if @column_max >= 2 and @index < @item_max - 1
  2304.           # Move cursor right
  2305.           $game_system.se_play($data_system.cursor_se)
  2306.           @index += 1
  2307.         end
  2308.       end
  2309.       # If the left directional button was pressed
  2310.       if Input.repeat?(Input::LEFT)
  2311.         # If column count is 2 or more, and cursor position is more back than 0
  2312.         if @column_max >= 2 and @index > 0
  2313.           # Move cursor left
  2314.           $game_system.se_play($data_system.cursor_se)
  2315.           @index -= 1
  2316.         end
  2317.       end
  2318.       # If R button was pressed
  2319.       if Input.repeat?(Input::R)
  2320.         # If bottom row being displayed is more to front than bottom data row
  2321.         if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
  2322.           # Move cursor 1 page back
  2323.           $game_system.se_play($data_system.cursor_se)
  2324.           @index = [@index + self.page_item_max, @item_max - 1].min
  2325.           self.top_row += self.page_row_max
  2326.         end
  2327.       end
  2328.       # If L button was pressed
  2329.       if Input.repeat?(Input::L)
  2330.         # If top row being displayed is more to back than 0
  2331.         if self.top_row > 0
  2332.           # Move cursor 1 page forward
  2333.           $game_system.se_play($data_system.cursor_se)
  2334.           @index = [@index - self.page_item_max, 0].max
  2335.           self.top_row -= self.page_row_max
  2336.         end
  2337.       end
  2338.     end
  2339.     # Update help text (update_help is defined by the subclasses)
  2340.     if self.active and @help_window != nil
  2341.       update_help
  2342.     end
  2343.     # Update cursor rectangle
  2344.     update_cursor_rect
  2345.   end
  2346. end
  2347. class Window_ItemPanel < Window_Base
  2348.   #--------------------------------------------------------------------------
  2349.   # * Object Initialization
  2350.   #--------------------------------------------------------------------------
  2351.   def initialize
  2352.     super(0, 64, 320, 480)
  2353.     @item = []
  2354.     @column_max = 9
  2355.     self.back_opacity = 0
  2356.     self.opacity = 0
  2357.     self.contents = Bitmap.new(width - 32, height - 32)
  2358.   end
  2359.   def refresh(index)
  2360.     self.x = (index % @column_max * 32) - 6
  2361.     self.y = ((index / @column_max * 32 - self.oy) + 64) - 6
  2362.   end
  2363.   def clear_panels
  2364.     self.contents.clear
  2365.   end
  2366.   def item
  2367.     return @item
  2368.   end
  2369.   def draw_panels(item, index, item2)
  2370.     @item = item
  2371.     #panels = item[0]
  2372.     #@string1 = panels[0]
  2373.     #@string2 = panels[1]
  2374.     #@string3 = panels[2]
  2375.     #@string4 = panels[3]
  2376.     item2 = item2
  2377.     for k in 0...item[0].size
  2378.       string = item[0][k]
  2379.       for i in 0...string.size
  2380.         string += string.slice(0,1)
  2381.         case string.slice!(0,1)
  2382.         when "o"
  2383.           x = i % @column_max * 32
  2384.           y = (i / @column_max * 32 - self.oy) + (k*32)
  2385.           rect = Rect.new(x + 2, y + 2, 28, 28)
  2386.           self.contents.fill_rect(rect, activepanel_color)
  2387.           bitmap = RPG::Cache.icon(item2.icon_name)
  2388.           opacity = self.contents.font.color == normal_color ? 255 : 128
  2389.           self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2390.         when "l"
  2391.           x = i % @column_max * 32
  2392.           y = (i / @column_max * 32 - self.oy) + (k*32)
  2393.           rect = Rect.new(x + 2, y + 2, 28, 28)
  2394.           self.contents.fill_rect(rect, linkpanel_color)
  2395.           bitmap = RPG::Cache.icon(COTTONJJ::BLANKICON)
  2396.           opacity = self.contents.font.color == normal_color ? 255 : 128
  2397.           self.contents.blt(x + 4, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2398.         when "x"
  2399.           x = i % @column_max * 32
  2400.           y = (i / @column_max * 32 - self.oy) + (k*32)
  2401.           rect = Rect.new(x + 2, y + 2, 28, 28)
  2402.           self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2403.         end
  2404.       end
  2405.     end
  2406.   end
  2407. end
  2408. module RPG
  2409.   class Weapon
  2410.     alias initcj initialize
  2411.     def initialize
  2412.       @weapon_accessories = []
  2413.       initcj
  2414.     end
  2415.     attr_accessor :weapon_accessories
  2416.   end
  2417.   class Armor
  2418.     alias initcj initialize
  2419.     def initialize
  2420.       @armor_accessories = []
  2421.       initcj
  2422.     end
  2423.     attr_accessor :armor_accessories
  2424.   end
  2425. end
  2426. class Game_Actor < Game_Battler
  2427.   attr_accessor :fake_level
  2428.   attr_accessor :gain
  2429.   attr_accessor :weapon
  2430.   attr_accessor :armors
  2431.   alias initcj initialize
  2432.   def initialize(actor_id)
  2433.     initcj(actor_id)
  2434.     @weapon = $data_weapons[@weapon_id].dup if $data_weapons[@weapon_id] != nil
  2435.     @armors = []
  2436.     @armors[0] = $data_armors[@armor1_id].dup if $data_armors[@armor1_id] != nil
  2437.     @armors[1] = $data_armors[@armor2_id].dup if $data_armors[@armor2_id] != nil
  2438.     @armors[2] = $data_armors[@armor3_id].dup if $data_armors[@armor3_id] != nil
  2439.     @armors[3] = $data_armors[@armor4_id].dup if $data_armors[@armor4_id] != nil
  2440.     @gain = true
  2441.     @fake_level = @level
  2442.   end
  2443.   def equip_weaponaccessory(item)
  2444.     @weapon = $data_weapons[@weapon_id]# if @weapon.weapon_accessories == nil
  2445.     if @weapon.weapon_accessories == nil
  2446.       @weapon.weapon_accessories = []
  2447.     end
  2448.     @weapon.weapon_accessories.push(item)
  2449.     $game_party.lose_armor(item.id, 1)
  2450.   end
  2451.   def unequip_weaponaccessory(item)
  2452.     @weapon = $data_weapons[@weapon_id]# if @weapon.weapon_accessories == nil
  2453.     if @weapon.weapon_accessories == nil
  2454.       @weapon.weapon_accessories = []
  2455.     end
  2456.     for i in [email hidden]_accessories.size
  2457.       if @weapon.weapon_accessories[i] == item
  2458.         @weapon.weapon_accessories[i] = nil
  2459.         break
  2460.       end
  2461.     end
  2462.     @weapon.weapon_accessories = @weapon.weapon_accessories.compact
  2463.     $game_party.gain_armor(item.id, 1)
  2464.   end
  2465.   def equip_armoraccessory(equip_type, item)
  2466.     case equip_type
  2467.     when 0
  2468.       g = @armor1_id
  2469.     when 1
  2470.       g = @armor2_id
  2471.     when 2
  2472.       g = @armor3_id
  2473.     when 3
  2474.       g = @armor4_id
  2475.     end
  2476.     @armors[equip_type] = $data_armors[g]
  2477.     if @armors[equip_type].armor_accessories == nil
  2478.       @armors[equip_type].armor_accessories = []
  2479.     end
  2480.     @armors[equip_type].armor_accessories.push(item)
  2481.     $game_party.lose_armor(item.id, 1)
  2482.   end
  2483.   def unequip_armoraccessory(equip_type, item)
  2484.     case equip_type
  2485.     when 0
  2486.       g = @armor1_id
  2487.     when 1
  2488.       g = @armor2_id
  2489.     when 2
  2490.       g = @armor3_id
  2491.     when 3
  2492.       g = @armor4_id
  2493.     end
  2494.     @armors[equip_type] = $data_armors[g]
  2495.     for i in 0...@armors[equip_type].armor_accessories.size
  2496.       if @armors[equip_type].armor_accessories[i] == item
  2497.         @armors[equip_type].armor_accessories[i] = nil
  2498.         break
  2499.       end
  2500.     end
  2501.     @armors[equip_type].armor_accessories = @armors[equip_type].armor_accessories.compact
  2502.     $game_party.gain_armor(item.id, 1)
  2503.   end
  2504.   def weapon_equips
  2505.     return @actor.weapon.weapon_accessories
  2506.   end
  2507.   def armor_equips(equip_type)
  2508.     return @actor.armors[equip_type].armor_accessories
  2509.   end
  2510.   def equip(equip_type, id)
  2511.     case equip_type
  2512.     when 0  # Weapon
  2513.       if id == 0 or $game_party.weapon_number(id) > 0
  2514.         $game_party.gain_weapon(@weapon_id, 1)
  2515.         @weapon_id = id
  2516.         $game_party.lose_weapon(id, 1)
  2517.         @weapon = $data_weapons[@weapon_id].dup if $data_weapons[@weapon_id] != nil
  2518.       end
  2519.     when 1  # Shield
  2520.       if id == 0 or $game_party.armor_number(id) > 0
  2521.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  2522.         $game_party.gain_armor(@armor1_id, 1)
  2523.         @armor1_id = id
  2524.         $game_party.lose_armor(id, 1)
  2525.         @armors[0] = $data_armors[@armor1_id].dup if $data_armors[@armor1_id] != nil
  2526.       end
  2527.     when 2  # Head
  2528.       if id == 0 or $game_party.armor_number(id) > 0
  2529.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  2530.         $game_party.gain_armor(@armor2_id, 1)
  2531.         @armor2_id = id
  2532.         $game_party.lose_armor(id, 1)
  2533.         @armors[1] = $data_armors[@armor2_id].dup if $data_armors[@armor2_id] != nil
  2534.       end
  2535.     when 3  # Body
  2536.       if id == 0 or $game_party.armor_number(id) > 0
  2537.         #print("a")
  2538.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  2539.         $game_party.gain_armor(@armor3_id, 1)
  2540.         @armor3_id = id
  2541.         $game_party.lose_armor(id, 1)
  2542.         @armors[2] = $data_armors[@armor3_id].dup if $data_armors[@armor3_id] != nil
  2543.       end
  2544.     when 4  # Accessory
  2545.       if id == 0 or $game_party.armor_number(id) > 0
  2546.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  2547.         $game_party.gain_armor(@armor4_id, 1)
  2548.         @armor4_id = id
  2549.         $game_party.lose_armor(id, 1)
  2550.         @armors[3] = $data_armors[@armor4_id].dup if $data_armors[@armor4_id] != nil
  2551.       end
  2552.     end
  2553.   end
  2554. end
  2555. class Game_Actor < Game_Battler
  2556.   def exp=(exp)
  2557.     @exp = exp#[[exp, 9999999].min, 0].max
  2558.     while @exp >= @exp_list[@fake_level+1] and @exp_list[@fake_level+1] > 0
  2559.      
  2560.       if @gain == true && COTTONJJ::GAINLEVELITEM == true
  2561.         $game_party.gain_item(COTTONJJ::LEVELUP, 1)
  2562.       else
  2563.         @level += 1
  2564.       end
  2565.       @fake_level += 1
  2566.       # NEW - David
  2567.       $d_new_skill = nil
  2568.      
  2569.       for j in $data_classes[@class_id].learnings
  2570.         if j.level == @fake_level
  2571.           learn_skill(j.skill_id)
  2572.      
  2573.           # NEW - David
  2574.           skill = $data_skills[j.skill_id]
  2575.           $d_new_skill = skill.name
  2576.      
  2577.         end
  2578.       end
  2579.     end
  2580.     while @exp < @exp_list[@level]
  2581.       if item_number(COTTONJJ::LEVELUP) < 1
  2582.         @fake_level -= 1
  2583.         if COTTONJJ::GAINLEVELITEM == false
  2584.           @level -= 1
  2585.         end
  2586.       else
  2587.         if COTTONJJ::GAINLEVELITEM == false
  2588.           @level -= 1
  2589.         else
  2590.           $game_party.lose_item(COTTONJJ::LEVELUP, 1)
  2591.         end
  2592.         @fake_level -= 1
  2593.       end
  2594.     end
  2595.     @hp = [@hp, self.maxhp].min
  2596.     @sp = [@sp, self.maxsp].min
  2597.     #@fake_level = @level
  2598.   end
  2599.   def level=(level)
  2600.     # Check up and down limits
  2601.     @level = level
  2602.     #@fake_level = @level
  2603.     #level = [[level, $data_actors[@actor_id].final_level].min, 1].max
  2604.     # Change EXP
  2605.     @gain = false
  2606.     self.exp = @exp_list[level]
  2607.     @gain = true
  2608.   end
  2609.   def run_equip(equip_type,id)
  2610.     case equip_type
  2611.     when 0  # Weapon
  2612.       for i in 0...$item_panels.size
  2613.         return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Weapon"
  2614.       end
  2615.     when 5
  2616.       for i in 0...$item_panels.size
  2617.         return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Item"
  2618.       end
  2619.     end
  2620.     for i in 0...$item_panels.size
  2621.       return $item_panels[i] if $item_panels[i][3] == id && $item_panels[i][1] == "Armor"
  2622.     end
  2623.     return false
  2624.   end
  2625. end
  2626. class Game_Actor < Game_Battler
  2627.   attr_accessor :bag
  2628.   alias initcj2 initialize
  2629.   def initialize(actor_id)
  2630.     initcj2(actor_id)
  2631.     @bag = {}
  2632.   end
  2633.   def equip_item(item_id,n = 1)
  2634.     if item_id > 0
  2635.       @bag[item_id] = item_number(item_id) + n
  2636.     end
  2637.     $game_party.lose_item(item_id,n)
  2638.   end
  2639.   def unequip_item(item_id,n = 1)
  2640.     n = -(n)
  2641.     if item_id > 0
  2642.       @bag[item_id] = item_number(item_id) + n
  2643.     end
  2644.     $game_party.gain_item(item_id,n)
  2645.   end
  2646.   def item_number(item_id)
  2647.     # If quantity data is in the hash, use it. If not, return 0
  2648.     return @bag.include?(item_id) ? @bag[item_id] : 0
  2649.   end
  2650.   #--------------------------------------------------------------------------
  2651.   # * Determine if Item is Usable
  2652.   #     item_id : item ID
  2653.   #--------------------------------------------------------------------------
  2654.   def item_can_use?(item_id)
  2655.     # If item quantity is 0
  2656.     if item_number(item_id) == 0
  2657.       # Unusable
  2658.       return false
  2659.     end
  2660.     # Get usable time
  2661.     occasion = $data_items[item_id].occasion
  2662.     # If in battle
  2663.     if $game_temp.in_battle
  2664.       # If useable time is 0 (normal) or 1 (only battle) it's usable
  2665.       return (occasion == 0 or occasion == 1)
  2666.     end
  2667.     # If useable time is 0 (normal) or 2 (only menu) it's usable
  2668.     return (occasion == 0 or occasion == 2)
  2669.   end
  2670. end
  2671. #==============================================================================
  2672. # ** Window_Item
  2673. #------------------------------------------------------------------------------
  2674. #  This window displays items in possession on the item and battle screens.
  2675. #==============================================================================
  2676.  
  2677. class Window_Item < Window_Selectable
  2678.   #--------------------------------------------------------------------------
  2679.   # * Object Initialization
  2680.   #--------------------------------------------------------------------------
  2681.   def initialize(actor = nil)
  2682.     super(0, 64, 640, 416)
  2683.     @actor = actor
  2684.     @column_max = 2
  2685.     refresh
  2686.     self.index = 0
  2687.     # If in battle, move window to center of screen
  2688.     # and make it semi-transparent
  2689.     if $game_temp.in_battle
  2690.       self.y = 64
  2691.       self.height = 256
  2692.       self.back_opacity = 160
  2693.     end
  2694.   end
  2695.   #--------------------------------------------------------------------------
  2696.   # * Get Item
  2697.   #--------------------------------------------------------------------------
  2698.   def item
  2699.     return @data[self.index]
  2700.   end
  2701.   #--------------------------------------------------------------------------
  2702.   # * Refresh
  2703.   #--------------------------------------------------------------------------
  2704.   def refresh
  2705.     if self.contents != nil
  2706.       self.contents.dispose
  2707.       self.contents = nil
  2708.     end
  2709.     @data = []
  2710.     # Add item
  2711.     #if $game_temp.in_battle
  2712.     if COTTONJJ::ITEMBAG == false
  2713.       for i in 1...$data_items.size
  2714.         if $game_party.item_number(i) > 0
  2715.           @data.push($data_items[i])
  2716.         end
  2717.       end
  2718.     else
  2719.       if $game_temp.in_battle
  2720.         for i in 1...$data_items.size
  2721.           if @actor != nil
  2722.             if @actor.item_number(i) > 0
  2723.               @data.push($data_items[i])
  2724.             end
  2725.           end
  2726.         end
  2727.       else
  2728.         for i in 1...$data_items.size
  2729.           if $game_party.item_number(i) > 0
  2730.             @data.push($data_items[i])
  2731.           end
  2732.         end
  2733.       end
  2734.     end
  2735.     # Also add weapons and items if outside of battle
  2736.     unless $game_temp.in_battle
  2737.       for i in 1...$data_weapons.size
  2738.         if $game_party.weapon_number(i) > 0
  2739.           @data.push($data_weapons[i])
  2740.         end
  2741.       end
  2742.       for i in 1...$data_armors.size
  2743.         if $game_party.armor_number(i) > 0
  2744.           @data.push($data_armors[i])
  2745.         end
  2746.       end
  2747.     end
  2748.     # If item count is not 0, make a bit map and draw all items
  2749.     @item_max = @data.size
  2750.     if @item_max > 0
  2751.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2752.       for i in 0...@item_max
  2753.         draw_item(i)
  2754.       end
  2755.     end
  2756.   end
  2757.   #--------------------------------------------------------------------------
  2758.   # * Draw Item
  2759.   #     index : item number
  2760.   #--------------------------------------------------------------------------
  2761.   def draw_item(index)
  2762.     item = @data[index]
  2763.     case item
  2764.     when RPG::Item
  2765.       if @actor != nil && COTTONJJ::ITEMBAG == true
  2766.         number = @actor.item_number(item.id)
  2767.       else
  2768.         number = $game_party.item_number(item.id)
  2769.       end
  2770.     when RPG::Weapon
  2771.       number = $game_party.weapon_number(item.id)
  2772.     when RPG::Armor
  2773.       number = $game_party.armor_number(item.id)
  2774.     end
  2775.     if @actor != nil && COTTONJJ::ITEMBAG == true
  2776.       b = @actor.item_can_use?(item.id)
  2777.     else
  2778.       b = $game_party.item_can_use?(item.id)
  2779.     end
  2780.     if item.is_a?(RPG::Item) and b == true
  2781.       self.contents.font.color = normal_color
  2782.     else
  2783.       self.contents.font.color = disabled_color
  2784.     end
  2785.     x = 4 + index % 2 * (288 + 32)
  2786.     y = index / 2 * 32
  2787.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2788.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2789.     bitmap = RPG::Cache.icon(item.icon_name)
  2790.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2791.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2792.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  2793.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  2794.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  2795.   end
  2796.   #--------------------------------------------------------------------------
  2797.   # * Help Text Update
  2798.   #--------------------------------------------------------------------------
  2799.   def update_help
  2800.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2801.   end
  2802. end
  2803. class Scene_Battle
  2804.   def start_item_select
  2805.     # Make item window
  2806.     @item_window = Window_Item.new(@active_battler == nil ? @active_actor : @active_battler)
  2807.     # Associate help window
  2808.     @item_window.help_window = @help_window
  2809.     # Disable actor command window
  2810.     @actor_command_window.active = false
  2811.     @actor_command_window.visible = false
  2812.   end
  2813.   #--------------------------------------------------------------------------
  2814.   # * Item action result compilation
  2815.   #--------------------------------------------------------------------------
  2816.   def make_item_action_result(battler = nil)
  2817.     if COTTONJJ::RTAB == true
  2818.       # Acquiring the item
  2819.       @item = $data_items[battler.current_action.item_id]
  2820.       # When with the item and so on is cut off and it becomes not be able to use
  2821.       if battler.is_a?(Game_Actor)
  2822.         b = battler.item_can_use?(@item.id)
  2823.       else
  2824.         b = $game_party.item_can_use?(@item.id)
  2825.       end
  2826.       unless b == true
  2827.         # It moves to step 6
  2828.         battler.phase = 6
  2829.         return
  2830.       end
  2831.       # In case of consumable
  2832.       if @item.consumable
  2833.         # The item which you use is decreased 1
  2834.         $game_party.lose_item(@item.id, 1)
  2835.       end
  2836.       # Setting animation ID
  2837.       battler.anime1 = @item.animation1_id
  2838.       battler.anime2 = @item.animation2_id
  2839.       # Setting common event ID
  2840.       battler.event = @item.common_event_id
  2841.       # Deciding the object
  2842.       index = battler.current_action.target_index
  2843.       target = $game_party.smooth_target_actor(index)
  2844.       # Setting the object side battler
  2845.       set_target_battlers(@item.scope, battler)
  2846.       # Applying the effect of the item
  2847.       for target in battler.target
  2848.         target.item_effect(@item, battler)
  2849.       end
  2850.     else
  2851.       # Get item
  2852.       @item = $data_items[@active_battler.current_action.item_id]
  2853.       # If unable to use due to items running out
  2854.       if @active_battler.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
  2855.         b = @active_battler.item_can_use?(@item.id)
  2856.       else
  2857.         b = $game_party.item_can_use?(@item.id)
  2858.       end
  2859.       unless b == true
  2860.         # It moves to step 6
  2861.         @phase4_step = 1
  2862.         return
  2863.       end
  2864.       # If consumable
  2865.       if @item.consumable
  2866.         # Decrease used item by 1
  2867.         $game_party.lose_item(@item.id, 1)
  2868.       end
  2869.       # Display item name on help window
  2870.       @help_window.set_text(@item.name, 1)
  2871.       # Set animation ID
  2872.       @animation1_id = @item.animation1_id
  2873.       @animation2_id = @item.animation2_id
  2874.       # Set common event ID
  2875.       @common_event_id = @item.common_event_id
  2876.       # Decide on target
  2877.       index = @active_battler.current_action.target_index
  2878.       target = $game_party.smooth_target_actor(index)
  2879.       # Set targeted battlers
  2880.       set_target_battlers(@item.scope)
  2881.       # Apply item effect
  2882.       for target in @target_battlers
  2883.         target.item_effect(@item)
  2884.       end
  2885.     end
  2886.   end
  2887.   #--------------------------------------------------------------------------
  2888.   # * Frame renewal (actor command phase: Item selection)
  2889.   #--------------------------------------------------------------------------
  2890.   def update_phase3_item_select
  2891.     if COTTONJJ::RTAB == true
  2892.       # During command selecting when it becomes incapacitation,
  2893.       unless @active_actor.inputable?
  2894.         @active_actor.current_action.clear
  2895.         command_delete
  2896.         # To command input of the following actor
  2897.         phase3_next_actor
  2898.         return
  2899.       end
  2900.       # The item window is put in visible state
  2901.       @item_window.visible = true
  2902.       # Renewing the item window
  2903.       @item_window.update
  2904.       # The B when button is pushed,
  2905.       if Input.trigger?(Input::B)
  2906.         # Performing cancellation SE
  2907.         $game_system.se_play($data_system.cancel_se)
  2908.         # End selection of item
  2909.         end_item_select
  2910.         return
  2911.       end
  2912.       #When C button is pushed,
  2913.       if Input.trigger?(Input::C)
  2914.         # Acquiring the data which presently is selected in the item window
  2915.         @item = @item_window.item
  2916.         if @active_actor.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
  2917.           b = @active_actor.item_can_use?(@item.id)
  2918.         else
  2919.           b = $game_party.item_can_use?(@item.id)
  2920.         end
  2921.         # When you cannot use,
  2922.         unless b == true
  2923.           # Performing buzzer SE
  2924.           $game_system.se_play($data_system.buzzer_se)
  2925.           return
  2926.         end
  2927.         # Performing decision SE
  2928.         $game_system.se_play($data_system.decision_se)
  2929.         # Setting action
  2930.         @active_actor.current_action.item_id = @item.id
  2931.         # The item window is put in invisibility state
  2932.         @item_window.visible = false
  2933.         # When the effective range is the enemy single unit,
  2934.         if @item.scope == 1
  2935.           # Starting the selection of the enemy
  2936.           start_enemy_select
  2937.         # When the effective range is the friend single unit,
  2938.         elsif @item.scope == 3 or @item.scope == 5
  2939.           # Starting the selection of the actor
  2940.           start_actor_select
  2941.         # When the effective range is not the single unit,
  2942.         else
  2943.           # Setting action
  2944.           @active_actor.current_action.kind = 2
  2945.           # End selection of item
  2946.           end_item_select
  2947.           # To command input of the following actor
  2948.           phase3_next_actor
  2949.         end
  2950.         return
  2951.       end
  2952.     else
  2953.       # Make item window visible
  2954.       @item_window.visible = true
  2955.       # Update item window
  2956.       @item_window.update
  2957.       # If B button was pressed
  2958.       if Input.trigger?(Input::B)
  2959.         # Play cancel SE
  2960.         $game_system.se_play($data_system.cancel_se)
  2961.         # End item selection
  2962.         end_item_select
  2963.         return
  2964.       end
  2965.       # If C button was pressed
  2966.       if Input.trigger?(Input::C)
  2967.         # Get currently selected data on the item window
  2968.         @item = @item_window.item
  2969.         # If it can't be used
  2970.         if @active_actor.is_a?(Game_Actor) && COTTONJJ::ITEMBAG == true
  2971.           b = @active_actor.item_can_use?(@item.id)
  2972.         else
  2973.           b = $game_party.item_can_use?(@item.id)
  2974.         end
  2975.         # When you cannot use,
  2976.         unless b == true
  2977.           # Performing buzzer SE
  2978.           $game_system.se_play($data_system.buzzer_se)
  2979.           return
  2980.         end
  2981.         # Play decision SE
  2982.         $game_system.se_play($data_system.decision_se)
  2983.         # Set action
  2984.         @active_battler.current_action.item_id = @item.id
  2985.         # Make item window invisible
  2986.         @item_window.visible = false
  2987.         # If effect scope is single enemy
  2988.         if @item.scope == 1
  2989.           # Start enemy selection
  2990.           start_enemy_select
  2991.         # If effect scope is single ally
  2992.         elsif @item.scope == 3 or @item.scope == 5
  2993.           # Start actor selection
  2994.           start_actor_select
  2995.         # If effect scope is not single
  2996.         else
  2997.           # End item selection
  2998.           end_item_select
  2999.           # Go to command input for next actor
  3000.           phase3_next_actor
  3001.         end
  3002.         return
  3003.       end
  3004.     end
  3005.   end
  3006. end
  3007. class Scene_Title
  3008.   alias cjupdate update
  3009.   def update
  3010.     if $DEBUG
  3011.       if Input.trigger?(Input::R)
  3012.         print("...:Weapons:...")
  3013.         g = []
  3014.         for k in 0...$item_panels.size
  3015.           if $item_panels[k][1] == "Weapon"
  3016.             for i in 1...$data_weapons.size
  3017.               if $item_panels[k][3] == i
  3018.                 g.push($data_weapons[i])
  3019.               end
  3020.             end
  3021.           end
  3022.         end
  3023.         if g.empty? == false
  3024.           p = $data_weapons.dup
  3025.           for i in 0...g.size
  3026.             p.delete(g[i])
  3027.           end
  3028.         end
  3029.         if p != nil
  3030.           for i in 0...p.size
  3031.             if p[i] != nil
  3032.               print p[i],"\n",p[i].name,"\n",p[i].id
  3033.             end
  3034.           end
  3035.           if p.compact.empty?
  3036.             print("None")
  3037.           end
  3038.         end
  3039.         print("...:Armors:...")
  3040.         g = []
  3041.         for k in 0...$item_panels.size
  3042.           if $item_panels[k][1] == "Armor"
  3043.             for i in 1...$data_armors.size
  3044.               if $item_panels[k][3] == i
  3045.                 g.push($data_armors[i])
  3046.               end
  3047.             end
  3048.           end
  3049.         end
  3050.         if g.empty? == false
  3051.           p = $data_armors.dup
  3052.           for i in 0...g.size
  3053.             p.delete(g[i])
  3054.           end
  3055.         end
  3056.         if p != nil
  3057.           for i in 0...p.size
  3058.             if p[i] != nil
  3059.               print p[i],"\n",p[i].name,"\n",p[i].id
  3060.             end
  3061.           end
  3062.           if p.compact.empty?
  3063.             print("None")
  3064.           end
  3065.         end
  3066.         print("...:Items:...")
  3067.         g = []
  3068.         for k in 0...$item_panels.size
  3069.           if $item_panels[k][1] == "Item"
  3070.             for i in 1...$data_items.size
  3071.               if $item_panels[k][3] == i
  3072.                 g.push($data_items[i])
  3073.               end
  3074.             end
  3075.           end
  3076.         end
  3077.         if g.empty? == false
  3078.           p = $data_items.dup
  3079.           for i in 0...g.size
  3080.             p.delete(g[i])
  3081.           end
  3082.         end
  3083.         if p != nil
  3084.           for i in 0...p.size
  3085.             if p[i] != nil
  3086.               print p[i],"\n",p[i].name,"\n",p[i].id
  3087.             end
  3088.           end
  3089.           if p.compact.empty?
  3090.             print("None")
  3091.           end
  3092.         end
  3093.         j = false
  3094.         for k in 0...$item_panels.size
  3095.           if $item_panels[k][1] == "Skill"
  3096.             j = true
  3097.           end
  3098.         end
  3099.         if j == true
  3100.           print("...:Skills:...")
  3101.           g = []
  3102.           for k in 0...$item_panels.size
  3103.             if $item_panels[k][1] == "Skill"
  3104.               for i in 1...$data_skills.size
  3105.                 if $item_panels[k][3] == i
  3106.                   g.push($data_skills[i])
  3107.                 end
  3108.               end
  3109.             end
  3110.           end
  3111.           if g.empty? == false
  3112.             p = $data_skills.dup
  3113.             for i in 0...g.size
  3114.               p.delete(g[i])
  3115.             end
  3116.           end
  3117.           if p != nil
  3118.             for i in 0...p.size
  3119.               if p[i] != nil
  3120.                 print p[i],"\n",p[i].name,"\n",p[i].id
  3121.               end
  3122.             end
  3123.             if p.compact.empty?
  3124.               print("None")
  3125.             end
  3126.           end
  3127.         end
  3128.       end
  3129.     end
  3130.     cjupdate
  3131.     #$data_skills        = load_data("Data/Skills.rxdata")
  3132.     #$data_items         = load_data("Data/Items.rxdata")
  3133.     #$data_weapons       = load_data("Data/Weapons.rxdata")
  3134.     #$data_armors        = load_data("Data/Armors.rxdata")
  3135.   end
  3136. end
  3137. #==============================================================================
  3138. # ** Scene_Save
  3139. #------------------------------------------------------------------------------
  3140. #  This class performs save screen processing.
  3141. #==============================================================================
  3142. class Scene_Save < Scene_File
  3143. #--------------------------------------------------------------------------
  3144. # * Alias Methods
  3145. #--------------------------------------------------------------------------
  3146.   alias cjwsd write_save_data
  3147. #--------------------------------------------------------------------------
  3148. # * Write Save Data
  3149. #     file : write file object (opened)
  3150. #--------------------------------------------------------------------------
  3151.   def write_save_data(file)
  3152.   # Call original method
  3153.     cjwsd(file)
  3154.     # Write save data
  3155.     Marshal.dump($panels, file)
  3156.     Marshal.dump($panels2, file)
  3157.     Marshal.dump($panels3, file)
  3158.   end
  3159. end  
  3160. #==============================================================================
  3161. # ** Scene_Load
  3162. #------------------------------------------------------------------------------
  3163. #  This class performs load screen processing.
  3164. #==============================================================================
  3165. class Scene_Load < Scene_File
  3166. #--------------------------------------------------------------------------
  3167. # * Alias Methods
  3168. #--------------------------------------------------------------------------
  3169.   alias cjrsd read_save_data
  3170. #--------------------------------------------------------------------------
  3171. # * Read Save Data
  3172. #     file : file object for reading (opened)
  3173. #--------------------------------------------------------------------------
  3174.   def read_save_data(file)
  3175.     # Call original method
  3176.     cjrsd(file)
  3177.     # Load saved data
  3178.     #$panels = []
  3179.     #$panels2 = []
  3180.     #$panels3 = []
  3181.     #$panels.load_save(Marshal.load(file))
  3182.     $panels             = Marshal.load(file)
  3183.     $panels2            = Marshal.load(file)
  3184.     $panels3            = Marshal.load(file)
  3185.   end
  3186. end
  3187. if COTTONJJ::CUSTOMXY == true
  3188.   class Game_Actor < Game_Battler
  3189.     def screen_x
  3190.       # Return after calculating x-coordinate by order of members in party
  3191.       if self.index != nil
  3192.         return self.index * 40 + 50
  3193.       else
  3194.         return 0
  3195.       end
  3196.     end
  3197.     def screen_y
  3198.       return 370 - (self.index * 30 + 50)
  3199.     end
  3200.   end
  3201.   class Game_Enemy < Game_Battler
  3202.     def screen_x
  3203.       if $game_troop.enemies.size > 4
  3204.         o = 280
  3205.       else
  3206.         o = 400
  3207.       end
  3208.       # Return after calculating x-coordinate by order of members in party
  3209.       return o + @member_index * 40 + 50
  3210.     end
  3211.     def screen_y
  3212.       return 370 - ((@member_index % 4) * 30 + 50)
  3213.     end
  3214.   end
  3215. end
Expand to see the code.


Instructions

Edit the items in the tab labeled item database. x = blank panel. l = linkable panel, o = item panel.

LEVELUP = 1 (ID of the Level Up Item)
LEVELUPDOUBLER = 2 (ID of the Level Doubler Item)
LEVELUPTRIPLER = 3 (ID of the Level Tripler Item)
ASSISTITEMS = [1,2,3] (IDs of assist items) (LevelUps)
ASSISTARMORS = [1,2,3,4] (IDs of assist armors) (Weapon and Armor Links)
ABILITYVAR = 1 (ID of Ability changing armor)

$weapon_abilities[1] = [2,3,4] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]

$armor_abilities[8] = [9] ...[Weapon ID] = [Skill IDs Learned from Ability Armors]



Visual Equipment
ARMOR[6] = "_outfit1" (ArmorID = armor name augment)
WEAPON[1] = "_weapon1" (WeaponID = armor name augment)


Compatibility

Made to work with te rtab and rpg maker xp

Credits and Thanks

Kain. Demonfire

Author's Notes

If there are any questions or comments... requests? here.

Terms and Conditions

---
This looks great, its close to what I'm trying to make but not quite ):
thanks. right now. I'm workin on makin the script a little more self-dependent and User friendly. If you want, I might be able to fix the script up to your likining if it's not too hard... Suggest a feature or something
Wao nice script ^^ I really like the concept.
Here are some of mai suggestions o.oa

1. Leveling increases panels - Players start with like lets say a small 5x5 panels, and every level gives more panels o.oa
2. Pressing left or right will change the panel page (weapon, armor, assist, etc) instead of having to put the cursor on top.
3. Boosters - Like the level modifier except it adds stuffs like 20% poison resist or +50 hp
4. Overlapping - Like the booster earlier, multiple equipment panel can overlap over booster panel so if you can place a panel from your hat and a panel from your armor on top of the same booster panel, you get 100 hp (50 x 2)
5. Different size panels - like some panels occupies four square panels instead of one (like for a powerful skill/weapon)
6. Cursed panels - some equipment have a cursed panels attached to them, if other equipment overlap on it, you will get nasty effects (-hp, etc)

o.o
hmm....

1. Leveling Increases Panels: This could probably be done really easily.. I was actually planning to do it anyway along with a panel page system from the orignal game the idea came from.

2. Button Alternatives: No worries I can do that.

3. Boosters: Hopefully I get this right. Your saying you want an equippable item or something that can boost stats, without taking up and armor slot or a weapon attachment? This will probably take longer than the other suggestions, but it can be done.

4. Overlapping: I didn't really understand this. because I didn't really understand boosting. But are you saying that you can make it so an armor's link/equip panels can overlap each other so that any link panel in the overlap is doubled? (This would probably mean I'd have to redo my panel collison detection.)

5. Different size panels: I tried this (didn't try very hard, but I did) and failed. But if I tried harder, this could probably be accomplished. But it'd take awhile. This would probably also call of a redo of the panel collison.

6. Cursed Panels - Don't really understand 6. if you attach a "chain" (for example) to an armor, you will unknowingly gain bad effects? And you have no idea which link panels are cursed?
BUG REPORT!!!


Hello! I've been having this bug , while playing the demo... liike, i put th LVL-UP panel into the board, the characters lvls up, normally, but then, like every time I try to take an LVL-UP Panel from the board... It crashes saying this "Script' # Scene_Panels [1]' line 244 NoMethodError Ocurred. Undefined Method 'Remove' for {}: Hash" And then it closed the window...
Plz fix this, Caz i want to use this script on my game... OH! And if you can unpgrad eit.. it bill be soo kool, if we could unlocked equip panels, by resceiveng Items such as and Item like "4 Panels Unlcked" (and obviuslly that would be something like a event item, that will never show up in the invetory) That will be awesome, I hope you reply to these and try to fix me bug... PLZ!!! :angel: :haha: 😉 :cute:
What I mean about booster is uhh, they act like an equipment but their slots is actually their effect range, and if your equipment slot touches this effect range, you get the booster effect.

Overlapping is like placing two different equipment slot on the same booster panel (ex. Helmet's top slot touching booster panel while glove's bottom slot touches it also)

Curse panels is uhh some equipment have a dark panel along with their normal ones. And if another equipment slot touches the dark panel, they get nasty effect specially if the table is crowded and the only way to avoid the curse panel is putting the equipment in the corner (the price you pay for powerful equipment)

I can prolly make a pic if you had a hard time ^^:
CodedAngel wrote:
BUG REPORT!!!


Hello! I've been having this bug , while playing the demo... liike, i put th LVL-UP panel into the board, the characters lvls up, normally, but then, like every time I try to take an LVL-UP Panel from the board... It crashes saying this "Script' # Scene_Panels [1]' line 244 NoMethodError Ocurred. Undefined Method 'Remove' for {}: Hash" And then it closed the window...
Plz fix this, Caz i want to use this script on my game... OH! And if you can unpgrad eit.. it bill be soo kool, if we could unlocked equip panels, by resceiveng Items such as and Item like "4 Panels Unlcked" (and obviuslly that would be something like a event item, that will never show up in the invetory) That will be awesome, I hope you reply to these and try to fix me bug... PLZ!!! :angel: :haha: 😉 :cute:


I'm sorry for the wait, but for the longest time I couldn't login... And I'm failing two classes and blah blah blah... so anyway... that error was caused because I called the variable in an odd way. if you can find the variable I used. search for "variable" = {} and change it to "variable" = []. I can't say exactly because I've changed the script already and don't remember what I changed. Sorry for the wait once again. I might be working more on this during spring break. but I'm not sure.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=69505