terça-feira, 30 de abril de 2013

Rádio trans comercial

Click na imagem 


A Rádio trans comercial tem como objetivo principal levar até você 
Entretenimento musical diferenciado e variado
Agradando assim vários públicos 


Direção do Locutor Goiano Silva

segunda-feira, 15 de abril de 2013

Quebrando a senha de um Roteador Cisco (reset de senha)


Caso você precise acessar o roteador e não souber a senha, existe um procedimento para “quebrar” a senha, muito simples, porém pouco conhecido entre os usuários iniciantes. Segue o passo-a-passo abaixo:
1) Abrir o Hiperterminal e reinicializar o router: Abra uma sessão do terminal com o cabo de console conectado ao roteador e reinicie-o fisicamente (no botão liga/desliga).
2) Fazer o roteador entar em Rommon: Após 5 segundos aproximadamente, pressionar simultaneamente as teclas ctrl + break. Este procedimento interrompe a seqüência normal do boot e inicia o Rom Monitor, no prompt conforme abaixo.
rommon 1 >
3) Alterar o registro de configuração para 0×2142: Em rommon é necessário trocar o registro de configuração para que o roteador seja reinicializado sem carregar sua configuração contida na NVRAM (startup-config), desta forma nenhuma senha será carregada e o roteador iniciará em modo setup como se estivesse “zerado”.
rommon 1 > confreg 0×2142
rommon 2 > reset
Em routers mais antigos o comando pode ser “o/r 0×2142“.
O comando “i” também tem a mesma função do “reset“.
4) Sair do modo setup: Após reinicializar o roteador, ele será carregado sem nenhuma configuração. Isso não significa que a configuração foi apagada, apenas significa que a mesma não foi carregada, ela continua presente na NVRAM e você pode verificar com o comando “show startup-config“.
Na inicialização, pelo motivo do roteador estar desconfigurado, ele vem com a pergunta para iniciar o setup dialog. Vamos responder que não para termos acesso ao CLI.
Would you like to enter the initial configuration dialog? [yes/no]:N
Digite “no”, “n” ou pressione as teclas control+C.
5) Em seguida vamos carregar o arquivo de configuração na memória RAM:
router>enable (o router não pedirá senha, pois ainda não foi carregada na configuração)
router#copy startup-config running-config
6) Trocar as senhas e tirar as interfaces de shutdown: Como o processo de copiar da NVRAM para a RAM faz um “merge”, além do procedimento acima, é necessário tirar as interfaces de shutdown. Também não podemos esquecer de alterar as senhas (enable, console e VTY) antes de gravar a configuração novamente na NVRAM.
7) Voltar o registro de configuração para o valor padrão (0×2102) e gravar a config: Após tirar as interfaces de shutdown, deveremos voltar o registro para o padrão normal para que ele desta vez carregue o arquivo de configuração.
O código de registro 0×2142 faz que o roteador ignore o arquivo de backup contido na NVRAM. O registro 0×2102 que é o padrão, carrega o arquivo de backup da NVRAM para a memória RAM.
router(config)#config-register 0×2102
router#copy running-config startup-config
router#reload
Para verificar se o valor do registro de configuração está correto após a inicialização utilize o comando “show version“.
Espero que vocês tenham gostado do post e até a próxima!

domingo, 14 de abril de 2013

Jogo Buguelo




*****************************************************
Buguelo
E desenvolvimento voltado aos Demos
Nos deselvolves em cima do projeto
Chamados de software livre
A pedido da galera colocamos o FullDemo a disposição
Obs: não samos criadores
Porrisso nao mandaremos o codigo aberto

*****************************************************

http://moisesmonteiro20xx.blogspot.com.br/


Link do Jogo para baixar : Buguelo

http://www.4shared.com/zip/kgbQPwW1/FullDemo001.html

quarta-feira, 3 de abril de 2013

RPGMAKERVXACE - Mostra icone do item


#==============================================================================
# ★ RGSS3_Popup Icon Ver1.2
#==============================================================================
=begin

Autor:tomoaky
website: Hikimoki (http://hikimoki.sakura.ne.jp/)

Mostra icone do item ao abrir baus ou coletar itens.
Mostra um icone sobre um evento ou Player.

Para mostar o icone use o seguinte comando no "Chamar Script"
  pop_icon(event_id, icon_id, duration)
 
  event_id é o Id do evento que ira sofrer a ação
  icon_id é o index do icon a ser usado。
  se o "event_id" for "0" será tratado como o evento que o invocou
  -1 é o player
  duration é a duração do evento ( em frames)
 
  EX:)pop_icon(-1, 17, 300)
  Isso ira exibir um icone no player por 5 segundos.
 
  Um pop_icon Não será exibido seguido do outro
  Use delete_icon com espera de alguns frames
  para evibir pop_icon Seguidos。
 
  EX)delete_icon(-1)
  Para revover o icone do personagem
 
Variavéis usadas (padrão do Script)
  0006
 
2012.01.19  Ver1.2
 ・Adicionado o comando delete_icon.
 ・Erro de popup corrigido.
 
2011.12.21  Ver1.11
 ・Corrigido o erro de exibição no evento demasiado "0"
 
2011.12.17  Ver1.1
 ・Adicionado tempo de exibição

2011.12.15  Ver1.0
  Publicação.

=end

#==============================================================================
# □ Configuração.
#==============================================================================
module TMICPOP
  GRAVITY = 24              # Gravidade de acordo com o Icone
  SPEED   = -320            # Velocidade
 
  VN_TARGET = 6             # Variavel de atribuição do icone.
end

#==============================================================================
# □ コマンド
#==============================================================================
module TMICPOP
module Commands
  #--------------------------------------------------------------------------
  # ○ アイコンポップの開始
  #--------------------------------------------------------------------------
  def pop_icon(event_id, icon_id, duration = 120)
    target = get_character(event_id)
    return unless target
    target.icpop_id = icon_id
    target.icpop_duration = duration
  end
  #--------------------------------------------------------------------------
  # ○ アイコンポップの削除
  #--------------------------------------------------------------------------
  def delete_icon(event_id)
    target = get_character(event_id)
    return unless target
    target.icpop_delete_flag = true
  end
end
end # module TMICPOP

#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
  #--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_accessor :icpop_id                 # アイコンポップ ID
  attr_accessor :icpop_duration           # アイコンポップ 表示時間
  attr_accessor :icpop_delete_flag        # アイコンポップ 削除フラグ
  #--------------------------------------------------------------------------
  # ● 公開メンバ変数の初期化
  #--------------------------------------------------------------------------
  alias tmicpop_game_characterbase_init_public_members init_public_members
  def init_public_members
    tmicpop_game_characterbase_init_public_members
    @icpop_id = 0
    @icpop_duration = 0
    @icpop_delete_flag = false
  end
end

#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     character : Game_Character
  #--------------------------------------------------------------------------
  alias tmicpop_sprite_character_initialize initialize
  def initialize(viewport, character = nil)
    @icpop_duration = 0
    tmicpop_sprite_character_initialize(viewport, character)
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  alias tmicpop_sprite_character_dispose dispose
  def dispose
    dispose_icpop
    tmicpop_sprite_character_dispose
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  alias tmicpop_sprite_character_update update
  def update
    update_icpop
    tmicpop_sprite_character_update
  end
  #--------------------------------------------------------------------------
  # ● 新しいエフェクトの設定
  #--------------------------------------------------------------------------
  alias tmicpop_sprite_character_setup_new_effect setup_new_effect
  def setup_new_effect
    tmicpop_sprite_character_setup_new_effect
    if !@icpop_sprite && @character.icpop_id > 0
      @icpop_id = @character.icpop_id
      @character.icpop_id = 0
      start_icpop
    end
  end
  #--------------------------------------------------------------------------
  # ○ アイコンポップ表示の開始
  #--------------------------------------------------------------------------
  def start_icpop
    dispose_icpop
    @icpop_duration = @icpop_duration_max = @character.icpop_duration
    @icpop_sprite = ::Sprite.new(viewport)
    @icpop_sprite.bitmap = Cache.system("IconSet")
    @icpop_sprite.src_rect.set(@icpop_id % 16 * 24, @icpop_id / 16 * 24, 24, 24)
    @icpop_sprite.ox = 12
    @icpop_sprite.oy = 24
    @icpop_y_plus = 0
    @icpop_y_speed = TMICPOP::SPEED
    update_icpop
  end
  #--------------------------------------------------------------------------
  # ○ アイコンポップの解放
  #--------------------------------------------------------------------------
  def dispose_icpop
    @character.icpop_delete_flag = false
    if @icpop_sprite
      @icpop_sprite.dispose
      @icpop_sprite = nil
    end
  end
  #--------------------------------------------------------------------------
  # ○ アイコンポップの更新
  #--------------------------------------------------------------------------
  def update_icpop
    if @icpop_duration > 0
      @icpop_duration -= 1
      if @character.icpop_delete_flag
        @icpop_duration = 0
        dispose_icpop
      elsif @icpop_duration > 0
        @icpop_sprite.x = x
        @icpop_y_plus += @icpop_y_speed
        @icpop_y_speed += TMICPOP::GRAVITY
        if @icpop_y_plus > 0
          @icpop_y_plus = 0 - @icpop_y_plus
          @icpop_y_speed = 0 - @icpop_y_speed / 2
        end
        @icpop_sprite.y = y - height + (@icpop_y_plus / 256)
        @icpop_sprite.z = z + 200
        @icpop_sprite.opacity = (@icpop_duration < 16 ? @icpop_duration * 16 :
          (@icpop_duration_max - @icpop_duration) * 32)
      else
        dispose_icpop
        @character.icpop_id = 0
      end
    end
  end
end

#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event
  include TMICPOP::Commands
  #--------------------------------------------------------------------------
  # ○ キャラクターの取得
  #     param : -1 ならプレイヤー、0 ならこのイベント、それ以外はイベント ID
  #--------------------------------------------------------------------------
  def get_character(param)
    if param < 0
      $game_player
    else
      $game_map.events[param > 0 ? param : @id]
    end
  end
end

#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
  include TMICPOP::Commands
  #--------------------------------------------------------------------------
  # ● アイテムの増減
  #--------------------------------------------------------------------------
  alias tmicpop_game_interpreter_command_126 command_126
  def command_126
    tmicpop_game_interpreter_command_126
    value = operate_value(@params[1], @params[2], @params[3])
    if value > 0
      if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
        item = $data_items[@params[0]]
        pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 武器の増減
  #--------------------------------------------------------------------------
  alias tmicpop_game_interpreter_command_127 command_127
  def command_127
    tmicpop_game_interpreter_command_127
    value = operate_value(@params[1], @params[2], @params[3])
    if value > 0
      if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
        item = $data_weapons[@params[0]]
        pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 防具の増減
  #--------------------------------------------------------------------------
  alias tmicpop_game_interpreter_command_128 command_128
  def command_128
    tmicpop_game_interpreter_command_128
    value = operate_value(@params[1], @params[2], @params[3])
    if value > 0
      if $game_variables[TMICPOP::VN_TARGET] >= -1 && !$game_party.in_battle
        item = $data_armors[@params[0]]
        pop_icon($game_variables[TMICPOP::VN_TARGET], item.icon_index)
      end
    end
  end
end

RPGMAKERVXACE - Sistema Mouse


# ================================================= ==============================
# Sistema Mouse (RGSS3)
# Por Jet10985 (Jet)
# Código Alguns por: Woratana, Berka
# Usa: Caminho listra-92 de encontrar
# Super Teste Ajuda / Debug Heavy / Solicitado por: Nathaniel (Beleren)
# ========================== ================================================== ===
# Este script irá permitir a plena utilização do rato dentro de RMVX para vários
fins #.
# Este script tem:. 7 opções de personalização
# =================== ================================================== ==========
# Métodos sobrescritos:
# Game_Player: move_by_input
# ------------------------------- ------------------------------------------------
# alias métodos:
# Scene_Map: atualização, terminar, update_transfer_player
# Entrada:? atualização, gatilho, de imprensa, de repetição, dir4, dir8?
# Window_Selectable: atualização, top_row =
# Scene_File: update
# Window_NameInput: update
# Game_Temp: inicializar
# Game_Event: inicializar , atualização
# =============================================== ================================ = começar Mostrando texto acima evento quando mouse passa: Se você quer uma mensagem para aparecer mais cabeça de um evento quando o mouse está pairando sobre o evento, colocar este comentário no evento: MENSAGEM DE TEXTO mouse aqui tudo depois do texto será a exibição pairando. ------------------ -------------------------------------------------- ------------ imagem do mouse Alterar acima evento quando mouse passa: Se você quiser que a imagem do mouse para alterar temporariamente whne sobre um evento, coloque este comentário em caso MOUSE PIC nome / número , se você colocar um nome, o mouse torna-se esse quadro, mas se você colocar um número em seguida, o rato vai se tornar o ícone que é o número de identificação ----------------------- -------------------------------------------------- ------- específicos do mouse clique em vias de movimento: Se você quiser que o jogador pousar especificamente em um quadrado em torno de um evento quando eles clique para mover sobre o evento, coloque um desses comentários no evento: Mova o mouse para cima / esquerda / direita / baixo só colocar a direção que você quer que o jogador pousar. --------------------------------- ----------------------------------------------- Clique para ativar : Se você quiser que um evento para iniciar automaticamente quando é clicado, coloque isso em um comentário evento: clique do mouse -------------------------- -------------------------------------------------- ---- Não pare o jogador ao caminhar sobre um evento de toque: Por padrão, este script vai parar um rato causou movimento se o jogador anda acima / abaixo um evento de toque jogador touch / evento. Se você deseja que o evento para ativar, mas para o jogador a continuar caminhando ao seu destino, colocar este comentário no evento: MOUSE nostop ---------------------- -------------------------------------------------- -------- Ignorar Eventos: Para ter um evento ser ignorado quando o mouse faz seu caminho de movimento (como se o evento não está lá), colocar este comentário no evento: mouse através ------ -------------------------------------------------- ------------------------ Notas extras: Em janelas selecionáveis ​​que têm mais itens do que o que é mostrado, os jogadores podem ou colocar o mouse abaixo da janela para rolar para baixo , ou usar o mouse de roda de rolagem para rolar para cima / para baixo. Você pode ativar eventos de botão de ação por estar ao lado do evento e clicando sobre ele com o mouse. = fim JetMouse módulo   # Se você estiver usando um gráfico, é isso.   # Deve ser no Gráficos / pasta System.   CURSOR_PICTURE = "cursor do mouse"   # Se você não estiver usando um gráfico, este ícone será o mouse.   # Para usar o ícone, basta colocar uma imagem inexistente como o acima configuração   ICON_INDEX = 387   # Você quer que o jogador seja capaz de se mover, clicando o mouse?   ALLOW_MOUSE_MOVEMENT = true   # Você quer o movimento do mouse para fazer 8-dir a pé?   # Requer 8-Dir Walking pelo Jet.   DO_8DIR_WALKING = false   # Girar esta chave vai fazer o mouse invisível e unusuable até   # o interruptor estiver desligado   TURN_MOUSE_OFF_SWITCH = 20   # Você quer o mouse para verificar a rolagem da roda do mouse em selectbale   # windows? Não usar isso pode reduzir alguns raros casos de defasagem.   USE_WHEEL_DETECTION = false   # Você quer usar a fórmula de Dijkstra para pathfinding?   # Este é mais preciso, mas mais lento.   USE_DIJKSTRA = true end # ========== ================================================== =================== # NÃO edite mais se você não sabe o que fazer. # ================= ================================================== ============ módulo Rato   Get_Message = Win32API.new ('user32', 'GetMessage', 'plll', 'l')   GetAsyncKeyState = Win32API.new ("user32", "GetAsyncKeyState", 'i', 'i')   = GetKeyState Win32API.new ("user32", "GetKeyState", 'i', 'i')   = SetCursorPos Win32API.new ('user32', 'SetCursorPos', 'nn', 'n ')   = GetCursorPo Win32API.new ('user32', 'GetCursorPos', 'p', 'i')   = ScreenToClient Win32API.new ('user32', 'ScreenToClient', 'lp', 'i')   = FindWindowA Win32API. novo ('user32', 'FindWindowA', 'PP', 'l')   GetClientRect = Win32API.new ('user32', 'GetClientRect', 'lp', 'i')   = GetWindowRect Win32API.new ('user32', 'GetWindowRect', 'lp', 'i')   = conteúdo File.open ('Game.ini', 'r') {| f | f.read}   q = conteúdo [Título / = (+) /.]. nulo? ? "Cccc": US $ 1   = @ alça FindWindowA.call ('RGSS jogador', q)   module_function   Ponto = Struct.new (: x,: y)   = Mensagem Struct.new (: mensagem,: wparam,: lparam,: pt)   Param = Struct.new (: x,: y,: scroll)   Scroll = 0x0000020A   def HIWORD (dword); retorno ((dword & 0xFFFF0000) >> 16) &0x0000ffff; final   def LOWORD (dword); dword retorno &0x0000ffff; final   def word2signed_short (valor )     valor de retorno if (value & 0x8000) == 0     retorno -1 * ((valor ~ & 0x7fff) + 1)   end   def unpack_dword (buffer, offset = 0)     ret = buffer [deslocamento + 0] & 0x000000FF     ret | = buffer ([deslocamento + 1 ] << (8 * 1)) & 0x0000ff00     ret | = (buffer [deslocamento + 2] << (8 * 2)) & 0x00ff0000     ret | = (buffer [deslocamento + 3] << (8 * 3)) & 0xff000000     ret retorno   final   def unpack_msg (buffer)     msg = Message.new; msg.pt = Point.new     msg.message = unpack_dword (buffer, 4 * 1)     = msg.wparam unpack_dword (buffer, 4 * 2)     = msg.lparam unpack_dword (tampão , 4 * 3)     = msg.pt.x unpack_dword (buffer, 4 * 5)     = msg.pt.y unpack_dword (buffer, 4 * 6)     retorno msg   final   def wmcallback (msg)     o retorno a menos msg.message == Vá     param = Param.new     param.x = word2signed_short (LOWORD (msg.lparam))     = param.y word2signed_short (HIWORD (msg.lparam))     = param.scroll word2signed_short (HIWORD (msg.wparam))     retorno param [param.x, . y, param.scroll]   final   clique def? (botão)     return false se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     verdadeiro retorno if@keys.include? (botão)     return false   end   def imprensa? (botão)     return false se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     retorno if@press.include verdade? (botão)     return false   end   def set_pos (x_pos = 0, y_pos = 0)     largura, altura = client_size     if (x_pos.between? (0, largura) && y_pos. entre? (0, altura))       SetCursorPos.call (client_pos [0] + x_pos, client_pos [1] + y_pos)     final   final   de atualização def     retorno se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     @ pos = Mouse.pos     @ chaves, @ pressione = [], []     @ keys.push (1) se GetAsyncKeyState.call (1) & 0x01 == 1     @ keys.push (2) se GetAsyncKeyState.call (2) & 0x01 == 1     @ keys.push (3) se GetAsyncKeyState.call (4) & 0x01 == 1     @ press.push (1) se pressionado? (1)     @ press.push (2) se pressionado? (2)     @ press.push (3) se pressionado? (4)   final   def pressionado? (key)     return true menos GetKeyState.call (chave). entre? (0, 1)     return false   end   def global_pos     pos = [0, 0] embalagem. ('ll')     GetCursorPo.call (pos)! ? = 0 (retorno pos.unpack ('ll')): (retorno [0, 0])   end   def pos     retorno 0, 0 se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     x, y = screen_to_client (* global_pos)     , largura height = client_size     começam       x = 0 se x <= 0, y = 0 se y <= 0       x = largura if x> = largura; y = altura se y> = altura       retorno x, y     final   fim   def screen_to_client (x, y )     retornar zero, a menos que x && y     pos = [x, y] embalagem. ('ll')     ) ScreenToClient.call (@ punho, pos) = 0 (retorno pos.unpack ('ll'!?): (retorno [0 , 0])   end   def client_size     rect = [0, 0, 0, 0]. pack ('l4')     GetClientRect.call (@ alça, rect)     inferior direito, rect.unpack = ('l4') [2 .. 3]     retorne para a direita, de baixo   final   def client_pos     rect = [0, 0, 0, 0]. pack ('l4')     GetWindowRect.call (@ alça, rect)     à esquerda, superior = rect.unpack ('l4') [0 .. 1]     retorno deixaram + 4, superior + 30   final   grade def     retorno [-1, -1] se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     retorno [-1, -1] if@pos.nil?     retorno [(@ pos [0] / 32), (@ pos [1] / 32)]   end   def true_grid     retorno [grid [0] + $ game_map.display_x / 256, grade [1] + $ game_map.display_y / 256]   final   área def ? (x, y, largura, altura)     return false se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     voltar if@pos.nil falso?     retorno @ pos [0]. entre? (x, x + largura) && @ pos [1 .?] entre (y, altura + y)   end   def rolagem     msg = "\ 0" * 32; Get_Message.call (msg, 0,0,0), r = wmcallback (unpack_msg (msg))     r retorno se r! . nulo?   final final Sprite_Cursor classe <Sprite_Base   attr_accessor: current_cursor,: not_default   incluem JetMouse   def initialize     super-     current_cursor @ = ""     @ not_default = false     Win32API.new ('user32', 'ShowCursor', 'i', 'i'). chamar (0)     self.z = 5004     create_cursor (CURSOR_PICTURE)     $ game_switches = []     atualização   final   create_cursor def (cursor = "")     self.bitmap.dispose menos self.bitmap.nil?     self.bitmap = nil     começar       self.bitmap = Cache.system (cursor)       @ = current_cursor cursor     salvamento       self.bitmap Bitmap.new = (24, 24)       = bitmap Cache.system ("Iconset")       = rect Rect.new (ICON_INDEX% 16 * 24, ICON_INDEX / 16 * 24 , 24, 24)       self.bitmap.blt (0, 0 bitmap, rect)       @ current_cursor = ICON_INDEX     final     @ not_default = false   final   change_cursor def (cursor)     self.bitmap.dispose menos self.bitmap.nil?     self.bitmap = nil     começar       self.bitmap = Cache.system (cursor)       @ current_cursor = cursor       @ not_default = true     resgate       começar         self.bitmap = Bitmap.new (24, 24)         = bitmap Cache.system ("Iconset")         rect = Rect.new ( cursor 16% * 24 cursor, / 16 * 24, 24, 24)         self.bitmap.blt (0, 0 bitmap, rect)         @ current_cursor = cursor         @ not_default = true       resgate         create_cursor (CURSOR_PICTURE)       final     final   final   de atualização def      retorno se self.disposed?     se $ game_switches [TURN_MOUSE_OFF_SWITCH]       self.opacity = 0 a menos self.opacity == 0     final     self.opacity = 255 a menos self.opacity == 255     Super     x = self.x     y = self.y     self.x, self.y = Mouse.pos     self.x - = 8 se @ not_default     self.y - = 8 se @ not_default   final fim $ cursor = Sprite_Cursor.new módulo de entrada   classe << auto     jet5888_press alias? pressionar? unless $ @     def imprensa? (arg)       Se arg == Input :: C         return true se Mouse.press? (1)       elsif arg == Entrada B ::         return true se Mouse.press? (2)       final       jet5888_press? (arg )     final     jet5888_repeat alias? repetir? unless $ @     def repetição? (arg)       Se arg == Input :: C         return true se Mouse.click? (1)       elsif arg == Entrada B ::         return true se Mouse.click? (2)       final       jet5888_repeat? (arg )     final     jet5888_trigger alias? gatilho? unless $ @     def gatilho? (arg)       Se arg == Input :: C         return true se Mouse.click? (1)       elsif arg == Entrada B ::         return true se Mouse.click? (2)       final       jet5888_trigger? (arg )     final     apelido atualização jet8432_update unless $ @     def update (* args, bloco &)       jet8432_update (* args, bloco &)       se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH] && $ cursor.opacity! = 0         = 0 $ cursor.opacity       final       cursor $. atualizar a menos que $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]       Mouse.update a menos que $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     finais     apelido jet1626_dir4 dir4 unless $ @     def dir4 (* args, bloco &)       se! $ game_temp.nil?         se game_temp.move_because_of_mouse $           se ! $ game_temp.mouse_path.empty? && $ Game_player.movable? &&               ! $ game_map.interpreter.running? && SceneManager.scene_is? (Scene_Map) &&               jet1626_dir4 (* args, bloco e) == 0             f = $ game_temp.mouse_path.reverse!. pop             $ game_temp.mouse_path.reverse!             retorno f * 2           mais             game_temp.move_because_of_mouse $ = false             $ game_temp . mouse_path = []           end         end       end       jet1626_dir4 (* args, bloco &)     end     apelido jet1626_dir8 dir8 unless $ @     def dir8 (* args, bloco &)       se! $ game_temp.nil?         se $ game_temp.move_because_of_mouse           se! $ game_temp.mouse_path.empty ? && $ Game_player.movable? &&               ! $ game_map.interpreter.running? && SceneManager.scene_is? (Scene_Map) &&               jet1626_dir8 (* args, bloco e) == 0             f = $ game_temp.mouse_path.reverse!. pop             $ game_temp.mouse_path.reverse!             se [1, 2, 3, 4]. incluir? (f)               de retorno f * 2             mais               f caso               quando 5                 return 1               quando seis                 retorno 3               , quando sete                 retorno 7               quando 8                 9 retorno               final             final           mais             game_temp.move_because_of_mouse $ = false             $ game_temp.mouse_path = []           final         final       final       jet1626_dir8 (* args, & bloco)     final   final final classe Game_Player    def move_by_input     retornar se! móvel? | Game_map.interpreter.running $ |?     move = Input.dir4     move_straight (movimento) se movimento> 0   final final classe Game_Character   def find_mouse_path (trgt_x, trgt_y)      fake_char = Game_Character.new      fake_char.moveto (self.x, self.y)       fake_char.set_direction (self.direction)      path = []      g = MGraph.new (JetMouse :: DO_8DIR_WALKING 8: 4)     até fake_char.x == && trgt_x fake_char.y == trgt_y       se JetMouse :: USE_DIJKSTRA         path.push ( g.Dijkstra (fake_char.x, fake_char.y, trgt_x, trgt_y))       mais         path.push (g.AStar (fake_char.x, fake_char.y, trgt_x, trgt_y))       final       se o caminho [-1]! = 0         fake_char . move_straight (caminho [-1] * 2)       mais         path = []         pausa       final     final     Graphics.frame_reset     retorno path.reverse   final final classe PQueue <Matriz   def addEl (ii)     iii = 0     enquanto iii <auto && self.comprimento [iii ] <ii       iii + = 1     fim     self.insert (III, II)   final   def REMEL (ii)     iii = 0     enquanto iii <auto && self.comprimento [iii] <ii       iii + = 1     fim     self.delete_at (iii)   final   def encontrado? (ii)     i = 0     j = self.comprimento-1     ss = false     enquanto (não ss) && i <= j       mid = (i + j) / 2       se auto [meados] == ii         ff = true       mais         se auto [meados] <ii           i = meio uma         outra           j = meio-1         final       final     final     retorno ff   final final classe MGraph   attr_accessor: w,: h   attr_accessor: vizinhos   attr_accessor: passage_table   def initialize (nh, char = $ game_player)     @ w = $ game_map.width     @ h = $ game_map.height     @ vizinhos = nh     @ passage_table = Table.new (@ w @ h, nh)     for i in 0 .. @ w       para j em 0 .. @ h         para k em 1 .. nh           @ passage_table [i, j, k-1] = char.passable? (i, j, k * 2)? 1: 0           se não neighborExist (nodeOf (i, j), k)?             @ passage_table [i, j, k - 1] = 0           final         final       final     final   final   def nodeOf (x, y)     retorno y * @ w + x + um   fim   def XNode (idxNode)     retorno (idxNode-1)% @ w   final   def yNode (idxNode)     retorno (idxNode-1) / @ w   final   def neighborOf (idxNode, dir)     caso dir       quando um         retorno (idxNode + @ w)       quando 2         retorno (idxNode-1)       , quando três         de retorno (idxNode +1)       quando 4         retorno (idxNode-@ w)     final   final   neighborExist def? (idxNode, dir)     caso dir       quando um         retorno (yNode (idxNode) <@ h-1)       quando 2         retorno (XNode (idxNode)> 0)       quando 3         retorno (XNode (idxNode) <@ w-1)       , quando quatro         retorno (yNode (idxNode)> 0)     end   end   def reconstruct_path (s, t, vertices_prev)     u = t     enquanto vertices_prev [u]! = s && vertices_prev [u]! = 0       u = vertices_prev [u]     final     caso u       quando s + w @         return 1       quando s-1         return 2       s quando um         retorno 3       quando s-w @         retorno 4     acabar     retornar 0   final   def heuristic_dist (u, v)     dx = XNode (v)-XNode (u)     dy = yNode (v)-yNode (u)     retorno (dx.abs + dy.abs)   final   def Dijkstra (x1, y1 , x2, y2)     s = nodeOf (x1, y1)     = t nodeOf (x2, y2)     q = PQueue.new (1, 0)     q.addEl (s)     = vertices_dist Array.new (@ w * @ h + 1 , 9999)     vertices_prev = Array.new (@ w * @ h + 1, 0)     vertices_dist [s] = 0     , enquanto q.length> 1       d = vertices_dist [q [1]]       u = q [1]       se q.length > 2         para ii em 2 .. q.length-1           se vertices_dist [q [ii]] <d             d = vertices_dist [q [ii]]             u = q [ii]           final         final       final       se u == t         retorno reconstruct_path (s , t, vertices_prev)       final       q.remEl (u)       for i in 1 .. @ vizinhos         se @ passage_table [XNode (u), yNode (u), i - 1] == 1           v = neighborOf (u, i)           alt = vertices_dist [u] + 1           se alt <vertices_dist [v]             q.addEl (v)             vertices_dist [v] = alt             vertices_prev [v] = u           final         final       final     final     return 0   end   def AStar (x1, y1, x2, y2)     s = nodeOf (x1, y1)     = t nodeOf (x2, y2)     q = PQueue.new (1, 0)     q.addEl (s)     q1 = Array.new (@ w * @ h + 1, false)     vertices_prev = Array.new (@ w * @ h + 1, 0)     = vertices_dist Array.new (@ w * @ h + 1, 9999)     = h_score Array.new (@ w * @ h + 1, 0)     = Array f_score. novo (@ w * @ h + 1, 9999)     vertices_dist [s] = 0     h_score [s] = heuristic_dist (s, t)     f_score [s] = h_score [s]     enquanto q.length> 1       d = f_score [q [ 1]]       u = q [1]       se q.length> 2         para ii em 2 .. q.length-1           se f_score [q [ii]] <d             d = f_score [q [ii]]             u = q [ii ]           final         final       final       se u == t         retorno reconstruct_path (s, t, vertices_prev)       final       q.remEl (u)       q1 [u] = true       for i in 1 .. @ vizinhos         se @ passage_table [XNode (u), yNode ( u), i - 1] == 1           v = neighborOf (u, i)           ! se q1 [v]             = tentative_g_score vertices_dist [u] + 1             !? se q.found (v)               q.addEl (v)               tentative_is_better = true             elsif tentative_g_score <vertices_dist [v]               = true tentative_is_better             mais               tentative_is_better = false             final             se tentative_is_better               se vertices_prev [v]! = 0                 se f_score [u] <f_score [vertices_prev [v]]                   vertices_prev [v] = u                 final               mais                 vertices_prev [v] = u               final               vertices_dist [v] = tentative_g_score               h_score [v] = heuristic_dist (v, t)               f_score [v] = vertices_dist [v] + h_score [v]             final           final         final       final     final     return 0   end end classe Game_Temp   attr_accessor: move_because_of_mouse   attr_accessor: mouse_controlled_object   attr_accessor: making_path   attr_accessor: mouse_path   attr_accessor: did_mouse_change   apelido jet6742_initialize inicializar a menos que $ @   def initialize (* args, bloco &)     jet6742_initialize (* args, bloco &)     @ move_because_of_mouse = false     @ making_path = false     @ mouse_path = []   end final classe Window_Selectable   apelido jet6742_update atualizar a menos que $ @   def update (* args, bloco &)     jet6742_update (* args, bloco &)     && update_mouse se self.active self.visible   finais   apelido jet7222_top_row top_row = unless $ @   def top_row = (* args, bloco &)     @ last_cursor_move = 0 se @ last_cursor_move.nil?     @ last_cursor_move - = 1     retorno se in_rect_loop @ | | @ last_cursor_move> 0     jet7222_top_row (* args, bloco &)     @ = 10 last_cursor_move   final   update_mouse def     se JetMouse USE_WHEEL_DETECTION ::       f = Mouse.scroll       ! se f.nil?         se f [2] <0           se contents.height> self.oy && self.height - contents.height <-self.height + 32             = self.top_row self.top_row + 1           final         mais           self.top_row = self.top_row - 1 se contents.height> self.height         final       final     final     original_index = @ índice     fake_index = -2     add_x = self.viewport.nil? ? 0: self.viewport.ox     add_y = self.viewport.nil? ? 0: self.viewport.oy     self.item_max.times {| i |       rect = item_rect (i)       ? se Mouse.area (self.x - self.ox + rect.x + 16 + add_x, self.y - auto. oy + rect.y + 16 + add_y, rect.width, rect.height)         fake_index = i       final     }     @ index = fake_index == -2? original_index: fake_index     update_cursor   final final classe Scene_File   atualização wor_scefil_upd_mouse apelido unless $ @   def update (* args, bloco &)     (0 .. self.item_max - 1) cada um do | i |.       ix = @ savefile_windows [i] x.       iy = @ savefile_windows [i]. y + 48       = iw @ savefile_windows [i] largura.       ih = @ savefile_windows [i] altura.       Mouse.area se? (ix, iy, iw, ih)         @ savefile_windows [@ index]. selecionado = false         @ savefile_windows [i]. selecionado = true         @ index = i       final     final     wor_scefil_upd_mouse (* args, bloco &)   final final classe Window_NameInput   atualização wor_winnam_upd_mouse apelido unless $ @   def update (* args, bloco &)     wor_winnam_upd_mouse (* args, bloco &)     se auto. ativo e self.visible       (0 .. self.table [@ page] tamanho - 1). cada um fazer |. i |       espirre = item_rect (i)       = IRX self.x + 16 + irect.x - self.ox       Iry = self.y + 16 + irect.y - self.oy       @ index = i se Mouse.area (IRX, Iry, irect.width, irect.height)?       final     final   final final classe Window_PartyCommand   def update_mouse     (0 .. self.item_max - 1) cada um fazer | i |.     espirre = item_rect (i)     = IRX self.viewport.ox + 16 + irect.x - auto.

    IRX = self.viewport.ox + 288 + 16 + 96 + irect.x
    Iry = 288 + 16 + 64 + irect.y
    self.index = i se Mouse.area? (IRX, Iry, irect.width, irect.height )
    final
  final
final classe Window_EventPopUp <Window_Base   def initialize (x, y, largura, altura, texto)     super (x, y, largura, altura)     self.opacity = 0     @ texto = texto     atualização   final   def refresh     self.contents.clear     auto . contents.draw_text (0, 0, self.width, 24, @ texto)   final final classe Game_Event   attr_accessor: popup_window,: Página   def check_for_comment (regexp)     retornar if@list.nil falso?     para o item na lista @       se item.code == 108 ou 408 item.code ==         se! item.parameters [0] [regexp]. nulo?           retornar $ 1.nil? ? verdade: $ 1         final       final     final     return false   end   def através     verdadeiro retorno se check_for_comment (Rato / POR / i) && $ game_temp.making_path     @ return através   final   de atualização jet2734_update apelido unless $ @   def update (* args, & bloco)     jet2734_update (* args, & bloco)     update_mouse_popup     update_mouse_change   final   def update_mouse_popup     interruptor = $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     se Mouse.true_grid == [self.x, self.y] &&! && interruptor! @ apagados       f self.check_for_comment = (/ MOUSE texto (. +) / i)       , se f = falso!         Bitmap.new q = (1, 1)         = tamanho q.text_size (f)         x = self.screen_x - 16 - Size.Width / 2         tamanho - y = self.screen_y - 52 . altura / 2         se self.popup_window! = nil           self.popup_window.dispose           self.popup_window = nil         final         self.popup_window Window_EventPopUp.new = (x, y,           Size.Width + 34, Size.Height + 34, f)         q. dispor         q = nil       final     mais       se self.popup_window! = nil         self.popup_window.dispose         self.popup_window = nil       final     final   final   update_mouse_change def     se Mouse.true_grid == [self.x, self.y]       f = self.check_for_comment (( / salvamento MOUSE PIC (. +) / i) falso)       se f! = false         se f.to_i! = 0           $ cursor.change_cursor (f.to_i) a menos $ cursor.current_cursor == f.to_i         mais           $ cursor.change_cursor ( f) a menos que $ cursor.current_cursor == f         final         game_temp.did_mouse_change $ = true       final     final   final final classe Scene_Map   apelido atualização jet6742_update unless $ @   def update (* args, bloco &)     se! $ game_message.visible       update_mouse_left_click     final     jet6742_update (* args, & bloco)     check_mouse_change   finais   apelido jet7811_terminate encerrar a menos que $ @   def encerrar (* args, bloco &)     para o evento em $ game_map.events.values       ​​próximos se event.popup_window.nil?       event.popup_window.dispose menos event.popup_window.disposed?       event.popup_window = nil     end     $ cursor.create_cursor (JetMouse CURSOR_PICTURE ::) se! [JetMouse :: CURSOR_PICTURE,       JetMouse :: ICON_INDEX]. incluir? (cursor.current_cursor $)     $ cursor.opacity = 0     jet7811_terminate (* args, bloco &)     $ cursor . opacidade = 255 a menos que $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]   final   update_transfer_player jet8887_update_transfer_player apelido unless $ @   def update_transfer_player (* args, bloco &)     se $ game_player.transfer?       $ cursor.create_cursor (JetMouse CURSOR_PICTURE ::) se     & Bloco)   final   check_mouse_change def     retorno se $ game_switches [JetMouse :: TURN_MOUSE_OFF_SWITCH]     se $ game_message.visible | |? $ game_player.transfer       cursor.create_cursor $ (JetMouse CURSOR_PICTURE ::) se     se $ game_temp.did_mouse_change.nil? &&       ! [JetMouse :: CURSOR_PICTURE, JetMouse :: ICON_INDEX]. incluir? (cursor.current_cursor $)     $ game_temp.did_mouse_change = nil   end   def update_mouse_left_click     retorno se $ game_map.interpreter.running? | Game_player.transfer $ |?     se Mouse.click (1)?       event_activated = false       para o evento em $ game_map.events_xy (* Mouse.true_grid)         se event.check_for_comment (CLIQUE / MOUSE / i)           event.start           event_activated = true         elsif ( event.x -. $ game_player.x) ABS + (event.y -. $ game_player.y) abs == 1           !.? se [3, 4] incluem (event.trigger) &&                ! ​​([0, 2] . include (event.priority_type) | | event.trigger == 0) &&?                   [0, 1] incluem (event.page.list.size)!.?             se (event.y - $ game_player.y) abs>.                (event.x - $ game_player.x). abs               se event.y - $ game_player.y> 0                 game_player.set_direction $ (2)               mais                 game_player.set_direction $ (8)               fim             mais               se event.x - $ game_player.x> 0                 game_player.set_direction $ (6)               mais                 game_player.set_direction $ (4)               fim             fim             event.start             event_activated = true             pausa           final         final         se! event_activated           for i in ["UP", "DOWN", "direita", "LEFT"]             if (MOVE / MOUSE # {i} / i) event.check_for_comment               event_activated = true               caso eu               quando "UP"                 x, y = event.x, event.y - 1               quando "DOWN"                 x, y = event.x evento, . y + 1               quando "LEFT"                 x, y = event.x - 1, event.y               quando "DIREITO"                 x, y = event.x + 1, event.y               final               pausa             final           final         final       final       ! se event_activated         x, y = * Mouse.true_grid       final       se! x.nil?         $ game_temp.move_because_of_mouse = true         g = $ game_player.find_mouse_path (x, y)         = g $ game_temp.mouse_path       final     final   final final

RPGMAKERVXACE - Sombra de characters


#Sombra nos chars e Eventos
#O nome do script já diz tudo, adicione este script abaix o Sprite Reflection(script postado pela nossa atiradora(Hat)) assim o jogo fica mais profissa....
#@edit = Screenshot adicionada
#Screem do Efeito



################################################################################
#                            Sombra de characters                              #
################################################################################
#-----------------------------Características----------------------------------#
################################################################################
# Deixa todos os characters, eventos e veículos com sombra.                    #
################################################################################
#------------------------------Configurações-----------------------------------#
################################################################################
module Config
  # Um tile possui 32 pixels.
 
  X                  = 0            # Dinstância da sombra em relação ao
                                    # character no eixo x (horizontal), em pixels.
 
  Y                  = 32           # Dinstância da sombra em relação ao
                                    # character no eixo y (vertical), em pixels.
                             
  X_Comment          = "X"          # Comentário que deve-se colocar em um evento
                                    # para mudar a distância entre ele e sua
                                    # sombra em relação ao eixo x.*
                                   
  Y_Comment          = "Y"          # Comentário que deve-se colocar em um evento
                                    # para mudar a distância entre ele e sua
                                    # sombra em relação ao eixo y.*

  No_Shadow_Comment  = "No Shadow"  # Comentário que deve-se colocar em um evento
                                    # para que esta não possua sombra.
                                   
  Invert             = true         # Inverte a sombra (true ou false).
 
  Invert_Comment     = "Invert"     # Comentário que deve-se colocar em um evento
                                    # para inverter ou desinverter a sombra.
 
  # * Como usar: Colocar a quantidade desejada após o cometário, separado por um
  # espaço.
 
end
################################################################################
class Game_Event < Game_Character
  def read_comment(comment)
    for command in @list
        next if command.code != 108        
        return command.parameters[0] if command.parameters[0].include?(comment)
    end
    return nil
  end
  def has_comment?(comment)
    for command in @list
        next if command.code != 108        
        return true if command.parameters[0].include?(comment)
    end
    return false
  end
end
class Sprite_Shadow < Sprite_Base
  def initialize(viewport, invert, character = nil, x = 0, y = 0)
    super(viewport)
    @x = x
    @y = y
    @character = character
    @invert = invert
    update
  end
  def dispose
    super
  end
  def update
    super
    update_bitmap
    update_src_rect
    update_position
    update_other
  end
  def tileset_bitmap(tile_id)
    Cache.tileset($game_map.tileset.tileset_names[5 + tile_id / 256])
  end
  def update_bitmap
    if graphic_changed?
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_index = @character.character_index
      if @tile_id > 0
        set_tile_bitmap
      else
        set_character_bitmap
      end
    end
  end
  def graphic_changed?
    @tile_id != @character.tile_id ||
    @character_name != @character.character_name ||
    @character_index != @character.character_index
  end
  def set_tile_bitmap
    sx = (@tile_id / 128 % 2 * 8 + @tile_id % * 32
    sy = @tile_id % 256 / 8 % 16 * 32
    self.bitmap = tileset_bitmap(@tile_id)
    self.src_rect.set(sx, sy, 32, 32)
    self.ox = 16
    self.oy = 32
  end
  def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    self.tone = Tone.new(-255,-255,-255)
    if @invert
      self.angle = 270
      self.mirror = true
      self.angle = 180
      self.mirror = false
    end
    sign = @character_name[/^[\!\$]./]
    if sign && sign.include?('$')
      @cw = bitmap.width / 3
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2 - Config::X - @x
    self.oy = @invert ? (@ch + 32 - Config::Y + @y) : @ch - Config::Y - @y
  end
  def update_src_rect
    if @tile_id == 0
      index = @character.character_index
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sx = ((index % 4 * 3 + pattern) * @cw)
      if @invert
        sy = ((index / 4 * 4 + (10 - @character.direction - 2) / 2) * @ch)
      else
        sy = ((index / 4 * 4 + (@character.direction - 2) / 2) * @ch)
      end
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
  def update_position
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z
  end
  def update_other
    self.opacity = @character.opacity/2
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    self.visible = !@character.transparent
  end
end
class Spriteset_Map
  def create_characters
    @character_sprites = []
    $game_map.events.values.each do |event|
      if !event.has_comment?(Config::No_Shadow_Comment)
        x = 0
        y = 0
        invert = event.has_comment?(Config::Invert_Comment)
        if invert
          if Config::Invert
            invert = false
          end
        else
          invert = Config::Invert
        end
        x = event.read_comment(Config::X_Comment)[Config::X_Comment.size..event.read_comment(Config::X_Comment).size].to_i if event.has_comment?(Config::X_Comment)
        y = event.read_comment(Config::Y_Comment)[Config::Y_Comment.size..event.read_comment(Config::Y_Comment).size].to_i if event.has_comment?(Config::Y_Comment)
        @character_sprites.push(Sprite_Shadow.new(@viewport1, invert, event, x, y))
      end
      @character_sprites.push(Sprite_Character.new(@viewport1, event))
    end
    $game_map.vehicles.each do |vehicle|
      invert = Config::Invert
      @character_sprites.push(Sprite_Shadow.new(@viewport1, invert, vehicle))
      @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
    end
    $game_player.followers.reverse_each do |follower|
      invert = Config::Invert
      @character_sprites.push(Sprite_Shadow.new(@viewport1, invert, follower))
      @character_sprites.push(Sprite_Character.new(@viewport1, follower))
    end
    invert = Config::Invert
    @character_sprites.push(Sprite_Shadow.new(@viewport1, invert, $game_player))
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
    @map_id = $game_map.map_id
  end
end

RPGMAKERVXACE - Usar Chars do XP


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#|Autor: RD12|                  Usar Chars do XP
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#Apenas bote @ no nome do char, exemplo: @Char

class Sprite_Character < Sprite_Base
 
    def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    sign = @character_name[/^[\!\$\@]./]
    if sign && sign.include?('$')
      @cw = bitmap.width / 3
      @ch = bitmap.height / 4
    elsif sign && sign.include?('@')
      @cw = bitmap.width / 4
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / 12
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch
  end

  def update_src_rect
    if @tile_id == 0
      index = @character.character_index
      pattern = @character.pattern < 3 ? @character.pattern : 1
      sign = @character_name[/^[\!\$\@]./]
    if sign && sign.include?('@')
      pattern = 4 if pattern == 0
      sx = (index % 4 * 4 + (pattern-1)) * @cw  
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    else
      sx = (index % 4 * 3 + pattern) * @cw
      sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    end
      self.src_rect.set(sx, sy, @cw, @ch)
    end
  end
 
end

RPGMAKERVXACE - voando


# Muda o gráfico do jogador para: Actor4_v por exemplo
# Mostra animação do gráfico voando(batendo asas)
# Caso o gráfico voando não exista, não irá dar erro e nem voar.
# Você pode mudar o _v para qualquer outro sufixo
# Você pode escolher qual Tecla vai fazer o jogador voar.
# Você pode escolher se só pode voar se tiver tal acessório
# Você pode escolher uma Switch para poder voar

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#|Autor: RD12|             Jogador poder Voar
#------------------------------------------------------------------------------------
#       Muda o gráfico do jogador para ele voando, e faz atravessar tudo
#                        www.aldeiarpgbr.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Você pode escolher qual Tecla vai fazer o jogador voar.
# Você pode escolher se só pode voar se tiver tal acessório

module Conf_Voar
  #Teclas: "A" = Z : "Y" = S : "Z" = D : "X" = A : "L" = Q : "R" = W
  Tecla = :Y
  Acessorios = {}
  #ID dos Acessórios que fazem voar | Deixe false para poder voar sem acessório
  Acessorios = [false,55, 54]
  #Sufixo que ficará na frente do nome do char voando
  Sufixo = "_v"
  #Velocidade Voando (a normal é 4)
  Vel_Voando = 4.5
  #ID da Switch para poder voar (on)
  Switch = 5
end

class Game_Character
  attr_accessor   :character_name
  attr_accessor   :through
  attr_accessor   :move_speed
  attr_accessor   :always_on_top
  attr_accessor   :walk_anime
end

class Scene_Map
   alias voar_update update
  def update
      voar_update
     
    #Guarda o nome e index do gráfico normal do jogador
    @old_graphic = $game_player.character_name if @old_graphic.nil?
    actor = $game_party.members[0]
      if !(Input.press?(Conf_Voar::Tecla) and $game_switches[Conf_Voar::Switch])
        $game_player.through = false
        $game_player.move_speed = 4
        $game_player.always_on_top = false
        $game_player.walk_anime = false
        #Muda para o gráfico normal
        actor.mudar_voando(@old_graphic)
        $game_player.refresh
      end
    if !Conf_Voar::Acessorios[0] and $game_switches[Conf_Voar::Switch]
       if Input.press?(Conf_Voar::Tecla)
        graphic = @old_graphic + Conf_Voar::Sufixo
        #Verifica se o gráfico existe para não dar erro
        filename = "Graphics/Characters/"+graphic+".png"
        return if !FileTest.exist?(filename)
        #Muda para o gráfico voando, aumenta velocidade, bota pra atravessar tudo...
        actor.mudar_voando(graphic)
        $game_player.through = true
        $game_player.move_speed = Conf_Voar::Vel_Voando
        $game_player.always_on_top = true
        $game_player.walk_anime = true
        $game_player.refresh
       end
       return
     end
     if $game_switches[Conf_Voar::Switch] and Input.press?(Conf_Voar::Tecla)
      return if !Conf_Voar::Acessorios[0] or actor.equips[4].nil?
       if Conf_Voar::Acessorios.include?(actor.equips[4].id)
        graphic = @old_graphic + Conf_Voar::Sufixo
        #Verifica se o gráfico existe para não dar erro
        filename = "Graphics/Characters/"+graphic+".png"
        return if !FileTest.exist?(filename)
        #Muda para o gráfico voando, aumenta velocidade, bota pra atravessar tudo...
        actor.mudar_voando(graphic)
        $game_player.through = true
        $game_player.move_speed = Conf_Voar::Vel_Voando
        $game_player.always_on_top = true
        $game_player.walk_anime = true
        $game_player.refresh
      end
     end
  end
end

class Game_Actor < Game_Battler
  def mudar_voando(character_name)
    @character_name = character_name
  end
end

RPGMAKERVXACE - Animação de Respirar


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#|Autor: RD12|                Animação de Respirar
#----------------------------------------------------------------------------------------
#   Faz com que os characters tenham uma animação de respirar tornando o jogo
#mais realístico
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#Não é necessário gráfico deles respirando.
#Para eventos não respirar, bote no comentario: off_anim

class Sprite_Character < Sprite_Base
  attr_accessor :character
 alias anim_update_bitmap update_bitmap
  def update_bitmap
    initialize_vars if @contador.nil?
    @contador += 1
    @rand_time[@character.id] = rand(20) if @rand_time[@character.id].nil?
   if !$anim_off.include?(@character.id)
     if @contador == 70+@rand_time[@character.id]
         self.zoom_y = 1.07
     end
     if @contador >= 110+@rand_time[@character.id]
        if self.zoom_y > 1
           self.zoom_y -= 0.01
         else
           @contador = 0
        end
     end
   end
  anim_update_bitmap
 end
 def initialize_vars
    @contador = 0
    @rand_time = []
 end
end
$anim_off = []
class Game_Event < Game_Character
  alias rd12_refresh refresh
  def refresh
    rd12_refresh
    return if @list == nil
    for cmd in @list
      if cmd.code == 108 or cmd.code == 408
        comentario = cmd.parameters[0]
        if comentario == "off_anim"
          $anim_off << @event.id
        end
      end
    end
  end
end

RPGMAKERVXACE - Khas Awesome Light Effec


#-------------------------------------------------------------------------------
# * [ACE] Khas Awesome Light Effects
#-------------------------------------------------------------------------------
# * Por Khas Arcthunder - arcthunder.site40.net
# * Versão: 1.0 BR
# * Lançada em: 12/01/2012
#
#-------------------------------------------------------------------------------
# * Termos de uso
#-------------------------------------------------------------------------------
# Ao utilizar qualquer script feito por Khas, você concorda com os termos abaixo
# 1. Você deve dar crédito a Khas se estiver usando algum script Khas;
# 2. Todos os scripts Khas estão sob licença Creative Commons;
# 3. Todos os scripts Khas são para projetos não comerciais, se você precisar de
#    algum script Khas em seu projeto comercial (aceito pedidos para esse tipo
#    de projeto), envie um email para nilokruch@live.com com o pedido;
# 4. Todos os scripts Khas são para uso pessoal, você pode usar e editar para uso
#    no seu projeto, porém você não pode postar nenhuma versão modificada;
# 5. Você não pode dar créditos a si próprio por postar algum script Khas;
# 6. Caso queira compartilhar um script Khas, não poste o link direto de
#    download, apenas redirecione o usuário para arcthunder.site40.net
#
#-------------------------------------------------------------------------------
# * Características
#-------------------------------------------------------------------------------
# - Efeitos de luz realista
# - Luz real (não passa paredes!)
# - Fontes de luz estática (que não se move)
# - Fonte de luz dinâmica (uma lanterna para o jogador, por exemplo)
# - Efeitos multiplos podem se juntar
# - Fácil configuração
# - Uso por comentário
#
#-------------------------------------------------------------------------------
# * IMPORTANTE - Desempenho
#-------------------------------------------------------------------------------
# Esse script pode vir a ser pesado para processadores muito antigos! O Awesome
# Light Effects foi testado em um Core 2 Duo E4500 e em um Core i5, sem lag.
# Porém, além do processador, há vários fatores que influenciam no desempenho
# do script:
#
# 1. Tamanho do mapa
# Este script analiza o mapa em busca de superfícies para cortar a luz. Em um
# mapa muito grande, esse número de superfícies pode aumentar muito, afetando
# o desempenho da LUZ DINÂMICA. O tamanho do mapa não influência nas luzes
# estáticas.
#
# 2. Quantidade de efeitos
# Este script desenha os efeitos na tela, conforme sua posição. Antes de
# atualizá-los, a sua posição é verificada. Portanto, em mapas muito grandes
# com excesso de efeitos pode a vir ocorrer lag. Note que isso é apenas uma
# previsão, pois nos testes atuais não foi detectado lag.
#
# 3. Tamanho da imagem
# O tamanho da imagem da luz dinâmica influencia diretamente no desempenho.
# O corte de luz é feito linha a linha, quanto maior a resolução da imagem,
# mais tempo será gasto para cortá-la. A recomendação é até 200x200 pixels.
#
#-------------------------------------------------------------------------------
# * IMPORTANTE - Imagens de luz
#-------------------------------------------------------------------------------
# Para o funcionamento correto do script, as imagens de luz DEVEM obedecer
# os seguintes critérios:
#
# 1. O tamanho da imagem DEVE ser par. Exemplo: 150x150
# 2. A imagem DEVE ser quadrada, com dimensões IGUAIS. Exemplo: 156x156
# 3. A imagem DEVE estar com as cores invertidas! Isso é nescessário, pois o
#    script inverte as cores para desenhar o efeito na superfície de efeitos.
#    Lembre-se que a cor preta ficará transparente!
#
#-------------------------------------------------------------------------------
# * Instruções - 1. Configurando efeitos estáticos
#-------------------------------------------------------------------------------
# Para configurar efeitos estáticos, vá até a configuração (logo abaixo) e
# defina os efeitos dentro da hash Effects. Faça do seguinte modo:
#
# X => [imagem, opacidade, variação, corte],   <= Lembre dessa vírgula no final!
#
# Onde:
# Imagem => Nome da imagem na pasta "Graphics/Lights";
# Opacidade => Opacidade da imagem;
# Variação => Variação POSITIVA da opacidade;
# Corte => Coloque true para cortar a imagem e false para não cortar;
# X => É o ID do efeito, para ser usado nos eventos. Use um ID para cada efeito.
#
# Veja os efeitos pré configurados para entender como funciona.
#
#-------------------------------------------------------------------------------
# * Instruções - 2. Usando o efeitos em eventos:
#-------------------------------------------------------------------------------
# Para usar o efeito definido em um evento, coloque o seguinte comentário:
#
# [light x]
#
# Onde x deve ser o ID do efeito configurado.
#
#-------------------------------------------------------------------------------
# * Instruções - 3. Utilizando a luz dinâmica (lanterna)
#-------------------------------------------------------------------------------
# A lanterna é automaticamente inicializada como invisível. Você pode usar os
# seguintes métodos com o comando "Chamar Script":
#
# l = $game_map.lantern
# Adiquire a lanterna em uma variável.
# Você pode usar todos os comandos abaixo com "$game_map.lantern" ao
# invés de adiquirir a lanterna em uma variável, porém tome cuidado, pois
# o comando "Chamar Script" corta o código e pode gerar erros.
#
# l.set_graphic(i)
# Muda o gráfico da lanterna para i, onde i deve ser o nome, entre aspas,
# da imagem na pasta Graphics/Lights
#
# l.set_multiple_graphics(h)
# Muda os gráficos da lanterna para h, onde h deve ser uma Hash com o seguinte
# formato:
#
# h = {2=>"ld",4=>"ll",6=>"lr",8=>"lu"}
#
# Onde:
# "ld" é o nome da imagem quando o portador está virado para baixo;
# "ll" é o nome da imagem quando o portador está virado para esquerda;
# "lr" é o nome da imagem quando o portador está virado para direita;
# "lu" é o nome da imagem quando o portador está virado para cima.
#
# l.change_owner(char)
# Muda o portador da lanterna para char, onde char pode ser:
# $game_player           <= O jogador;
# self_event             <= O evento em que o comando é chamado;
# $game_map.events[x]    <= O evento de ID x do mapa.
#
# l.set_opacity(o,p)
# Ajusta a opacidade da lanterna, onde:
# o é a opacidade padrão;
# p é a variação POSITIVA da opacidade.
#
# l.show
# Depois de configurar a lanterna com os comandos acima, use este comando para
# tornar a lanterna visível.
#
# l.hide
# Use este comando para esconder a lanterna.
#
#-------------------------------------------------------------------------------
# * Instruções - 4. Utilizando a superfície de efeitos (Chamar Script)
#-------------------------------------------------------------------------------
# O Awesome Light Effects desenha os efeitos sobre uma superfície. Para que
# os efeitos estejam visíveis, a superfície de efeitos deve estar visível.
# Para utilizar a superfície de efeitos, utilize os comandos abaixo:
#
# s = $game_map.effect_surface
# Adiquire a superfície em uma variável.
# Você pode usar todos os comandos abaixo com "$game_map.effect_surface" ao
# invés de adiquirir a superfície em uma variável, porém tome cuidado, pois
# o comando "Chamar Script" corta o código e pode gerar erros.
#
# s.set_color(r,g,b)
# Muda a cor da superfície instantâneamente para a cor fornecida:
# r => valor da cor vermelha;
# g => valor da cor verde;
# b => valor da cor azul.
#
# s.set_alpha(a)
# Muda a opacidade da superfície instantâneamente para a.
#
# s.change_color(time,r,g,b)
# Muda SOMENTE a cor da superfície em um certo tempo, onde:
# time => tempo para a mudança (em frames);
# r => valor da cor vermelha;
# g => valor da cor verde;
# b => valor da cor azul.
#
# s.change_color(time,r,g,b,a)
# Muda a cor da superfície e a opacidade em um certo tempo, onde:
# time => tempo para a mudança (em frames);
# r => valor da cor vermelha;
# g => valor da cor verde;
# b => valor da cor azul;
# a => opacidade.
#
# s.change_alpha(time,a)
# Muda a opacidade da superfície em um certo tempo, onde:
# time => tempo para a mudança (em frames);
# a => opacidade.
#
#-------------------------------------------------------------------------------
# * Instruções - 5. Utilizando a superfície de efeitos (Evento)
#-------------------------------------------------------------------------------
# Você pode acessar a superfície de efeitos pelo comando "Tonalidade de Tela",
# para isso, coloque a opção "Surface_UE" (nas configurações) como true. Caso
# queria desabilitar essa opção e ter controle sobre o tom da tela, coloque a
# opção "Surface_UE" como false.
#
# Observe os seguintes detalhes, se for usar esta opção:
# 1. Os valores de cor devem estar entre 0 e 255;
# 2. O tempo é em frames;
# 3. O valor "Cinza" será enviado como a opacidade da superfície.
#
#-------------------------------------------------------------------------------
# * Instruções - 6. Configurando as Tags do mapa
#-------------------------------------------------------------------------------
# Afim de que as luzes sejam cortadas de forma precisa e realista, há 3 tipos
# de comportamento para um tile: telhado, parede e bloco. Pense de maneira
# lógica: um telhado gera sombras como telhado, uma parede como uma parede, e
# assim por diante.
#
# Para isso, as tags do tileset DEVEM ser configuradas. Por padrão, são
# configuradas para 6,7 e 8. Veja a demo para ter noção de como isso funciona.
#
# Note que o script só irá analizar a primeira camada (camada A) do mapa. Certos
# tilesets não irão funcionar caso os tiles não estejam configurados de modo
# correto. Note ainda que este script depende do bom mapeamento para funcionar,
# preste atenção aos detalhes do seu mapa.
#
#-------------------------------------------------------------------------------
# * Configuração
#-------------------------------------------------------------------------------
module Light_Core
  Effects = { # Não mude isto!
#-------------------------------------------------------------------------------
# ADICIONE ABAIXO OS SEUS EFEITOS!
#-------------------------------------------------------------------------------
  0 => ["light",255,0,true],
  1 => ["torch",200,20,true],
  2 => ["torch_m",180,30,true],
  3 => ["light_s",255,0,true],
 
#-------------------------------------------------------------------------------
# Fim da configuração de efeitos
#-------------------------------------------------------------------------------
  } # Não mude isto!
 
  # Coordenada Z da superfície de efeitos:
  Surface_Z = 180
 
  # Habilitar controle da superfície por "Tonalidade da Tela"?
  Surface_UE = true
 
  # Tag para a superfície se comportar como "telhado"
  Roof_Tag = 5
  # Tag para a superfície se comportar como "parede"
  Wall_Tag = 6
  # Tag para a superfície se comportar como "bloco" (semelhante ao telhado)
  Block_Tag = 7
 
  # Constante de correção de ângulo (não altere)
  ACC = Math.tan(Math::PI/26)
end
#-------------------------------------------------------------------------------
# Fim da configuração - Início do script
#-------------------------------------------------------------------------------
module Cache
  def self.light(filename)
    load_bitmap("Graphics/Lights/", filename)
  end
end
module Light_Bitcore
  include Light_Core
  def self.initialize
    @@buffer = {}
    Effects.values.each { |effect| Light_Bitcore.push(effect[0])}
  end
  def self::[](key)
    return @@buffer[key]
  end
  def self.push(key)
    return if @@buffer.keys.include?(key)
    @@buffer[key] = Cache.light(key)
  end
end
Light_Bitcore.initialize
class Light_SSource
  attr_reader :real_x
  attr_reader :real_y
  attr_reader :range
  attr_accessor :bitmap
  attr_reader :w
  attr_reader :h
  attr_reader :hs
  def initialize(char,bitmap,opacity,plus,hs)
    sync(char)
    @key = bitmap
    @bitmap = Light_Bitcore[@key].clone
    @range = @bitmap.width/2
    @w = @bitmap.width
    @h = @bitmap.height
    @mr = @range - 16
    @opacity = opacity
    @plus = plus
    @hs = hs
    render if @hs
  end
  def render
    tx = x
    ty = y
    tsx = x + @range
    tsy = y + @range
    dr = @range*2
    for s in $game_map.surfaces
      next if !s.visible?(tsx,tsy) || !s.within?(tx,tx+dr,ty,ty+dr)
      s.render_shadow(tx,ty,tsx,tsy,@range,@bitmap)
    end
  end
  def restore
    return unless @bitmap.nil?
    @bitmap = Light_Bitcore[@key].clone
    render if @hs
  end
  def opacity
    @plus == 0 ? @opacity : (@opacity + rand(@plus))
  end
  def sx
    return $game_map.adjust_x(@real_x)*32-@mr
  end
  def sy
    return $game_map.adjust_y(@real_y)*32-@mr
  end
  def sync(char)
    @real_x = char.real_x
    @real_y = char.real_y
  end
  def x
    return (@real_x*32 - @mr).to_f
  end
  def y
    return (@real_y*32 - @mr).to_f
  end
  def dispose
    return if @bitmap.nil?
    @bitmap.dispose
    @bitmap = nil
  end
end
class Light_DSource < Light_SSource
  attr_reader :bitmap
  attr_reader :visible
  def initialize
    @key = nil
    @bitmap = nil
    @opacity = 255
    @plus = 0
    @char = $game_player
    @visible = false
  end
  def set_opacity(o,p)
    @opacity = o
    @plus = p
  end
  def set_graphic(sb)
    dispose
    @key = {2=>sb,4=>sb,6=>sb,8=>sb}
    Light_Bitcore.push(sb)
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
    @range = @bitmap[2].width/2
    @w = @bitmap[2].width
    @h = @bitmap[2].height
    @mr = @range - 16
  end
  def set_multiple_graphics(ba)
    dispose
    @key = ba
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
    @range = @bitmap[2].width/2
    @w = @bitmap[2].width
    @h = @bitmap[2].height
    @mr = @range - 16
  end
  def get_graphic
    return @bitmap[@char.direction].clone
  end
  def show
    return if @bitmap.nil?
    @visible = true
  end
  def hide
    @visible = false
  end
  def restore
    return if @key.nil?
    @key.values.each {|key| Light_Bitcore.push(key)}
    @bitmap = {2=>Light_Bitcore[@key[2]].clone,4=>Light_Bitcore[@key[4]].clone,6=>Light_Bitcore[@key[6]].clone,8=>Light_Bitcore[@key[8]].clone}
  end
  def dispose
    return if @bitmap.nil?
    @bitmap.values.each { |b| b.dispose }
    @bitmap = nil
  end
  def change_owner(char)
    @char = char
  end
  def render
  end
  def sx
    return $game_map.adjust_x(@char.real_x)*32-@mr
  end
  def sy
    return $game_map.adjust_y(@char.real_y)*32-@mr
  end
  def x
    return (@char.real_x*32 - @mr).to_f
  end
  def y
    return (@char.real_y*32 - @mr).to_f
  end
end
class Light_Surface
  def initialize
    @ta = @a = 0
    @tr = @r = 255
    @tg = @g = 255
    @tb = @b = 255
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def refresh
    return if @timer == 0
    @a += @va
    @r += @vr
    @g += @vg
    @b += @vb
    $game_map.light_surface.opacity = @a
    @timer -= 1
  end
  def change_color(time,r,g,b,a=nil)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    unless a.nil?
      a = 0 if a < 0; a = 255 if a > 255
    end
    @timer = time
    @tr = 255-r
    @tg = 255-g
    @tb = 255-b
    @va = (a.nil? ? 0 : (a-@a).to_f/@timer)
    @vr = (@tr - @r).to_f/@timer
    @vg = (@tg - @g).to_f/@timer
    @vb = (@tb - @b).to_f/@timer
  end
  def change_alpha(time,a)
    a = 0 if a < 0; a = 255 if a > 255
    @timer = time
    @ta = a
    @vr = @vg = @vb = 0.0
    @va = (a-@a).to_f/@timer
  end
  def set_color(r,g,b)
    r = 0 if r < 0; r = 255 if r > 255
    g = 0 if g < 0; g = 255 if g > 255
    b = 0 if b < 0; b = 255 if b > 255
    @tr = @r = 255-r
    @tg = @g = 255-g
    @tb = @b = 255-b
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def set_alpha(a)
    a = 0 if a < 0; a = 255 if a > 255
    @ta = @a = a
    $game_map.light_surface.opacity = @a
    @va = @vr = @vg = @vb = 0.0
    @timer = 0
  end
  def alpha
    return @a
  end
  def color
    return Color.new(@r,@g,@b)
  end
end
class Game_Map
  include Light_Core
  attr_accessor :light_surface
  attr_accessor :light_sources
  attr_accessor :surfaces
  attr_accessor :effect_surface
  attr_accessor :lantern
  alias kbl_setup_events setup_events
  alias kbl_initialize initialize
  alias kbl_update update
  def initialize
    kbl_initialize
    @effect_surface = Light_Surface.new
    @lantern = Light_DSource.new
  end
  def update(arg)
    @effect_surface.refresh if arg
    kbl_update(arg)
  end
  def first_tag(x,y)
    tag = tileset.flags[tile_id(x,y,0)] >> 12
    return tag > 0 ? tag : 0
  end
  def setup_events
    @light_sources.nil? ? @light_sources = [] : @light_sources.clear
    setup_surfaces
    merge_surfaces
    kbl_setup_events
  end
  def setup_surfaces
    @surfaces = []
    for x in 0..(width-1)
      for y in 0..(height-1)
        tag = first_tag(x,y)
        if tag == Wall_Tag
          i = tile_id(x,y,0)
          if i & 0x02 == 0x02
            @surfaces << Block_SD.new(x*32,y*32,x*32+32,y*32)
          end
          if i & 0x04 == 0x04
            @surfaces << Block_WR.new(x*32+31,y*32,x*32+31,y*32+32)
            @surfaces << Block_IL.new(x*32+32,y*32,x*32+32,y*32+32)
          end
          if i & 0x01 == 0x01
            @surfaces << Block_IR.new(x*32-1,y*32,x*32-1,y*32+32)
            @surfaces << Block_WL.new(x*32,y*32,x*32,y*32+32)
          end
        elsif tag == Roof_Tag
          i = tile_id(x,y,0)
          @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if i & 0x02 == 0x02
          @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if i & 0x04 == 0x04
          @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if i & 0x01 == 0x01
        elsif tag == Block_Tag
          f = tileset.flags[tile_id(x,y,0)]
          @surfaces << Block_SL.new(x*32,y*32,x*32,y*32+32) if f & 0x02 == 0x02
          @surfaces << Block_SR.new(x*32+31,y*32,x*32+31,y*32+32) if f & 0x04 == 0x04
          @surfaces << Block_SU.new(x*32,y*32,x*32+32,y*32) if f & 0x08 == 0x08
        end
      end
    end
  end
  def merge_surfaces
    new_surfaces = []
    hs = []; vs = []
    ws = []; is = []
    for surface in @surfaces
      if surface.type & 0x05 == 0
        hs << surface
      else
        if surface.type & 0x010 == 0
          vs << surface
        else
          if surface.type & 0x08 == 0
            ws << surface
          else
            is << surface
          end
        end
      end
    end
    for surface in hs
      surface.ready ? next : surface.ready = true
      for s in hs
        next if s.ready || s.y1 != surface.y1 || surface.type != s.type
        if s.x2 == surface.x1
          surface.x1 = s.x1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.x1 == surface.x2
          surface.x2 = s.x2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    hs.each { |s| @surfaces.delete(s) if s.trash}
    for surface in vs
      surface.ready ? next : surface.ready
      for s in vs
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    vs.each { |s| @surfaces.delete(s) if s.trash}
    for surface in ws
      surface.ready ? next : surface.ready
      for s in ws
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    ws.each { |s| @surfaces.delete(s) if s.trash}
    for surface in is
      surface.ready ? next : surface.ready
      for s in is
        next if s.ready || s.x1 != surface.x1
        if s.y2 == surface.y1
          surface.y1 = s.y1
          s.trash = true
          s.ready = true
          surface.ready = false
        elsif s.y1 == surface.y2
          surface.y2 = s.y2
          s.trash = true
          s.ready = true
          surface.ready = false
        end
      end
    end
    is.each { |s| @surfaces.delete(s) if s.trash}
  end
end
class Game_Event < Game_Character
  alias kbl_initialize initialize
  alias kbl_setup_page setup_page
  def initialize(m,e)
    @light = nil
    kbl_initialize(m,e)
  end
  def setup_page(np)
    kbl_setup_page(np)
    setup_light(np.nil?)
  end
  def setup_light(dispose)
    unless @light.nil?
      $game_map.light_sources.delete(self)
      @light.dispose
      @light = nil
    end
    unless dispose && @list.nil?
      for command in @list
        if command.code == 108 && command.parameters[0].include?("[light")
          command.parameters[0].scan(/\[light ([0.0-9.9]+)\]/)
          effect = Light_Core::Effects[$1.to_i]
          @light = Light_SSource.new(self,effect[0],effect[1],effect[2],effect[3])
          $game_map.light_sources << self
          return
        end
      end
    end
  end
  def draw_light
    sx = @light.sx
    sy = @light.sy
    w = @light.w
    h = @light.h
    return if sx > 544 && sy > 416 && sx + w < 0 && sy + h < 0
    $game_map.light_surface.bitmap.blt(sx,sy,@light.bitmap,Rect.new(0,0,w,h),@light.opacity)
  end
  def dispose_light
    @light.dispose
  end
  def restore_light
    @light.restore
  end
end
if Light_Core::Surface_UE
  class Game_Interpreter
    def command_223
      $game_map.effect_surface.change_color(@params[1],@params[0].red,@params[0].green,@params[0].blue,@params[0].gray)
      wait(@params[1]) if @params[2]
    end
  end
end
class Game_Interpreter
  def self_event
    return $game_map.events[@event_id]
  end
end
class Block_Surface
  include Light_Core
  attr_accessor :x1
  attr_accessor :y1
  attr_accessor :x2
  attr_accessor :y2
  attr_accessor :ready
  attr_accessor :trash
  def initialize(x1,y1,x2,y2)
    @x1 = x1
    @y1 = y1
    @x2 = x2
    @y2 = y2
    @ready = false
    @trash = false
  end
  def within?(min_x,max_x,min_y,max_y)
    return @x2 > min_x && @x1 < max_x && @y2 > min_y && @y1 < max_y
  end
end
class Block_SL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x01
  end
  def visible?(sx,sy)
    return sx < @x1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in @x1..(sx+range)
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_SR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x04
  end
  def visible?(sx,sy)
    return sx > @x1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_IL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x019
  end
  def visible?(sx,sy)
    return sx < @x1 && sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = @y1 - @m1*@x1
    @m2 = (@y2-sy)/(@x2-sx)
    @m2 = 0 if @m2 > 0
    @n2 = @y2 - @m2*@x2
    for x in @x1..(sx+range)
      init = shadow_iy(x).floor
      bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_IR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x01c
  end
  def visible?(sx,sy)
    return sx > @x1 && sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = @y1 - @m1*@x1
    @m2 = (@y2-sy)/(@x2-sx)
    @m2 = 0 if @m2 < 0
    @n2 = @y2 - @m2*@x2
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x).floor
      bitmap.clear_rect(x-phx,init-3-phy,1,shadow_fy(x)-init+3)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_WL < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x011
  end
  def visible?(sx,sy)
    return sx < @x1 && sy < @y2
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in @x1..(sx+range)
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_WR < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x014
  end
  def visible?(sx,sy)
    return sx > @x1 && sy < @y2
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    @m1 = (@y1-sy)/(@x1-sx)
    @n1 = sy - @m1*sx
    @m2 = (@y2-sy)/(@x2-sx)
    @n2 = sy - @m2*sx
    for x in (sx-range).to_i..@x1
      init = shadow_iy(x)
      bitmap.clear_rect(x-phx,init-phy,1,shadow_fy(x)-init+2)
    end
  end
  def shadow_iy(x)
    return @m1*x+@n1
  end
  def shadow_fy(x)
    return @m2*x+@n2
  end
end
class Block_SU < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x02
  end
  def visible?(sx,sy)
    return sy < @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    if @x1 == sx
      @m1 = nil
    else
      @m1 = (@y1-sy)/(@x1-sx)
      @m1 += ACC if @m1 < -ACC
      @n1 = @y1 - @m1*@x1
    end
    if @x2 == sx
      @m2 = nil
    else
      @m2 = (@y2-sy)/(@x2-sx)
      @n2 = sy - @m2*sx
    end
    for y in @y1..(sy+range)
      init = shadow_ix(y)
      bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
    end
  end
  def shadow_ix(y)
    return @m1.nil? ? @x1 : (y-@n1)/@m1
  end
  def shadow_fx(y)
    return @m2.nil? ? @x2 : (y-@n2)/@m2
  end
end
class Block_SD < Block_Surface
  attr_reader :type
  def initialize(x1,y1,x2,y2)
    super(x1,y1,x2,y2)
    @type = 0x08
  end
  def visible?(sx,sy)
    return sy > @y1
  end
  def render_shadow(phx,phy,sx,sy,range,bitmap)
    if @x1 == sx
      @m1 = nil
    else
      @m1 = (@y1-sy)/(@x1-sx)
      @m1 -= ACC if @m1 > ACC
      @n1 = sy - @m1*sx
    end
    if x2 == sx
      @m2 = nil
    else
      @m2 = (@y2-sy)/(@x2-sx)
      @n2 = sy - @m2*sx
    end
    for y in (sy-range).to_i..@y1
      init = shadow_ix(y)
      bitmap.clear_rect(init-phx,y-phy,shadow_fx(y)-init+1,1)
    end
  end
  def shadow_ix(y)
    return @m1.nil? ? @x1 : (y-@n1)/@m1
  end
  def shadow_fx(y)
    return @m2.nil? ? @x2 : (y-@n2)/@m2
  end
end
class Spriteset_Map
  include Light_Core
  alias kbl_initialize initialize
  alias kbl_update update
  alias kbl_dispose dispose
  def initialize
    setup_lights
    kbl_initialize
  end
  def update
    kbl_update
    update_lights
  end
  def dispose
    kbl_dispose
    dispose_lights
  end
  def dispose_lights
    $game_map.lantern.dispose
    $game_map.light_sources.each { |source| source.dispose_light }
    $game_map.light_surface.bitmap.dispose
    $game_map.light_surface.dispose
    $game_map.light_surface = nil
  end
  def update_lights
    $game_map.light_surface.bitmap.clear
    $game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
    $game_map.light_sources.each { |source| source.draw_light }
    return unless $game_map.lantern.visible
    @btr = $game_map.lantern.get_graphic
    x = $game_map.lantern.x
    y = $game_map.lantern.y
    r = $game_map.lantern.range
    sx = x + r
    sy = y + r
    dr = r*2
    $game_map.surfaces.each { |s| s.render_shadow(x,y,sx,sy,r,@btr) if s.visible?(sx,sy) && s.within?(x,x+dr,y,y+dr) }
    $game_map.light_surface.bitmap.blt($game_map.lantern.sx,$game_map.lantern.sy,@btr,Rect.new(0,0,dr,dr),$game_map.lantern.opacity)
  end
  def setup_lights
    @btr = nil
    $game_map.lantern.restore
    $game_map.light_sources.each { |source| source.restore_light }
    $game_map.light_surface = Sprite.new
    $game_map.light_surface.bitmap = Bitmap.new(544,416)
    $game_map.light_surface.bitmap.fill_rect(0,0,544,416,$game_map.effect_surface.color)
    $game_map.light_surface.blend_type = 2
    $game_map.light_surface.opacity = $game_map.effect_surface.alpha
    $game_map.light_surface.z = Surface_Z
  end
end