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
39954c1f
Commit
39954c1f
authored
Apr 04, 2016
by
Peter Xin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add language split
Git fix GameCode Fix SQL fix fix
parent
4131a978
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
68 additions
and
21 deletions
+68
-21
.gitignore
.gitignore
+2
-1
Commands.rb
Commands.rb
+22
-4
Git.rb
Git.rb
+3
-3
Global.rb
Global.rb
+13
-3
MSETranslator.rb
MSETranslator.rb
+2
-2
Server.rb
Server.rb
+1
-1
Sqlite.rb
Sqlite.rb
+9
-1
Test.rb
Test.rb
+8
-3
YgoCoreConstants.rb
YgoCoreConstants.rb
+1
-0
YgoCoreJudgers.rb
YgoCoreJudgers.rb
+6
-2
records.json
records.json
+1
-1
No files found.
.gitignore
View file @
39954c1f
...
...
@@ -4,4 +4,5 @@ MagicSetEditor
ygopro-images/*
ygopro-images-raw/*.jpg
*.mse-set
*.log
\ No newline at end of file
*.log
*.cdb
\ No newline at end of file
Commands.rb
View file @
39954c1f
...
...
@@ -16,26 +16,37 @@ module Commands
end
def
generate_all
Log
.
logger
.
info
"Generate all the card images."
Log
.
logger
.
info
"Generate all the card images
with language
#{
Global
.
language
}
."
self
.
clear_mse
data
=
Sqlite
.
split
Sqlite
.
load
MSETranslator
.
generate_mse_all
(
data
)
MSETranslator
.
export_mse_all
end
def
generate_delta
def
generate_delta
(
languages
=
nil
)
Log
.
logger
.
info
"Generate delta card image(s)"
self
.
clear_mse
data
=
Sqlite
.
load
changes
=
HashJudger
.
compare
data
generates
=
changes
[
0
]
+
changes
[
2
]
removes
=
changes
[
1
]
data
=
Sqlite
.
split
generates
if
languages
==
nil
process
(
removes
,
data
)
else
for
language
in
languages
Global
.
language
=
language
process
(
removes
,
data
)
end
end
end
def
process
(
removes
,
data
)
for
card
in
removes
id
=
YGOCoreJudgers
.
get_id
card
path
=
Global
.
full_image_name
id
path
=
File
.
join
Global
.
full_answer_path
,
id
.
to_s
+
Global
.
image_type
File
.
delete
path
if
File
.
exist?
path
end
data
=
Sqlite
.
split
generates
MSETranslator
.
generate_mse_all
(
data
)
MSETranslator
.
export_mse_all
end
...
...
@@ -51,4 +62,11 @@ module Commands
Log
.
logger
.
info
"Clearing MSE Path"
Dir
.
glob
(
"
#{
Global
.
mse_set_path
}
/*.mse-set"
)
{
|
set
|
File
.
delete
set
}
end
def
get_languages
names
=
Dir
.
glob
(
"
#{
Global
.
full_image_path
}
/cards-*.cdb"
)
languages
=
names
.
map
{
|
name
|
File
.
basename
(
name
)}.
map
{
|
name
|
name
[
6
,
name
.
length
-
10
]}
languages
end
end
\ No newline at end of file
Git.rb
View file @
39954c1f
...
...
@@ -6,14 +6,14 @@ module Git
module_function
def
pull
return
`cd
#{
g
lobal
.
git_path
}
&& git pull`
return
`cd
#{
G
lobal
.
git_path
}
&& git pull`
end
def
push
return
`cd
#{
g
lobal
.
answer_path
}
&& git push`
return
`cd
#{
G
lobal
.
answer_path
}
&& git push`
end
def
commit
(
message
=
""
)
return
`cd
#{
g
lobal
.
answer_path
}
&& git add . && git commit -a -m
\"
Update card images
\"
`
return
`cd
#{
G
lobal
.
answer_path
}
&& git add . && git commit -a -m
\"
Update card images
\"
`
end
end
\ No newline at end of file
Global.rb
View file @
39954c1f
...
...
@@ -6,6 +6,7 @@ module Global
attr_accessor
:git_path
attr_accessor
:git_uri
attr_accessor
:database_name
attr_accessor
:temp_database_name
attr_accessor
:image_type
attr_accessor
:records_name
attr_accessor
:answer_path
...
...
@@ -18,9 +19,10 @@ module Global
self
.
git_path
=
'ygopro-images-raw'
self
.
git_uri
=
'https://github.com/mycard/ygopro-images-raw.git'
self
.
database_name
=
'cards-%s.cdb'
self
.
temp_database_name
=
"working-cards.cdb"
self
.
image_type
=
'.jpg'
self
.
records_name
=
"records.json"
self
.
answer_path
=
"ygopro-images"
self
.
answer_path
=
"ygopro-images
-%s
"
self
.
answer_uri
=
"https://github.com/mycard/ygo-images.git"
self
.
mse_path
=
"MagicSetEditor2"
self
.
sql_fix_name
=
"fix.sql"
...
...
@@ -35,7 +37,12 @@ module Global
end
def
full_answer_path
return
self
.
answer_path
name
=
sprintf
(
self
.
answer_path
,
self
.
language
)
unless
Dir
.
exist?
name
File
.
delete
name
if
!
(
File
.
directory?
name
)
and
File
.
exist?
name
Dir
.
mkdir
name
end
return
name
end
def
full_image_name
(
id
)
...
...
@@ -46,4 +53,7 @@ module Global
def
full_mse_path
return
File
.
join
self
.
mse_path
,
'mse.com'
end
end
\ No newline at end of file
end
# 建立 mse-sets 文件夹
Dir
.
mkdir
Global
.
mse_set_path
unless
File
.
directory?
Global
.
mse_set_path
\ No newline at end of file
MSETranslator.rb
View file @
39954c1f
...
...
@@ -48,7 +48,7 @@ module MSETranslator
end
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
::
TagCode
,
YGOCoreJudgers
.
get_id
_str
(
card
)
file
.
write
self
.
generate_line
MSEConstants
::
MSETags
::
TagCode
,
YGOCoreJudgers
.
get_id
(
card
).
to_s
end
def
write_spell
(
file
,
card
)
...
...
@@ -59,7 +59,7 @@ module MSETranslator
file
.
write
self
.
generate_line
MSEConstants
::
MSETags
::
TagLevel
,
YGOCoreJudgers
.
get_level_str
(
card
)
file
.
write
self
.
generate_line
MSEConstants
::
MSETags
::
TagImage
,
YGOCoreJudgers
.
get_image_str
(
card
)
file
.
write
self
.
generate_text
MSEConstants
::
MSETags
::
TagText
,
YGOCoreJudgers
.
get_desc
(
card
)
file
.
write
self
.
generate_line
MSEConstants
::
MSETags
::
TagCode
,
YGOCoreJudgers
.
get_id
_str
(
card
)
file
.
write
self
.
generate_line
MSEConstants
::
MSETags
::
TagCode
,
YGOCoreJudgers
.
get_id
(
card
).
to_s
end
LineHead
=
"
\t
"
#" "
...
...
Server.rb
View file @
39954c1f
...
...
@@ -10,7 +10,7 @@ end
post
'/hook'
do
Git
.
pull
Commands
.
generate_delta
Commands
.
generate_delta
(
Commands
.
get_languages
)
Git
.
commit
Git
.
push
end
Sqlite.rb
View file @
39954c1f
require
'sqlite3'
require
'fileutils'
require
File
.
dirname
(
__FILE__
)
+
'/Git.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Global.rb'
require
File
.
dirname
(
__FILE__
)
+
'/Log.rb'
...
...
@@ -6,8 +7,15 @@ require File.dirname(__FILE__) + '/MSEConstants.rb'
module
Sqlite
def
self
.
load
(
id
=
-
1
)
path
=
Global
.
full_database_path
if
File
.
exist?
path
FileUtils
.
cp
path
,
Global
.
temp_database_name
else
Log
.
logger
.
error
"No sql databse named
#{
path
}
"
return
nil
end
begin
db
=
SQLite3
::
Database
.
new
Global
.
full_database_path
db
=
SQLite3
::
Database
.
new
Global
.
temp_database_name
self
.
run_fix
(
db
)
command
=
"select * from datas join texts on datas.id == texts.id"
command
+=
" where datas.id ==
#{
id
}
"
if
id
>
0
...
...
Test.rb
View file @
39954c1f
...
...
@@ -13,7 +13,7 @@ def unit_test2
require
'./Sqlite.rb'
Global
.
language
=
'jp'
data
=
Sqlite
.
split
Sqlite
.
load
data
=
[
data
[
1
2
]]
data
=
[
data
[
1
]]
require
'./MSETranslator.rb'
MSETranslator
.
generate_mse_all
(
data
)
end
...
...
@@ -23,5 +23,10 @@ def unit_test3
MSETranslator
.
export_mse_all
end
unit_test2
unit_test3
\ No newline at end of file
def
unit_test_god
require
'./Commands.rb'
Global
.
language
=
'jp'
Commands
.
generate_single
(
10000040
)
end
unit_test_god
\ No newline at end of file
YgoCoreConstants.rb
View file @
39954c1f
...
...
@@ -75,4 +75,5 @@ module YGOCoreConstants
PendulumLeftMod
=
65536
PendulumRightMod
=
16777216
QuestionMark
=
-
2
end
YgoCoreJudgers.rb
View file @
39954c1f
...
...
@@ -155,11 +155,15 @@ module YGOCoreJudgers
end
def
get_attack
(
card
)
return
card
[
ColumnAtk
].
to_i
value
=
card
[
ColumnAtk
].
to_i
return
"?"
if
value
==
YGOCoreConstants
::
QuestionMark
value
end
def
get_defense
(
card
)
return
card
[
ColumnDef
].
to_i
value
=
card
[
ColumnDef
].
to_i
return
"?"
if
value
==
YGOCoreConstants
::
QuestionMark
value
end
def
get_level
(
card
)
...
...
records.json
View file @
39954c1f
This diff is collapsed.
Click to expand it.
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