Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-images-generator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
ygopro-images-generator
Commits
0793dfd1
Commit
0793dfd1
authored
Apr 04, 2017
by
不如归去
Committed by
GitHub
Apr 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from moecube/master
PR
parents
cd9437bd
94fa2e2a
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
93 additions
and
39 deletions
+93
-39
.gitmodules
.gitmodules
+1
-13
Commands.rb
Commands.rb
+6
-0
Global.rb
Global.rb
+3
-3
ImgGen
ImgGen
+1
-1
LanguageConstants.rb
LanguageConstants.rb
+1
-1
Log.rb
Log.rb
+2
-1
MSEConstants.rb
MSEConstants.rb
+1
-1
MSETranslator.rb
MSETranslator.rb
+13
-5
Test.rb
Test.rb
+4
-4
fix.sql
fix.sql
+1
-1
locales/en-US.yml
locales/en-US.yml
+55
-0
locales/ja-JP.yml
locales/ja-JP.yml
+2
-2
locales/zh-CN.yml
locales/zh-CN.yml
+1
-1
locales/zh-Classical.yml
locales/zh-Classical.yml
+2
-2
magicseteditor
magicseteditor
+0
-1
ygopro-database
ygopro-database
+0
-1
ygopro-images
ygopro-images
+0
-1
ygopro-images-raw
ygopro-images-raw
+0
-1
No files found.
.gitmodules
View file @
0793dfd1
[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"]
[submodule "ImgGen"]
path = ImgGen
path = ImgGen
url = git@github.com:mycard/ImgGen.git
url = git@github.com:mycard/ImgGen.git
shallow = true
Commands.rb
View file @
0793dfd1
...
@@ -42,11 +42,17 @@ module Commands
...
@@ -42,11 +42,17 @@ module Commands
changes
=
HashJudger
.
compare
data
changes
=
HashJudger
.
compare
data
generates
=
changes
[
0
]
+
changes
[
2
]
generates
=
changes
[
0
]
+
changes
[
2
]
removes
=
changes
[
1
]
removes
=
changes
[
1
]
# 这两句是暂时排除 Bug 用。
generates
=
generates
.
select
{
|
card
|
card
!=
nil
}
removes
=
removes
.
select
{
|
card
|
card
!=
nil
}
# 因此可能导致无法预期的后果。
data
=
Sqlite
.
split
generates
data
=
Sqlite
.
split
generates
for
card
in
removes
for
card
in
removes
id
=
YGOCoreJudgers
.
get_id
card
id
=
YGOCoreJudgers
.
get_id
card
path
=
File
.
join
Global
.
full_answer_path
,
id
.
to_s
+
Global
.
image_type
path
=
File
.
join
Global
.
full_answer_path
,
id
.
to_s
+
Global
.
image_type
File
.
delete
path
if
File
.
exist?
path
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
end
MSETranslator
.
generate_mse_all
(
data
)
MSETranslator
.
generate_mse_all
(
data
)
MSETranslator
.
export_mse_all
if
export
MSETranslator
.
export_mse_all
if
export
...
...
Global.rb
View file @
0793dfd1
...
@@ -17,14 +17,14 @@ module Global
...
@@ -17,14 +17,14 @@ 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
=
'
ygopro-images-raw
'
self
.
git_path
=
'
pics
'
self
.
database_path
=
'ygopro-database'
self
.
database_path
=
'ygopro-database'
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"
self
.
image_type
=
'.jpg'
self
.
image_type
=
'.jpg'
self
.
records_name
=
"
ygopro-images/
records.json"
self
.
records_name
=
"records.json"
self
.
answer_path
=
"ygopro-images
-%s
"
self
.
answer_path
=
"ygopro-images"
self
.
answer_uri
=
"https://github.com/mycard/ygo-images.git"
self
.
answer_uri
=
"https://github.com/mycard/ygo-images.git"
self
.
mse_path
=
"magicseteditor"
self
.
mse_path
=
"magicseteditor"
self
.
sql_fix_name
=
"fix.sql"
self
.
sql_fix_name
=
"fix.sql"
...
...
ImgGen
@
65827d91
Subproject commit
b1fe4ca39ced52dfbd55e31d6b47470f44918a71
Subproject commit
65827d9178bcf51ded53873ef4b96b0d8037d366
LanguageConstants.rb
View file @
0793dfd1
...
@@ -49,5 +49,5 @@ class LanguageConstants
...
@@ -49,5 +49,5 @@ class LanguageConstants
self
.
languages
[
locale
].
mse_language
=
value
[
'mse_language'
]
self
.
languages
[
locale
].
mse_language
=
value
[
'mse_language'
]
self
.
languages
[
locale
].
mse_stylesheet
=
value
[
'mse_stylesheet'
]
self
.
languages
[
locale
].
mse_stylesheet
=
value
[
'mse_stylesheet'
]
end
end
end
end
end
end
Log.rb
View file @
0793dfd1
...
@@ -5,5 +5,6 @@ module Log
...
@@ -5,5 +5,6 @@ module Log
class
<<
self
class
<<
self
attr_accessor
:logger
attr_accessor
:logger
end
end
self
.
logger
=
Logger
.
new
STDOUT
self
.
logger
=
Logger
.
new
STDERR
self
.
logger
.
level
=
Logger
::
WARN
end
end
MSEConstants.rb
View file @
0793dfd1
...
@@ -105,7 +105,7 @@ module MSEConstants
...
@@ -105,7 +105,7 @@ module MSEConstants
Synchro
=
"synchro monster"
Synchro
=
"synchro monster"
Spell
=
"spell card"
Spell
=
"spell card"
Trap
=
"trap card"
Trap
=
"trap card"
Special
=
{
1000000
1
=>
"obelisk"
,
10000011
=>
"ra"
,
10000021
=>
"slifer"
}
Special
=
{
1000000
0
=>
"obelisk"
,
10000010
=>
"ra"
,
10000020
=>
"slifer"
}
end
end
SetFileName
=
"set"
SetFileName
=
"set"
...
...
MSETranslator.rb
View file @
0793dfd1
...
@@ -3,12 +3,13 @@ require File.dirname(__FILE__) + '/YgoCoreJudgers.rb'
...
@@ -3,12 +3,13 @@ require File.dirname(__FILE__) + '/YgoCoreJudgers.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Global.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Global.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Log.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Log.rb'
require
'zip'
require
'zip'
Zip
.
default_compression
=
Zlib
::
NO_COMPRESSION
module
MSETranslator
module
MSETranslator
module_function
module_function
def
write_set
(
file
,
set
)
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_styles
h
eet
,
LanguageConstants
.
current
.
mse_language
.
upcase
))
for
card
in
set
for
card
in
set
self
.
write_card
(
file
,
card
)
self
.
write_card
(
file
,
card
)
end
end
...
@@ -71,6 +72,7 @@ module MSETranslator
...
@@ -71,6 +72,7 @@ module MSETranslator
word
=
word
.
delete
"
\r
"
word
=
word
.
delete
"
\r
"
word
=
word
.
squeeze
"
\n
"
word
=
word
.
squeeze
"
\n
"
word
=
word
.
gsub
"。
\n
"
,
"。"
word
=
word
.
gsub
"。
\n
"
,
"。"
word
=
word
.
gsub
".
\n
"
,
"."
word
word
end
end
...
@@ -86,9 +88,9 @@ module MSETranslator
...
@@ -86,9 +88,9 @@ module MSETranslator
word
=
reline
word
word
=
reline
word
words
=
word
.
split
LanguageConstants
.
current
.
monster_effect_head
words
=
word
.
split
LanguageConstants
.
current
.
monster_effect_head
return
[
""
,
words
[
0
]]
if
words
.
count
<=
1
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
pendulum_effect
=
""
if
pendulum_effect
==
nil
return
[
pendulum_effect
,
words
[
1
]
]
return
[
pendulum_effect
,
words
[
words
.
length
-
1
].
strip
]
end
end
def
generate_mse
(
data
,
key
=
""
)
def
generate_mse
(
data
,
key
=
""
)
...
@@ -102,19 +104,25 @@ module MSETranslator
...
@@ -102,19 +104,25 @@ module MSETranslator
zipfile
.
add
id
.
to_s
+
Global
.
image_type
,
image_name
zipfile
.
add
id
.
to_s
+
Global
.
image_type
,
image_name
clear_data
.
push
card
clear_data
.
push
card
else
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
end
end
zipfile
.
get_output_stream
(
MSEConstants
::
SetFileName
)
{
|
os
|
write_set
(
os
,
clear_data
)
}
zipfile
.
get_output_stream
(
MSEConstants
::
SetFileName
)
{
|
os
|
write_set
(
os
,
clear_data
)
}
end
end
Log
.
logger
.
info
(
"Finished a pack named data
#{
key
}
-
#{
Global
.
language
}
.mse-set with following
#{
clear_data
.
count
}
cards:"
)
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
))}
clear_data
.
each
{
|
card
|
Log
.
logger
.
info
(
YGOCoreJudgers
.
get_log_str
(
card
))}
puts
"
#{
key
}
-
#{
Global
.
language
}
.mse-set"
end
end
def
generate_mse_all
(
datas
)
def
generate_mse_all
(
datas
)
$missing_image
=
false
for
i
in
0
...
datas
.
size
for
i
in
0
...
datas
.
size
generate_mse
(
datas
[
i
],
i
)
generate_mse
(
datas
[
i
],
i
)
end
end
if
$missing_image
raise
'missing image'
end
end
end
def
export_mse
(
full_file_name
)
def
export_mse
(
full_file_name
)
...
...
Test.rb
View file @
0793dfd1
...
@@ -15,7 +15,7 @@ def unit_test2
...
@@ -15,7 +15,7 @@ def unit_test2
data
=
Sqlite
.
split
Sqlite
.
load
data
=
Sqlite
.
split
Sqlite
.
load
data
=
[
data
[
1
]]
data
=
[
data
[
1
]]
require
'./MSETranslator.rb'
require
'./MSETranslator.rb'
MSETranslator
.
generate_mse_all
(
data
)
MSETranslator
.
generate_mse_all
(
data
w
)
end
end
def
unit_test3
def
unit_test3
...
@@ -25,8 +25,8 @@ end
...
@@ -25,8 +25,8 @@ end
def
unit_test_god
def
unit_test_god
require
'./Commands.rb'
require
'./Commands.rb'
Global
.
language
=
'
jp
'
Global
.
language
=
'
en-US
'
Commands
.
generate_single
(
10000040
)
p
MSETranslator
.
split_effect
YGOCoreJudgers
.
get_desc
(
Sqlite
.
load
(
17390179
)[
0
]
)
end
end
unit_test_god
unit_test_god
\ No newline at end of file
fix.sql
View file @
0793dfd1
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
);
locales/en-US.yml
0 → 100644
View file @
0793dfd1
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
locales/ja-JP.yml
View file @
0793dfd1
...
@@ -49,7 +49,7 @@ ja-JP:
...
@@ -49,7 +49,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
mse_stylesheet
:
standard
mse_stylesheet
:
standard
locales/zh-CN.yml
View file @
0793dfd1
...
@@ -50,6 +50,6 @@ zh-CN:
...
@@ -50,6 +50,6 @@ 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
mse_stylesheet
:
standard
mse_stylesheet
:
standard
locales/zh-Classical.yml
View file @
0793dfd1
zh-C
N
:
zh-C
lassical
:
term
:
term
:
monster
:
"
怪兽卡"
monster
:
"
怪兽卡"
spell
:
"
魔法卡"
spell
:
"
魔法卡"
...
@@ -50,6 +50,6 @@ zh-CN:
...
@@ -50,6 +50,6 @@ 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
mse_stylesheet
:
classical
mse_stylesheet
:
classical
magicseteditor
@
22aa511d
Subproject commit 22aa511d27f0a341cd4da3efedc62a039dac65e4
ygopro-database
@
89d97d98
Subproject commit 89d97d9875fc1b4a954ab8b168916f79390cec85
ygopro-images
@
0b4fb560
Subproject commit 0b4fb560d6a5052128b7156b8571651f6a0ed0aa
ygopro-images-raw
@
24c16129
Subproject commit 24c1612965fb454e080e49e7ccd29c8924567905
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment