Bom pessoal acho que com essa nova melhoria no NP precisariamos trazer o script de auto save do NP 3.0 que salva no servidor para o NP4.0
Será que alguem poderia converte-lo para o 4.0?
segue o script:
Grato desde já.
Será que alguem poderia converte-lo para o 4.0?
segue o script:
- Spoiler:
#--------------------
class Scene_Title
#----------
def character1
$Icon1 = Window_Informacoes.new(315, 90, 296,320,1)
$Icon1.visible = false
$Icon1.active = false
#-----
if Network::Main.check_save_exist(1) and not $delete_1 == true
$Icon2 = Load_Character.new(240,130,170,193,1)
$op_1 = true
@direita1 = Button2.new($Icon2,118+6,60," > ") {$Icon2.visible = false; $Icon2.active = false; $Icon3.visible = true; $Icon3.active = true; @id_c = 2}
@esquerda1 = Button2.new($Icon2,15,60," < ") {$Icon2.visible = false; $Icon2.active = false; $Icon4.visible = true; $Icon4.active = true; @id_c = 3}
if $ban_1 != true
@logbotao1 = Button_Login.new($Icon2,49,120," Entrar "){@id_c = 1;carregar}
end
@crebotao1 = Button_Login.new($Icon2,49,142," Apagar"){@delete.visible = true; @delete.active = true;$char_id = 1}
else
$Icon2 = Load_Character.new(240,130,170,193,1)
@direita1 = Button2.new($Icon2,118+6,60," > ") {$Icon2.visible = false; $Icon2.active = false; $Icon3.visible = true; $Icon3.active = true; @id_c = 2}
@esquerda1 = Button2.new($Icon2,15,60," < ") {$Icon2.visible = false; $Icon2.active = false; $Icon4.visible = true; $Icon4.active = true; @id_c = 3}
@logbotao1 = Button_Login.new($Icon2,49,120," Criar "){xd_1}
end
end
#----------
def character2
$Icon10 = Window_Informacoes.new(315, 90, 296,320,2)
$Icon10.visible = false
$Icon10.active = false
#-----
if Network::Main.check_save_exist(2) and not $delete_2 == true
$Icon3 = Load_Character.new(240,130,170,193,2)
$Icon3.visible = false
$Icon3.active = false
$op_2 = true
@direita2 = Button2.new($Icon3,118+6,60," > ")
@esquerda2 = Button2.new($Icon3,15,60," < ") {$Icon3.visible = false; $Icon3.active = false; $Icon2.visible = true; $Icon2.active = true; @id_c = 1}
if $ban_2 != true
@logbotao2 = Button_Login.new($Icon3,49,120," Entrar "){@id_c = 2;carregar}
end
@crebotao2 = Button_Login.new($Icon3,49,142," Apagar"){@delete.visible = true; @delete.active = true;$char_id = 2}
else
$Icon3 = Load_Character.new(240,130,170,193,2)
$Icon3.visible = false
$Icon3.active = false
@direita2 = Button2.new($Icon3,118+6,60," > ")
@esquerda2 = Button2.new($Icon3,15,60," < ") {$Icon3.visible = false; $Icon3.active = false; $Icon2.visible = true; $Icon2.active = true; @id_c = 1}
@logbotao2 = Button_Login.new($Icon3,49,120," Criar "){xd_2}
end
end
#----------
def character3
$Icon20 = Window_Informacoes.new(315, 90, 296,320,3)
$Icon20.visible = false
$Icon20.active = false
#-----
if Network::Main.check_save_exist(3) and not $delete_3 == true
$Icon4 = Load_Character.new(240,130,170,193,3)
$Icon4.visible = false
$Icon4.active = false
$op_3 = true
@direita3 = Button2.new($Icon4,118+6,60," > ") {$Icon4.visible = false; $Icon4.active = false; $Icon2.visible = true; $Icon2.active = true; @id_c = 1}
@esquerda3 = Button2.new($Icon4,15,60," < ")
if $ban_3 != true
@logbotao3 = Button_Login.new($Icon4,49,120," Entrar "){@id_c = 3;carregar}
end
@crebotao3 = Button_Login.new($Icon4,49,142," Apagar"){@delete.visible = true; @delete.active = true;$char_id = 3}
else
$Icon4 = Load_Character.new(240,130,170,193,3)
$Icon4.visible = false
$Icon4.active = false
@direita3 = Button2.new($Icon4,118+6,60," > ") {$Icon4.visible = false; $Icon4.active = false; $Icon2.visible = true; $Icon2.active = true; @id_c = 1}
@esquerda3 = Button2.new($Icon4,15,60," < ")
@logbotao3 = Button_Login.new($Icon4,49,120," Criar "){xd_3}
end
end
#----------
def cmd_abaixo
name = Network::Main.name
#-----
for i in 1 .. 3
if !Network::Main.check_save_exist(i)
if $create.visible != true
$create.visible = true
$create.active = true
end
$create.refresh
$char_id = i
$Icon1.visible = false
$Icon1.active = false
$Icon10.visible = false
$Icon1.active = false
$Icon20.visible = false
$Icon20.active = false
$create_box.visible = true
$create_box.active = true
$mouse_active = true
return
end
end
end
#----------
def sim
@delete.visible = false
@delete.active = false
#-----
name = Network::Main.name
if $Icon2.visible == true
$op_1 = false
$delete_1 = true
Network::Main.delete_save(1)
elsif $Icon3.visible == true
$op_2 = false
$delete_2 = true
Network::Main.delete_save(2)
elsif $Icon4.visible == true
$op_3 = false
$delete_3 = true
Network::Main.delete_save(3)
end
#-----
$scene = Scene_Title.new
end
#----------
def carregar2
Network::Main.update
$ABS = MrMo_ABS.new
name = Network::Main.name
#-----
file = Network::Main.get_save_data(@id_c)
characters = Marshal.load(file)
#-----
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$ABS = Marshal.load(file)
$distribuir_pontos = Marshal.load(file)
$genero = Marshal.load(file)
$guild_name = Marshal.load(file)
$guild_position = Marshal.load(file)
$flag = Marshal.load(file)
$guild_points = Marshal.load(file)
$guild_lider_name = Marshal.load(file)
$item_carregado = Marshal.load(file)
$carregou_item = Marshal.load(file)
$item_carregado_2 = Marshal.load(file)
$carregou_item_2 = Marshal.load(file)
$item_carregado_3 = Marshal.load(file)
$carregou_item_3 = Marshal.load(file)
$item_carregado_4 = Marshal.load(file)
$carregou_item_4 = Marshal.load(file)
$level_info = Marshal.load(file)
$arma_n = Marshal.load(file)
$escudo_n = Marshal.load(file)
$capa_ac = Marshal.load(file)
$bota_ac = Marshal.load(file)
$amuleto_ac = Marshal.load(file)
$luva_ac = Marshal.load(file)
#-----
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
$game_map.update
$ABS.update
$game_party.refresh
$game_map.autoplay
Graphics.freeze
#-----
$char_id = @id_c if @id_c.between?(1, 3)
$divide_exp = false
#-----
if Network::Main.group == 'admin'
$game_party.actors[0].grupo = "Admin"
else
$game_party.actors[0].grupo = "Standard"
end
#-----
file.close
File.delete(file.path)
#-----
if $guild_name != ""
if Network::Main.user_exist?($guild_name.to_s+"-Guild-DEL") == true
$guild_name = ""
$game_party.actors[0].guild = ""
$game_player.refresh
$guild_position = "Membro"
$guild_lider_name = ""
$guild_points = 0
return
end
end
#-----
$game_player.refresh
$chat_ativo_agr = true
$scene = Scene_Map.new
$fechando_ativar = true
Network::Main.send_start
end
end
#---------------
class Load_Character < Window_Base
#----------
def initialize(x,y,a,b,id)
super(x,y,a,b)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 200
@id_char = id
self.windowskin = RPG::Cache.windowskin("WindSkinC")
if (@file_exist = Network::Main.check_save_exist(id))
file = Network::Main.get_save_data(id)
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = Marshal.load(file)
@game_screen = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
File.delete(file.path)
end
refresh
end
#----------
end
#---------------
class Window_Informacoes < Window_Base
def initialize(x, y, a, b, id)
super(x, y, a, b)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 200
self.z = 99999
@closable = true
#-----
if (@file_exist = Network::Main.check_save_exist(id))
file = Network::Main.get_save_data(id)
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@game_self_switches = Marshal.load(file)
@game_screen = Marshal.load(file)
@game_actors = Marshal.load(file)
@game_party = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
File.delete(file.path)
end
#-----
refresh
end
end
#---------------
class Socket
#----------
def gets(end_char = "\n")
buffer = ""
while (char = recv(1)) != end_char
buffer += char
end
return buffer
end
#----------
end
#---------------
class Network::Main
#----------
def self.close_socket
return if @socket == nil
#-----
if $game_temp.message_window_showing
@message_window = Window_Message.new
@message_window.terminate_message
end
#-----
if $scene.is_a?(Scene_Connect)
end
#-----
if $scene.is_a?(Scene_Login)
end
#-----
if $scene.is_a?(Scene_Title)
end
#-----
if $scene.is_a?(Scene_Trade)
salvar
end
#-----
if $scene.is_a?(Scene_PChat)
salvar
end
#-----
if $scene.is_a?(Scene_Map)
salvar
#-----
if not $party.empty?
for i in 0..$party.members.size
if $party.members[i] != nil
if $parte_s == true
name = $game_party.actors[0].name
Network::Main.pchat($charzinho_id, "[COM] [ET] #{name}")
Network::Main.pchat($charzinho_id, "[COM] [EXIT] #{name}")
Network::Main.pchat($charzinho_id, "#{name} saiu da party!")
else
name = $game_party.actors[0].name
Network::Main.pchat($party.members[i].netid, "[COM] [ET] #{name}")
Network::Main.pchat($party.members[i].netid, "[COM] [EXIT] #{name}")
Network::Main.pchat($party.members[i].netid, "#{name} saiu da party!")
end
end
end
end
end
#-----
@socket.send("<9>#{self.id}9>\n")
@socket.close
@socket = nil
#-----
end
#----------
def self.check_save_exist(char_id)
self.update
@socket.send("#{"%03d" % char_id} \n")
if @socket.gets("\n") == ""
return true
else
return false
end
end
#----------
def self.delete_save(char_id)
@socket.send("#{"%03d" % char_id} \n")
end
#----------
def self.get_save_data(char_id)
self.update
#-----
@socket.send("#{"%03d" % char_id} \n")
stream_size = @socket.gets("\n").scan(/[0-9]+/)[0].to_i
zipped_save = @socket.recv(stream_size)
#-----
while zipped_save.count("\n") != 0 or zipped_save.count("\0") != 0
if zipped_save.count("\n") != 0
zipped_save.gsub!("\n", '')
zipped_save << @socket.recv(zipped_save.count("\n"))
end
if zipped_save.count("\0") != 0
zipped_save.gsub!("\0", '')
zipped_save << @socket.recv(zipped_save.count("\0"))
end
if stream_size != zipped_save.size
zipped_save << @socket.recv(stream_size - zipped_save.size)
end
end
#-----
while File.exist?(tmp_file_name = ENV['TMP'] + "/" + (rand(0xFFFF).to_s + rand(0xFFFF).to_s + rand(0xFFFF).to_s) + ".tmp")
end
#-----
file = File.open(tmp_file_name, 'wb')
file.write(Zlib::Inflate.inflate(zipped_save.unpack('m0')[0]))
file.close
#-----
File.open(tmp_file_name, 'rb')
end
#----------
end
#---------------
def salvar
#-----
char_id = $char_id
characters = []
save_contents = ""
#-----
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
save_contents << Marshal.dump(characters)
save_contents << Marshal.dump(Graphics.frame_count)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
save_contents << Marshal.dump($game_system)
save_contents << Marshal.dump($game_switches)
save_contents << Marshal.dump($game_variables)
save_contents << Marshal.dump($game_self_switches)
save_contents << Marshal.dump($game_screen)
save_contents << Marshal.dump($game_actors)
save_contents << Marshal.dump($game_party)
save_contents << Marshal.dump($game_troop)
save_contents << Marshal.dump($game_map)
save_contents << Marshal.dump($game_player)
save_contents << Marshal.dump($ABS)
save_contents << Marshal.dump($distribuir_pontos)
save_contents << Marshal.dump($genero)
save_contents << Marshal.dump($guild_name)
save_contents << Marshal.dump($guild_position)
save_contents << Marshal.dump($flag)
save_contents << Marshal.dump($guild_points)
save_contents << Marshal.dump($guild_lider_name)
save_contents << Marshal.dump($item_carregado)
save_contents << Marshal.dump($carregou_item)
save_contents << Marshal.dump($item_carregado_2)
save_contents << Marshal.dump($carregou_item_2)
save_contents << Marshal.dump($item_carregado_3)
save_contents << Marshal.dump($carregou_item_3)
save_contents << Marshal.dump($item_carregado_4)
save_contents << Marshal.dump($carregou_item_4)
save_contents << Marshal.dump($level_info)
save_contents << Marshal.dump($arma_n)
save_contents << Marshal.dump($escudo_n)
save_contents << Marshal.dump($capa_ac)
save_contents << Marshal.dump($bota_ac)
save_contents << Marshal.dump($amuleto_ac)
save_contents << Marshal.dump($luva_ac)
#-----
part_size = 3048
#-----
save_contents = [Zlib::Deflate.deflate(save_contents, 9)].pack('m0').gsub("\n", '')
Network::Main.socket.send("#{"%03d" % char_id} \n")
#-----
for part in 1 .. (save_contents.length/part_size)+1
part_str = save_contents[(part - 1)*part_size ... part*part_size]
unless part_str == nil or part_str.empty?
Network::Main.socket.send("#{part_str} \n")
end
end
#-----
Network::Main.socket.send("\n")
#-----
end
#--------------------
Grato desde já.