fix: 동일 부위 유니크 소유시, '1턴' 연장하도록 수정

This commit is contained in:
2022-06-09 15:49:13 +09:00
parent 64af68e2d6
commit 58da20f276
+15 -2
View File
@@ -126,7 +126,7 @@ class AuctionUniqueItem extends Auction
) ?? []);
$auctionIDList = [];
foreach($openUniqueAuctions as $auction){
foreach ($openUniqueAuctions as $auction) {
$auctionIDList[] = $auction->id;
}
$db = DB::db();
@@ -149,7 +149,7 @@ class AuctionUniqueItem extends Auction
$itemCode = $this->info->target;
if($itemCode === null){
if ($itemCode === null) {
throw new \Exception('아이템 코드가 없습니다.');
}
@@ -234,6 +234,7 @@ class AuctionUniqueItem extends Auction
return '유니크 아이템 소유 제한 상태입니다. 종료 시간이 연장됩니다.';
}
$isExtendCloseDateRequired = false;
foreach (GameConst::$allItems as $itemType => $itemList) {
//아직은 그런 경우는 없지만 동일 유니크를 여러 부위에 장착할 수 있을지도 모름
if (!key_exists($itemKey, $itemList)) {
@@ -243,11 +244,13 @@ class AuctionUniqueItem extends Auction
$ownItem = $general->getItem($itemType);
if ($ownItem->getRawClassName() == $itemKey) {
//FIXME: 이 경우에는 환불이 되던가 해야함.
$isExtendCloseDateRequired = true;
$reasons[] = '이미 그 유니크를 가지고 있습니다.';
continue;
}
if (!$ownItem->isBuyable()) {
$isExtendCloseDateRequired = true;
$reasons[] = '이미 다른 유니크를 가지고 있습니다.';
continue;
}
@@ -263,6 +266,16 @@ class AuctionUniqueItem extends Auction
}
if (!$availableItemTypes) {
if ($isExtendCloseDateRequired) {
$turnTerm = $gameStor->getValue('turnterm');
//동일 부위 제한에 걸렸다면 자동 연장
$extendedCloseDate = $this->info->closeDate->add(TimeUtil::secondsToDateInterval(
max(static::MIN_EXTENSION_MINUTES_LIMIT_BY_BID, $turnTerm * static::COEFF_EXTENSION_MINUTES_LIMIT_BY_BID) * 60
));
$this->extendCloseDate($extendedCloseDate, true);
$this->extendLatestBidCloseDate(null);
}
return join(' ', $reasons);
}