This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use infobubbles from Phobos for traits.
- Loading branch information
Showing
11 changed files
with
186 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/* Osmium | ||
* Copyright (C) 2015 Romain "Artefact2" Dalmaso <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
require __DIR__.'/../inc/root.php'; | ||
|
||
if($argc !== 2) { | ||
fprintf(STDERR, "Usage: %s <path-to-infobubbles.json>\n"); | ||
die(1); | ||
} | ||
|
||
$info = json_decode(file_get_contents($argv[1]), true); | ||
if($info === false || json_last_error() !== JSON_ERROR_NONE) { | ||
die(2); | ||
} | ||
|
||
\Osmium\Db\query('BEGIN;'); | ||
\Osmium\Db\query( | ||
'TRUNCATE TABLE eve.infotypebonuses, eve.infotypeelements, eve.infoelements;' | ||
); | ||
|
||
foreach($info['infoBubbleElements'] as $id => $element) { | ||
\Osmium\Db\query_params( | ||
'INSERT INTO eve.infoelements (elementid, name, description) VALUES ($1, $2, $3);', | ||
[ $id, $element['name_en-us'], $element['description_en-us'], ] | ||
); | ||
} | ||
|
||
foreach($info['infoBubbleTypeElements'] as $typeid => $e) { | ||
foreach($e['elements'] as $prio => $eid) { | ||
\Osmium\Db\query_params( | ||
'INSERT INTO eve.infotypeelements (typeid, elementid, priority) VALUES ($1, $2, $3);', | ||
[ $typeid, $eid, $prio ] | ||
); | ||
|
||
} | ||
} | ||
|
||
foreach($info['infoBubbleTypeBonuses'] as $typeid => $data) { | ||
foreach($data as $source => $bonii) { | ||
foreach($bonii as $prio => $bonus) { | ||
\Osmium\Db\query_params( | ||
'INSERT INTO eve.infotypebonuses ( | ||
typeid, sourcetypeid, sourceother, priority, name, unitid, bonus | ||
) VALUES ($1, $2, $3, $4, $5, $6, $7);', [ | ||
$typeid, | ||
(int)$source >= 0 ? $source : null, | ||
(int)$source < 0 ? $source : null, | ||
$prio, | ||
$bonus['name_en-us'], | ||
(isset($bonus['unitID']) && $bonus['unitID'] > 0) ? $bonus['unitID'] : null, | ||
isset($bonus['bonus']) ? $bonus['bonus'] : null, | ||
]); | ||
} | ||
} | ||
} | ||
|
||
\Osmium\Db\query('COMMIT;'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
/* Osmium | ||
* Copyright (C) 2014 Romain "Artefact2" Dalmaso <[email protected]> | ||
* Copyright (C) 2014, 2015 Romain "Artefact2" Dalmaso <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
|
@@ -256,12 +256,11 @@ function formatCCPTagSoup($text) { | |
function formatTypeTraits($shiptypeid) { | ||
$traitsq = \Osmium\Db\query_params( | ||
'SELECT COALESCE(sourcetypeid, sourceother) AS source, | ||
bonus, t.message, u.unitid, u.displayname | ||
FROM eve.fsdtypebonuses ftb | ||
JOIN eve.tramessages t ON t.nameid = ftb.nameid | ||
LEFT JOIN eve.dgmunits u ON u.unitid = ftb.unitid | ||
WHERE ftb.typeid = $1 | ||
ORDER BY sourcetypeid ASC, t.nameid ASC', | ||
bonus, name AS message, u.unitid, u.displayname | ||
FROM eve.infotypebonuses itb | ||
LEFT JOIN eve.dgmunits u ON u.unitid = itb.unitid | ||
WHERE itb.typeid = $1 | ||
ORDER BY source ASC, priority ASC', | ||
array($shiptypeid) | ||
); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.