From 00db927ce70ea9c6773c9cb8c08879872a76a25f Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 14 Aug 2019 00:55:45 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=91=EC=9C=84=20=EB=B3=B4=EC=83=81=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func.php | 18 +++++++++--------- hwe/func_gamerule.php | 24 +++++++++++++++++++++++- hwe/j_server_basic_info.php | 2 +- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/hwe/func.php b/hwe/func.php index 4c0efb95..1e4ec85f 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -2261,7 +2261,7 @@ function CheckHall($no) { } -function GuaranteedUniqueItemLottery(array $weightedArray, string $headerText='아이템'):?int{ +function guaranteedUniqueItemLottery(array $weightedArray, string $headerText='아이템'):?int{ //NOTE: Util::choiceRandomUsingWeight 사용 //TODO: 또 재 구현해야함.... ㅜㅜ @@ -2293,14 +2293,14 @@ function GuaranteedUniqueItemLottery(array $weightedArray, string $headerText=' $sel = Util::choiceRandomUsingWeight($selGroup); switch($sel) { - case 0: [$type, $nameFunc] = ["weap", 'getWeapName']; break; - case 1: [$type, $nameFunc] = ["book", 'getBookName']; break; - case 2: [$type, $nameFunc] = ["horse", 'getHorseName']; break; - case 3: [$type, $nameFunc] = ["item", 'getItemName']; break; + case 0: [$type, $nameFunc] = ["weap", 'sammo\getWeapName']; break; + case 1: [$type, $nameFunc] = ["book", 'sammo\getBookName']; break; + case 2: [$type, $nameFunc] = ["horse", 'sammo\getHorseName']; break; + case 3: [$type, $nameFunc] = ["item", 'sammo\getItemName']; break; } - foreach($db->queryFirstColumn('SELECT %b FROM general WHERE %b > 6', $type) as $item){ - $occupied[$item] = 1; + foreach($db->queryFirstColumn('SELECT %b FROM general WHERE %b > 6', $type, $type) as $itemIdx){ + $occupied[$itemIdx] = 1; } for($i=7; $i <= 26; $i++) { if(!Util::array_get($occupied[$i])) { @@ -2383,8 +2383,8 @@ function uniqueItem($general, $log, $vote=0) { default: $voteTypeText = '아이템'; break; } - foreach($db->queryFirstColumn('SELECT %b FROM general WHERE %b > 6', $type, $type) as $item){ - $occupied[$item] = 1; + foreach($db->queryFirstColumn('SELECT %b FROM general WHERE %b > 6', $type, $type) as $itemIdx){ + $occupied[$itemIdx] = 1; } for($i=7; $i <= 26; $i++) { if(!Util::array_get($occupied[$i])) { diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index ba16fdec..fc15e605 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -973,7 +973,7 @@ function updateNationState() { $connect=$db->get(); $history = array(); - $admin = $gameStor->getValues(['year', 'month', 'fiction', 'startyear', 'show_img_level', 'turnterm', 'turntime']); + $admin = $gameStor->getValues(['year', 'month', 'fiction', 'startyear', 'show_img_level', 'turnterm', 'turntime', 'killturn']); $query = "select nation,name,level,gennum,tech from nation"; $nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1030,6 +1030,28 @@ function updateNationState() { break; } + //유니크 아이템 하나 돌리자 + $nationGenList = $db->query('SELECT no, level, belong, horse, weap, book, item FROM general WHERE nation = %i AND killturn >= %i AND npc < 2', $nation['nation'], $admin['killturn']); + $uniqueLotteryWeightList = []; + + foreach($nationGenList as $nationGen){ + if($nationGen['horse'] > 6 || $nationGen['weap'] > 6 || $nationGen['book'] > 6 || $nationGen['item'] > 6){ + continue; + } + $score = $nationGen['belong'] + 5; //임관 년도 + 5 + if($nationGen['level'] == 12){ + $score += 200; //NOTE: 꼬우면 군주하세요. + } + else if($nationGen['level'] == 11){ + $score += 100; + } + else if($nationGen['level'] > 4){ + $score += 50; + } + $uniqueLotteryWeightList[$nationGen['no']] = $score; + } + guaranteedUniqueItemLottery($uniqueLotteryWeightList, '작위보상'); + $lastAssemblerID = $gameStor->assembler_id??0; for($levelGen = max(1, $oldLevel) + 1; $levelGen <= $nationlevel; $levelGen+=1){ diff --git a/hwe/j_server_basic_info.php b/hwe/j_server_basic_info.php index c34d3fa2..0939c241 100644 --- a/hwe/j_server_basic_info.php +++ b/hwe/j_server_basic_info.php @@ -90,7 +90,7 @@ $admin['fictionMode'] = $admin['fiction']?'가상':'사실'; $otherTextInfo = []; -if($options['join_mode'] == 'onlyRandom'){ +if($admin['join_mode'] == 'onlyRandom'){ $otherTextInfo[] = '랜덤 임관 전용'; }