Commit 0793dfd1 authored by 不如归去's avatar 不如归去 Committed by GitHub

Merge pull request #2 from moecube/master

PR
parents cd9437bd 94fa2e2a
[submodule "magicseteditor"]
path = magicseteditor
url = git@github.com:mycard/magicseteditor.git
branch = win32
[submodule "ygopro-images-raw"]
path = ygopro-images-raw
url = git@github.com:mycard/ygopro-images-raw.git
[submodule "ygopro-database"]
path = ygopro-database
url = git@github.com:mycard/ygopro-database.git
[submodule "ygopro-images"]
path = ygopro-images
url = git@github.com:mycard/ygopro-images.git
[submodule "ImgGen"]
path = ImgGen
url = git@github.com:mycard/ImgGen.git
shallow = true
......@@ -42,11 +42,17 @@ module Commands
changes = HashJudger.compare data
generates = changes[0] + changes[2]
removes = changes[1]
# 这两句是暂时排除 Bug 用。
generates = generates.select { |card| card != nil }
removes = removes.select { |card| card != nil }
# 因此可能导致无法预期的后果。
data = Sqlite.split generates
for card in removes
id = YGOCoreJudgers.get_id card
path = File.join Global.full_answer_path, id.to_s + Global.image_type
File.delete path if File.exist? path
path = File.join Global.full_answer_path, 'thumbnail', id.to_s + Global.image_type
File.delete path if File.exist? path
end
MSETranslator.generate_mse_all(data)
MSETranslator.export_mse_all if export
......
......@@ -17,14 +17,14 @@ module Global
attr_accessor :sql_fix_name
end
self.language = 'zh-CN'
self.git_path = 'ygopro-images-raw'
self.git_path = 'pics'
self.database_path = 'ygopro-database'
self.git_uri = 'https://github.com/mycard/ygopro-images-raw.git'
self.database_name = '%s.cdb'
self.temp_database_name = "working-cards.cdb"
self.image_type = '.jpg'
self.records_name = "ygopro-images/records.json"
self.answer_path = "ygopro-images-%s"
self.records_name = "records.json"
self.answer_path = "ygopro-images"
self.answer_uri = "https://github.com/mycard/ygo-images.git"
self.mse_path = "magicseteditor"
self.sql_fix_name = "fix.sql"
......
Subproject commit b1fe4ca39ced52dfbd55e31d6b47470f44918a71
Subproject commit 65827d9178bcf51ded53873ef4b96b0d8037d366
......@@ -49,5 +49,5 @@ class LanguageConstants
self.languages[locale].mse_language = value['mse_language']
self.languages[locale].mse_stylesheet = value['mse_stylesheet']
end
end
end
end
......@@ -5,5 +5,6 @@ module Log
class << self
attr_accessor :logger
end
self.logger = Logger.new STDOUT
self.logger = Logger.new STDERR
self.logger.level = Logger::WARN
end
......@@ -105,7 +105,7 @@ module MSEConstants
Synchro = "synchro monster"
Spell = "spell card"
Trap = "trap card"
Special = {10000001 => "obelisk", 10000011 => "ra", 10000021 => "slifer"}
Special = {10000000 => "obelisk", 10000010 => "ra", 10000020 => "slifer"}
end
SetFileName = "set"
......
......@@ -3,12 +3,13 @@ require File.dirname(__FILE__) + '/YgoCoreJudgers.rb'
require File.dirname(__FILE__) + '/Global.rb'
require File.dirname(__FILE__) + '/Log.rb'
require 'zip'
Zip.default_compression = Zlib::NO_COMPRESSION
module MSETranslator
module_function
def write_set(file, set)
file.write(sprintf(MSEConstants::MSEConfig::Head, LanguageConstants.current.mse_styleseet, LanguageConstants.current.mse_language.upcase))
file.write(sprintf(MSEConstants::MSEConfig::Head, LanguageConstants.current.mse_stylesheet, LanguageConstants.current.mse_language.upcase))
for card in set
self.write_card(file, card)
end
......@@ -71,6 +72,7 @@ module MSETranslator
word = word.delete "\r"
word = word.squeeze "\n"
word = word.gsub "。\n", "。"
word = word.gsub ".\n", "."
word
end
......@@ -86,9 +88,9 @@ module MSETranslator
word = reline word
words = word.split LanguageConstants.current.monster_effect_head
return ["", words[0]] if words.count <= 1
pendulum_effect = words[0].split(LanguageConstants.current.pendulum_effect_head).last
pendulum_effect = words[0].gsub(LanguageConstants.current.pendulum_effect_head, "").strip
pendulum_effect = "" if pendulum_effect == nil
return [pendulum_effect, words[1]]
return [pendulum_effect, words[words.length - 1].strip]
end
def generate_mse(data, key = "")
......@@ -102,19 +104,25 @@ module MSETranslator
zipfile.add id.to_s + Global.image_type, image_name
clear_data.push card
else
Log.logger.warn "#{YGOCoreJudgers.get_log_str(card)} has no proper image for. Skipped."
Log.logger.error "#{YGOCoreJudgers.get_log_str(card)} has no proper image for."
$missing_image = true
end
end
zipfile.get_output_stream(MSEConstants::SetFileName) { |os| write_set(os, clear_data) }
end
Log.logger.info("Finished a pack named data#{key}-#{Global.language}.mse-set with following #{clear_data.count} cards:")
clear_data.each {|card| Log.logger.info(YGOCoreJudgers.get_log_str(card))}
puts "#{key}-#{Global.language}.mse-set"
end
def generate_mse_all(datas)
$missing_image = false
for i in 0...datas.size
generate_mse(datas[i], i)
end
end
if $missing_image
raise 'missing image'
end
end
def export_mse(full_file_name)
......
......@@ -15,7 +15,7 @@ def unit_test2
data = Sqlite.split Sqlite.load
data = [data[1]]
require './MSETranslator.rb'
MSETranslator.generate_mse_all(data)
MSETranslator.generate_mse_all(dataw)
end
def unit_test3
......@@ -25,8 +25,8 @@ end
def unit_test_god
require './Commands.rb'
Global.language = 'jp'
Commands.generate_single(10000040)
Global.language = 'en-US'
p MSETranslator.split_effect YGOCoreJudgers.get_desc(Sqlite.load(17390179)[0])
end
unit_test_god
\ No newline at end of file
unit_test_god
update datas set level = 0 where id in (1686814, 90884403, 52653092, 65305468);
update datas set level = 0 where id in (1686814, 90884403, 52653092, 65305468, 43490025);
en-US:
term:
monster: "Monster"
spell: "Spell"
trap: "Trap"
normal: "Normal"
effect: "Effect"
fusion: "Fusion"
ritual: "Ritual"
trapmonster: "Trapmonster"
spirit: "Spirit"
union: "Union"
dual: "Gemini"
tuner: "Tuner"
synchro: "Synchro"
token: "Token"
quickplay: "Quickplay"
continuous: "Continuous"
equip: "Equip"
field: "Field"
counter: "Counter"
flip: "Flip"
cartoon: "Cartoon"
xyz: "Xyz"
pendulum: "Pendulum"
races:
- ""
- "Warrior"
- "Spellcaster"
- "Fairy"
- "Fiend"
- "Zombie"
- "Machine"
- "Aqua"
- "Pyro"
- "Rock"
- "Winged Beast"
- "Plant"
- "Insect"
- "Thunder"
- "Dragon"
- "Beast"
- "Beast-Warrior"
- "Dinosaur"
- "Fish"
- "Sea Serpent"
- "Reptile"
- "Psychic"
- "Divine-Beast"
- "Creator God"
- "Wyrm"
pendulum_effect_head: !ruby/regexp /Pendulum Scale\s*=\s*\d+\n*\[\s*Pendulum Effect\s*\]\n*(\-n\/a(\-)*)*/
monster_effect_head: !ruby/regexp /\n*(-+?\n+)*\n*\[\s*(Monster Effect|Flavor Text)\s*\]\s*?\n/
mse_language: en
mse_stylesheet: standard
......@@ -49,7 +49,7 @@ ja-JP:
- "幻神獣族"
- "創造神族"
- "幻竜族"
pendulum_effect_head: !ruby/regexp /【Pスケール:青(.*)/赤(.*)】(\n)?/
monster_effect_head: !ruby/regexp /(\n)?【モンスター効果】\n/
pendulum_effect_head: !ruby/regexp /【Pスケール:青(.*)/赤(.*)】(\n)*/
monster_effect_head: !ruby/regexp /(\n)*(【モンスター効果】|【モンスター情報】)\n/
mse_language: jp
mse_stylesheet: standard
......@@ -50,6 +50,6 @@ zh-CN:
- "创世神族"
- "幻龙族"
pendulum_effect_head: !ruby/regexp /←\d+ 【灵摆】 \d+→\n?/
monster_effect_head: !ruby/regexp /\n(?:【怪兽效果】|【怪兽简介】|【怪兽描述】)\n/
monster_effect_head: !ruby/regexp /(\n)*(?:【怪兽效果】|【怪兽简介】|【怪兽描述】)\n/
mse_language: cn
mse_stylesheet: standard
zh-CN:
zh-Classical:
term:
monster: "怪兽卡"
spell: "魔法卡"
......@@ -50,6 +50,6 @@ zh-CN:
- "创世神族"
- "幻龙族"
pendulum_effect_head: !ruby/regexp /←\d+ 【灵摆】 \d+→\n?/
monster_effect_head: !ruby/regexp /\n(?:【怪兽效果】|【怪兽简介】|【怪兽描述】)\n/
monster_effect_head: !ruby/regexp /(\n)?(?:【怪兽效果】|【怪兽简介】|【怪兽描述】)\n/
mse_language: cn
mse_stylesheet: classical
Subproject commit 22aa511d27f0a341cd4da3efedc62a039dac65e4
Subproject commit 89d97d9875fc1b4a954ab8b168916f79390cec85
Subproject commit 0b4fb560d6a5052128b7156b8571651f6a0ed0aa
Subproject commit 24c1612965fb454e080e49e7ccd29c8924567905
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