Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # DRG Inventory System VX Compatibility Patch
- # Version: 1.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- "Place Above DRG Inventory System"
- #==============================================================================
- # ** Window_Selectable
- #------------------------------------------------------------------------------
- # This window class contains cursor movement and scroll functions.
- #==============================================================================
- if defined?(Window_ActorCommand)
- class Window_Selectable_Drago < Window_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_reader :index,:help_window # cursor position and help window
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item_max, @column_max, @index = 1,1,-1
- end
- #--------------------------------------------------------------------------
- # * Set Cursor Position
- #--------------------------------------------------------------------------
- def index=(index)
- @index = index
- update_help if self.active and @help_window != nil
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Get Row Count
- #--------------------------------------------------------------------------
- def row_max() (@item_max + @column_max - 1) / @column_max end
- #--------------------------------------------------------------------------
- # * Get Top Row
- #--------------------------------------------------------------------------
- def top_row() self.oy / 32 end
- #--------------------------------------------------------------------------
- # * Set Top Row
- #--------------------------------------------------------------------------
- def top_row=(row) self.oy = [[row,0].max, row_max-1].min * 32 end
- #--------------------------------------------------------------------------
- # * Get Number of Rows Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_row_max() (self.height - 32) / 32 end
- #--------------------------------------------------------------------------
- # * Get Number of Items Displayable on 1 Page
- #--------------------------------------------------------------------------
- def page_item_max() page_row_max * @column_max end
- #--------------------------------------------------------------------------
- # * Set Help Window
- #--------------------------------------------------------------------------
- def help_window=(help_window)
- @help_window = help_window
- update_help if self.active and @help_window != nil
- end
- #--------------------------------------------------------------------------
- # * Update Cursor Rectangle
- #--------------------------------------------------------------------------
- def update_cursor_rect
- return self.cursor_rect.empty if @index < 0
- row = @index / @column_max
- self.top_row = row if row < self.top_row
- if row > self.top_row + (self.page_row_max - 1)
- self.top_row = row - (self.page_row_max - 1)
- end
- cursor_width = self.width / @column_max - 32
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- self.cursor_rect.set(x, y, cursor_width, 32)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- if self.active and @item_max > 0 and @index >= 0
- if Input.repeat?(Input::DOWN)
- if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
- @index < @item_max - @column_max
- Sound.play_cursor
- @index = (@index + @column_max) % @item_max
- end
- end
- if Input.repeat?(Input::UP)
- if (@column_max == 1 and Input.trigger?(Input::UP)) or
- @index >= @column_max
- Sound.play_cursor
- @index = (@index - @column_max + @item_max) % @item_max
- end
- end
- if Input.repeat?(Input::RIGHT)
- if @column_max >= 2 and @index < @item_max - 1
- Sound.play_cursor
- @index += 1
- end
- end
- if Input.repeat?(Input::LEFT)
- if @column_max >= 2 and @index > 0
- Sound.play_cursor
- @index -= 1
- end
- end
- if Input.repeat?(Input::R)
- if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
- Sound.play_cursor
- @index = [@index + self.page_item_max, @item_max - 1].min
- self.top_row += self.page_row_max
- end
- end
- if Input.repeat?(Input::L)
- if self.top_row > 0
- Sound.play_cursor
- @index = [@index - self.page_item_max, 0].max
- self.top_row -= self.page_row_max
- end
- end
- end
- update_help if self.active and @help_window != nil
- update_cursor_rect
- end
- end
- #==============================================================================
- # ** Window_InputNumber
- #------------------------------------------------------------------------------
- # This window is for inputting numbers, and is used within the
- # message window.
- #==============================================================================
- class Window_InputNumber < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- # digits_max : digit count
- #--------------------------------------------------------------------------
- def initialize(digits_max)
- @digits_max = digits_max
- @number = 0
- # Calculate cursor width from number width (0-9 equal width and postulate)
- dummy_bitmap = Bitmap.new(32, 32)
- @cursor_width = dummy_bitmap.text_size("0").width + 8
- dummy_bitmap.dispose
- super(0, 0, @cursor_width * @digits_max + 32, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.z += 9999
- self.opacity = 0
- @index = 0
- refresh
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Get Number
- #--------------------------------------------------------------------------
- def number
- return @number
- end
- #--------------------------------------------------------------------------
- # * Set Number
- # number : new number
- #--------------------------------------------------------------------------
- def number=(number)
- @number = [[number, 0].max, 10 ** @digits_max - 1].min
- refresh
- end
- #--------------------------------------------------------------------------
- # * Cursor Rectangle Update
- #--------------------------------------------------------------------------
- def update_cursor_rect
- self.cursor_rect.set(@index * @cursor_width, 0, @cursor_width, 32)
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- # If up or down directional button was pressed
- if Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)
- $game_system.se_play($data_system.cursor_se)
- # Get current place number and change it to 0
- place = 10 ** (@digits_max - 1 - @index)
- n = @number / place % 10
- @number -= n * place
- # If up add 1, if down substract 1
- n = (n + 1) % 10 if Input.repeat?(Input::UP)
- n = (n + 9) % 10 if Input.repeat?(Input::DOWN)
- # Reset current place number
- @number += n * place
- refresh
- end
- # Cursor right
- if Input.repeat?(Input::RIGHT)
- if @digits_max >= 2
- Sound.play_cursor
- @index = (@index + 1) % @digits_max
- end
- end
- # Cursor left
- if Input.repeat?(Input::LEFT)
- if @digits_max >= 2
- Sound.play_cursor
- @index = (@index + @digits_max - 1) % @digits_max
- end
- end
- update_cursor_rect
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = normal_color
- s = sprintf("%0*d", @digits_max, @number)
- for i in 0...@digits_max
- self.contents.draw_text(i * @cursor_width + 4, 0, 32, 32, s[i,1])
- end
- end
- end
- end
- $drg_inv_sys_vx = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement