Advertisement
dyalgi

BFK CORE

Apr 24th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.72 KB | None | 0 0
  1. #--------------------------------------------------------------------------
  2. # BFK CORE (BY RAVEN) - v1.0 -
  3. #--------------------------------------------------------------------------
  4. # * Arquivo com mas ferramentas para executar scripts BFK
  5. #--------------------------------------------------------------------------
  6. $registro = [] if $registro.nil?
  7. $registro << ["BFK Core",1.0]  
  8. module BFK
  9.   DEBUG = false
  10.   SHOW_POPUPS = true
  11.   attr_accessor :restext
  12.   def self.modular(nome,version)
  13.     modulo = $registro.collect{ |x| x[0] == nome && x[1]>= version}
  14.     if !modulo.include?(true)
  15.       msgbox("Não foi encontrado o Script #{nome} versão maior que #{version}")
  16.       exit
  17.     else
  18.       return true
  19.     end
  20.   end
  21.  
  22.   def self.calc_porcent(quant,cem)
  23.     porcento = (quant * 100)/cem
  24.   end
  25.  
  26.   #--------------------------------------------------------------------------
  27.   # * FUNÇÃO QUE AUXILIA NA BUSCA DE TAGS (ESTA FUNÇÃO SERÁ MODIFICADA PELAS ATUALIZAÇÕES
  28.   #--------------------------------------------------------------------------
  29.   def self.find_map_note(rgx)
  30.     map = $game_map.get_map
  31.     l_note = map.note.scan(rgx)
  32.     l_note.each{ |off|
  33.       return true if off
  34.     }
  35.       return false
  36.     end
  37.  
  38.   def self.search_rgx(nota,rgxstart,rgxend)
  39.       @notecontent = ""
  40.       @rgx_start = false
  41.       nota.split(/[\r\n]+/).each { |line|
  42.       next if line.empty?
  43.       case line
  44.         when rgxstart
  45.           @rgx_start = true
  46.         when rgxend
  47.           @rgx_start = false
  48.         else
  49.           if @rgx_start
  50.             @notecontent += line
  51.           end
  52.         end
  53.       }
  54.       return @notecontent
  55.     end
  56.  
  57.   #--------------------------------------------------------------------------
  58.   # * Traduz uma string de acordo com uma matiz
  59.   #     qqvalue : texto a ser traduzido
  60.   #     index   : matriz de tradução
  61.   #--------------------------------------------------------------------------
  62.   def self.trans(qqvalue,index=nil)
  63.     return qqvalue.capitalize if !index[qqvalue] && Vocab.method_defined?(qqvalue) == false
  64.     return index[qqvalue].capitalize if index[qqvalue]
  65.     return Vocab::qqvalue.capitalize if Vocab::qqvalue
  66.   end
  67. end
  68. #==============================================================================
  69. # ** Game_Map
  70. #------------------------------------------------------------------------------
  71. #  Esta classe altera o comportamento da classe original sem modifica-la
  72. #==============================================================================
  73. class Game_Map
  74.   attr_accessor :map
  75.   def get_map
  76.     @map
  77.   end
  78.  
  79.   def set_map_steps(steps)
  80.     @map.encounter_step = steps
  81.   end
  82.   def set_map_troop_freq(id,cent)
  83.     @map.encounter_list[id].weight = cent
  84.   end
  85. end
  86. #==============================================================================
  87. # ** Window_Base
  88. #------------------------------------------------------------------------------
  89. #  This is a superclass of all windows in the game.
  90. #==============================================================================
  91.  
  92. class Window_Base < Window
  93.   #--------------------------------------------------------------------------
  94.   # * Desenho do nome de itens
  95.   #     item    : objeto
  96.   #     x       : coordenada X
  97.   #     y       : coordenada Y
  98.   #     enabled : habilitar flag, translucido quando false
  99.   #     width   : largura
  100.   #--------------------------------------------------------------------------
  101.   alias draw_item_name_space draw_item_name
  102.   def draw_item_name(item, x, y, enabled = true, width = 172)
  103.     return unless item
  104.     draw_icon(item.icon_index, x, y, enabled)
  105.     change_color(normal_color, enabled)
  106.     draw_text(x + 32, y, width, line_height, item.name)
  107.   end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement