Commit e0b8d20a authored by 神楽坂玲奈's avatar 神楽坂玲奈

093, failure

parent de17066c
...@@ -2,4 +2,14 @@ source :rubygems ...@@ -2,4 +2,14 @@ source :rubygems
ruby '1.9.3' ruby '1.9.3'
gem 'rubysdl', :platform => :ruby gem 'rubysdl', :platform => :ruby
gem 'rubysdl-mswin32-1.9', :platforms => [:mswin, :mingw] gem 'rubysdl-mswin32-1.9', :platforms => [:mswin, :mingw]
\ No newline at end of file gem 'eventmachine'
gem 'em-http-request'
gem 'xmpp4r'
gem 'locale'
gem 'i18n'
gem 'ruby-ogginfo'
gem 'sqlite3'
gem 'zip'
gem 'websocket'
gem 'net-http-pipeline'
\ No newline at end of file
#encoding: UTF-8 #encoding: UTF-8
require 'rubygems' require 'rubygems'
require 'rake' require 'rake'
require 'rake/clean' require 'rake/clean'
require 'rubygems/package_task' require 'rubygems/package_task'
require 'rdoc/task' require 'rdoc/task'
#require 'rake/testtask' #require 'rake/testtask'
Windows = RUBY_PLATFORM["mingw"] || RUBY_PLATFORM["mswin"] Windows = RUBY_PLATFORM["mingw"] || RUBY_PLATFORM["mswin"]
#在windows上UTF-8脚本编码环境中 Dir.glob无法列出中文目录下的文件 所以自己写个递归 #在windows上UTF-8脚本编码环境中 Dir.glob无法列出中文目录下的文件 所以自己写个递归
def list(path) def list(path)
result = [] result = []
Dir.foreach(path) do |file| Dir.foreach(path) do |file|
next if file == "." or file == ".." next if file == "." or file == ".."
result << "#{path}/#{file}" result << "#{path}/#{file}"
result.concat list(result.last) if File.directory? result.last result.concat list(result.last) if File.directory? result.last
end rescue p $! end rescue p $!
result result
end end
spec = Gem::Specification.new do |s| spec = Gem::Specification.new do |s|
s.name = 'mycard' s.name = 'mycard'
s.version = '0.8.5' s.version = '0.9.3'
s.extra_rdoc_files = ['README.txt', 'LICENSE.txt'] s.extra_rdoc_files = ['README.txt', 'LICENSE.txt']
s.summary = 'a card game' s.summary = 'a card game'
s.description = s.summary s.description = s.summary
s.author = 'zh99998' s.author = 'zh99998'
s.email = 'zh99998@gmail.com' s.email = 'zh99998@gmail.com'
s.homepage = 'http://my-card.in' s.homepage = 'http://my-card.in'
# s.executables = ['your_executable_here'] # s.executables = ['your_executable_here']
s.files = %w(LICENSE.txt README.txt config.yml replay) s.files = %w(LICENSE.txt README.txt config.yml replay)
%w{lib audio data fonts locales graphics ygocore}.each{|dir|s.files.concat list(dir)} %w{lib audio data fonts locales graphics ygocore}.each{|dir|s.files.concat list(dir)}
if Windows if Windows
s.files += %w(mycard.exe) + list("ruby") s.files += %w(mycard.exe) + list("ruby")
else else
s.files += %w(install.sh) s.files += %w(install.sh)
end end
s.require_path = "lib" s.require_path = "lib"
#s.bindir = "bin" #s.bindir = "bin"
end end
Gem::PackageTask.new(spec) do |p| Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec p.gem_spec = spec
if Windows if Windows
p.need_zip = true p.need_zip = true
p.zip_command = '7z a' p.zip_command = '7z a'
def p.zip_file def p.zip_file
"#{package_name}-win32.7z" "#{package_name}-win32.7z"
end end
else else
p.need_tar = true p.need_tar = true
end end
end end
Rake::RDocTask.new do |rdoc| Rake::RDocTask.new do |rdoc|
files =['README.txt', 'LICENSE.txt', 'lib/**/*.rb'] files =['README.txt', 'LICENSE.txt', 'lib/**/*.rb']
rdoc.rdoc_files.add(files) rdoc.rdoc_files.add(files)
rdoc.main = "README.txt" # page to start on rdoc.main = "README.txt" # page to start on
rdoc.title = "Mycard Docs" rdoc.title = "Mycard Docs"
rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
rdoc.options << '--line-numbers' rdoc.options << '--line-numbers'
end end
CLOBBER.include %w(error-程序出错请到论坛反馈.txt log.log profile.log config.yml doc ygocore/pics) + list('replay') + list('ygocore/replay') + list('.').keep_if{|file|File.basename(file) == "Thumbs.db"} + list("graphics/avatars").reject{|file|File.basename(file) =~ /(?:error|loading)_(?:small|middle|large)\.png/} + list("ygocore/deck").keep_if{|file|File.basename(file) != 'sample.ydk'} CLOBBER.include %w(error-程序出错请到论坛反馈.txt log.log profile.log config.yml doc ygocore/pics) + list('replay') + list('ygocore/replay') + list('.').keep_if{|file|File.basename(file) == "Thumbs.db"} + list("graphics/avatars").reject{|file|File.basename(file) =~ /(?:error|loading)_(?:small|middle|large)\.png/} + list("ygocore/deck").keep_if{|file|File.basename(file) != 'sample.ydk'}
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
begin begin
Windows = RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"] Windows = RUBY_PLATFORM["win"] || RUBY_PLATFORM["ming"]
#System_Encoding = Windows ? "CP#{`chcp`.scan(/\d+$/)}" : `locale |grep LANG |awk -F '=' '{print $2}'`
Dir.glob('post_update_*.rb').sort.each { |file| load file } Dir.glob('post_update_*.rb').sort.each { |file| load file }
Thread.abort_on_exception = true Thread.abort_on_exception = true
...@@ -45,6 +47,9 @@ begin ...@@ -45,6 +47,9 @@ begin
unless $scene == false unless $scene == false
#加载文件 #加载文件
require 'openssl'
require 'digest/sha1'
require 'digest/md5'
require 'logger' require 'logger'
require 'sdl' require 'sdl'
include SDL include SDL
......
...@@ -4,13 +4,20 @@ require_relative 'room' ...@@ -4,13 +4,20 @@ require_relative 'room'
require_relative 'ygocore/game' require_relative 'ygocore/game'
$game = Ygocore.new $game = Ygocore.new
open('debug.txt', 'wb'){|f|f.write ARGV.first}
file = ARGV.first.dup.force_encoding("UTF-8")
file.force_encoding("GBK") unless file.valid_encoding?
file.encode!("UTF-8")
if ARGV.first[0, 9] == 'mycard://' if ARGV.first[0, 9] == 'mycard://'
file = URI.unescape URI.unescape ARGV.first[9, ARGV.first.size-9] file = URI.unescape file[9, file.size-9]
uri = "http://" + URI.escape(file) uri = "http://" + URI.escape(file)
#elsif ARGV.first[0, 2] == '//'
# file = URI.unescape URI.unescape ARGV.first[2, ARGV.first.size-2]
# uri = "http://" + URI.escape(file)
else else
file = ARGV.first.dup.force_encoding("UTF-8")
file.force_encoding("GBK") unless file.valid_encoding?
file.encode!("UTF-8")
uri = file uri = file
end end
case file case file
...@@ -45,13 +52,12 @@ case file ...@@ -45,13 +52,12 @@ case file
deck.side.each { |card| dest.puts card.number } deck.side.each { |card| dest.puts card.number }
end end
Ygocore.run_ygocore($2, true) Ygocore.run_ygocore($2, true)
when /^(?:(.*)\:(.*)\@)?(.*)\:(\d+)\/(.*)$/ when /^(?:(.+?)(?:\:(.+?))?\@)?([\d\.]+)\:(\d+)(?:\/(.*))$/
require 'uri' require 'uri'
require_relative 'server'
$game.user = User.new($1.to_sym, $1) if $1 $game.user = User.new($1.to_sym, $1) if $1
$game.password = $2 if $2 $game.password = $2 if $2
room = Room.new(0, $5) room = Room.new(0, $5.to_s)
room.server_ip = $3 room.server = Server.new(nil, nil, $3, $4.to_i, !!$2)
room.server_port = $4.to_i
room.server_auth = true if $2
Ygocore.run_ygocore room, true Ygocore.run_ygocore room, true
end end
\ No newline at end of file
require 'open-uri' require 'open-uri'
require "fileutils" require "fileutils"
require_relative 'card' require_relative 'card'
module Update module Update
Version = '0.8.6' Version = '0.9.3'
URL = "http://my-card.in/mycard/update.json?version=#{Version}" URL = "http://my-card.in/mycard/update.json?version=#{Version}"
class <<self class <<self
attr_reader :thumbnails, :images, :status attr_reader :thumbnails, :images, :status
def start def start
Dir.glob("mycard-update-*-*.zip") do |file| Dir.glob("mycard-update-*-*.zip") do |file|
file =~ /mycard-update-(.+?)-(.+?)\.zip/ file =~ /mycard-update-(.+?)-(.+?)\.zip/
if $1 <= Version and $2 > Version if $1 <= Version and $2 > Version
$log.info('安装更新'){file} $log.info('安装更新') { file }
WM::set_caption("MyCard - 正在更新 #{Version} -> #{$2}", "MyCard") WM::set_caption("MyCard - 正在更新 #{Version} -> #{$2}", "MyCard")
require 'zip/zip' require 'zip/zip'
Zip::ZipFile::open(file) do |zip| Zip::ZipFile::open(file) do |zip|
zip.each do |f| zip.each do |f|
if !File.directory?(f.name) if !File.directory?(f.name)
FileUtils.mkdir_p(File.dirname(f.name)) FileUtils.mkdir_p(File.dirname(f.name))
end end
f.extract{true} f.extract { true }
end end
end rescue $log.error('安装更新出错'){file+$!.inspect+$!.backtrace.inspect} end rescue $log.error('安装更新出错') { file+$!.inspect+$!.backtrace.inspect }
Version.replace $2 Version.replace $2
File.delete file File.delete file
@updated = true @updated = true
...@@ -32,44 +33,44 @@ module Update ...@@ -32,44 +33,44 @@ module Update
end end
@images = [] @images = []
@thumbnails = [] @thumbnails = []
@status = '正在检查更新' @status = '正在检查更新'
@updated = false @updated = false
Thread.new do (Thread.new do
open(URL) do |file| open(URL) do |file|
require 'json' require 'json'
reply = file.read reply = file.read
$log.info('下载更新-服务器回传'){reply} $log.info('下载更新-服务器回传') { reply }
reply = JSON.parse(reply) reply = JSON.parse(reply)
$log.info('下载更新-解析后'){reply.inspect} $log.info('下载更新-解析后') { reply.inspect }
reply.each do |fil| reply.each do |fil|
name = File.basename fil name = File.basename fil
@status.replace "正在下载更新#{name}" @status.replace "正在下载更新#{name}"
open(fil, 'rb') do |fi| open(fil, 'rb') do |fi|
$log.info('下载完毕'){name} $log.info('下载完毕') { name }
@updated = true @updated = true
open(name, 'wb') do |f| open(name, 'wb') do |f|
f.write fi.read f.write fi.read
end end
end rescue $log.error('下载更新'){'下载更新失败'} end rescue $log.error('下载更新') { '下载更新失败' }
end end
end rescue $log.error('检查更新'){'检查更新失败'} end rescue $log.error('检查更新') { '检查更新失败' }
if @updated if @updated
require_relative 'widget_msgbox' require_relative 'widget_msgbox'
Widget_Msgbox.new('mycard', '下载更新完毕,点击确定重新运行mycard并安装更新', :ok => "确定"){IO.popen('./mycard'); $scene = nil} Widget_Msgbox.new('mycard', '下载更新完毕,点击确定重新运行mycard并安装更新', :ok => "确定") { IO.popen('./mycard'); $scene = nil }
end end
if File.file? "ygocore/cards.cdb" if File.file? "ygocore/cards.cdb"
require 'sqlite3' require 'sqlite3'
db = SQLite3::Database.new( "ygocore/cards.cdb" ) db = SQLite3::Database.new("ygocore/cards.cdb")
db.execute( "select id from datas" ) do |row| db.execute("select id from datas") do |row|
@thumbnails << row[0] @thumbnails << row[0]
end end
@images.replace @thumbnails @images.replace @thumbnails
if !File.directory?('ygocore/pics/thumbnail') if !File.directory?('ygocore/pics/thumbnail')
FileUtils.mkdir_p('ygocore/pics/thumbnail') FileUtils.mkdir_p('ygocore/pics/thumbnail')
end end
existed_thumbnails = [] existed_thumbnails = []
Dir.foreach("ygocore/pics/thumbnail") do |file| Dir.foreach("ygocore/pics/thumbnail") do |file|
if file =~ /(\d+)\.jpg/ if file =~ /(\d+)\.jpg/
...@@ -86,9 +87,9 @@ module Update ...@@ -86,9 +87,9 @@ module Update
@images -= existed_images @images -= existed_images
existed_images = [] existed_images = []
if (!@images.empty? or !@thumbnails.empty?) and File.file?("#{Card::PicPath}/1.jpg") if (!@images.empty? or !@thumbnails.empty?) and File.file?("#{Card::PicPath}/1.jpg")
db_mycard = SQLite3::Database.new( "data/data.sqlite" ) db_mycard = SQLite3::Database.new("data/data.sqlite")
db_mycard.execute( "select id, number from `yu-gi-oh` where number in (#{(@images+@thumbnails).uniq.collect{|number|"'%08d'" % number}.join(',')})" ) do |row| db_mycard.execute("select id, number from `yu-gi-oh` where number in (#{(@images+@thumbnails).uniq.collect { |number| "'%08d'" % number }.join(',')})") do |row|
id = row[0] id = row[0]
number = row[1].to_i number = row[1].to_i
src = "#{Card::PicPath}/#{id}.jpg" src = "#{Card::PicPath}/#{id}.jpg"
...@@ -108,39 +109,69 @@ module Update ...@@ -108,39 +109,69 @@ module Update
@thumbnails -= existed_images @thumbnails -= existed_images
@thumbnails = (@thumbnails & @images) + (@thumbnails - @images) @thumbnails = (@thumbnails & @images) + (@thumbnails - @images)
unless @thumbnails.empty? and @images.empty? unless @thumbnails.empty? and @images.empty?
$log.info('待下载的完整卡图'){@images.inspect} $log.info('待下载的完整卡图') { @images.inspect }
$log.info('待下载的缩略卡图'){@thumbnails.inspect} $log.info('待下载的缩略卡图') { @thumbnails.inspect }
threads = 5.times.collect do
thread = Thread.new do open('http://my-card.in/cards/image.json') do |f|
while number = @thumbnails.pop image_index = JSON.parse(f.read)
@status.replace "正在下载缩略卡图 (剩余#{@thumbnails.size}张)" url = image_index['url']
open("http://my-card.in/images/cards/ygocore/thumbnail/#{number}.jpg", 'rb') do |remote| uri = URI(url)
next if File.file? "ygocore/pics/thumbnail/#{number}.jpg" image_req = uri.path
#$log.debug('下载缩略卡图'){"http://my-card.in/images/cards/ygocore/thumbnail/#{number}.jpg 到 ygocore/pics/thumbnail/#{number}.jpg" } image_req += '?' + uri.query if uri.query
open("ygocore/pics/thumbnail/#{number}.jpg", 'wb') do |local| image_req += '#' + uri.fragment if uri.fragment
local.write remote.read
url = image_index['thumbnail_url']
uri = URI(url)
thumbnail_req = uri.path
thumbnail_req += '?' + uri.query if uri.query
thumbnail_req += '#' + uri.fragment if uri.fragment
require 'net/http/pipeline'
@thumbnails_left = @thumbnails.size
@images_left = @images.size
threads = 1.times.collect do
thread = Thread.new do
Net::HTTP.start uri.host, uri.port do |http|
http.pipelining = true
while !@thumbnails.empty?
ids = @thumbnails.pop(100)
reqs = ids.reverse.collect { |id| Net::HTTP::Get.new image_req.gsub(':id', id.to_s) }
http.pipeline reqs do |res|
@status.replace "正在下载缩略卡图 (剩余#{@thumbnails_left}张)"
@thumbnails_left -= 1
id = ids.pop
next if File.file? "ygocore/pics/thumbnail/#{id}.jpg"
content = res.body
open("ygocore/pics/thumbnail/#{id}.jpg", 'wb') do |local|
local.write content
end
end rescue $log.error('下载缩略卡图') { [$!.inspect, *$!.backtrace].collect { |str| str.force_encoding("UTF-8") }.join("\n") }
end end
end rescue $log.error('下载缩略出错'){"http://my-card.in/images/cards/ygocore/thumbnail/#{number}.jpg 到 ygocore/pics/thumbnail/#{number}.jpg" } while !@images_reqs.empty?
end ids = @images_reqs.pop(100)
while number = @images.pop reqs = ids.reverse.collect { |id| Net::HTTP::Get.new thumbnail_req.gsub(':id', id.to_s) }
@status.replace "正在下载完整卡图 (剩余#{@images.size}张)" http.pipeline reqs do |res|
#$log.debug('下载完整卡图'){"http://my-card.in/images/cards/ygocore/#{number}.jpg 到 ygocore/pics/#{number}.jpg" } @status.replace "正在下载完整卡图 (剩余#{@images_left}张)"
open("http://my-card.in/images/cards/ygocore/#{number}.jpg", 'rb') do |remote| @images_left -= 1
next if File.file? "ygocore/pics/#{number}.jpg" id = ids.pop
open("ygocore/pics/#{number}.jpg", 'wb') do |local| next if File.file? "ygocore/pics/#{id}.jpg"
local.write remote.read content = res.body
open("ygocore/pics/#{id}.jpg", 'wb') do |local|
local.write content
end
end rescue $log.error('下载完整卡图') { [$!.inspect, *$!.backtrace].collect { |str| str.force_encoding("UTF-8") }.join("\n") }
end end
end rescue $log.error('下载完整卡图出错'){"http://my-card.in/images/cards/ygocore/#{number}.jpg 到 ygocore/pics/#{number}.jpg" } end rescue $log.error('下载完整卡图出错') { [$!.inspect, *$!.backtrace].collect { |str| str.force_encoding("UTF-8") }.join("\n") }
end end
thread.priority = -1
thread
end end
thread.priority = -1 threads.each { |thread| thread.join }
thread
end end
threads.each{|thread|thread.join}
end end
end rescue $log.error('卡图更新'){'找不到ygocore卡片数据库'} end rescue $log.error('卡图更新') { [$!.inspect, *$!.backtrace].collect { |str| str.force_encoding("UTF-8") }.join("\n") }
@status = nil @status = nil
end.priority = -1 end).priority = -1
end end
end end
end end
#encoding: UTF-8 #encoding: UTF-8
load 'lib/ygocore/window_login.rb' load 'lib/ygocore/window_login.rb'
require 'eventmachine' require 'eventmachine'
require 'em-http' require 'em-http'
...@@ -32,9 +32,9 @@ class Ygocore < Game ...@@ -32,9 +32,9 @@ class Ygocore < Game
matched = @username.match Jabber::JID::PATTERN matched = @username.match Jabber::JID::PATTERN
if matched[1] && matched[2] if matched[1] && matched[2]
@username = matched[1] @username = matched[1]
jid = Jabber::JID::new matched[1], matched[2], matched[3] || 'mycard' jid = Jabber::JID::new @username, matched[2], matched[3] || 'mycard'
else else
jid = Jabber::JID::new @username.dup, 'my-card.in', 'mycard' jid = Jabber::JID::new @username, 'my-card.in', 'mycard'
end end
@@im = Jabber::Client.new(jid) @@im = Jabber::Client.new(jid)
...@@ -116,59 +116,63 @@ class Ygocore < Game ...@@ -116,59 +116,63 @@ class Ygocore < Game
@@im.allow_tls = false @@im.allow_tls = false
@@im.use_ssl = true @@im.use_ssl = true
if @@im.jid.domain == 'my-card.in' connected = false
@@im.connect(record.target.to_s, 5223) if @@im.jid.domain == "my-card.in"
@@im.connect("ygopro-server.my-card.in", 5223) rescue Game_Event.push Game_Event::Error.new('登录', '连接服务器失败')
connected = true
else else
#由于XMPP4r在windows下TLS有问题...
srv = [] srv = []
Resolv::DNS.open { |dns| Resolv::DNS.open { |dns|
# If ruby version is too old and SRV is unknown, this will raise a NameError
# which is caught below
Jabber::debuglog("RESOLVING:\n_xmpp-client._tcp.#{@@im.jid.domain} (SRV)") Jabber::debuglog("RESOLVING:\n_xmpp-client._tcp.#{@@im.jid.domain} (SRV)")
srv = dns.getresources("_xmpp-client._tcp.#{@@im.jid.domain}", Resolv::DNS::Resource::IN::SRV) srv = dns.getresources("_xmpp-client._tcp.#{@@im.jid.domain}", Resolv::DNS::Resource::IN::SRV)
} }
if srv.empty? if srv.empty?
Game_Event.push Game_Event::Error.new('登录', '解析服务器地址失败') Game_Event.push Game_Event::Error.new('登录', '解析服务器地址失败')
Thread.exit Thread.exit
end end
# Sort SRV records: lowest priority first, highest weight first # Sort SRV records: lowest priority first, highest weight first
srv.sort! { |a,b| (a.priority != b.priority) ? (a.priority <=> b.priority) : (b.weight <=> a.weight) } srv.sort! { |a,b| (a.priority != b.priority) ? (a.priority <=> b.priority) : (b.weight <=> a.weight) }
srv.each { |record| srv.each { |record|
begin begin
@@im.connect @@im.connect(record.target.to_s, 5223)
# Success # Success
connected = true
break break
rescue SocketError, Errno::ECONNREFUSED rescue
# Try next SRV record # Try next SRV record
end end
} }
end end
begin if connected
@@im.auth(@password) begin
rescue Jabber::ClientAuthenticationFailure @@im.auth(@password)
Game_Event.push Game_Event::Error.new('登录', '用户名或密码错误') rescue Jabber::ClientAuthenticationFailure
Thread.exit Game_Event.push Game_Event::Error.new('登录', '用户名或密码错误')
end Thread.exit
Game_Event.push Game_Event::Login.new User.new(@@im.jid, @username, true) end
@@im.send(Jabber::Presence.new.set_type(:available)) @@im.send(Jabber::Presence.new.set_type(:available))
begin Game_Event.push Game_Event::Login.new User.new(@@im.jid, @username, true)
nickname = nickname() begin
#@@im_room.join(Jabber::JID.new(I18n.t('lobby.room'), I18n.t('lobby.server'), nickname)) nickname = nickname()
@@im_room.join(Jabber::JID.new('mycard', 'conference.my-card.in', nickname)) #@@im_room.join(Jabber::JID.new(I18n.t('lobby.room'), I18n.t('lobby.server'), nickname))
rescue Jabber::ServerError => exception @@im_room.join(Jabber::JID.new('mycard', 'conference.my-card.in', nickname))
if exception.error.error == 'conflict' rescue Jabber::ServerError => exception
@nickname_conflict << nickname if exception.error.error == 'conflict'
retry @nickname_conflict << nickname
retry
end
end end
Game_Event.push Game_Event::AllUsers.new @@im_room.roster.keys.collect { |nick| User.new(nick.to_sym, nick) } rescue p $!
else
$log.error('聊天连接出错.1') { exception }
Game_Event.push Game_Event::Error.new('登录', '连接服务器失败.1')
end end
Game_Event.push Game_Event::AllUsers.new @@im_room.roster.keys.collect { |nick| User.new(nick.to_sym, nick) } rescue p $!
rescue StandardError => exception rescue StandardError => exception
$log.error('聊天连接出错') { exception } $log.error('聊天连接出错') { exception }
Game_Event.push(Game_Event::Chat.new(ChatMessage.new(User.new(:system, 'System'), '聊天服务器连接失败'))) Game_Event.push Game_Event::Error.new('登录', '登录失败')
end end
} }
end end
...@@ -229,7 +233,6 @@ class Ygocore < Game ...@@ -229,7 +233,6 @@ class Ygocore < Game
end end
def exit def exit
@@im.close rescue nil
@recv.exit if @recv @recv.exit if @recv
@recv = nil @recv = nil
end end
...@@ -304,12 +307,13 @@ class Ygocore < Game ...@@ -304,12 +307,13 @@ class Ygocore < Game
system_conf['textfont'] = 'c:/windows/fonts/simsun.ttc 14' system_conf['textfont'] = 'c:/windows/fonts/simsun.ttc 14'
system_conf['numfont'] = 'c:/windows/fonts/arialbd.ttf' system_conf['numfont'] = 'c:/windows/fonts/arialbd.ttf'
end end
system_conf['nickname'] = $game.user.name if $game.user
system_conf['nickname'] += '$' + $game.password if $game.password and !$game.password.empty? and room.server.auth system_conf['nickname'] = $game.user.name
$log.info room system_conf['nickname'] += '$' + $game.password if $game.password and !$game.password.empty? and room.server.auth
end
system_conf['lastip'] = room.server.ip system_conf['lastip'] = room.server.ip
system_conf['lastport'] = room.server.port.to_s system_conf['lastport'] = room.server.port.to_s
system_conf['roompass'] = room_name system_conf['roompass'] = room_name if room_name and !room_name.empty?
open('system.conf', 'w') { |file| file.write system_conf.collect { |key, value| "#{key} = #{value}" }.join("\n") } open('system.conf', 'w') { |file| file.write system_conf.collect { |key, value| "#{key} = #{value}" }.join("\n") }
args = '-j' args = '-j'
when :replay when :replay
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment