feat,wip: 유니크 입찰 기본 구현

This commit is contained in:
2022-06-09 01:21:21 +09:00
parent 4d6b3d1a53
commit a12e15eb78
6 changed files with 206 additions and 51 deletions
-31
View File
@@ -17,37 +17,6 @@ class AuctionUniqueItem extends Auction
static AuctionType $auctionType = AuctionType::UniqueItem;
static public function genObfuscatedName(int $id): string
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$namePool = $gameStor->getValue('obfuscatedNamePool');
if ($namePool === null) {
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
UniqueConst::$hiddenSeed,
)));
$namePool = [];
foreach (GameConst::$randGenFirstName as $ch0) {
foreach (GameConst::$randGenMiddleName as $ch1) {
foreach (GameConst::$randGenLastName as $ch2) {
$namePool[] = "{$ch0}{$ch1}{$ch2}";
}
}
}
$namePool = $rng->shuffle($namePool);
$gameStor->setValue('obfuscatedNamePool', $namePool);
}
$dupIdx = intdiv($id, count($namePool));
$subIdx = $id % count($namePool);
if ($dupIdx == 0) {
return $namePool[$subIdx];
}
return "{$namePool[$subIdx]}{$dupIdx}";
}
static public function openItemAuction(BaseItem $item, General $general, int $startAmount): self|string
{
if ($startAmount < GameConst::$inheritItemUniqueMinPoint) {