작위 보상 추가

This commit is contained in:
2019-08-14 00:55:45 +09:00
parent 9fea24f0f6
commit 00db927ce7
3 changed files with 33 additions and 11 deletions
+9 -9
View File
@@ -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])) {
+23 -1
View File
@@ -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){
+1 -1
View File
@@ -90,7 +90,7 @@ $admin['fictionMode'] = $admin['fiction']?'가상':'사실';
$otherTextInfo = [];
if($options['join_mode'] == 'onlyRandom'){
if($admin['join_mode'] == 'onlyRandom'){
$otherTextInfo[] = '랜덤 임관 전용';
}