Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Window_Base < Window
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # NEW! Function(s): draw_actor_sparam, draw_actor_xparam
- # Overwrites: draw_actor_param
- # : Identical to drawing normal parameters, but for s/x params instead.
- # : Also draws icons when available for the various stats.
- def draw_actor_param(actor, x, y, param_id)
- name = Vocab::param(param_id)
- if J::StatIcons::ICONS.include?(name)
- draw_icon(J::StatIcons::ICONS[name], x-32, y)
- end
- value = sprintf("%04d", actor.param(param_id).to_s)
- change_color(system_color)
- draw_text(x-10, y, 120, line_height, name)
- change_color(normal_color)
- draw_text(x + 50, y, 48, line_height, value, 2)
- end#def
- def draw_actor_sparam(actor, x, y, sparam_id)
- name = Vocab::sparam(sparam_id)
- if J::StatIcons::ICONS.include?(name)
- draw_icon(J::StatIcons::ICONS[name], x-24, y)
- end
- value = ((actor.sparam(sparam_id)*100) - 100).to_i
- change_color(system_color)
- draw_text(x - 10, y, 120, line_height, name)
- change_color(normal_color)
- draw_text(x + 50, y, 48, line_height, value, 2)
- end#def
- def draw_actor_xparam(actor, x, y, xparam_id)
- name = Vocab::xparam(xparam_id)
- if J::StatIcons::ICONS.include?(name)
- draw_icon(J::StatIcons::ICONS[name], x-24, y)
- end
- change_color(system_color)
- draw_text(x - 10, y, 120, line_height, name)
- change_color(normal_color)
- draw_text(x + 50, y, 48, line_height, (actor.xparam(xparam_id)*100).to_i, 2)
- end#def
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # * Draw HP
- # Overwrites: make_font_bigger, make_font_smaller
- # : Modifies existing method to allow custom input for font-size adjustments.
- def make_font_bigger(size = 8)
- contents.font.size += size if contents.font.size <= 64
- end#def
- def make_font_smaller(size = 8)
- contents.font.size -= size if contents.font.size >= 16
- end#def
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # * Draw HP
- # Overwrites: draw_actor_hp, draw_actor_mp
- # : Modifies existing method to draw fixed number of digits (4).
- def draw_actor_hp(actor, x, y, width = 124)
- c_hp = sprintf("%04d", actor.hp); m_hp = sprintf("%04d", actor.mhp)
- draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
- change_color(system_color)
- draw_text(x, y, 30, line_height, Vocab::hp_a)
- draw_current_and_max_values(x, y, width, c_hp, m_hp,
- hp_color(actor), normal_color)
- end#def
- def draw_actor_mp(actor, x, y, width = 124)
- c_mp = sprintf("%04d", actor.mp); m_mp = sprintf("%04d", actor.mmp)
- draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
- change_color(system_color)
- draw_text(x, y, 30, line_height, Vocab::mp_a)
- draw_current_and_max_values(x, y, width, c_mp, m_mp,
- mp_color(actor), normal_color)
- end#def
- end#Window_Base
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Overwrites: Entire status menu.
- # : WARNING! Do not use with other scripts that modify the status menu.
- # : NOTE there is 14 standard rows available for use with 360 height.
- # : This is copy-pasta, in effort to accomplish goals of new stat drawing.
- class Window_Status < Window_Selectable
- def initialize(actor)
- super(0, 0, Graphics.width, Graphics.height)
- @actor = actor
- @data = []
- refresh
- activate
- end
- #--------------------------------------------------------------------------
- # * Get Digit Count
- #--------------------------------------------------------------------------
- def col_max
- return 3
- end
- #--------------------------------------------------------------------------
- # * Get Number of Items
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # * Get Item
- #--------------------------------------------------------------------------
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- #--------------------------------------------------------------------------
- # * Get Activation State of Selection Item
- #--------------------------------------------------------------------------
- #~ def current_item_enabled?
- #~ enable?(@data[index])
- #~ end
- #--------------------------------------------------------------------------
- # * Get Item Height
- #--------------------------------------------------------------------------
- def item_height
- 20 #(height - standard_padding * 2) / 4
- end
- #--------------------------------------------------------------------------
- # * Create Item List
- #--------------------------------------------------------------------------
- #~ def make_item_list(actor)
- #~ 6.times {|bid| @data << actor.param(bid)}
- #~ 10.times {|sid| @data << actor.sparam(sid)}
- #~ 10.times {|xid| @data << actor.xparam(xid)}
- #~ end
- def refresh
- contents.clear
- # make_item_list(@actor)
- # create_contents
- # draw_all_items
- draw_block_header (line_height * 0)
- draw_block_allparams (line_height * 4)
- draw_block_explife (line_height * 0)
- end#def
- def draw_block_allparams(y = 0)
- draw_b_parameters( 20, y)
- draw_s_parameters(170, y)
- draw_x_parameters(320, y)
- draw_equipments(440, y)
- end#def
- def draw_block_header(y)
- draw_actor_face(@actor, 0, y)
- make_font_bigger(4)
- draw_actor_name(@actor, 100, y + line_height * 0)
- make_font_smaller(8)
- draw_actor_class(@actor, 100, y + line_height * 1)
- draw_actor_nickname(@actor, 100, y + line_height * 2)
- make_font_bigger(4)
- draw_actor_level(@actor, 100, y + line_height * 3)
- end#def
- def draw_block_explife(y)
- draw_actor_hp(@actor, 240, y + line_height * 0, 80)
- draw_actor_mp(@actor, 240, y + line_height * 1, 80)
- draw_actor_icons(@actor, 240, y + line_height * 2)
- draw_exp_info(370, y)
- end#def
- def draw_equipments(x, y)
- @actor.equips.each_with_index do |item, i|
- draw_item_name(item, x, y + line_height * i)
- end#each
- end#def
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Overwrites: draw_exp_info
- # : Modifies existing method to draw fixed number of digits (10).
- # : Draws in only 2 lines instead of 4 to save vertical space.
- def draw_exp_info(x, y)
- if @actor.max_level?
- s2 = "-------";
- else
- s1 = sprintf("%010d", @actor.exp)
- s2 = sprintf("%010d", (@actor.next_level_exp - @actor.exp))
- end
- s_e = sprintf("Exp.: ")#(Vocab::ExpNext, Vocab::level)
- s_n = sprintf("Next: ")#(Vocab::ExpNext, Vocab::ExpTotal)
- change_color(system_color)
- draw_text(x + 0, y + line_height * 0, 180, line_height, s_e)
- draw_text(x + 0, y + line_height * 1, 180, line_height, s_n)
- change_color(normal_color)
- draw_text(x + 64, y + line_height * 0, 180, line_height, s1)
- draw_text(x + 64, y + line_height * 1, 180, line_height, s2)
- end#def
- # Draws a 2px vertical line at the given location.
- def draw_vert_line(x, y)
- # (origin x, origin y, line_width, how tall, color)
- contents.fill_rect(x, y, 2, 200, line_color)
- end#def
- # Draws the base parameters that the database normally modifies.
- def draw_b_parameters(x, y)
- lh = line_height - 4
- make_font_smaller(4)
- 8.times {|i| draw_actor_param(@actor, x, y + lh * i, i) }
- make_font_bigger(4)
- end#def
- # Draws the secondary parameters like MCR/PDR/EXR.
- def draw_s_parameters(x, y)
- lh = line_height - 4
- make_font_smaller(4)
- 10.times {|i| draw_actor_sparam(@actor, x, y + lh * i, i) }
- make_font_bigger(4)
- end#def
- # Draws the extra parameters like Hit/crit/evade.
- def draw_x_parameters(x, y)
- lh = line_height - 4
- make_font_smaller(4)
- 10.times {|i| draw_actor_xparam(@actor, x, y + lh * i, i) }
- make_font_bigger(4)
- end#def
- end#Window_Status
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # NEW! class used explicity with this script.
- # : Draws the three categories of parameters to drill down into for details.
- class Window_Parameter_Choice < Window_Selectable
- def initialize(x, y)
- super(x, y, 460, 240)
- end#def
- def item_max
- return 30
- end
- def col_max; return 3; end
- def item_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height - 2
- rect.x = index % col_max * 150#(item_width) + spacing)
- rect.y = index / col_max * item_height + 2
- rect
- end#def
- def item_width
- (width - standard_padding * 2 + spacing) / col_max - spacing
- end#def
- def item_height
- 20#line_height
- end#def
- #--------------------------------------------------------------------------
- # * Move Cursor Down
- #--------------------------------------------------------------------------
- def cursor_down(wrap = false)
- if index == 21
- return
- else
- super(wrap)
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Right
- #--------------------------------------------------------------------------
- def cursor_right(wrap = false)
- if index == 26 || index == 23
- select(index == 23 ? 25 : 28)
- else
- super(wrap)
- end
- end
- #--------------------------------------------------------------------------
- # * Move Cursor Left
- #--------------------------------------------------------------------------
- def cursor_left(wrap = false)
- if index == 28 || index == 25
- select(index == 25 ? 23 : 26)
- else
- super(wrap)
- end
- end
- def select(index)
- super(index)
- @help_window.set_text(Vocab.paramInfo(@index))
- end
- # Writes in the horizontal list of the 3 sections.
- #def make_command_list(*args, &block)
- # add_command("B", :paramb)
- # add_command("S", :params)
- # add_command("X", :paramx)
- #end
- end#Window_Parameter_Choice
- #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # Overwrites: Scene_Status
- # : Modified to handle the new windows and methods created above.
- # : Modified to allow for parameter help descriptions.
- class Scene_Status < Scene_MenuBase
- def start
- super
- create_status_window
- create_help_window
- create_select_window
- end
- def create_status_window
- @status_window = Window_Status.new(@actor)
- @status_window.actor = @actor
- @status_window.set_handler(:cancel, method(:return_scene))
- @status_window.set_handler(:pagedown, method(:next_actor))
- @status_window.set_handler(:pageup, method(:prev_actor))
- end
- def create_help_window
- @help_window = Window_Help.new
- @help_window.viewport = @viewport
- @help_window.opacity = 0 #for visibility, will be 0 later
- @help_window.y = 310
- end
- def create_select_window
- @select_window = Window_Parameter_Choice.new(0, 96)
- @select_window.opacity = 0
- @select_window.active = true
- @select_window.help_window = @help_window
- @select_window.select(0) # Put cursor to MaxHP and draw help text for it
- end
- def on_actor_change
- @status_window.actor = @actor
- @status_window.activate
- @help_window.refresh
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement