diff --git a/hwe/install.php b/hwe/install.php index 128956b1..6ccd73f3 100644 --- a/hwe/install.php +++ b/hwe/install.php @@ -114,6 +114,7 @@ if ($session->userGrade < 5 && !$allowReset) {
+
diff --git a/hwe/j_install.php b/hwe/j_install.php index 503f8af5..3e9ae397 100644 --- a/hwe/j_install.php +++ b/hwe/j_install.php @@ -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']; diff --git a/hwe/j_server_basic_info.php b/hwe/j_server_basic_info.php index db088fdf..47b95a88 100644 --- a/hwe/j_server_basic_info.php +++ b/hwe/j_server_basic_info.php @@ -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']?'가상':'사실'; diff --git a/hwe/sammo/API/General/Join.php b/hwe/sammo/API/General/Join.php index f36b7796..dd9e6807 100644 --- a/hwe/sammo/API/General/Join.php +++ b/hwe/sammo/API/General/Join.php @@ -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[] = [ diff --git a/hwe/sammo/ResetHelper.php b/hwe/sammo/ResetHelper.php index a0070f61..ff4969ae 100644 --- a/hwe/sammo/ResetHelper.php +++ b/hwe/sammo/ResetHelper.php @@ -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, diff --git a/hwe/ts/PageJoin.vue b/hwe/ts/PageJoin.vue index f61b2411..99114988 100644 --- a/hwe/ts/PageJoin.vue +++ b/hwe/ts/PageJoin.vue @@ -62,7 +62,8 @@
장수명
- + + 무작위
전콘 사용
@@ -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(); +const blockCustomGeneralName = staticValues.config.blockCustomGeneralName; + const stats = ref({ min: 50, max: 50, diff --git a/hwe/ts/gateway/entrance.ts b/hwe/ts/gateway/entrance.ts index a6a81a0a..510a884a 100644 --- a/hwe/ts/gateway/entrance.ts +++ b/hwe/ts/gateway/entrance.ts @@ -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 == '선택 생성' }) diff --git a/hwe/v_join.php b/hwe/v_join.php index a059ab82..fc7545ec 100644 --- a/hwe/v_join.php +++ b/hwe/v_join.php @@ -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'],