Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // Last Modified :03/17/2012
- #==============================================================================#
- # ** FRV::STATUS
- #==============================================================================#
- module FRV
- module STATUS
- DRAW_ELEMENTS = [
- 1..9
- ]
- def self.ranks( value )
- case value
- when (-999)..(-100) ; return :f
- when (-99)..0 ; return :e
- when 1..50 ; return :d
- when 51..100 ; return :c
- when 101..150 ; return :b
- when 151..999 ; return :a # // Actually cap is 200
- end
- end
- RANK_TEXTS = {
- :a => "W",
- :b => "W",
- :c => "N",
- :d => "R",
- :e => "R",
- :f => "R"
- }
- RANK_COLORS = {
- :a => 18,
- :b => 17,
- :c => 0,
- :d => 16,
- :e => 16,
- :f => 16
- }
- #--------------------------------------------------------------------------#
- # * Convert all Ranges to Integers
- #--------------------------------------------------------------------------#
- DRAW_ELEMENTS = ::FRV.convert_integer_array( DRAW_ELEMENTS )
- end
- end
- #==============================================================================#
- # ** FRV::Window_StatusBase
- #==============================================================================#
- class FRV::Window_StatusBase < ::Window_Selectable
- attr_accessor :actor
- #--------------------------------------------------------------------------#
- # * super method :initialize
- #--------------------------------------------------------------------------#
- def initialize( actor, x, y, width, height )
- super( x, y, width, height )
- @actor = actor
- refresh()
- end
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- end
- #--------------------------------------------------------------------------
- # * Draw Parameters
- # x : Draw spot X coordinate
- # y : Draw spot Y coordinate
- #--------------------------------------------------------------------------
- def draw_parameters( x, y, param_spacing=WLH )
- draw_actor_parameter(@actor, x, y + param_spacing * 0, 0)
- draw_actor_parameter(@actor, x, y + param_spacing * 1, 1)
- draw_actor_parameter(@actor, x, y + param_spacing * 2, 2)
- draw_actor_parameter(@actor, x, y + param_spacing * 3, 3)
- end
- #--------------------------------------------------------------------------
- # * Draw Equipment
- # x : Draw spot X coordinate
- # y : Draw spot Y coordinate
- #--------------------------------------------------------------------------
- def draw_equipments( x, y )
- self.contents.font.color = system_color
- self.contents.draw_text( x, y, 120, WLH, Vocab::equip )
- for i in 0..4
- draw_item_name( @actor.equips[i], x + 16, y + WLH * (i + 1) )
- end
- end
- end
- #==============================================================================#
- # FRV::Window_StatusMain
- #==============================================================================#
- class FRV::Window_StatusMain < ::FRV::Window_StatusBase
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- create_contents()
- draw_actor_face( @actor, 0, 0 )
- draw_actor_name( @actor, 100, 4 )
- draw_actor_hp( @actor, 100, 42 )
- draw_actor_mp( @actor, 100, 56 )
- draw_actor_level( @actor, 4, 96-24 )
- draw_actor_state( @actor, 100, 26, 128 )
- draw_parameters( self.width / 2, 4 )
- end
- end
- #==============================================================================#
- # FRV::Window_StatusEquipment
- #==============================================================================#
- class FRV::Window_StatusEquipment < ::FRV::Window_StatusBase
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- create_contents()
- draw_equipments( 4, 4 )
- end
- end
- #==============================================================================#
- # FRV::Window_StatusElements
- #==============================================================================#
- class FRV::Window_StatusElements < ::FRV::Window_StatusBase
- WLH = 36 # // Default 24, try editing this in the future if you add new elements
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :actor
- #--------------------------------------------------------------------------#
- # * new method :refresh
- #--------------------------------------------------------------------------#
- def refresh()
- @elements = FRV::STATUS::DRAW_ELEMENTS
- @item_max = @elements.size
- @spacing = 2
- @column_max = 2 # // Uses 2 columns
- create_contents()
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # * Get rectangle for displaying items
- # index : item number
- #--------------------------------------------------------------------------
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = (contents.width + @spacing) / @column_max - @spacing
- rect.height = WLH
- rect.x = index % @column_max * (rect.width + @spacing)
- rect.y = index / @column_max * rect.height
- return rect
- end
- #--------------------------------------------------------------------------#
- # * new method :draw_item
- #--------------------------------------------------------------------------#
- def draw_item( index, enabled=true )
- rect = item_rect( index )
- ele = @elements[index]
- val = @actor.element_rate( ele )
- rank = FRV::STATUS.ranks( val )
- nm = $data_system.elements[ele]
- draw_icon( FRV::Icon.element( ele ), rect.x, rect.y+((rect.height-24)/2) )
- self.contents.font.size = Font.default_size - 4
- rect.x += 24 ; rect.width -= 24
- self.contents.font.bold = true
- self.contents.font.color = normal_color
- self.contents.draw_text( rect, nm )
- self.contents.font.bold = Font.default_bold
- self.contents.font.size = Font.default_size #- 2
- self.contents.font.color = text_color( FRV::STATUS::RANK_COLORS[rank] )
- rect.width -= 4
- self.contents.draw_text( rect, sprintf("%s", FRV::STATUS::RANK_TEXTS[rank]), 2 )
- #self.contents.font.color = system_color
- #self.contents.draw_text( rect, sprintf("%s%", val), 2 )
- self.contents.font.size = Font.default_size
- end
- end
- #==============================================================================#
- # Window_StatusHelp
- #==============================================================================#
- class Window_StatusHelp < IRS::Sprite_Help ; end
- #==============================================================================#
- # Scene_Status
- #==============================================================================#
- class Scene_Status < Scene_Base
- #--------------------------------------------------------------------------#
- # * overwrite method :start
- #--------------------------------------------------------------------------#
- def start()
- super()
- create_menu_background()
- @actor = $game_party.members[@actor_index]
- @help_window = Window_StatusHelp.new( 0, 0, Graphics.width, 32 )
- @status_window = FRV::Window_StatusMain.new( @actor, 0, 32,
- Graphics.width, 128+12 )
- @equip_window = FRV::Window_StatusEquipment.new( @actor,
- 0, @status_window.y + @status_window.height,
- Graphics.width/2, Graphics.height - (@status_window.y + @status_window.height) - 32 )
- @element_window= FRV::Window_StatusElements.new( @actor,
- Graphics.width/2, @status_window.y + @status_window.height,
- Graphics.width/2, Graphics.height - (@status_window.y + @status_window.height) - 32 )
- @inputhelp_window = Window_StatusHelp.new( 0, Graphics.height-32, Graphics.width, 32 )
- @inputhelp_window.align = 1
- @inputhelp_window.set_text("Use A and S to switch Characters")
- # // ----------------------------------------------------------------- // #
- @menuback_sprite.bitmap = Cache.system( "Menu_background" )
- @menuback_sprite.opacity= 255
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :terminate
- #--------------------------------------------------------------------------#
- def terminate()
- super()
- dispose_menu_background()
- @help_window.dispose()
- @status_window.dispose()
- @equip_window.dispose()
- @element_window.dispose()
- @inputhelp_window.dispose()
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :update
- #--------------------------------------------------------------------------#
- def update()
- update_menu_background()
- @status_window.update()
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene()
- elsif Input.trigger?(Input::Y)
- Sound.play_cursor
- next_actor()
- elsif Input.trigger?(Input::X)
- Sound.play_cursor
- prev_actor()
- end
- super()
- end
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment