forked from devsam/core
feat: 장수명 무작위 생성 모드 가능
This commit is contained in:
@@ -114,6 +114,7 @@ if ($session->userGrade < 5 && !$allowReset) {
|
||||
<div class="col-sm-9">
|
||||
<div id="block_general_create" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
|
||||
<input type="radio" class="btn-check" id="block_general_create_0" name="block_general_create" value="0" checked><label for="block_general_create_0" class="btn btn-secondary">가능</label>
|
||||
<input type="radio" class="btn-check" id="block_general_create_2" name="block_general_create" value="2"><label for="block_general_create_2" class="btn btn-secondary">장수명무작위</label>
|
||||
<input type="radio" class="btn-check" id="block_general_create_1" name="block_general_create" value="1"><label for="block_general_create_1" class="btn btn-secondary">불가</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ $scenario = (int)$_POST['scenario'];
|
||||
$fiction = (int)$_POST['fiction'];
|
||||
$extend = (int)$_POST['extend'];
|
||||
$npcmode = (int)$_POST['npcmode'];
|
||||
$block_general_create = (bool)$_POST['block_general_create'];
|
||||
$block_general_create = (int)$_POST['block_general_create'];
|
||||
$show_img_level = (int)$_POST['show_img_level'];
|
||||
$tournament_trig = !!(int)$_POST['tournament_trig'];
|
||||
$join_mode = $_POST['join_mode'];
|
||||
|
||||
@@ -56,7 +56,7 @@ if(file_exists(__DIR__.'/.htaccess')){
|
||||
'scenarioName'=>$options['scenarioName'],
|
||||
'turnterm'=>$options['turnterm'],
|
||||
'fictionMode'=>($options['fiction']?'가상':'사실'),
|
||||
'block_general_create'=>(!!$options['block_general_create']),
|
||||
'block_general_create'=>Util::toInt($options['block_general_create']),
|
||||
'npcMode'=>([0=>'불가',1=>'가능',2=>'선택 생성'][$options['npcmode']]),
|
||||
'openDatetime'=>$reserved['date'],
|
||||
'starttime'=>$options['starttime'],
|
||||
@@ -90,7 +90,7 @@ $admin['scenario'] = $admin['scenario_text'];
|
||||
$admin['userCnt'] = $genCnt;
|
||||
$admin['npcCnt'] = $npcCnt;
|
||||
$admin['nationCnt'] = $nationCnt;
|
||||
$admin['block_general_create'] = !!$admin['block_general_create'];
|
||||
$admin['block_general_create'] = $admin['block_general_create'];
|
||||
$admin['npcMode'] = [0=>'불가',1=>'가능',2=>'선택 생성'][$admin['npcMode']];
|
||||
$admin['fictionMode'] = $admin['fiction']?'가상':'사실';
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace sammo\API\General;
|
||||
|
||||
use Ds\Set;
|
||||
use sammo\ActionLogger;
|
||||
use sammo\Auction;
|
||||
use sammo\CityConst;
|
||||
use sammo\DB;
|
||||
use sammo\Enums\RankColumn;
|
||||
@@ -154,9 +155,16 @@ class Join extends \sammo\BaseAPI
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
||||
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'block_general_create', 'turnterm', 'turntime', 'genius', 'npcmode']);
|
||||
########## 동일 정보 존재여부 확인. ##########
|
||||
|
||||
$block_general_create = $gameStor->getValue('block_general_create');
|
||||
if($block_general_create & 1){
|
||||
return '장수 직접 생성이 불가능한 모드입니다.';
|
||||
}
|
||||
|
||||
$blockCustomGeneralName = $gameStor->getValue('block_general_create') & 2;
|
||||
|
||||
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
|
||||
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
|
||||
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name);
|
||||
@@ -377,6 +385,10 @@ class Join extends \sammo\BaseAPI
|
||||
$betray += 2;
|
||||
}
|
||||
|
||||
if($blockCustomGeneralName){
|
||||
$name = bin2hex(random_bytes(5));
|
||||
}
|
||||
|
||||
########## 회원정보 테이블에 입력값을 등록한다. ##########
|
||||
$db->insert('general', [
|
||||
'owner' => $userID,
|
||||
@@ -415,6 +427,12 @@ class Join extends \sammo\BaseAPI
|
||||
'special2' => $special2
|
||||
]);
|
||||
$generalID = $db->insertId();
|
||||
|
||||
if($blockCustomGeneralName){
|
||||
//XXX: 클래스가 이게 맞나?
|
||||
$name = Auction::genObfuscatedName($generalID);
|
||||
}
|
||||
|
||||
$turnRows = [];
|
||||
foreach (Util::range(GameConst::$maxTurn) as $turnIdx) {
|
||||
$turnRows[] = [
|
||||
|
||||
@@ -160,7 +160,7 @@ class ResetHelper{
|
||||
int $scenario,
|
||||
int $fiction,
|
||||
int $extend,
|
||||
bool $block_general_create,
|
||||
int $block_general_create,
|
||||
int $npcmode,
|
||||
int $show_img_level,
|
||||
bool $tournament_trig,
|
||||
|
||||
+9
-1
@@ -62,7 +62,8 @@
|
||||
<div class="row">
|
||||
<div class="col col-md-4 col-3 a-right align-self-center">장수명</div>
|
||||
<div class="col col-md-3 col-9 align-self-center">
|
||||
<input v-model="args.name" class="form-control" />
|
||||
<input v-if="!blockCustomGeneralName" v-model="args.name" class="form-control" />
|
||||
<span v-else>무작위</span>
|
||||
</div>
|
||||
<div class="col col-md-1 col-3 a-right align-self-center">전콘 사용</div>
|
||||
<div class="col col-md-4 col-9 align-self-center">
|
||||
@@ -267,6 +268,11 @@ declare const staticValues: {
|
||||
imgsvr: 0 | 1;
|
||||
};
|
||||
|
||||
config: {
|
||||
show_img_level: number;
|
||||
blockCustomGeneralName: boolean;
|
||||
}
|
||||
|
||||
serverID: string;
|
||||
inheritTotalPoint: number;
|
||||
};
|
||||
@@ -294,6 +300,8 @@ const { serverID, member, turnterm } = staticValues;
|
||||
const nationList = ref(shuffle(staticValues.nationList));
|
||||
const args = ref<JoinArgs>();
|
||||
|
||||
const blockCustomGeneralName = staticValues.config.blockCustomGeneralName;
|
||||
|
||||
const stats = ref({
|
||||
min: 50,
|
||||
max: 50,
|
||||
|
||||
@@ -98,7 +98,7 @@ type ReservedGameInfo = {
|
||||
scenarioName: string,
|
||||
turnterm: number,
|
||||
fictionMode: '가상' | '사실',
|
||||
block_general_create: boolean,
|
||||
block_general_create: number,
|
||||
npcMode: '불가' | '가능' | '선택 생성',
|
||||
openDatetime: string,
|
||||
starttime: string,
|
||||
@@ -119,7 +119,7 @@ type GameInfo = {
|
||||
turntime: string,
|
||||
join_mode: string,
|
||||
fictionMode: '가상' | '사실',
|
||||
block_general_create: boolean,
|
||||
block_general_create: number,
|
||||
autorun_user: string,
|
||||
userCnt: number,
|
||||
npcCnt: number,
|
||||
@@ -271,7 +271,7 @@ async function Entrance_drawServerList(serverInfos: ServerResponseItem[]) {
|
||||
$serverHtml.append(
|
||||
TemplateEngine(serverCreateTemplate, {
|
||||
serverPath: serverPath,
|
||||
canCreate: !game.block_general_create,
|
||||
canCreate: !(game.block_general_create & 1),
|
||||
canSelectNPC: game.npcMode == '가능',
|
||||
canSelectPool: game.npcMode == '선택 생성'
|
||||
})
|
||||
|
||||
+3
-2
@@ -24,7 +24,7 @@ $db = DB::db();
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$admin = $gameStor->getValues(['block_general_create', 'show_img_level', 'maxgeneral', 'turnterm']);
|
||||
if ($admin['block_general_create']) {
|
||||
if ($admin['block_general_create'] & 1) {
|
||||
die(WebUtil::errorBackMsg("잘못된 접근입니다!!!"));
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ foreach ($scoutMsgs as $destNationID => $scoutMsg) {
|
||||
'serverID' => UniqueConst::$serverID,
|
||||
'nationList' => array_values($nationList),
|
||||
'config' => [
|
||||
'show_img_level' => $admin['show_img_level']
|
||||
'show_img_level' => $admin['show_img_level'],
|
||||
'blockCustomGeneralName' => ($admin['block_general_create'] & 2),
|
||||
],
|
||||
'member' => [
|
||||
'name' => $member['name'],
|
||||
|
||||
Reference in New Issue
Block a user