feat,wip: 유니크 경매 시작
This commit is contained in:
-218
@@ -1673,215 +1673,6 @@ function giveRandomUniqueItem(RandUtil $rng, General $general, string $acquireTy
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rollbackInheritUniqueTrial(General $general, string $itemKey, string $reason)
|
|
||||||
{
|
|
||||||
|
|
||||||
$ownerID = $general->getVar('owner');
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
|
|
||||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
|
|
||||||
LogText("선택유니크 롤백:{$ownerID}", [$itemKey, $itemTrials]);
|
|
||||||
unset($itemTrials[$itemKey]);
|
|
||||||
if (count($itemTrials) == 0) {
|
|
||||||
$itemTrials = null;
|
|
||||||
}
|
|
||||||
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
|
|
||||||
|
|
||||||
|
|
||||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}");
|
|
||||||
$ownTrial = $trialStor->getValue("u{$ownerID}");
|
|
||||||
|
|
||||||
$itemObj = buildItemClass($itemKey);
|
|
||||||
$itemName = $itemObj->getName();
|
|
||||||
|
|
||||||
if ($ownTrial) {
|
|
||||||
//두 값이 general, KVStorage 둘다 있고, 이중에선 KVStorage 값을 기준으로 하자 따르자
|
|
||||||
[,, $amount] = $ownTrial;
|
|
||||||
$trialStor->deleteValue("u{$ownerID}");
|
|
||||||
$general->increaseInheritancePoint(InheritanceKey::previous, $amount);
|
|
||||||
$general->increaseRankVar(RankColumn::inherit_point_spent_dynamic, -$amount);
|
|
||||||
LogText("선택유니크 롤백포인트:{$ownerID}", $amount);
|
|
||||||
|
|
||||||
$userLogger = new UserLogger($ownerID);
|
|
||||||
$userLogger->push("{$itemName} 입찰에 사용한 {$amount} 포인트 반환", "inheritPoint");
|
|
||||||
}
|
|
||||||
|
|
||||||
//메시지
|
|
||||||
|
|
||||||
$staticNation = $general->getStaticNation();
|
|
||||||
|
|
||||||
$unlimited = new \DateTime('9999-12-31');
|
|
||||||
$src = new MessageTarget(0, '', 0, 'System', '#000000');
|
|
||||||
$dest = new MessageTarget($general->getID(), $general->getName(), $general->getNationID(), $staticNation['name'], $staticNation['color'], GetImageURL($general->getVar('imgsvr'), $general->getVar('picture')));
|
|
||||||
$josaUl = JosaUtil::pick($itemName, '을');
|
|
||||||
$msg = new Message(
|
|
||||||
Message::MSGTYPE_PRIVATE,
|
|
||||||
$src,
|
|
||||||
$dest,
|
|
||||||
"{$itemName}{$josaUl} 얻지 못했습니다. {$reason}",
|
|
||||||
new DateTime(),
|
|
||||||
$unlimited,
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
$general->applyDB($db);
|
|
||||||
$msg->send(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function tryRollbackInheritUniqueItem(RandUtil $rng, General $general): void
|
|
||||||
{
|
|
||||||
tryInheritUniqueItem($rng, $general, 'Rollback', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function tryInheritUniqueItem(RandUtil $rng, General $general, string $acquireType = '아이템', bool $justRollback = false): bool
|
|
||||||
{
|
|
||||||
$ownerID = $general->getVar('owner');
|
|
||||||
if (!$ownerID) {
|
|
||||||
LogText("선택유니크 실패???: {$ownerID}", $general->getName());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial') ?? [];
|
|
||||||
arsort($itemTrials);
|
|
||||||
LogText("선택유니크항목: {$ownerID}", $itemTrials);
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
|
|
||||||
$ownTarget = null;
|
|
||||||
$ownType = null;
|
|
||||||
|
|
||||||
foreach ($itemTrials as $itemKey => $amount) {
|
|
||||||
$availableItemTypes = [];
|
|
||||||
$reasons = [];
|
|
||||||
foreach (GameConst::$allItems as $itemType => $itemList) {
|
|
||||||
//아직은 그런 경우는 없지만 동일 유니크를 여러 부위에 장착할 수 있을지도 모름
|
|
||||||
if (!key_exists($itemKey, $itemList)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$ownItem = $general->getItem($itemType);
|
|
||||||
if ($ownItem->getRawClassName() == $itemKey) {
|
|
||||||
$reasons[] = '이미 그 유니크를 가지고 있습니다.';
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$ownItem->isBuyable()) {
|
|
||||||
$reasons[] = '이미 다른 유니크를 가지고 있습니다.';
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$availableCnt = $itemList[$itemKey];
|
|
||||||
$occupiedCnt = $db->queryFirstField('SELECT count(*) FROM general WHERE %b = %s', $itemType, $itemKey);
|
|
||||||
if ($occupiedCnt >= $availableCnt) {
|
|
||||||
$reasons[] = '그 유니크는 모두 점유되었습니다.';
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$availableItemTypes[] = $itemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$availableItemTypes) {
|
|
||||||
rollbackInheritUniqueTrial($general, $itemKey, join(' ', $reasons));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$reasons = [];
|
|
||||||
|
|
||||||
$itemType = $rng->choice($availableItemTypes);
|
|
||||||
|
|
||||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}"); //혹시 itemKey의 크기가 37이 넘을 수 있을까?
|
|
||||||
$anyTrials = $trialStor->getAll();
|
|
||||||
if (!$anyTrials) {
|
|
||||||
//순서가 꼬였던 모양, 실제 값은 storage를 우선시하자
|
|
||||||
rollbackInheritUniqueTrial($general, $itemKey, '절차상의 오류입니다.');
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//XXX: 정렬할 필요 없지 않나?
|
|
||||||
usort($anyTrials, function ($lhsTrial, $rhsTrial) {
|
|
||||||
[,, $lhsAmount] = $lhsTrial;
|
|
||||||
[,, $rhsAmount] = $rhsTrial;
|
|
||||||
return $rhsAmount <=> $lhsAmount; //큰 값이 앞에 오도록
|
|
||||||
});
|
|
||||||
|
|
||||||
LogText("선택유니크상태 {$ownerID} {$itemKey}", $anyTrials);
|
|
||||||
|
|
||||||
//공동 1등인데 본인이 있을 수도 있다.
|
|
||||||
[,, $topAmount] = $anyTrials[0];
|
|
||||||
if ($amount < $topAmount) {
|
|
||||||
$compAmount = $topAmount / $amount;
|
|
||||||
if ($compAmount > 2.0) {
|
|
||||||
$compText = '엄청난 차이로 ';
|
|
||||||
} else if ($compAmount > 1.2) {
|
|
||||||
$compText = '큰 차이로 ';
|
|
||||||
} else if ($compAmount > 1.05) {
|
|
||||||
$compText = '';
|
|
||||||
} else {
|
|
||||||
$compText = '아슬아슬한 차이로 ';
|
|
||||||
}
|
|
||||||
rollbackInheritUniqueTrial($general, $itemKey, "{$compText}상위 입찰한 장수가 있습니다.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//내가 1위다
|
|
||||||
if ($ownTarget !== null) {
|
|
||||||
//이미 다른 아이템을 얻기로 되어있다.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$ownTarget = $itemKey;
|
|
||||||
$ownType = $itemType;
|
|
||||||
}
|
|
||||||
unset($itemKey);
|
|
||||||
unset($itemType);
|
|
||||||
|
|
||||||
if ($ownTarget === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ($justRollback) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
LogText("선택유니크획득{$ownerID}", $ownTarget);
|
|
||||||
|
|
||||||
$trialStor = KVStorage::getStorage($db, "ut_{$ownTarget}");
|
|
||||||
$trialStor->deleteValue("u{$ownerID}");
|
|
||||||
|
|
||||||
//rollbackInheritUniqueTrial 과정 때문에 새로 받아와야함
|
|
||||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
|
|
||||||
unset($itemTrials[$ownTarget]);
|
|
||||||
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
|
|
||||||
|
|
||||||
$nationName = $general->getStaticNation()['name'];
|
|
||||||
$generalName = $general->getName();
|
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
|
||||||
$itemObj = buildItemClass($ownTarget);
|
|
||||||
$itemName = $itemObj->getName();
|
|
||||||
$itemRawName = $itemObj->getRawName();
|
|
||||||
$josaUl = JosaUtil::pick($itemRawName, '을');
|
|
||||||
|
|
||||||
|
|
||||||
$general->setVar($ownType, $ownTarget);
|
|
||||||
|
|
||||||
|
|
||||||
$logger = $general->getLogger();
|
|
||||||
|
|
||||||
$logger->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 습득했습니다!");
|
|
||||||
$logger->pushGeneralHistoryLog("<C>{$itemName}</>{$josaUl} 습득");
|
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
|
|
||||||
$logger->pushGlobalHistoryLog("<C><b>【{$acquireType}】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
|
|
||||||
|
|
||||||
$general->applyDB($db);
|
|
||||||
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$givenUnique =$gameStor->getValue('givenUnique') ?? [];
|
|
||||||
$givenUnique[$ownTarget] = ($givenUnique[$ownTarget] ?? 0) + 1;
|
|
||||||
$gameStor->setValue('givenUnique', $givenUnique);
|
|
||||||
|
|
||||||
//같은 종류의 유니크를 입찰했을 수 있으니 한번 더 검사한다.
|
|
||||||
tryRollbackInheritUniqueItem($rng, $general);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireType = '아이템'): bool
|
function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireType = '아이템'): bool
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
@@ -1927,18 +1718,9 @@ function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireTy
|
|||||||
$userLogger = new UserLogger($general->getVar('owner'));
|
$userLogger = new UserLogger($general->getVar('owner'));
|
||||||
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
|
||||||
}
|
}
|
||||||
tryRollbackInheritUniqueItem($rng, $general);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$inheritUnique = $general->getAuxVar('inheritUniqueTrial');
|
|
||||||
if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique) && $availableBuyUnique) {
|
|
||||||
$trialResult = tryInheritUniqueItem($rng, $general, $acquireType);
|
|
||||||
if ($trialResult) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$scenario = $gameStor->scenario;
|
$scenario = $gameStor->scenario;
|
||||||
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
|
||||||
|
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace sammo\API\InheritAction;
|
|
||||||
|
|
||||||
use sammo\Session;
|
|
||||||
use DateTimeInterface;
|
|
||||||
use sammo\DB;
|
|
||||||
use sammo\Enums\RankColumn;
|
|
||||||
use sammo\GameConst;
|
|
||||||
use sammo\General;
|
|
||||||
use sammo\KVStorage;
|
|
||||||
use sammo\UserLogger;
|
|
||||||
use sammo\Validator;
|
|
||||||
|
|
||||||
use function sammo\buildItemClass;
|
|
||||||
|
|
||||||
class BuySpecificUnique extends \sammo\BaseAPI
|
|
||||||
{
|
|
||||||
public function validateArgs(): ?string
|
|
||||||
{
|
|
||||||
$availableItems = [];
|
|
||||||
foreach (GameConst::$allItems as $items) {
|
|
||||||
foreach ($items as $itemKey => $amount) {
|
|
||||||
if ($amount == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$availableItems[$itemKey] = $amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$v = new Validator($this->args);
|
|
||||||
$v->rule('required', [
|
|
||||||
'item',
|
|
||||||
'amount',
|
|
||||||
])
|
|
||||||
->rule('int', 'amount')
|
|
||||||
->rule('min', 'amount', GameConst::$inheritItemUniqueMinPoint)
|
|
||||||
->rule('keyExists', 'item', $availableItems);
|
|
||||||
|
|
||||||
if (!$v->validate()) {
|
|
||||||
return $v->errorStr();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRequiredSessionMode(): int
|
|
||||||
{
|
|
||||||
//KVStrorage, General.aux 모두 쓰므로 lock;
|
|
||||||
return static::REQ_GAME_LOGIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
|
|
||||||
{
|
|
||||||
$itemKey = $this->args['item'];
|
|
||||||
$amount = $this->args['amount'];
|
|
||||||
|
|
||||||
$userID = $session->userID;
|
|
||||||
$generalID = $session->generalID;
|
|
||||||
|
|
||||||
$general = General::createGeneralObjFromDB($generalID);
|
|
||||||
if ($userID != $general->getVar('owner')) {
|
|
||||||
return '로그인 상태가 이상합니다. 다시 로그인해 주세요.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemTrials = $general->getAuxVar('inheritUniqueTrial') ?? [];
|
|
||||||
if (key_exists($itemKey, $itemTrials)) {
|
|
||||||
return '이미 입찰한 아이템입니다. 다음 턴에 시도해 주세요.';
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach(GameConst::$allItems as $itemType => $items){
|
|
||||||
if(!key_exists($itemKey, $items)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$prevItem = $general->getItem($itemType);
|
|
||||||
if(!$prevItem->isBuyable()){
|
|
||||||
return '이미 같은 자리에 유니크를 보유하고 있습니다.';
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
|
|
||||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}");
|
|
||||||
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
|
|
||||||
if ($previousPoint < $amount) {
|
|
||||||
return '충분한 유산 포인트를 가지고 있지 않습니다.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemObj = buildItemClass($itemKey);
|
|
||||||
$userLogger = new UserLogger($userID);
|
|
||||||
$userLogger->push("{$amount} 포인트로 유니크 {$itemObj->getName()} 구입 시도", "inheritPoint");
|
|
||||||
$userLogger->flush();
|
|
||||||
|
|
||||||
$itemTrials[$itemKey] = $amount;
|
|
||||||
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
|
|
||||||
$inheritStor->setValue('previous', [$previousPoint - $amount, null]);
|
|
||||||
$general->increaseRankVar(RankColumn::inherit_point_spent_dynamic, $amount);
|
|
||||||
$trialStor->setValue("u{$userID}", [$userID, $generalID, $amount]);
|
|
||||||
$general->applyDB($db);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ enum ResourceType: string
|
|||||||
{
|
{
|
||||||
case gold = 'gold';
|
case gold = 'gold';
|
||||||
case rice = 'rice';
|
case rice = 'rice';
|
||||||
case inheritancePoint = 'inheritancePoint';
|
case inheritancePoint = 'inheritPoint';
|
||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-17
@@ -610,23 +610,7 @@ class General implements iAction
|
|||||||
$refundPoint += GameConst::$inheritItemRandomPoint;
|
$refundPoint += GameConst::$inheritItemRandomPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemTrials = $this->getAuxVar('inheritUniqueTrial') ?? [];
|
//TODO: 경매 최우선 입찰자인경우 반환
|
||||||
foreach (array_keys($itemTrials) as $itemKey) {
|
|
||||||
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}");
|
|
||||||
$ownTrial = $trialStor->getValue("u{$userID}");
|
|
||||||
|
|
||||||
$itemObj = buildItemClass($itemKey);
|
|
||||||
$itemName = $itemObj->getName();
|
|
||||||
|
|
||||||
if (!$ownTrial) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
[,, $amount] = $ownTrial;
|
|
||||||
$trialStor->deleteValue("u{$userID}");
|
|
||||||
$userLogger->push("사망으로 {$itemName} 입찰에 사용한 {$amount} 포인트 반환", "inheritPoint");
|
|
||||||
$refundPoint += $amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->getAuxVar('inheritSpecificSpecialWar')) {
|
if ($this->getAuxVar('inheritSpecificSpecialWar')) {
|
||||||
$this->setAuxVar('inheritSpecificSpecialWar', null);
|
$this->setAuxVar('inheritSpecificSpecialWar', null);
|
||||||
|
|||||||
+16
-14
@@ -62,12 +62,12 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<b-button class="col-6 offset-6" variant="primary" @click="setNextSpecialWar"> 구입 </b-button>
|
<BButton class="col-6 offset-6" variant="primary" @click="setNextSpecialWar"> 구입 </BButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<div class="a-right col-6 align-self-center">유니크 입찰</div>
|
<div class="a-right col-6 align-self-center">유니크 경매</div>
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<select v-model="specificUnique" class="form-select col-6">
|
<select v-model="specificUnique" class="form-select col-6">
|
||||||
<option disabled selected :value="null"> 유니크 선택 </option>
|
<option disabled selected :value="null"> 유니크 선택 </option>
|
||||||
@@ -89,14 +89,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="a-right">
|
<div class="a-right">
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
>얻고자 하는 유니크 아이템을 포인트를 걸어 입찰합니다. 최고 포인트인 경우 다음 턴에 유니크를 얻습니다.<br />
|
>얻고자 하는 유니크 아이템으로 경매를 시작합니다. 24턴 동안 진행됩니다.<br />
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
<span style="color: white" v-html="specificUnique == null?'':availableUnique[specificUnique].info" />
|
<span style="color: white" v-html="specificUnique == null?'':availableUnique[specificUnique].info" />
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<b-button class="col-6 offset-6" variant="primary" @click="buySpecificUnique"> 구입 </b-button>
|
<BButton class="col-6 offset-6" variant="primary" @click="openUniqueItemAuction"> 경매 시작 </BButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<div class="a-right col-6 align-self-center">랜덤 턴 초기화</div>
|
<div class="a-right col-6 align-self-center">랜덤 턴 초기화</div>
|
||||||
<b-button class="col-6" variant="primary" @click="buySimple('ResetTurnTime')"> 구입 </b-button>
|
<BButton class="col-6" variant="primary" @click="buySimple('ResetTurnTime')"> 구입 </BButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="a-right">
|
<div class="a-right">
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<div class="a-right col-6 align-self-center">랜덤 유니크 획득</div>
|
<div class="a-right col-6 align-self-center">랜덤 유니크 획득</div>
|
||||||
<b-button class="col-6" variant="primary" @click="buySimple('BuyRandomUnique')"> 구입 </b-button>
|
<BButton class="col-6" variant="primary" @click="buySimple('BuyRandomUnique')"> 구입 </BButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="a-right">
|
<div class="a-right">
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
<div class="col col-md-4 col-sm-6 col-12 py-2">
|
||||||
<div class="row px-4">
|
<div class="row px-4">
|
||||||
<div class="a-right col-6 align-self-center">즉시 전투 특기 초기화</div>
|
<div class="a-right col-6 align-self-center">즉시 전투 특기 초기화</div>
|
||||||
<b-button class="col-6" variant="primary" @click="buySimple('ResetSpecialWar')"> 구입 </b-button>
|
<BButton class="col-6" variant="primary" @click="buySimple('ResetSpecialWar')"> 구입 </BButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="a-right">
|
<div class="a-right">
|
||||||
<small class="form-text text-muted"
|
<small class="form-text text-muted"
|
||||||
@@ -173,13 +173,13 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="row px-4" style="margin-bottom: 1em">
|
<div class="row px-4" style="margin-bottom: 1em">
|
||||||
<b-button
|
<BButton
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
class="col col-md-6 col-4 offset-md-0 offset-4"
|
class="col col-md-6 col-4 offset-md-0 offset-4"
|
||||||
@click="inheritBuff[buffKey] = prevInheritBuff[buffKey] ?? 0"
|
@click="inheritBuff[buffKey] = prevInheritBuff[buffKey] ?? 0"
|
||||||
>
|
>
|
||||||
리셋 </b-button
|
리셋 </BButton
|
||||||
><b-button variant="primary" class="col col-md-6 col-4" @click="buyInheritBuff(buffKey)"> 구입 </b-button>
|
><BButton variant="primary" class="col col-md-6 col-4" @click="buyInheritBuff(buffKey)"> 구입 </BButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -209,6 +209,7 @@ import NumberInputWithInfo from "@/components/NumberInputWithInfo.vue";
|
|||||||
import { SammoAPI } from "./SammoAPI";
|
import { SammoAPI } from "./SammoAPI";
|
||||||
import type { inheritBuffType } from "./defs/API/InheritAction";
|
import type { inheritBuffType } from "./defs/API/InheritAction";
|
||||||
import * as JosaUtil from '@/util/JosaUtil';
|
import * as JosaUtil from '@/util/JosaUtil';
|
||||||
|
import { BButton } from "bootstrap-vue-3";
|
||||||
|
|
||||||
type InheritanceType =
|
type InheritanceType =
|
||||||
| "previous"
|
| "previous"
|
||||||
@@ -376,6 +377,7 @@ export default defineComponent({
|
|||||||
components: {
|
components: {
|
||||||
TopBackBar,
|
TopBackBar,
|
||||||
NumberInputWithInfo,
|
NumberInputWithInfo,
|
||||||
|
BButton,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const inheritBuff = {} as Record<inheritBuffType, number>;
|
const inheritBuff = {} as Record<inheritBuffType, number>;
|
||||||
@@ -519,7 +521,7 @@ export default defineComponent({
|
|||||||
//TODO: 페이지 새로고침 필요없이 하도록
|
//TODO: 페이지 새로고침 필요없이 하도록
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
async buySpecificUnique() {
|
async openUniqueItemAuction() {
|
||||||
if(this.specificUnique === null){
|
if(this.specificUnique === null){
|
||||||
alert("유니크를 선택해주세요.");
|
alert("유니크를 선택해주세요.");
|
||||||
return;
|
return;
|
||||||
@@ -544,8 +546,8 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await SammoAPI.InheritAction.BuySpecificUnique({
|
await SammoAPI.Auction.OpenUniqueAuction({
|
||||||
item: this.specificUnique,
|
itemID: this.specificUnique,
|
||||||
amount,
|
amount,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -554,7 +556,7 @@ export default defineComponent({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert("성공했습니다.");
|
alert("성공했습니다. 경매장을 확인해주세요.");
|
||||||
//TODO: 페이지 새로고침 필요없이 하도록
|
//TODO: 페이지 새로고침 필요없이 하도록
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -149,10 +149,6 @@ const apiRealPath = {
|
|||||||
level: number;
|
level: number;
|
||||||
}>,
|
}>,
|
||||||
BuyRandomUnique: PUT as APICallT<undefined>,
|
BuyRandomUnique: PUT as APICallT<undefined>,
|
||||||
BuySpecificUnique: PUT as APICallT<{
|
|
||||||
item: string;
|
|
||||||
amount: number;
|
|
||||||
}>,
|
|
||||||
ResetSpecialWar: PUT as APICallT<undefined>,
|
ResetSpecialWar: PUT as APICallT<undefined>,
|
||||||
ResetTurnTime: PUT as APICallT<undefined>,
|
ResetTurnTime: PUT as APICallT<undefined>,
|
||||||
SetNextSpecialWar: PUT as APICallT<{
|
SetNextSpecialWar: PUT as APICallT<{
|
||||||
|
|||||||
Reference in New Issue
Block a user