'장수를 따라' 임관하는 기능 추가

This commit is contained in:
2019-07-17 23:06:20 +09:00
parent 0af5e9ec84
commit 122479158c
4 changed files with 75 additions and 28 deletions
+17 -8
View File
@@ -103,21 +103,30 @@ function getTurn(array $general, $type, $font=1) {
$str[$i] = "{$general['name']}{$josaUl} 등용"; $str[$i] = "{$general['name']}{$josaUl} 등용";
break; break;
case 25: //임관 case 25: //임관
$third = $command[2];
$double = $command[1]; $double = $command[1];
if($double == 98){ if($third == 98){
$nationName = '건국된 임의 국가'; $str[$i] = "【건국된 임의 국가】로 임관";
} }
else if($double == 99){ else if($third == 99){
$nationName = '임의의 국가'; $str[$i] = "【임의의 국가】로 임관";
}
else if($third == 1){
$generalName = $db->queryFirstField('SELECT name FROM general WHERE no=%i', $double)??'?!?!';
$josaUl = JosaUtil::pick($generalName, '을');
$str[$i] = "{$generalName}{$josaUl} 따라 임관";
}
else if($third == 0){
$nationName = getNationStaticInfo($double)['name']??'?!?!';
$josaRo = JosaUtil::pick($nationName, '로');
$str[$i] = "{$nationName}{$josaRo} 임관";
} }
else{ else{
$nationName = getNationStaticInfo($double)['name']??'?!?!'; $str[$i] = "????";
} }
$josaRo = JosaUtil::pick($nationName, '로');
$str[$i] = "{$nationName}{$josaRo} 임관";
break; break;
case 26: //집합 case 26: //집합
$str[$i] = "집합"; $str[$i] = "집합";
+1 -1
View File
@@ -399,7 +399,7 @@ function processAI($no) {
} }
else{ else{
//랜임 커맨드 입력. //랜임 커맨드 입력.
$command = EncodeCommand(0, 0, 99, 25); //임관 $command = EncodeCommand(0, 99, 0, 25); //임관
} }
break; break;
case 1: //거병이나 견문 40% case 1: //거병이나 견문 40%
+10 -6
View File
@@ -80,10 +80,11 @@ function process_25(&$general) {
$city = MYDB_fetch_array($result); $city = MYDB_fetch_array($result);
$command = DecodeCommand($general['turn0']); $command = DecodeCommand($general['turn0']);
$type = $command[2];
$where = $command[1]; $where = $command[1];
if($admin['join_mode'] == 'onlyRandom' && $where < 98){ if($admin['join_mode'] == 'onlyRandom' && $type < 98){
$where = 99; $type = 99;
} }
$nation = null; $nation = null;
@@ -91,7 +92,7 @@ function process_25(&$general) {
$joinedNations = Json::decode($general['nations']); $joinedNations = Json::decode($general['nations']);
// 랜덤임관인 경우 // 랜덤임관인 경우
if($general['npc'] >= 2 && $where >= 98 && !$admin['fiction'] && 1000 <= $admin['scenario'] && $admin['scenario'] < 2000){ if($general['npc'] >= 2 && $type >= 98 && !$admin['fiction'] && 1000 <= $admin['scenario'] && $admin['scenario'] < 2000){
//'사실' 모드에서는 '성향'에 우선을 두되, 장수수, 랜덤에 비중을 둠 //'사실' 모드에서는 '성향'에 우선을 두되, 장수수, 랜덤에 비중을 둠
$nations = $db->query( $nations = $db->query(
'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0', 'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0',
@@ -124,7 +125,7 @@ function process_25(&$general) {
} }
} }
else if($where >= 98) { else if($type >= 98) {
//랜임 //랜임
$generals = []; $generals = [];
foreach($db->queryAllLists('SELECT count(no), nation FROM general WHERE npc <= 2 AND nation > 0 GROUP BY nation') as list($cnt, $nation)){ foreach($db->queryAllLists('SELECT count(no), nation FROM general WHERE npc <= 2 AND nation > 0 GROUP BY nation') as list($cnt, $nation)){
@@ -161,7 +162,7 @@ function process_25(&$general) {
$randVals = []; $randVals = [];
foreach($nations as $idx=>$testNation){ foreach($nations as $idx=>$testNation){
// 임관금지없음 국가, 방랑군 제외 // 임관금지없음 국가, 방랑군 제외
if($where == 98 && $testNation['level'] == 0){ if($type == 98 && $testNation['level'] == 0){
continue; continue;
} }
@@ -181,7 +182,10 @@ function process_25(&$general) {
$nation = null; $nation = null;
} }
} else { } else if($type == 0) {
$nation = $db->queryFirstRow('SELECT `name`,nation,scout,`level` FROM nation WHERE nation=%i', $where);
} else if($type == 1){
$where = $db->queryFirstField('SELECT nation FROM general WHERE no=%i', $where)??0;
$nation = $db->queryFirstRow('SELECT `name`,nation,scout,`level` FROM nation WHERE nation=%i', $where); $nation = $db->queryFirstRow('SELECT `name`,nation,scout,`level` FROM nation WHERE nation=%i', $where);
} }
+47 -13
View File
@@ -717,6 +717,8 @@ function command_25($turn, $command) {
} }
} }
unset($nation); unset($nation);
$generalList = $db->query('SELECT no,name,nation,npc FROM general WHERE owner!=%i ORDER BY name ASC', $userID);
?> ?>
국가에 임관합니다.<br> 국가에 임관합니다.<br>
@@ -727,22 +729,31 @@ function command_25($turn, $command) {
<?php else: ?> <?php else: ?>
임관할 국가를 목록에서 선택하세요.<br> 임관할 국가를 목록에서 선택하세요.<br>
<?php endif; ?> <?php endif; ?>
!!!는 방랑군을 포함한 랜덤임관입니다. 유니크를 기대하신다면!<br> 임의의 국가로 임관할 경우 유니크 아이템을 얻을 기회가 높습니다.
???는 방랑군을 제외한 랜덤임관입니다. 유니크 혜택은 없습니다.<br>
임관 금지이거나 초기 제한중인 국가는 붉은색 배경으로 표시됩니다.<br> 임관 금지이거나 초기 제한중인 국가는 붉은색 배경으로 표시됩니다.<br>
870px x 200px를 넘어서는 내용은 표시되지 않습니다.<br> 870px x 200px를 넘어서는 내용은 표시되지 않습니다.<br>
<form name=form1 action=c_double.php method=post> <form name=form1 action=c_double.php method=post>
<select name=double size=1 style=color:white;background-color:black> <input id='double' name='double' type='hidden'>
<option value=99 style=color:white;background-color:black;>!!!</option> <input id='third' name='third' type='hidden'>
<option value=98 style=color:white;background-color:black;>???</option> <select id='selectorV' name=value size=1 style=color:white;background-color:black>
<optgroup label='랜덤 임관'>
<?php foreach($nationList as $nation): ?> <option value=99 style=color:white;background-color:black;>임의의 국가</option>
<?php if(!$nation['availableJoin']): ?> <option value=98 style=color:white;background-color:black;>건국된 임의 국가</option>
<option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;background-color:red;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option> </optgroup>
<?php else: ?> <optgroup label='국가로 임관'>
<option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option> <?php foreach($nationList as $nation): ?>
<?php endif; ?> <?php if(!$nation['availableJoin']): ?>
<?php endforeach; ?> <option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;background-color:red;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option>
<?php else: ?>
<option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option>
<?php endif; ?>
<?php endforeach; ?>
</optgroup>
<optgroup label='장수를 따라 임관'>
<?php foreach($generalList as $targetGeneral): ?>
<option value='-<?=$targetGeneral['no']?>' <?=$onlyRandom?'disabled':''?>><?=formatName($targetGeneral['name'],$targetGeneral['npc'])?>【<?=getNationStaticInfo($targetGeneral['nation'])['name']??'재야'?>】</option>
<?php endforeach; ?>
</optgroup>
</select> </select>
<input type=submit value=임관> <input type=submit value=임관>
@@ -751,6 +762,29 @@ function command_25($turn, $command) {
<input type=hidden name=turn[] value=<?=$turn[$i]?>> <input type=hidden name=turn[] value=<?=$turn[$i]?>>
<?php endforeach; ?> <?php endforeach; ?>
</form> </form>
<script>
$(function(){
var $third = $('#third');
var $double = $('#double');
var $selector = $('#selectorV');
$selector.on('change', function(){
var value=$selector.val();
if(value >= 98){
$third.val(value);
$double.val(0);
}
else if(value>0){
$third.val(0);
$double.val(value);
}
else{
$third.val(1);
$double.val(-value);
}
});
$selector.val(99).trigger('change');
});
</script>
<?php <?php
echo getInvitationList($nationList); echo getInvitationList($nationList);