Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ############################################################
- #**NRGSS (Narzew RGSS Module)
- #**Narzew
- #**narzewcreations.rox.pl
- #**Projekt zaczęty 1 kwietnia 2012 roku.
- #**Wersja 1.7
- ############################################################
- #**Zeiling Engine and NRGSS Engine
- #**Narzew
- #**Thanks:
- #**Whiteflute (A Crying Minister) - Parts of MsgBox, some tutorials, some other parts
- ############################################################
- #??.04.12 - Script Start Date
- #11.05.12 - Script Completed Date V 1.0
- #20.05.12 - Script Completed Date V 1.1
- #1.06.12 - Script Completed Date V 1.2
- #3.06.12 - Script Completed Date V 1.3
- #10.06.12 - Script Completed Date V 1.4
- #22.06.12 - Script Completed Date V 1.5
- #13.07.12 - Script Completed Date V 1.6
- #27.07.12 - Script Completed Date V 1.7
- #V 1.7
- ############################################################
- $nrgss = 1.7
- add = 0
- remove = 1
- set = 2
- enable = 0
- disable = 1
- play = 0
- stop = 1
- fade = 2
- save = 0
- menu = 1
- encounter = 2
- title = 1
- gameover = 2
- debug = 3
- map = 4
- battle = 5
- shop = 6
- name = 7
- item = 8
- skill = 9
- equip = 10
- status = 11
- exit = 12
- bgm = 0
- bgs = 1
- me = 2
- se = 3
- item = 0
- weapon = 1
- armor = 2
- level = 0
- exp = 1
- hp = 2
- sp = 3
- maxhp = 4
- maxsp = 5
- str = 6
- dex = 7
- agi = 8
- int = 9
- atk = 10
- pdef = 11
- mdef = 12
- eva = 13
- enemyhp = 14
- enemysp = 15
- enemymaxhp = 16
- enemymaxsp = 17
- enemystr = 18
- enemydex = 19
- enemyagi = 20
- enemyint = 21
- enemyatk = 22
- enemypdef = 23
- enemymdef = 24
- enemyeva = 25
- player_x = 26
- player_y = 27
- direction = 28
- screen_x = 29
- screen_y = 30
- terrain_tag = 31
- map_id = 32
- actors_size = 33
- gold = 34
- steps = 35
- frame_count = 36
- frame_rate = 37
- timer = 38
- frame_ratio = 39
- timer_ratio = 40
- save_count = 41
- x = 0
- y = 1
- standalone = 0
- in_file = 1
- file = 1
- script = 0
- file = 1
- mb_ok = 0x0
- mb_okcancel = 0x1
- mb_abortretryignore = 0x2
- mb_yesnocancel = 0x3
- mb_yesno = 0x4
- mb_retrycancel = 0x5
- mb_iconerror = 0x10
- mb_iconquestion = 0x20
- mb_iconwarning = 0x30
- mb_iconinformation = 0x40
- mb_systemmodal = 0x1000
- mb_taskmodal = 0x2000
- mb_topmost = 0x40000
- mb_fatal = 0x042010
- mb_warn = 0x042030
- idok = 1
- idcancel = 2
- idabort = 3
- idretry = 4
- idignore = 5
- idyes = 6
- idno = 7
- error_section_num = (/^(?:Section)?{?(\d+)}?:/)
- error_section = (/^(?:Section)?{?\d+}?:/)
- double_crlf = (/\n\n/)
- messagebox = Win32API.new('user32', 'MessageBoxA', %w(p p p i), 'i')
- msgbox = Win32API.new('user32', 'MessageBoxA', %w(p p p i), 'i')
- getprivateprofilestring = Win32API.new('kernel32', 'GetPrivateProfileStringA',%w(p p p p l p),'l')
- rgss_eval = Win32API.new('RGSS.dll', 'RGSSEval', 'p', 'v') if File.exist?('RGSS.dll')
- rgss2_eval = Win32API.new('RGSS2.dll', 'RGSSEval', 'p', 'v') if File.exist?('RGSS2.dll')
- rgss3_eval = Win32API.new('RGSS3.dll', 'RGSSEval', 'p', 'v') if File.exist?('RGSS3.dll')
- module NRGSS
- $registered_names = []
- $activated_names = []
- $nrgss_extensions = []
- def self.register(product)
- $registered_names << product
- end
- def self.registered?(product)
- $registered_names.include?(product) ? true : false
- end
- def self.activate_product(product)
- $activated_names << product
- end
- def self.activated?
- $activated_names.include?(product) ? true : false
- end
- def self.activate(product)
- NRGSS.register(product) if !(NRGSS.registered?(product))
- NRGSS.activate_product(product) if !($activated_names.include?(product))
- unless NRGSS.registered?(product)
- unless NRGSS.activated?(product)
- raise 'Error wit activating #{product}. Game will now close.'
- end
- end
- end
- def self.extend(name, type, file=nil, encrypted=false)
- case type
- when 0
- $nrgss_extensions << name
- when 1
- NRGSS.eval_script(file, encrypted)
- $nrgss_extensions << name
- end
- end
- def self.extended?(name)
- $nrgss_extensions.include?(name) ? true : false
- end
- def self.in_range?( x, y, value)
- value = self if value == nil
- return true if value.to_i > x.to_i and value < y.to_i
- end
- def self.round_range(x, y, value)
- value = self if value == nil
- if value > x
- value = x
- elsif value < y
- value = y
- end
- end
- def self.unpack_byte(byte)
- result = []
- case byte
- when 0 then result << '$NULL$'
- when 1 then result << '$SOH$'
- when 2 then result << '$STX$'
- when 3 then result << '$ETX$'
- when 4 then result << '$EOT$'
- when 5 then result << '$ENQ$'
- when 6 then result << '$ACK$'
- when 7 then result << '$BEL$'
- when 8 then result << '$BS$'
- when 9 then result << '$TAB$'
- when 10 then result << '$LF$'
- when 11 then result << '$VT$'
- when 12 then result << '$FF$'
- when 13 then result << '$CR$'
- when 14 then result << '$SO$'
- when 15 then result << '$SI$'
- when 16 then result << '$DLE$'
- when 17 then result << '$DC1$'
- when 18 then result << '$DC2$'
- when 19 then result << '$DC3$'
- when 20 then result << '$DC4$'
- when 21 then result << '$NAK$'
- when 22 then result << '$SYN$'
- when 23 then result << '$ETB$'
- when 24 then result << '$CAN$'
- when 25 then result << '$EN$'
- when 26 then result << '$SUB$'
- when 27 then result << '$ESC$'
- when 28 then result << '$FS$'
- when 29 then result << '$GS$'
- when 30 then result << '$RS$'
- when 31 then result << '$US$'
- when 32 then result << ' '
- when 33 then result << '!'
- when 34 then result << '\"'
- when 35 then result << '#'
- when 36 then result << '$'
- when 37 then result << '%'
- when 38 then result << '&'
- when 39 then result << '\''
- when 40 then result << '('
- when 41 then result << ')'
- when 42 then result << '*'
- when 43 then result << '+'
- when 44 then result << ','
- when 45 then result << '-'
- when 46 then result << '.'
- when 47 then result << '/'
- when 48 then result << '0'
- when 49 then result << '1'
- when 50 then result << '2'
- when 51 then result << '3'
- when 52 then result << '4'
- when 53 then result << '5'
- when 54 then result << '6'
- when 55 then result << '7'
- when 56 then result << '8'
- when 57 then result << '9'
- when 58 then result << ':'
- when 59 then result << ';'
- when 60 then result << '<'
- when 61 then result << '='
- when 62 then result << '>'
- when 63 then result << '?'
- when 64 then result << '@'
- when 65 then result << 'A'
- when 66 then result << 'B'
- when 67 then result << 'C'
- when 68 then result << 'D'
- when 69 then result << 'E'
- when 70 then result << 'F'
- when 71 then result << 'G'
- when 72 then result << 'H'
- when 73 then result << 'I'
- when 74 then result << 'J'
- when 75 then result << 'K'
- when 76 then result << 'L'
- when 77 then result << 'M'
- when 78 then result << 'N'
- when 79 then result << 'O'
- when 80 then result << 'P'
- when 81 then result << 'Q'
- when 82 then result << 'R'
- when 83 then result << 'S'
- when 84 then result << 'T'
- when 85 then result << 'U'
- when 86 then result << 'V'
- when 87 then result << 'W'
- when 88 then result << 'X'
- when 89 then result << 'Y'
- when 90 then result << 'Z'
- when 91 then result << '['
- when 92 then result << '\\'
- when 93 then result << ']'
- when 94 then result << '^'
- when 95 then result << '_'
- when 96 then result << '`'
- when 97 then result << 'a'
- when 98 then result << 'b'
- when 99 then result << 'c'
- when 100 then result << 'd'
- when 101 then result << 'e'
- when 102 then result << 'f'
- when 103 then result << 'g'
- when 104 then result << 'h'
- when 105 then result << 'i'
- when 106 then result << 'j'
- when 107 then result << 'k'
- when 108 then result << 'l'
- when 109 then result << 'm'
- when 110 then ersult << 'n'
- when 111 then result << 'o'
- when 112 then result << 'p'
- when 113 then result << 'q'
- when 114 then result << 'r'
- when 115 then result << 's'
- when 116 then result << 't'
- when 117 then result << 'u'
- when 118 then result << 'v'
- when 119 then result << 'w'
- when 120 then result << 'x'
- when 121 then result << 'y'
- when 122 then result << 'z'
- when 123 then result << '{'
- when 124 then result << '|'
- when 125 then result << '}'
- when 126 then result << '~'
- when 127 then result << '$DEL$'
- else
- result << '$NOT$'
- end
- return result
- end
- def self.unpack_text(text)
- result = []
- text.each{|byte|
- result << NRGSS.unpack_byte(byte)
- }
- return result.to_s
- end
- def self.pack_bytes(text)
- result = []
- text.each_byte{|byte| result << byte }
- return result
- end
- def self.pack_byte(letter)
- result = []
- letter.each_byte{|byte| result << letter }
- return result.at(0)
- end
- def self.encrypt_int(int, val=12)
- srand(val*2 + 4)
- (val * 3 + 7).times{
- int = int + val
- int = int - 2
- int = int + rand(val * 4 - 6)
- int = int - rand(val * 3 + 7)
- }
- return int
- end
- def self.decrypt_int(int, val=12)
- srand(val*2 + 4)
- (val * 3 + 7).times{
- int = int - val
- int = int + 2
- int = int - rand(val * 4 - 6)
- int = int + rand(val * 3 + 7)
- }
- return int
- end
- def self.require_rbl(file)
- raise("Rbl #{file} is required. Please install or download it.") if !File.exist?(file)
- end
- def self.rbl_read(data)
- file = File.open(data, 'rb')
- data = file.read
- file.close
- end
- def self.rbl_build(src, file)
- writefile = File.open(file, 'wb')
- $rbl_data = src
- Marshal.dump($rbl_data, writefile)
- writefile.close
- end
- def self.rbl_call(rbl, func, args, bind=false)
- file = File.open(rbl, 'rb')
- $rbl_data = Marshal.load(file)
- $rbl_args = args
- eval(Zlib::Inflate.inflate($rbl_data[func])) if bind == false or bing == 0 or bind == nil
- eval(Zlib::Inflate.inflate($rbl_data[func]), TOPLEVEL_BINDING) if bind == true or bind == 1
- file.close
- end
- def self.zlib_compress_file(readfile2, writefile2, level=9)
- readfile = File.open(readfile2, 'rb')
- data = readfile.read
- readfile.close
- writefile = File.open(writefile2, 'wb')
- i1 = Zlib::Deflate.deflate(data, level)
- writefile.write(i1)
- writefile.close
- end
- def self.zlib_decompress_file(readfile2, writefile2, level=9)
- readfile = File.open(readfile2, 'rb')
- data = readfile.read
- readfile.close
- writefile = File.open(writefile2, 'wb')
- i1 = Zlib::Deflate.deflate(data, level)
- writefile.write(i1)
- writefile.close
- end
- def self.mda_compress(datalist, archive)
- $archived_data = []
- file = File.open(archiwe, 'wb')
- count = 0
- datalist.each{|data|
- datafile = File.open(data, 'rb')
- datafile_d = datafile.read
- datafile.close
- $archived_data[count] = datafile_d
- count += 1
- }
- Marshal.dump($archived_data, file)
- file.close
- end
- def self.mda_load(data, archive)
- file = File.open(data, archive)
- $archived_data = Marshal.load(file)
- return $archived_data[data]
- end
- def self.decompress(data, file, archive)
- NRGSS.file_write(NRGSS.mda_load(data, archive), file)
- end
- def self.file_read(var, file2)
- file = File.open(file2, 'rb')
- var = file.read
- file.close
- end
- def self.file_read2(file2)
- file = File.open(file2, 'rb')
- return file.read
- end
- def self.file_read3(file2)
- return load_data(file2)
- end
- def self.file_write(var, file2)
- file = File.open(file2, 'wb')
- file.write(var)
- file.close
- end
- def self.file_link(afile, bfile, cfile)
- file1 = File.open(afile, 'rb')
- file2 = File.open(bfile, 'rb')
- file3 = File.open(cfile, 'wb')
- file3.write(file1.read)
- file3.write(file2.read)
- file1.close
- file2.close
- file3.close
- end
- def self.cbrt(x)
- result = x**(1.0/3.0)
- return result
- end
- def self.root(nr, st)
- result = nr**(1.0/st.to_f)
- return result
- end
- def self.oppose(nr)
- result = nr - (nr*2)
- return result
- end
- def self.threepower(x, st)
- return (x**st)**st
- end
- def self.circlethreepower(x)
- return (x**x)**x
- end
- def self.zlib_defl(filename)
- file = File.open(filename, 'rb')
- filedata = file.read
- file.close
- return Zlib::Deflate.deflate(filedata, 9)
- end
- def self.zlib_infl(filename)
- file = File.open(filename)
- filedata = file.read
- file.close
- return Zlib::Inflate.inflate(filedata)
- end
- def self.randomize(min, max)
- return rand(max - min + 1)
- end
- def self.set_variable(var, value)
- $game_variables[var] = value
- end
- def self.get_variable(var)
- return $game_variables[var]
- end
- def self.get_player(value)
- case value
- when value = 0 then return $game_player.x
- when value = 1 then return $game_player.y
- when value = 2 then return $game_player.direction
- when value = 3 then return $game_player.screen_x
- when value = 4 then return $game_player.screen_y
- when value = 5 then return $game_player.terrain_tag
- end
- end
- def self.change_variable(variable, value, method, args=[0])
- case method
- when 0 then $game_variables[variable] += value
- when 1 then $game_variables[variable] -= value
- when 2
- case value
- when 0 then NRGSS.set_variable(variable, $game_actors[args[0]].level)
- when 1 then NRGSS.set_variable(variable, $game_actors[args[0]].exp)
- when 2 then NRGSS.set_variable(variable, $game_actors[args[0]].hp)
- when 3 then NRGSS.set_variable(variable, $game_actors[args[0]].sp)
- when 4 then NRGSS.set_variable(variable, $game_actors[args[0]].maxhp)
- when 5 then NRGSS.set_variable(variable, $game_actors[args[0]].maxsp)
- when 6 then NRGSS.set_variable(variable, $game_actors[args[0]].str)
- when 7 then NRGSS.set_variable(variable, $game_actors[args[0]].dex)
- when 8 then NRGSS.set_variable(variable, $game_actors[args[0]].agi)
- when 9 then NRGSS.set_variable(variable, $game_actors[args[0]].int)
- when 10 then NRGSS.set_variable(variable, $game_actors[args[0]].atk)
- when 11 then NRGSS.set_variable(variable, $game_actors[args[0]].pdef)
- when 12 then NRGSS.set_variable(variable, $game_actors[args[0]].mdef)
- when 13 then NRGSS.set_variable(variable, $game_actors[args[0]].eva)
- when 14 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].hp)
- when 15 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].sp)
- when 16 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].maxhp)
- when 17 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].maxsp)
- when 18 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].str)
- when 19 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].dex)
- when 20 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].agi)
- when 21 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].int)
- when 22 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].atk)
- when 23 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].pdef)
- when 24 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].mdef)
- when 25 then NRGSS.set_variable(variable, $game_troop.enemies[args[0]].eva)
- when 26 then NRGSS.set_variable(variable, NRGSS.get_player(0))
- when 27 then NRGSS.set_variable(variable, NRGSS.get_player(1))
- when 28 then NRGSS.set_variable(variable, NRGSS.get_player(2))
- when 29 then NRGSS.set_variable(variable, NRGSS.get_player(3))
- when 30 then NRGSS.set_variable(variable, NRGSS.get_player(4))
- when 31 then NRGSS.set_variable(variable, NRGSS.get_player(5))
- when 32 then NRGSS.set_variable(variable, $game_map.map_id)
- when 33 then NRGSS.set_variable(variable, $game_party.actors.size)
- when 34 then NRGSS.set_variable(variable, $game_party.gold)
- when 35 then NRGSS.set_variable(variable, $game_party.steps)
- when 36 then NRGSS.set_variable(variable, Graphics.frame_count)
- when 37 then NRGSS.set_variable(variable, Graphics.frame_rate)
- when 38 then NRGSS.set_variable(variable, $game_system.timer)
- when 39 then NRGSS.set_variable(variable, Graphics.frame_count / Graphics.frame_rate)
- when 40 then NRGSS.set_variable(variable, $game_system.timer / Graphics.frame_rate)
- when 41 then NRGSS.set_variable(variable, $game_system.save_count)
- end
- end
- end
- def self.return_data(data, args=[0])
- case data
- when 0 then return($game_actors[args[0]].level)
- when 1 then return($game_actors[args[0]].exp)
- when 2 then return($game_actors[args[0]].hp)
- when 3 then return($game_actors[args[0]].sp)
- when 4 then return($game_actors[args[0]].maxhp)
- when 5 then return($game_actors[args[0]].maxsp)
- when 6 then return($game_actors[args[0]].str)
- when 7 then return($game_actors[args[0]].dex)
- when 8 then return($game_actors[args[0]].agi)
- when 9 then return($game_actors[args[0]].int)
- when 10 then return($game_actors[args[0]].atk)
- when 11 then return($game_actors[args[0]].pdef)
- when 12 then return($game_actors[args[0]].mdef)
- when 13 then return($game_actors[args[0]].eva)
- when 14 then return($game_troop.enemies[args[0]].hp)
- when 15 then return($game_troop.enemies[args[0]].sp)
- when 16 then return($game_troop.enemies[args[0]].maxhp)
- when 17 then return($game_troop.enemies[args[0]].maxsp)
- when 18 then return($game_troop.enemies[args[0]].str)
- when 19 then return($game_troop.enemies[args[0]].dex)
- when 20 then return($game_troop.enemies[args[0]].agi)
- when 21 then return($game_troop.enemies[args[0]].int)
- when 22 then return($game_troop.enemies[args[0]].atk)
- when 23 then return($game_troop.enemies[args[0]].pdef)
- when 24 then return($game_troop.enemies[args[0]].mdef)
- when 25 then return($game_troop.enemies[args[0]].eva)
- when 26 then return(NRGSS.get_player(0))
- when 27 then return(NRGSS.get_player(1))
- when 28 then return(NRGSS.get_player(2))
- when 29 then return(NRGSS.get_player(3))
- when 30 then return(NRGSS.get_player(4))
- when 31 then return(NRGSS.get_player(5))
- when 32 then return($game_map.map_id)
- when 33 then return($game_party.actors.size)
- when 34 then return($game_party.gold)
- when 35 then return($game_party.steps)
- when 36 then return(Graphics.frame_count)
- when 37 then return(Graphics.frame_rate)
- when 38 then return($game_system.timer)
- when 39 then return(Graphics.frame_count / Graphics.frame_rate)
- when 40 then return($game_system.timer / Graphics.frame_rate)
- when 41 then return($game_system.save_count)
- end
- end
- def self.set_timer(time)
- $game_system.timer = time * Graphics.frame_rate
- $game_system.timer_working = true
- end
- def self.stop_timer
- $game_system.timer_working = false
- end
- def self.change_money(int, operation)
- case operation
- when 0 then $game_party.gold += int
- when 1 then $game_party.gold -= int
- when 2 then $game_party.gold = int
- end
- end
- def self.change_items(id, number, type, operation)
- case operation
- when 0
- case type
- when 0 then $game_party.gain_item(id, number)
- when 1 then $game_party.gain_weapon(id, number)
- when 2 then $game_party.gain_armor(id, number)
- end
- when 1
- case type
- when 0 then $game_party.lose_item(id,number)
- when 1 then $game_party.lose_weapon(id, number)
- when 2 then $game_party.lose_armor(id, number)
- end
- end
- end
- def self.change(operation, args=[])
- case operation
- when 0 then $game_system.windowskin_name = args[0]
- when 1 then $game_system.battle_bgm = args[0]
- when 2 then $game_system.battle_end_me = args[0]
- end
- end
- def self.manage(type, operation)
- case type
- when 0
- case operation
- when 0 then $game_system.save_disabled = false
- when 1 then $game_system.save_disabled = true
- end
- when 1
- case operation
- when 0 then $game_system.menu_disabled = false
- when 1 then $game_system.menu_disabled = true
- end
- when 2
- case operation
- when 0 then $game_system.encounter_disabled = false
- when 1 then $game_system.encounter_disabled = true
- end
- end
- end
- def self.play(filename, type, operation, args=[100,100])
- volume = 100 if volume == 0
- pitch = 100 if pitch == 0
- case operation
- when 0
- case type
- when 0 then $game_system.bgm_play(filename, args[0], args[1])
- when 1 then $game_system.bgs_play(filename, args[0], args[1])
- when 2 then $game_system.me_play(filename, args[0], args[1])
- when 3 then $game_system.se_play(filename, args[0], args[1])
- end
- when 1
- case type
- when 0 then $game_system.bgm_stop
- when 1 then $game_system.bgs_stop
- when 2 then $game_system.me_stop
- when 3 then $game_system.se_stop
- end
- when 2
- case type
- when 0 then $game_system.bgm_fade(args[0])
- when 1 then $game_system.bgs_fade(args[0])
- when 2 then $game_system.me_fade(args[0])
- when 3 then $game_systen.se_fade(args[0])
- end
- end
- end
- def self.change_hero(hero, attribute, operation, value)
- case operation
- when 0
- case attribute
- when 0 then $game_actors[hero].level += value
- when 1 then $game_actors[hero].exp += value
- when 2 then $game_actors[hero].hp += value
- when 3 then $game_actors[hero].sp += value
- when 4 then $game_actors[hero].maxhp += value
- when 5 then $game_actors[hero].maxsp += value
- when 6 then $game_actors[hero].str += value
- when 7 then $game_actors[hero].dex += value
- when 8 then $game_actors[hero].agi += value
- when 9 then $game_actors[hero].int += value
- when 10 then $game_actors[hero].learn_skill(value)
- end
- when 1
- case attribute
- when 0 then $game_actors[hero].level -= value
- when 1 then $game_actors[hero].exp -= value
- when 2 then $game_actors[hero].hp -= value
- when 3 then $game_actors[hero].sp -= value
- when 4 then $game_actors[hero].maxhp -= value
- when 5 then $game_actors[hero].maxsp -= value
- when 6 then $game_actors[hero].str -= value
- when 7 then $game_actors[hero].dex -= value
- when 8 then $game_actors[hero].agi -= value
- when 9 then $game_actors[hero].int -= value
- when 10 then $game_actors[hero].forget_skill(value)
- end
- when 2
- case atrribute
- when 0 then $game_actors[hero].level = value
- when 1 then $game_actors[hero].exp = value
- when 2 then $game_actors[hero].hp = value
- when 3 then $game_actors[hero].sp = value
- when 4 then $game_actors[hero].maxhp = value
- when 5 then $game_actors[hero].maxsp = value
- when 6 then $game_actors[hero].str = value
- when 7 then $game_actors[hero].dex = value
- when 8 then $game_actors[hero].agi = value
- when 9 then $game_actors[hero].int = value
- end
- end
- end
- def self.heal(actor)
- $game_actors[actor].hp = $game_actors[actor].maxhp
- $game_actors[actor].sp = $game_actors[actor].maxsp
- end
- def self.heal_all
- $game_actors.recover_all
- end
- def self.call(operation)
- case operation
- when 0 then $scene=Scene_Save.new
- when 1 then $scene=Scene_Title.new
- when 2 then $scene=Scene_Gameover.new
- when 3 then $scene=Scene_Debug.new
- when 4 then $scene=Scene_Map.new
- when 5 then $scene=Scene_Battle.new
- when 6 then $scene=Scene_Shop.new
- when 7 then $scene=Scene_Name.new
- when 8 then $scene=Scene_Item.new
- when 9 then $scene=Scene_Skill.new
- when 10 then $scene=Scene_Equip.new
- when 11 then $scene=Scene_Status.new
- when 12 then $scene=Scene_End.new
- end
- end
- def self.save_script(filename='script.txt')
- file = File.open(filename, 'wb')
- if NRGSS.registered?('NCEA')
- NCEA.load_game_data
- script = $game_data[8]
- else
- script = load_data('Data/Scripts.rxdata')
- end
- script.each {|s|
- file.write(Zlib::Inflate.inflate(s.at(2)))
- file.write("\n\n\n")
- }
- file.close
- end
- def self.compile_crbl(data, filename)
- file = File.open(filename, 'wb')
- datafile = File.open(data, 'rb')
- data2 = datafile.read
- $result = Zlib::Deflate.deflate(data2, 9)
- Marshal.dump($result, file)
- datafile.close
- file.close
- end
- def self.eval_crbl(crbl, bind=false)
- $result = load_data(crbl)
- to_eval = Zlib::Inflate.inflate($result)
- case bind
- when false then eval(to_eval)
- when true then eval(to_eval, TOPLEVEL_BINDING)
- end
- end
- def self.messagebox(message, title, type)
- msgbox.call(0, message, title, type)
- end
- def self.b64_encode(x)
- return [x].pack('m')
- end
- def self.b64_decode(x)
- return x.unpack('m').first
- end
- def self.b64_encode_file(file, result)
- readfile = File.open(file, 'rb')
- writefile = File.open(result, 'wb')
- data = readfile.read
- writefile.write(NRGSS.b64_encode(data))
- readfile.close
- writefile.close
- end
- def self.b64_decode_file(file, result)
- readfile = File.open(file, 'rb')
- writefile = File.open(result, 'wb')
- data = readfile.read
- writefile.write(NRGSS.b64_decode(data))
- readfile.close
- writefile.close
- end
- def self.rgss_eval(x)
- rgss_eval.call(x)
- rescue
- print 'RGSS.dll not found. Method not executed.'
- end
- def self.rgss2_eval(x)
- rgss2_eval.call(x)
- rescue
- print 'RGSS2.dll not found. Method not executed.'
- end
- def self.rgss3_eval(x)
- rgss3_eval.call(x)
- rescue
- print 'RGSS3.dll not found. Method not executed.'
- end
- def self.eval_script(filename, encrypted=false, bind=false)
- if encrypted == false
- file = File.open(filename, 'rb')
- data = file.read
- file.close
- if bind == true
- eval(data, TOPLEVEL_BINDING)
- else
- eval(data)
- end
- else
- file = File.open(filename, 'rb')
- $result = Marshal.load(file)
- file.close
- data = Zlib::Inflate.inflate($result)
- if bind == true
- eval(data, TOPLEVEL_BINDING)
- else
- eval(data)
- end
- end
- end
- def self.move_file(file, new_location)
- file = File.open(file, 'rb')
- data = file.read
- file.close
- file = File.open("#{new_location}/#{file}", 'wb')
- file.write(data)
- file.close
- end
- def self.check_bytesize(file, bytesize)
- file = File.open(file, 'rb')
- return true if file.bytesize == bytesize
- return false
- end
- def self.uri_download(x, nam)
- open(x) {|f|
- file = File.open(nam, 'wb')
- file.write(f.read)
- file.close
- }
- end
- def self.location_table(locations_ary)
- result = []
- locations_ary.each{|location|
- Dir.foreach(location){|x|
- if x != '.'
- if x != '..'
- result << "#{location}/#{x}"
- end
- end
- }
- }
- return result
- end
- def self.change_windowskin(filename)
- $game_system.windowskin_name = filename
- end
- end
- def _d(int, key=12)
- return NRGSS.decrypt_int(int, key)
- end
- def _e(int, key=12)
- return NRGSS.encrypt_int(int, key)
- end
- def _td(int, key=12)
- dec = NRGSS.decrypt_int(int, key)
- enc = NRGSS.encrypt_int(dec, key)
- return enc == int
- end
- def byte(byte)
- return NRGSS.pack_byte(byte)
- end
- def ubyte(byte)
- return NRGSS.unpack_byte(byte)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement