Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-cn-database-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
List
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-cn-database-generator
Commits
c49b53b1
Commit
c49b53b1
authored
Aug 23, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
a0c92c8c
Pipeline
#4900
passed with stages
in 1 minute and 48 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
run.ts
run.ts
+5
-1
src/dbreader.ts
src/dbreader.ts
+8
-7
No files found.
run.ts
View file @
c49b53b1
...
...
@@ -4,9 +4,13 @@ import _ from "underscore";
import
{
CNOCGFetcher
}
from
"
./src/cnocg
"
;
import
{
ExtraCards
}
from
"
./src/ExtraCards
"
;
import
{
DirectFetcher
}
from
"
./src/direct
"
;
import
Logger
from
"
bunyan
"
;
async
function
main
()
{
const
dbreader
=
new
DBReader
({
name
:
"
Database
"
});
const
dbreader
=
new
DBReader
({
name
:
"
Database
"
,
//level: Logger.DEBUG
});
await
dbreader
.
init
();
//const cards = await CNOCGFetcher.fetchOnce();
//const missingExtraCards = ExtraCards.filter(c => !cards.some(cc => c.code === cc.code));
...
...
src/dbreader.ts
View file @
c49b53b1
...
...
@@ -20,6 +20,7 @@ export class SQLQuery {
this
.
values
=
values
;
}
async
perform
(
db
:
Database
)
{
//console.log(db.config.filename, this.sql, this.values);
await
db
.
run
(
this
.
sql
,
this
.
values
);
}
}
...
...
@@ -186,8 +187,8 @@ export class DBReader extends Base {
return
cards
;
}
async
getOtherCardCodes
(
cnCodes
:
number
[])
{
const
sql
=
`SELECT id FROM datas WHERE
1 AND
${
cnCodes
.
map
(
m
=>
"
id != ?
"
).
join
(
"
AND
"
)}
`
;
const
otherCodes
:
number
[]
=
(
await
this
.
cndb
.
all
(
sql
,
cnCodes
)).
map
(
m
=>
m
.
id
);
const
sql
=
`SELECT id FROM datas WHERE
id not IN (
${
cnCodes
.
join
(
"
,
"
)}
)
`
;
const
otherCodes
:
number
[]
=
(
await
this
.
cndb
.
all
(
sql
)).
map
(
m
=>
m
.
id
);
return
otherCodes
;
}
async
generateBanlist
(
codes
:
number
[])
{
...
...
@@ -203,7 +204,7 @@ export class DBReader extends Base {
await
fs
.
writeFile
(
`
${
this
.
config
.
outputPath
}
/expansions/lflist.conf`
,
banlistString
);
}
async
generatePatch
(
codes
:
number
[])
{
const
patchString
=
`update datas set ot = ot | 0x8 where
${
codes
.
map
(
code
=>
`id =
${
code
}
`
).
join
(
'
or
'
)}
;`
;
const
patchString
=
`update datas set ot = ot | 0x8 where
id IN (
${
codes
.
join
(
'
,
'
)}
)
;`
;
await
fs
.
writeFile
(
`
${
this
.
config
.
outputPath
}
/patch.sql`
,
patchString
);
}
private
async
categorizeCards
(
cards
:
Card
[]):
Promise
<
CardPool
>
{
...
...
@@ -233,12 +234,12 @@ export class DBReader extends Base {
}
await
this
.
outputdb
.
run
(
"
COMMIT;
"
);
const
allCodes
=
allCards
.
map
(
card
=>
card
.
code
);
this
.
log
.
debug
(
`Database created.`
);
this
.
log
.
info
(
`Database created.`
);
await
this
.
generateBanlist
(
allCodes
);
this
.
log
.
debug
(
`LFList created.`
);
this
.
log
.
info
(
`LFList created.`
);
await
this
.
generatePatch
(
allCodes
);
this
.
log
.
debug
(
`Patch created.`
);
this
.
log
.
info
(
`Patch created.`
);
await
this
.
generateDecks
(
cards
);
this
.
log
.
debug
(
`Decks generated.`
);
this
.
log
.
info
(
`Decks generated.`
);
}
}
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