Commit 5640bc3f authored by IamI's avatar IamI

Update to Link.

Bug Fix.
parent 0793dfd1
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Global module Global
class << self class << self
attr_accessor :language attr_accessor :language
attr_accessor :raw_image_path
attr_accessor :git_path attr_accessor :git_path
attr_accessor :git_uri attr_accessor :git_uri
attr_accessor :database_path attr_accessor :database_path
...@@ -17,8 +18,8 @@ module Global ...@@ -17,8 +18,8 @@ module Global
attr_accessor :sql_fix_name attr_accessor :sql_fix_name
end end
self.language = 'zh-CN' self.language = 'zh-CN'
self.git_path = 'pics' self.raw_image_path = 'ygopro-images-raw/pics/'
self.database_path = 'ygopro-database' self.database_path = 'ygopro-database/locales/'
self.git_uri = 'https://github.com/mycard/ygopro-images-raw.git' self.git_uri = 'https://github.com/mycard/ygopro-images-raw.git'
self.database_name = '%s.cdb' self.database_name = '%s.cdb'
self.temp_database_name = "working-cards.cdb" self.temp_database_name = "working-cards.cdb"
...@@ -31,11 +32,11 @@ module Global ...@@ -31,11 +32,11 @@ module Global
self.mse_set_path = "mse-sets" self.mse_set_path = "mse-sets"
module_function module_function
def full_database_path def full_database_path
return File.join self.database_path, sprintf(self.database_name, self.language) return self.database_path + self.language + "/cards.cdb"
end end
def full_image_path def full_image_path
return self.git_path return self.raw_image_path
end end
def full_answer_path def full_answer_path
......
...@@ -25,6 +25,8 @@ class LanguageConstants ...@@ -25,6 +25,8 @@ class LanguageConstants
attr_accessor :term_cartoon attr_accessor :term_cartoon
attr_accessor :term_xyz attr_accessor :term_xyz
attr_accessor :term_pendulum attr_accessor :term_pendulum
attr_accessor :term_link
attr_accessor :term_spsummon
attr_accessor :pendulum_effect_head attr_accessor :pendulum_effect_head
attr_accessor :monster_effect_head attr_accessor :monster_effect_head
attr_accessor :term_races # 偷个鸡 attr_accessor :term_races # 偷个鸡
......
...@@ -53,6 +53,7 @@ module MSEConstants ...@@ -53,6 +53,7 @@ module MSEConstants
TagText = "rule text" TagText = "rule text"
TagAtk = "attack" TagAtk = "attack"
TagDef = "defense" TagDef = "defense"
TagLink = "link number"
TagNumber = "number" TagNumber = "number"
TagRarity = "rarity" TagRarity = "rarity"
TagPendulum = "pendulum" TagPendulum = "pendulum"
...@@ -103,6 +104,7 @@ module MSEConstants ...@@ -103,6 +104,7 @@ module MSEConstants
Token = "token monster" Token = "token monster"
Token2 = "token card" Token2 = "token card"
Synchro = "synchro monster" Synchro = "synchro monster"
Link = "link monster"
Spell = "spell card" Spell = "spell card"
Trap = "trap card" Trap = "trap card"
Special = {10000000 => "obelisk", 10000010 => "ra", 10000020 => "slifer"} Special = {10000000 => "obelisk", 10000010 => "ra", 10000020 => "slifer"}
...@@ -110,4 +112,7 @@ module MSEConstants ...@@ -110,4 +112,7 @@ module MSEConstants
SetFileName = "set" SetFileName = "set"
SingleFileMaxCount = 200 SingleFileMaxCount = 200
LinkMarkerHead = "Link Marker "
LinkMarks = ["DL", "Down", "DR", "Left", "", "Right", "UL", "Up", "UR"]
end end
...@@ -47,6 +47,11 @@ module MSETranslator ...@@ -47,6 +47,11 @@ module MSETranslator
else else
file.write self.generate_text MSEConstants::MSETags::TagText, YGOCoreJudgers.get_desc(card) file.write self.generate_text MSEConstants::MSETags::TagText, YGOCoreJudgers.get_desc(card)
end end
# Link data
if YGOCoreJudgers.is_link card
file.write self.generate_line MSEConstants::MSETags::TagLink, YGOCoreJudgers.get_link(card)
write_link_lines file, card
end
file.write self.generate_line MSEConstants::MSETags::TagAtk, YGOCoreJudgers.get_attack(card) file.write self.generate_line MSEConstants::MSETags::TagAtk, YGOCoreJudgers.get_attack(card)
file.write self.generate_line MSEConstants::MSETags::TagDef, YGOCoreJudgers.get_defense(card) file.write self.generate_line MSEConstants::MSETags::TagDef, YGOCoreJudgers.get_defense(card)
file.write self.generate_line MSEConstants::MSETags::TagCode, YGOCoreJudgers.get_id(card).to_s file.write self.generate_line MSEConstants::MSETags::TagCode, YGOCoreJudgers.get_id(card).to_s
...@@ -63,6 +68,11 @@ module MSETranslator ...@@ -63,6 +68,11 @@ module MSETranslator
file.write self.generate_line MSEConstants::MSETags::TagCode, YGOCoreJudgers.get_id(card).to_s file.write self.generate_line MSEConstants::MSETags::TagCode, YGOCoreJudgers.get_id(card).to_s
end end
def write_link_lines(file, card)
markers = YGOCoreJudgers.get_link_marks card
(0..8).each { |i| file.write self.generate_line MSEConstants::LinkMarkerHead + MSEConstants::LinkMarks[i], 'yes' if markers[i] }
end
LineHead = "\t"#" " LineHead = "\t"#" "
def generate_line(key, word) def generate_line(key, word)
"#{LineHead}#{key}: #{word}\n" "#{LineHead}#{key}: #{word}\n"
......
...@@ -29,4 +29,12 @@ def unit_test_god ...@@ -29,4 +29,12 @@ def unit_test_god
p MSETranslator.split_effect YGOCoreJudgers.get_desc(Sqlite.load(17390179)[0]) p MSETranslator.split_effect YGOCoreJudgers.get_desc(Sqlite.load(17390179)[0])
end end
unit_test_god def link_test
require './Commands.rb'
Commands.generate_all
end
def god_test
require './Commands.rb'
MSETranslator.generate_mse Sqlite.load(10000010)
end
\ No newline at end of file
...@@ -37,6 +37,7 @@ module YGOCoreConstants ...@@ -37,6 +37,7 @@ module YGOCoreConstants
Devine = 0x200000 # 幻兽神 Devine = 0x200000 # 幻兽神
Creatorgod = 0x400000 # 创世神 Creatorgod = 0x400000 # 创世神
Wyrm = 0x800000 # 幻龙 Wyrm = 0x800000 # 幻龙
Cyverse = 0x1000000 # 电子界
end end
module Rule module Rule
...@@ -71,6 +72,8 @@ module YGOCoreConstants ...@@ -71,6 +72,8 @@ module YGOCoreConstants
Cartoon = 0x400000 # 卡通 Cartoon = 0x400000 # 卡通
Xyz = 0x800000 # Xyz Xyz = 0x800000 # Xyz
Pendulum = 0x1000000 # 灵摆 Pendulum = 0x1000000 # 灵摆
SpSummon = 0x2000000 # 特殊召唤
Link = 0x4000000 # 连接
end end
PendulumLeftMod = 65536 PendulumLeftMod = 65536
......
...@@ -138,6 +138,14 @@ module YGOCoreJudgers ...@@ -138,6 +138,14 @@ module YGOCoreJudgers
return card[ColumnType] & YGOCoreConstants::Type::Pendulum != 0 return card[ColumnType] & YGOCoreConstants::Type::Pendulum != 0
end end
def is_spsummon(card)
return card[ColumnType] & YGOCoreConstants::Type::SpSummon != 0
end
def is_link(card)
return card[ColumnType] & YGOCoreConstants::Type::Link != 0
end
def get_id(card) def get_id(card)
return card[ColumnID].to_i return card[ColumnID].to_i
end end
...@@ -163,14 +171,27 @@ module YGOCoreJudgers ...@@ -163,14 +171,27 @@ module YGOCoreJudgers
def get_defense(card) def get_defense(card)
value = card[ColumnDef].to_i value = card[ColumnDef].to_i
return "?" if value == YGOCoreConstants::QuestionMark return "?" if value == YGOCoreConstants::QuestionMark
return "" if self.is_link card
value value
end end
def get_link(card)
return "" unless self.is_link card
return card[ColumnLevel].to_i
end
def get_link_marks(card)
value = card[ColumnDef]
sprintf("%09b", value).scan(/\d/).reverse.map { |s| s == '1' }
end
def get_level(card) def get_level(card)
return 0 if self.is_link card
return card[ColumnLevel].to_i % YGOCoreConstants::PendulumLeftMod return card[ColumnLevel].to_i % YGOCoreConstants::PendulumLeftMod
end end
def get_monster_level_str(card) def get_monster_level_str(card)
return "" if self.is_link card
return MSEConstants::MSESpellTrap::Level * self.get_level(card) return MSEConstants::MSESpellTrap::Level * self.get_level(card)
end end
...@@ -309,6 +330,8 @@ module YGOCoreJudgers ...@@ -309,6 +330,8 @@ module YGOCoreJudgers
return MSEConstants::MSECardType::Fusion return MSEConstants::MSECardType::Fusion
elsif self.is_sync card elsif self.is_sync card
return MSEConstants::MSECardType::Synchro return MSEConstants::MSECardType::Synchro
elsif self.is_link card
return MSEConstants::MSECardType::Link
elsif self.is_effect card elsif self.is_effect card
return MSEConstants::MSECardType::Effect return MSEConstants::MSECardType::Effect
end end
...@@ -326,7 +349,9 @@ module YGOCoreJudgers ...@@ -326,7 +349,9 @@ module YGOCoreJudgers
types.push LanguageConstants.current.term_fusion if self.is_fusion card types.push LanguageConstants.current.term_fusion if self.is_fusion card
types.push LanguageConstants.current.term_synchro if self.is_sync card types.push LanguageConstants.current.term_synchro if self.is_sync card
types.push LanguageConstants.current.term_pendulum if self.is_pendulum card types.push LanguageConstants.current.term_pendulum if self.is_pendulum card
types.push LanguageConstants.current.term_link if self.is_link card
# 子类别 # 子类别
types.push LanguageConstants.current.term_spsummon if self.is_spsummon card
types.push LanguageConstants.current.term_spirit if self.is_spirit card types.push LanguageConstants.current.term_spirit if self.is_spirit card
types.push LanguageConstants.current.term_union if self.is_union card types.push LanguageConstants.current.term_union if self.is_union card
types.push LanguageConstants.current.term_dual if self.is_dual card types.push LanguageConstants.current.term_dual if self.is_dual card
......
...@@ -23,6 +23,8 @@ en-US: ...@@ -23,6 +23,8 @@ en-US:
cartoon: "Cartoon" cartoon: "Cartoon"
xyz: "Xyz" xyz: "Xyz"
pendulum: "Pendulum" pendulum: "Pendulum"
spsummon: "Special Summon"
link: "Link"
races: races:
- "" - ""
- "Warrior" - "Warrior"
...@@ -49,6 +51,7 @@ en-US: ...@@ -49,6 +51,7 @@ en-US:
- "Divine-Beast" - "Divine-Beast"
- "Creator God" - "Creator God"
- "Wyrm" - "Wyrm"
- "Cyverse"
pendulum_effect_head: !ruby/regexp /Pendulum Scale\s*=\s*\d+\n*\[\s*Pendulum Effect\s*\]\n*(\-n\/a(\-)*)*/ 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/ monster_effect_head: !ruby/regexp /\n*(-+?\n+)*\n*\[\s*(Monster Effect|Flavor Text)\s*\]\s*?\n/
mse_language: en mse_language: en
......
...@@ -23,6 +23,8 @@ ja-JP: ...@@ -23,6 +23,8 @@ ja-JP:
cartoon: "トゥーン" cartoon: "トゥーン"
xyz: "エクシーズ" xyz: "エクシーズ"
pendulum: "ペンデュラム" pendulum: "ペンデュラム"
spsummon: "特殊召唤"
link: "リンク"
races: races:
- "" - ""
- "戦士族" - "戦士族"
...@@ -49,6 +51,7 @@ ja-JP: ...@@ -49,6 +51,7 @@ ja-JP:
- "幻神獣族" - "幻神獣族"
- "創造神族" - "創造神族"
- "幻竜族" - "幻竜族"
- "サイバース族"
pendulum_effect_head: !ruby/regexp /【Pスケール:青(.*)/赤(.*)】(\n)*/ pendulum_effect_head: !ruby/regexp /【Pスケール:青(.*)/赤(.*)】(\n)*/
monster_effect_head: !ruby/regexp /(\n)*(【モンスター効果】|【モンスター情報】)\n/ monster_effect_head: !ruby/regexp /(\n)*(【モンスター効果】|【モンスター情報】)\n/
mse_language: jp mse_language: jp
......
...@@ -23,6 +23,8 @@ zh-CN: ...@@ -23,6 +23,8 @@ zh-CN:
cartoon: "卡通" cartoon: "卡通"
xyz: "超量" xyz: "超量"
pendulum: "灵摆" pendulum: "灵摆"
spsummon: "特殊召唤"
link: "连接"
races: races:
- "" - ""
- "战士族" - "战士族"
...@@ -49,6 +51,7 @@ zh-CN: ...@@ -49,6 +51,7 @@ zh-CN:
- "幻兽神族" - "幻兽神族"
- "创世神族" - "创世神族"
- "幻龙族" - "幻龙族"
- "电子界族"
pendulum_effect_head: !ruby/regexp /←\d+ 【灵摆】 \d+→\n?/ 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_language: cn
......
...@@ -23,6 +23,8 @@ zh-Classical: ...@@ -23,6 +23,8 @@ zh-Classical:
cartoon: "卡通" cartoon: "卡通"
xyz: "超量" xyz: "超量"
pendulum: "灵摆" pendulum: "灵摆"
spsummon: "特殊召唤"
link: "连接"
races: races:
- "" - ""
- "战士族" - "战士族"
...@@ -49,6 +51,7 @@ zh-Classical: ...@@ -49,6 +51,7 @@ zh-Classical:
- "幻兽神族" - "幻兽神族"
- "创世神族" - "创世神族"
- "幻龙族" - "幻龙族"
- "电子界族"
pendulum_effect_head: !ruby/regexp /←\d+ 【灵摆】 \d+→\n?/ 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_language: cn
......
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