-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync.php
More file actions
31 lines (26 loc) · 996 Bytes
/
sync.php
File metadata and controls
31 lines (26 loc) · 996 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
if (php_sapi_name() != 'cli') {
header('HTTP/1.0 404 Not Found');
die('404 - Not Found');
}
$config = include __DIR__ . DIRECTORY_SEPARATOR . 'config.php';
$sheet = \Mkkp\Enemy\Google\SpreadSheet::create(
$config['spreadsheet']['app_secret'],
$config['spreadsheet']['token_file']
);
$lists = $sheet->getLists($config['spreadsheet']['id'], $config['spreadsheet']['range']);
$repo = \Mkkp\Enemy\Repository::create($config['enemy_repo_file']);
$repo->saveLists($lists);
if (isset(getopt('g')['g'])) {
$result = $repo->getAllCombination();
foreach ($result as $enemy) {
$file = $config['billboard']['save_to'] . DIRECTORY_SEPARATOR . sprintf('%s.png', $enemy->indexesString('_'));
\Mkkp\Enemy\Billboard::createFromBaseImage(
$config['billboard']['base'],
$config['billboard']['font']
)
->drawText($config['billboard']['title'], $config['billboard']['color_title'], -75)
->drawText($enemy->toString(), $config['billboard']['color_enemy'], 25)
->save($file);
}
}