mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Add quality and icon to Badge Lipsum generator
Summary: This just adds a few more dimensions to the generator. Test Plan: run `bin/lipsum generate badges`, verify new icons and quality work. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D17474
This commit is contained in:
parent
b28da10336
commit
814c28d39a
1 changed files with 22 additions and 2 deletions
|
@ -12,7 +12,7 @@ final class PhabricatorBadgesBadgeTestDataGenerator
|
|||
public function generateObject() {
|
||||
$author = $this->loadRandomUser();
|
||||
|
||||
list($name, $description) = $this->newLoot();
|
||||
list($name, $description, $quality, $icon) = $this->newLoot();
|
||||
|
||||
$xactions = array();
|
||||
|
||||
|
@ -26,6 +26,16 @@ final class PhabricatorBadgesBadgeTestDataGenerator
|
|||
'value' => $description,
|
||||
);
|
||||
|
||||
$xactions[] = array(
|
||||
'type' => 'quality',
|
||||
'value' => (string)$quality,
|
||||
);
|
||||
|
||||
$xactions[] = array(
|
||||
'type' => 'icon',
|
||||
'value' => $icon,
|
||||
);
|
||||
|
||||
$params = array(
|
||||
'transactions' => $xactions,
|
||||
);
|
||||
|
@ -58,7 +68,17 @@ final class PhabricatorBadgesBadgeTestDataGenerator
|
|||
|
||||
$drop = preg_replace($effect_pattern, '', $drop);
|
||||
|
||||
return array($drop, $description);
|
||||
$quality_map = PhabricatorBadgesQuality::getQualityMap();
|
||||
shuffle($quality_map);
|
||||
$quality = head($quality_map);
|
||||
$rarity = $quality['rarity'];
|
||||
|
||||
$icon_map = id(new PhabricatorBadgesIconSet())->getIcons();
|
||||
shuffle($icon_map);
|
||||
$icon_map = head($icon_map);
|
||||
$icon = $icon_map->getKey();
|
||||
|
||||
return array($drop, $description, $rarity, $icon);
|
||||
}
|
||||
|
||||
public function rollDropValue($matches) {
|
||||
|
|
Loading…
Reference in a new issue