feat,wip: 유니크 경매 시작, 입찰 구현
- 누군가는 무작위로 유니크를 하나를 먹을 수 있도록 설계?
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace sammo\API\General;
|
||||
|
||||
use Ds\Set;
|
||||
use sammo\DB;
|
||||
use sammo\Validator;
|
||||
|
||||
@@ -9,6 +10,7 @@ use sammo\Session;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\JosaUtil;
|
||||
use sammo\KVStorage;
|
||||
|
||||
class DropItem extends \sammo\BaseAPI
|
||||
{
|
||||
@@ -56,12 +58,30 @@ class DropItem extends \sammo\BaseAPI
|
||||
$logger->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 버렸습니다.");
|
||||
|
||||
$nationName = $me->getStaticNation()['name'];
|
||||
$db = DB::db();
|
||||
if (!$item->isBuyable()) {
|
||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 잃었습니다!");
|
||||
$logger->pushGlobalHistoryLog("<R><b>【망실】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 잃었습니다!");
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$givenUnique = $gameStor->getValue('givenUnique') ?? [];
|
||||
$itemCode = $item->getRawClassName();
|
||||
if (key_exists($itemCode, $givenUnique)) {
|
||||
$givenUniqueCnt = $givenUnique[$itemCode];
|
||||
$givenUniqueCnt -= 1;
|
||||
if ($givenUniqueCnt <= 0) {
|
||||
unset($givenUnique[$itemCode]);
|
||||
} else {
|
||||
$givenUnique[$itemCode] = $givenUniqueCnt;
|
||||
}
|
||||
} else {
|
||||
//XXX: 처리하지 못한 코드가 있는가?
|
||||
//FIXME: 여기에서 무언가 경고를 내야함
|
||||
}
|
||||
$gameStor->setValue('givenUnique', $givenUnique);
|
||||
}
|
||||
|
||||
$me->applyDB(DB::db());
|
||||
$me->applyDB($db);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user