TheoAllen

Theo - Skip Missing Resource

May 25th, 2013
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.23 KB | None | 0 0
  1. # ===========================================================================
  2. =begin
  3.  
  4.   THEO - SKIP MISSING RESOURCE
  5.   Version : 1.1
  6.  
  7.   _(:3JZ)_
  8.   Script ini ngebikin kamu bisa tetep jalanin game meski resorsnya ilang ato
  9.   ngga ada.
  10.  
  11. =end
  12. # ===========================================================================
  13. ($imported ||= {})[:Theo_SkipResource] = true
  14.  
  15. module THEO
  16.  
  17.   MissingList_FileName = "List"
  18.   # Nama file untuk nyatet resors yg missing
  19.  
  20.   ShowMessageBox = true
  21.   # Kalo false, message box ga keluar
  22.  
  23.   MissingSound = "Missing sound!"
  24.   # Kata2 kalo hal yg berkaitan dengan sound ilang
  25.  
  26.   MissingBitmap = "Missing bitmap!"
  27.   # Kata2 kalo hal yg berkaitan dengan gambar ilang
  28.  
  29. end
  30.  
  31. # ===========================================================================
  32. class << Audio
  33.  
  34.   [:bgm, :bgs, :me, :se].each do |method|
  35.     eval "
  36.    alias pre_skip_#{method}_play #{method}_play
  37.    def #{method}_play(filename, *args)
  38.      begin
  39.        pre_skip_#{method}_play(filename, *args)
  40.      rescue
  41.        msgbox THEO::MissingSound + \"\n\" + filename unless
  42.          Cache.missing_included?(filename) && THEO::ShowMessageBox
  43.        Cache.missing_resource_add(filename)
  44.        Cache.write_missing_list
  45.        return
  46.      end
  47.    end
  48.    "
  49.   end
  50.  
  51. end
  52.  
  53. class << Cache
  54.  
  55.   def missing_resource_add(path)
  56.     missing_list
  57.     @missing.push(path) unless missing_included?(path)
  58.   end
  59.  
  60.   def missing_included?(path)
  61.     missing_list
  62.     @missing.include?(path)
  63.   end
  64.  
  65.   def missing_list
  66.     return @missing ||= []
  67.   end
  68.  
  69.   def write_missing_list
  70.     File.open(THEO::MissingList_FileName + ".txt", "w+") do |file|
  71.       Marshal.dump(make_missing_list, file)
  72.     end
  73.   end
  74.  
  75.   def make_missing_list
  76.     Cache.missing_list.inject("\r\n"*2) do |text, list|
  77.       text + list + "\r\n"
  78.     end + "\r\n"
  79.   end
  80.  
  81. end
  82.  
  83. class Bitmap
  84.  
  85.   alias pre_skip_init initialize
  86.   def initialize(*args)
  87.     begin
  88.       pre_skip_init(*args)
  89.     rescue
  90.       msgbox sprintf(THEO::MissingBitmap + "\n%s",args[0]) unless Cache.missing_included?(args[0])
  91.       Cache.missing_resource_add(args[0])
  92.       Cache.write_missing_list
  93.       pre_skip_init(32,32)
  94.     end
  95.   end
  96.  
  97. end
Advertisement
Add Comment
Please, Sign In to add comment