diff --git a/.gitignore b/.gitignore
index 86fd902b..4bf58256 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,5 +10,6 @@
/images/minions/*_render.png
/images/rewards/*_render.png
/images/spells/*_render.png
+/images/trinkets/*_render.png
/images/quests/*_render.png
*.csv
diff --git a/bgjson/export.php b/bgjson/export.php
index f09da956..f9e988d5 100644
--- a/bgjson/export.php
+++ b/bgjson/export.php
@@ -878,6 +878,110 @@
echo 'Spells select failed: (' . $mysqli->errno . ') ' . $mysqli->error . '
';
}
+// generate trinkets files
+if ($stmt = $mysqli->prepare("SELECT bgt.id,
+ bgt.name,
+ bgt.turn,
+ bgt.cost,
+ bgt.text,
+ bgt.id_blizzard,
+ bgt.id_playhs,
+ bgt.id_hpwn,
+ bgt.flag_active,
+ bgt.flag_duos
+ FROM bg_trinkets bgt
+ -- WHERE bgh.flag_active = ?
+ ORDER BY bgt.tier, bgt.cost ASC")) {
+ #$stmt->bind_param("i", $getActiveOnly);
+ $stmt->execute();
+ $stmt->store_result();
+ $stmt->bind_result($id, $name, $tier, $cost, $text, $blizzardId, $playhsId, $hpwnId, $isActive, $isDuosOnly);
+
+ $row_count = $stmt->num_rows;
+
+ $csvHeader =
+ 'Name' . CSV_SEPARATOR .
+ 'Turn' . CSV_SEPARATOR .
+ 'Cost' . CSV_SEPARATOR .
+ 'Text' . CSV_SEPARATOR .
+ 'Blizzard ID' . CSV_SEPARATOR .
+ 'Picture link' . CSV_SEPARATOR .
+ 'Active' . CSV_SEPARATOR .
+ 'Duos only' . PHP_EOL;
+ $csvDataTrinkets = $csvHeader;
+ $csvDataTrinketsActive = $csvHeader;
+ $csvData = '';
+
+ // json metadata
+ $trinkets['meta']['date'] = date("Y-m-d");
+ $trinkets['meta']['version'] = VERSION;
+ $trinketsActive['meta']['date'] = date("Y-m-d");
+ $trinketsActive['meta']['version'] = VERSION;
+
+ $i = 0;
+ $j = 0;
+ while ($stmt->fetch()) {
+ $csvData =
+ $name . CSV_SEPARATOR .
+ $turn . CSV_SEPARATOR .
+ $cost . CSV_SEPARATOR .
+ (str_contains($text, ';') ? '"' . $text . '"' : $text) . CSV_SEPARATOR .
+ $blizzardId . CSV_SEPARATOR .
+ PICTURE_URL_RENDER_BG . $blizzardId . '.png' . CSV_SEPARATOR .
+ (bool)$isActive . CSV_SEPARATOR .
+ (bool)$isDuosOnly . PHP_EOL;
+
+ $csvDataTrinkets .= $csvData;
+
+ $trinkets['data'][$i]['name'] = $name;
+ $trinkets['data'][$i]['turn'] = $turn;
+ $trinkets['data'][$i]['cost'] = $cost;
+ $trinkets['data'][$i]['text'] = $text;
+ $trinkets['data'][$i]['id'] = $blizzardId;
+ $trinkets['data'][$i]['picture'] = PICTURE_URL_RENDER_BG . $blizzardId . '.png';
+// $trinkets['data'][$i]['pictureSmall'] = PICTURE_LOCAL_HERO . $blizzardId . PICTURE_LOCAL_RENDER_SUFFIX_80;
+ $trinkets['data'][$i]['websites']['blizzard'] = ($playhsId ? URL_PHS . $playhsId : null);
+ $trinkets['data'][$i]['websites']['bgknowhow'] = URL_BKH . 'spell/?id=' . $id;
+ $trinkets['data'][$i]['websites']['wiki'] = URL_HSF . str_replace(' ', '_', $name);
+ $trinkets['data'][$i]['websites']['hearthpwn'] = ($hpwnId ? URL_HPN . $hpwnId : null);
+ $trinkets['data'][$i]['isActive'] = (bool)$isActive;
+ $trinkets['data'][$i]['isDuosOnly'] = (bool)$isDuosOnly;
+
+ if ($isActive) {
+ $csvDataTrinketsActive .= $csvData;
+ $trinketsActive['data'][$j] = $trinkets['data'][$i];
+
+ $j++;
+ }
+
+ $i++;
+ }
+
+ $stmt->free_result();
+ $stmt->close();
+
+ $csvFile = 'output/bg_trinkets_all.csv';
+ file_put_contents($csvFile, $csvDataTrinkets);
+ echo 'Written file ' . $csvFile . ' with ' . $i . ' entries.
' . PHP_EOL;
+
+ $csvFile = 'output/bg_trinkets_active.csv';
+ file_put_contents($csvFile, $csvDataTrinketsActive);
+ echo 'Written file ' . $csvFile . ' with ' . $j . ' entries.
' . PHP_EOL;
+
+ $jsonFile = 'output/bg_trinkets_all.json';
+ $jsonData = json_encode($trinkets);
+ file_put_contents($jsonFile, $jsonData);
+ echo 'Written file ' . $jsonFile . ' with ' . $i . ' entries.
' . PHP_EOL;
+
+ $jsonData = json_encode($trinketsActive);
+ $jsonFile = 'output/bg_trinkets_active.json';
+ file_put_contents($jsonFile, $jsonData);
+ echo 'Written file ' . $jsonFile . ' with ' . $j . ' entries.
' . PHP_EOL;
+
+} else {
+ echo 'Trinkets select failed: (' . $mysqli->errno . ') ' . $mysqli->error . '
';
+}
+
// json metadata
$allEntities['meta']['date'] = date("Y-m-d");
@@ -898,6 +1002,7 @@
$allEntities['data']['rewards'] = $rewards['data'];
$allEntities['data']['anomalies'] = $anomalies['data'];
$allEntities['data']['spells'] = $spells['data'];
+$allEntities['data']['trinkets'] = $trinkets['data'];
$jsonFile = 'output/bg_entities_all.json';
$jsonData = json_encode($allEntities);
@@ -915,6 +1020,7 @@
unset($rewardsActive['meta']);
unset($anomaliesActive['meta']);
unset($spellsActive['meta']);
+unset($trinketsActive['meta']);
$allEntitiesActive['data']['heroes'] = $heroesActive['data'];
$allEntitiesActive['data']['minions'] = $minionsActive['data'];
@@ -923,6 +1029,7 @@
@$allEntitiesActive['data']['rewards'] = $rewardsActive['data'];
@$allEntitiesActive['data']['anomalies'] = $anomaliesActive['data'];
@$allEntitiesActive['data']['spells'] = $spellsActive['data'];
+@$allEntitiesActive['data']['trinkets'] = $trinketsActive['data'];
$jsonFile = 'output/bg_entities_active.json';
$jsonData = json_encode($allEntitiesActive);
diff --git a/bgjson/index.php b/bgjson/index.php
index 7bd78418..57787f31 100644
--- a/bgjson/index.php
+++ b/bgjson/index.php
@@ -47,11 +47,12 @@
JSON format (all) | +JSON format (all) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
All Battlegrounds Entities | +All Battlegrounds Entities | |||||||||||||
All Heroes | All Minions | +All Spells | All Buddies | All Quests | All Rewards | All Anomalies | -All Spells | +All Trinkets |
CSV format (all) | +CSV format (all) | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
All Heroes | All Minions | +All Spells | All Buddies | All Quests | All Rewards | All Anomalies | -All Spells | +All Trinkets |
Latest Changes:
Trinkets are special passive power-ups that you buy with Gold and use for the rest of the game. Trinkets are offered twice per game: on turns 6 and 9. Each offering, you’ll get 4 Trinkets to choose from. In total, there are 56 Lesser Trinkets (turn 6) and 60 Greater Trinkets (turn 9). Some Trinkets have a Lesser and a Greater version--letting you diversify or double-up on your effects.
Trinkets | +|
---|---|
Name | +Text | +$trinket->name | "; + echo "$trinket->text | "; + echo ""; + } + ?> + +
Quests are offered at the beginning of turn 4 (6 gold). The quest texts utilize placeholders like {0} (for example in the text "Spend {0} Gold."), which are replaced by an actual numeric value based on the armor value of the hero you are playing (heroes with more base armor will receive easier to complete quests) and the minion types in the lobby. The baseline value for each quest is documented on the details page. Finishing a quest will provide you with the attached reward.
'; diff --git a/bgstrategy/trinket/index.php b/bgstrategy/trinket/index.php new file mode 100644 index 00000000..cc1efe16 --- /dev/null +++ b/bgstrategy/trinket/index.php @@ -0,0 +1,45 @@ + + + + +bind_result($selectedId, $name, $turn, $cost, $text, $blizzardId, $isActive, $artist); + + $stmt->fetch() + ?> +