Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Name: Dark's Weapon/Armor Encyclopedia
- # Author: Nhat Nguyen (Dark Sky)
- # Released on: June 5th 2016
- #-------------------------------------------------------------------------------
- # Version 1.0: Released!
- # Version 2.0: Add Armor Encyclopedia. (June 6th 2016)
- #-------------------------------------------------------------------------------
- # Script call:
- # + Open weapon scene: SceneManager.call(Scene_WeaponPedia)
- # + Open armor scene: SceneManager.call(Scene_ArmorPedia)
- #-------------------------------------------------------------------------------
- # Item will be added to the pedia automatically when recive a weapon or an armor.
- #===============================================================================
- module DarkCreation
- module WeaponEncyclopedia
- #------------------------------------------------------------------------
- # * Get Weapon Category
- #------------------------------------------------------------------------
- def self.get_weapon_category
- wp_categories = []
- $data_system.weapon_types.each do |cate|
- next if cate == ""
- wp_categories.push( cate )
- end
- return wp_categories
- end
- end #WeaponEncyclopedia End
- module ArmorEncyclopedia
- #------------------------------------------------------------------------
- # * Get Weapon Category
- #------------------------------------------------------------------------
- def self.get_armor_category
- am_categories = []
- $data_system.armor_types.each do |cate|
- next if cate == ""
- am_categories.push( cate )
- end
- return am_categories
- end
- end #ArmorEncyclopedia End
- end #DarkCreatin End
- class Game_System
- attr_accessor :wpedia_list
- attr_accessor :apedia_list
- alias_method(:dark_wp_pedia_original_initialize,:initialize)
- def initialize
- @wpedia_list = []
- @apedia_list = []
- dark_wp_pedia_original_initialize()
- end
- end
- class Game_Interpreter
- alias_method(:dark_command_127_original,:command_127)
- alias_method(:dark_command_128_original,:command_128)
- #--------------------------------------------------------------------------
- # * Change Weapons
- #--------------------------------------------------------------------------
- def command_127
- dark_command_127_original()
- $game_system.wpedia_list.push($data_weapons[@params[0]].id)
- $game_system.wpedia_list.uniq!
- end
- #--------------------------------------------------------------------------
- # * Change Armor
- #--------------------------------------------------------------------------
- def command_128
- dark_command_128_original()
- $game_system.apedia_list.push($data_armors[@params[0]].id)
- $game_system.apedia_list.uniq!
- end
- end
- class Scene_WeaponPedia < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_windows
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def create_windows
- @title_window = Window_WeaponPediaTitle.new
- @cate_window = Window_WeaponPediaCategory.new
- @cate_window.y = @title_window.height
- @info_window = Window_WeaponPediaInfo.new
- @info_window.y = @title_window.height
- @info_window.x = @cate_window.width
- @item_list = Window_WeaponPediaList.new
- @item_list.info_window = @info_window
- @item_list.y = @cate_window.y + @cate_window.height
- end
- def update
- super
- if Input.trigger?(:B)
- terminate
- return_scene
- end
- end
- end
- include DarkCreation::WeaponEncyclopedia
- TOKEN = /w_(\d+)/i #Please don't change this!
- TOKENA = /a_(\d+)/i
- class Window_WeaponPediaTitle < Window_Base
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,Graphics.width,54)
- contents.font.size = 25
- contents.font.name = ["04b_19"]
- rect = contents.rect
- rect.y += 3
- contents.draw_text(rect,"WEAPON ENCYCLOPEDIA",1)
- end
- end
- class Window_WeaponPediaCategory < Window_Base
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,195,54)
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- rect = contents.rect
- rect.y += 3
- contents.draw_text(rect,"WEAPON CATEGORIES",1)
- end
- end
- class Window_WeaponPediaInfo < Window_Base
- attr_accessor :display
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,Graphics.width - 195,Graphics.height - 54)
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- display_no
- end
- #--------------------------------------------------------------------------
- # * Display no
- #--------------------------------------------------------------------------
- def display_no
- contents.clear
- if @spr_help
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @display = false
- contents.draw_text(contents.rect,"Choose a weapon to display!",1)
- end
- #--------------------------------------------------------------------------
- # * Draw Icon
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_icon2(icon_index, x, y, enabled = true)
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- rect2 = Rect.new(x, y, 64, 64)
- contents.stretch_blt(rect2, bitmap, rect,enabled ? 255 : translucent_alpha)
- end
- #--------------------------------------------------------------------------
- # * Display Normal
- #--------------------------------------------------------------------------
- def display_normal(wp_index)
- contents.clear
- if @spr_help
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @display = true
- wp = $data_weapons[wp_index]
- contents.fill_rect(0,0,65,65,Color.new(0,0,0,translucent_alpha))
- draw_icon2(wp.icon_index,1,1)
- name_rect = Rect.new(70,0,250,64)
- name_rect.y += 5
- name_rect.y -= line_height/2
- contents.font.size = 23
- contents.font.color = Color.new(255,128,0)
- draw_text(name_rect, wp.name,1)
- contents.font.size = 15
- name_rect.y += line_height
- contents.font.color = Color.new(255,255,255)
- draw_text(name_rect, "Price: #{wp.price}",1)
- contents.fill_rect(0,68,contents.width,40,Color.new(0,0,0,translucent_alpha))
- @viewport ||= Viewport.new(207,134,325,40)
- @viewport.z = 100
- @spr_help = Sprite.new(@viewport)
- @spr_help.bitmap = Bitmap.new(1280*3,40)
- @spr_help.bitmap.font.size = 17
- @spr_help.bitmap.font.bold = true
- @spr_help.bitmap.font.outline = false
- @des_text = wp.description
- @spr_help.bitmap.draw_text(0,5,1280*3,24,@des_text)
- @spr_help.oy -= 5
- @spr_help.ox = @scroll_pos = -30
- @atk_color1 = Color.new(255,140,0)
- @atk_color2 = Color.new(255,69,0)
- @def_color1 = Color.new(0,255,0)
- @def_color2 = Color.new(50,205,50)
- @mat_color1 = Color.new(75,0,130)
- @mat_color2 = Color.new(138,43,226)
- @mdf_color1 = Color.new(0,206,209)
- @mdf_color2 = Color.new(64,224,208)
- @mhp_color1 = Color.new(255,0,0)
- @mhp_color2 = Color.new(200,100,100)
- @agi_color1 = Color.new(199,21,133)
- @agi_color2 = Color.new(219,112,147)
- @luk_color1 = Color.new(255,255,0)
- @luk_color2 = Color.new(255,215,0)
- @mmp_color1 = Color.new(30,144,255)
- @mmp_color2 = Color.new(0,191,255)
- x = 10
- y = 170
- @rate = wp.params[2].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@atk_color1,@atk_color2,-@rate,"ATK")
- x += 80
- @rate = wp.params[3].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@def_color1,@def_color2,-@rate,"DEF")
- x += 80
- @rate = wp.params[4].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mat_color1,@mat_color2,-@rate,"MAT")
- x += 80
- @rate = wp.params[4].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mdf_color1,@mdf_color2,-@rate,"MDF")
- x = 10
- y += 80
- @rate = wp.params[5].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@agi_color1,@agi_color2,-@rate,"AGI")
- x += 80
- @rate = wp.params[6].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@luk_color1,@luk_color2,-@rate,"LUK")
- x += 80
- @rate = wp.params[0].to_f/5000.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mhp_color1,@mhp_color2,-@rate,"MHP",true)
- x += 80
- @rate = wp.params[1].to_f/5000.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mmp_color1,@mmp_color2,-@rate,"MMP",true)
- contents.font.size = 22
- contents.draw_text(-10,68+40+15,Graphics.width - 195,24,"STATS",1)
- end
- #--------------------------------------------------------------------------
- # * Draw Circular Gauge
- #--------------------------------------------------------------------------
- def draw_cir_gauge(x1,y1,x2,y2,color1,color2,rate,text,is_hp_mp=false)
- contents.line_start_cap = 2
- contents.line_end_cap = 2
- contents.simple_draw_arc( x1, y1, x2, y2, Color.new(255,255,255), 90 , 360 ,10)
- contents.simple_draw_arc( x1, y1, x2, y2, Color.new(0,0,0,200) , 90 , 360 ,8)
- contents.draw_arc( x1, y1, x2, y2, x1, y1, x2 , y2 ,color1,color2,90,rate*360,7)
- contents.font.color = color2
- draw_text(x1+18,y1+10,65,24,text)
- rect = Rect.new(x1,y1,65,70)
- rect.y += 3
- rect.x += 1
- if is_hp_mp == true
- draw_text(rect,"#{@rate*5000}",1)
- else
- draw_text(rect,"#{@rate*500.to_i}",1)
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- super
- if @spr_help && !@spr_help.disposed?
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @viewport.dispose if @viewport
- end
- #--------------------------------------------------------------------------
- # * Cal Text Width
- #--------------------------------------------------------------------------
- def cal_text_width(text)
- size = 0
- for i in 0...text.size
- size += text_size(text[i]).width
- end
- return size
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- super
- if @spr_help && self.display
- @spr_help.ox = @scroll_pos
- @scroll_pos += 1
- if @scroll_pos > cal_text_width(@des_text)*0.6 + 40*2
- @scroll_pos = -325
- @spr_help.ox = @scroll_pos
- end
- end
- end
- end
- class Window_WeaponPediaList < Window_Command
- attr_accessor :info_window
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0)
- set_handlers
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 195
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- 308
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- @categories = DarkCreation::WeaponEncyclopedia.get_weapon_category
- @weapon_list = $game_system.wpedia_list
- @expand_status = {}
- @categories.each do |cate|
- add_command(cate,cate.to_sym,true)
- @expand_status[cate.to_sym] = false
- end
- end
- #--------------------------------------------------------------------------
- # * Create New Command List
- #--------------------------------------------------------------------------
- def make_new_command_list
- @child = []
- @categories.each do |cate|
- add_command(cate,cate.to_sym,true)
- if @expand_status[cate.to_sym]
- @weapon_list.each do |index|
- wptype = $data_weapons[index].wtype_id
- name = $data_weapons[index].name
- if $data_system.weapon_types[wptype].to_sym == cate.to_sym
- @child.push(["w_#{index}".to_sym,index])
- add_command(name,"w_#{index}".to_sym,true)
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Set handler
- #--------------------------------------------------------------------------
- def set_handlers
- @categories.each do |cate|
- set_handler(cate.to_sym, method(:extract_small_commands))
- end
- end
- #--------------------------------------------------------------------------
- # * Set handler
- #--------------------------------------------------------------------------
- def set_handlers_new
- @categories.each do |cate|
- set_handler(cate.to_sym, method(:extract_small_commands))
- end
- @child.each do |sym|
- set_handler(sym[0], method(:on_wp_click))
- end
- end
- #--------------------------------------------------------------------------
- # * On Weapon Choose
- #--------------------------------------------------------------------------
- def on_wp_click
- if @list[@index][:symbol].to_s =~ TOKEN
- @info_window.display_normal($1.to_i)
- end #$data_weapons[
- activate
- end
- #--------------------------------------------------------------------------
- # * Check for current expand status
- #--------------------------------------------------------------------------
- def current_expand_status
- return @expand_status[@list[@index][:symbol]]
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @cursor_all
- cursor_rect.set(0, 0, contents.width, row_max * item_height)
- self.top_row = 0
- elsif @index < 0
- cursor_rect.empty
- else
- ensure_cursor_visible
- rect = item_rect(@index)
- if @list[@index][:symbol].to_s.include?("w_")
- rect.x += 10
- rect.width -= 10
- else
- @info_window.display_no if @info_window && @info_window.display
- end
- cursor_rect.set(rect)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- if @expand_status[@list[index][:symbol]]
- change_color(crisis_color, command_enabled?(index))
- else
- change_color(normal_color, command_enabled?(index))
- end
- rect = item_rect_for_text(index)
- rect.y += 2
- if @list[index][:symbol].to_s.include?("w_")
- rect.x += 10
- contents.font.name = Font.default_name
- contents.font.size = 18
- else
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- end
- draw_text(rect, command_name(index), alignment)
- end
- #--------------------------------------------------------------------------
- # * Invert expand status
- #--------------------------------------------------------------------------
- def invert_expand_status
- if current_expand_status
- @expand_status[@list[@index][:symbol]] = false
- else
- @expand_status[@list[@index][:symbol]] = true
- end
- end
- #--------------------------------------------------------------------------
- # * Extract small commands
- #--------------------------------------------------------------------------
- def extract_small_commands
- invert_expand_status
- activate
- clear_command_list
- make_new_command_list
- set_handlers_new
- contents.clear
- create_contents
- draw_all_items
- end
- end
- class Scene_ArmorPedia < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- create_windows
- end
- #--------------------------------------------------------------------------
- # * Create Windows
- #--------------------------------------------------------------------------
- def create_windows
- @title_window = Window_ArmorPediaTitle.new
- @cate_window = Window_ArmorPediaCategory.new
- @cate_window.y = @title_window.height
- @info_window = Window_ArmorPediaInfo.new
- @info_window.y = @title_window.height
- @info_window.x = @cate_window.width
- @item_list = Window_ArmorPediaList.new
- @item_list.info_window = @info_window
- @item_list.y = @cate_window.y + @cate_window.height
- end
- def update
- super
- if Input.trigger?(:B)
- terminate
- return_scene
- end
- end
- end
- include DarkCreation::ArmorEncyclopedia
- #TOKEN = /a_(\d+)/i #Please don't change this!
- class Window_ArmorPediaTitle < Window_Base
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,Graphics.width,54)
- contents.font.size = 25
- contents.font.name = ["04b_19"]
- rect = contents.rect
- rect.y += 3
- contents.draw_text(rect,"ARMOR ENCYCLOPEDIA",1)
- end
- end
- class Window_ArmorPediaCategory < Window_Base
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,195,54)
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- rect = contents.rect
- rect.y += 3
- contents.draw_text(rect,"ARMOR CATEGORIES",1)
- end
- end
- class Window_ArmorPediaInfo < Window_Base
- attr_accessor :display
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,Graphics.width - 195,Graphics.height - 54)
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- display_no
- end
- #--------------------------------------------------------------------------
- # * Display no
- #--------------------------------------------------------------------------
- def display_no
- contents.clear
- if @spr_help
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @display = false
- contents.draw_text(contents.rect,"Choose an armor to display!",1)
- end
- #--------------------------------------------------------------------------
- # * Draw Icon
- # enabled : Enabled flag. When false, draw semi-transparently.
- #--------------------------------------------------------------------------
- def draw_icon2(icon_index, x, y, enabled = true)
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- rect2 = Rect.new(x, y, 64, 64)
- contents.stretch_blt(rect2, bitmap, rect,enabled ? 255 : translucent_alpha)
- end
- #--------------------------------------------------------------------------
- # * Display Normal
- #--------------------------------------------------------------------------
- def display_normal(wp_index)
- contents.clear
- if @spr_help
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @display = true
- wp = $data_armors[wp_index]
- contents.fill_rect(0,0,65,65,Color.new(0,0,0,translucent_alpha))
- draw_icon2(wp.icon_index,1,1)
- name_rect = Rect.new(70,0,250,64)
- name_rect.y += 5
- name_rect.y -= line_height/2
- contents.font.size = 23
- contents.font.color = Color.new(255,128,0)
- draw_text(name_rect, wp.name,1)
- contents.font.size = 15
- name_rect.y += line_height
- contents.font.color = Color.new(255,255,255)
- draw_text(name_rect, "Price: #{wp.price}",1)
- contents.fill_rect(0,68,contents.width,40,Color.new(0,0,0,translucent_alpha))
- @viewport ||= Viewport.new(207,134,325,40)
- @viewport.z = 100
- @spr_help = Sprite.new(@viewport)
- @spr_help.bitmap = Bitmap.new(1280*3,40)
- @spr_help.bitmap.font.size = 17
- @spr_help.bitmap.font.bold = true
- @spr_help.bitmap.font.outline = false
- @des_text = wp.description
- @spr_help.bitmap.draw_text(0,5,1280*3,24,@des_text)
- @spr_help.oy -= 5
- @spr_help.ox = @scroll_pos = -30
- @atk_color1 = Color.new(255,140,0)
- @atk_color2 = Color.new(255,69,0)
- @def_color1 = Color.new(0,255,0)
- @def_color2 = Color.new(50,205,50)
- @mat_color1 = Color.new(75,0,130)
- @mat_color2 = Color.new(138,43,226)
- @mdf_color1 = Color.new(0,206,209)
- @mdf_color2 = Color.new(64,224,208)
- @mhp_color1 = Color.new(255,0,0)
- @mhp_color2 = Color.new(200,100,100)
- @agi_color1 = Color.new(199,21,133)
- @agi_color2 = Color.new(219,112,147)
- @luk_color1 = Color.new(255,255,0)
- @luk_color2 = Color.new(255,215,0)
- @mmp_color1 = Color.new(30,144,255)
- @mmp_color2 = Color.new(0,191,255)
- x = 10
- y = 170
- @rate = wp.params[2].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@atk_color1,@atk_color2,-@rate,"ATK")
- x += 80
- @rate = wp.params[3].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@def_color1,@def_color2,-@rate,"DEF")
- x += 80
- @rate = wp.params[4].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mat_color1,@mat_color2,-@rate,"MAT")
- x += 80
- @rate = wp.params[4].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mdf_color1,@mdf_color2,-@rate,"MDF")
- x = 10
- y += 80
- @rate = wp.params[5].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@agi_color1,@agi_color2,-@rate,"AGI")
- x += 80
- @rate = wp.params[6].to_f/500.to_f
- draw_cir_gauge(x,y,x+65,y+65,@luk_color1,@luk_color2,-@rate,"LUK")
- x += 80
- @rate = wp.params[0].to_f/5000.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mhp_color1,@mhp_color2,-@rate,"MHP",true)
- x += 80
- @rate = wp.params[1].to_f/5000.to_f
- draw_cir_gauge(x,y,x+65,y+65,@mmp_color1,@mmp_color2,-@rate,"MMP",true)
- contents.font.size = 22
- contents.draw_text(-10,68+40+15,Graphics.width - 195,24,"STATS",1)
- end
- #--------------------------------------------------------------------------
- # * Draw Circular Gauge
- #--------------------------------------------------------------------------
- def draw_cir_gauge(x1,y1,x2,y2,color1,color2,rate,text,is_hp_mp=false)
- contents.line_start_cap = 2
- contents.line_end_cap = 2
- contents.simple_draw_arc( x1, y1, x2, y2, Color.new(255,255,255), 90 , 360 ,10)
- contents.simple_draw_arc( x1, y1, x2, y2, Color.new(0,0,0,200) , 90 , 360 ,8)
- contents.draw_arc( x1, y1, x2, y2, x1, y1, x2 , y2 ,color1,color2,90,rate*360,7)
- contents.font.color = color2
- draw_text(x1+18,y1+10,65,24,text)
- rect = Rect.new(x1,y1,65,70)
- rect.y += 3
- rect.x += 1
- if is_hp_mp == true
- draw_text(rect,"#{@rate*5000}",1)
- else
- draw_text(rect,"#{@rate*500.to_i}",1)
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- super
- if @spr_help && !@spr_help.disposed?
- @spr_help.bitmap.dispose
- @spr_help.dispose
- end
- @viewport.dispose if @viewport
- end
- #--------------------------------------------------------------------------
- # * Cal Text Width
- #--------------------------------------------------------------------------
- def cal_text_width(text)
- size = 0
- for i in 0...text.size
- size += text_size(text[i]).width
- end
- return size
- end
- #--------------------------------------------------------------------------
- # * Update
- #--------------------------------------------------------------------------
- def update
- super
- if @spr_help && self.display
- @spr_help.ox = @scroll_pos
- @scroll_pos += 1
- if @scroll_pos > cal_text_width(@des_text)*0.6 + 40*2
- @scroll_pos = -325
- @spr_help.ox = @scroll_pos
- end
- end
- end
- end
- class Window_ArmorPediaList < Window_Command
- attr_accessor :info_window
- #--------------------------------------------------------------------------
- # * Initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0,0)
- set_handlers
- end
- #--------------------------------------------------------------------------
- # * Get Window Width
- #--------------------------------------------------------------------------
- def window_width
- return 195
- end
- #--------------------------------------------------------------------------
- # * Get Window Height
- #--------------------------------------------------------------------------
- def window_height
- 308
- end
- #--------------------------------------------------------------------------
- # * Create Command List
- #--------------------------------------------------------------------------
- def make_command_list
- @categories = DarkCreation::ArmorEncyclopedia.get_armor_category
- @armor_list = $game_system.apedia_list
- @expand_status = {}
- @categories.each do |cate|
- add_command(cate,cate.to_sym,true)
- @expand_status[cate.to_sym] = false
- end
- end
- #--------------------------------------------------------------------------
- # * Create New Command List
- #--------------------------------------------------------------------------
- def make_new_command_list
- @child = []
- @categories.each do |cate|
- add_command(cate,cate.to_sym,true)
- if @expand_status[cate.to_sym]
- @armor_list.each do |index|
- aptype = $data_armors[index].atype_id
- name = $data_armors[index].name
- if $data_system.armor_types[aptype].to_sym == cate.to_sym
- @child.push(["a_#{index}".to_sym,index])
- add_command(name,"a_#{index}".to_sym,true)
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Set handler
- #--------------------------------------------------------------------------
- def set_handlers
- @categories.each do |cate|
- set_handler(cate.to_sym, method(:extract_small_commands))
- end
- end
- #--------------------------------------------------------------------------
- # * Set handler
- #--------------------------------------------------------------------------
- def set_handlers_new
- @categories.each do |cate|
- set_handler(cate.to_sym, method(:extract_small_commands))
- end
- @child.each do |sym|
- set_handler(sym[0], method(:on_ar_click))
- end
- end
- #--------------------------------------------------------------------------
- # * On Weapon Choose
- #--------------------------------------------------------------------------
- def on_ar_click
- if @list[@index][:symbol].to_s =~ TOKENA
- @info_window.display_normal($1.to_i)
- end
- activate
- end
- #--------------------------------------------------------------------------
- # * Check for current expand status
- #--------------------------------------------------------------------------
- def current_expand_status
- return @expand_status[@list[@index][:symbol]]
- end
- #--------------------------------------------------------------------------
- # * Update Cursor
- #--------------------------------------------------------------------------
- def update_cursor
- if @cursor_all
- cursor_rect.set(0, 0, contents.width, row_max * item_height)
- self.top_row = 0
- elsif @index < 0
- cursor_rect.empty
- else
- ensure_cursor_visible
- rect = item_rect(@index)
- if @list[@index][:symbol].to_s.include?("a_")
- rect.x += 10
- rect.width -= 10
- else
- @info_window.display_no if @info_window && @info_window.display
- end
- cursor_rect.set(rect)
- end
- end
- #--------------------------------------------------------------------------
- # * Draw Item
- #--------------------------------------------------------------------------
- def draw_item(index)
- if @expand_status[@list[index][:symbol]]
- change_color(crisis_color, command_enabled?(index))
- else
- change_color(normal_color, command_enabled?(index))
- end
- rect = item_rect_for_text(index)
- rect.y += 2
- if @list[index][:symbol].to_s.include?("a_")
- rect.x += 10
- contents.font.name = Font.default_name
- contents.font.size = 18
- else
- contents.font.name = ["04b_19"]
- contents.font.size = 15
- end
- draw_text(rect, command_name(index), alignment)
- end
- #--------------------------------------------------------------------------
- # * Invert expand status
- #--------------------------------------------------------------------------
- def invert_expand_status
- if current_expand_status
- @expand_status[@list[@index][:symbol]] = false
- else
- @expand_status[@list[@index][:symbol]] = true
- end
- end
- #--------------------------------------------------------------------------
- # * Extract small commands
- #--------------------------------------------------------------------------
- def extract_small_commands
- invert_expand_status
- activate
- clear_command_list
- make_new_command_list
- set_handlers_new
- contents.clear
- create_contents
- draw_all_items
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment