feat,fix,wip: 버그 수정, 연장 시간 로직 변경

This commit is contained in:
2022-06-09 01:21:21 +09:00
parent d18ae3dd11
commit 717ec012ba
18 changed files with 232 additions and 137 deletions
+16 -19
View File
@@ -14,6 +14,7 @@ use sammo\RandUtil;
class AuctionUniqueItem extends Auction
{
const COEFF_EXTENSION_MINUTES_LIMIT_UNIQUE_CNT = 24;
static AuctionType $auctionType = AuctionType::UniqueItem;
@@ -52,18 +53,6 @@ class AuctionUniqueItem extends Auction
}
$gameStor = KVStorage::getStorage($db, 'game_env');
$givenUnique = $gameStor->getValue('givenUnique') ?? [];
$givenUniqueCnt = $givenUnique[$itemKey] ?? 0;
$remainUniqueCnt = 0;
foreach (GameConst::$allItems as $itemList) {
if (!key_exists($itemKey, $itemList)) {
continue;
}
$remainUniqueCnt += $itemList[$itemKey];
}
if ($remainUniqueCnt > 1 && $givenUniqueCnt >= $remainUniqueCnt - 1) {
return '더이상 이 아이템을 경매로 가져갈 수 없습니다.';
}
$now = new DateTimeImmutable();
@@ -115,7 +104,7 @@ class AuctionUniqueItem extends Auction
$josaRa = JosaUtil::pick($item->getRawName(), '라');
$logger = new ActionLogger(0, 0, $year, $month);
$logger->pushGlobalHistoryLog("누군가가 <C>{$itemName}</>{$josaRa}는 보물을 구한다는 소문이 들려옵니다.");
$logger->pushGlobalHistoryLog("<C><b>【보물수배】</b></>누군가가 <C>{$itemName}</>{$josaRa}는 보물을 구한다는 소문이 들려옵니다.");
$logger->flush();
return $auction;
@@ -159,9 +148,14 @@ class AuctionUniqueItem extends Auction
);
$itemCode = $this->info->target;
if($itemCode === null){
throw new \Exception('아이템 코드가 없습니다.');
}
$bidItemTypes = new Set();
foreach (GameConst::$allItems as $itemType => $itemList) {
if (($itemList[$itemCode] ?? 0) <= 0) {
if (key_exists($itemCode, $itemList) && $itemList[$itemCode] <= 0) {
continue;
}
$bidItemTypes->add($itemType);
@@ -228,12 +222,15 @@ class AuctionUniqueItem extends Auction
}
if ($availableEquipUniqueCnt <= 0) {
$turnTerm = $gameStor->getValue('turnterm');
//제한에 걸렸다면 자동 연장
$extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval(
max(static::MIN_EXTENSION_MINUTES_BY_EXTENSION_QUERY, $this->info->turnTerm * static::COEFF_EXTENSION_MINUTES_BY_EXTENSION_QUERY) * 60
max(static::MIN_EXTENSION_MINUTES_BY_EXTENSION_QUERY, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_UNIQUE_CNT) * 60
));
$this->extendCloseDate($extendedCloseDate, true);
$this->extendLatestBidCloseDate(null);
$this->applyDB();
return '유니크 아이템 소유 제한 상태입니다. 종료 시간이 연장됩니다.';
}
@@ -284,13 +281,13 @@ class AuctionUniqueItem extends Auction
$logger->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 습득했습니다!");
$logger->pushGeneralHistoryLog("<C>{$itemName}</>{$josaUl} 습득");
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
$logger->pushGlobalHistoryLog("<C><b>【보물발견】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
$logger->pushGlobalHistoryLog("<C><b>【보물수배】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
$userLogger = new UserLogger($general->getVar('owner'));
$userLogger->push(sprintf("유니크 %s 경매로 %d 포인트 사용", $itemName, $highestBid->amount), "inheritPoint");
$general->applyDB($db);
$givenUnique = $gameStor->getValue('givenUnique') ?? [];
$givenUnique[$itemKey] = ($givenUnique[$itemKey] ?? 0) + 1;
$gameStor->setValue('givenUnique', $givenUnique);
return null;
}
}