warning 수정
This commit is contained in:
+215
-215
@@ -1,215 +1,215 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace sammo;
|
namespace sammo;
|
||||||
|
|
||||||
include "lib.php";
|
include "lib.php";
|
||||||
include "func.php";
|
include "func.php";
|
||||||
|
|
||||||
$type = Util::getReq('type', 'int', 9);
|
$type = Util::getReq('type', 'int', 9);
|
||||||
|
|
||||||
//로그인 검사
|
//로그인 검사
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
$session = Session::requireGameLogin()->setReadOnly();
|
||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
increaseRefresh("장수일람", 2);
|
increaseRefresh("장수일람", 2);
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT con,turntime FROM general WHERE owner = %i', $userID);
|
$me = $db->queryFirstRow('SELECT con,turntime FROM general WHERE owner = %i', $userID);
|
||||||
|
|
||||||
$con = checkLimit($me['con']);
|
$con = checkLimit($me['con']);
|
||||||
if ($con >= 2) {
|
if ($con >= 2) {
|
||||||
printLimitMsg($me['turntime']);
|
printLimitMsg($me['turntime']);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type <= 0 || $type > 15) {
|
if ($type <= 0 || $type > 15) {
|
||||||
$type = 9;
|
$type = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ownerNameList = [];
|
$ownerNameList = [];
|
||||||
if($gameStor->isunited){
|
if($gameStor->isunited){
|
||||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
||||||
$ownerNameList[$ownerID] = $ownerName;
|
$ownerNameList[$ownerID] = $ownerName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=1024" />
|
<meta name="viewport" content="width=1024" />
|
||||||
<title><?=UniqueConst::$serverName?>: 장수일람</title>
|
<title><?=UniqueConst::$serverName?>: 장수일람</title>
|
||||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||||
<?=WebUtil::printCSS('css/common.css')?>
|
<?=WebUtil::printCSS('css/common.css')?>
|
||||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||||
<?=WebUtil::printJS('js/common.js')?>
|
<?=WebUtil::printJS('js/common.js')?>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr><td>장 수 일 람<br><?=closeButton()?></td></tr>
|
<tr><td>장 수 일 람<br><?=closeButton()?></td></tr>
|
||||||
<tr><td><form name=form1 method=post>정렬순서 :
|
<tr><td><form name=form1 method=post>정렬순서 :
|
||||||
<select id='viewType' name='type' size=1>
|
<select id='viewType' name='type' size=1>
|
||||||
<option value=1>국가</option>
|
<option value=1>국가</option>
|
||||||
<option value=2>통솔</option>
|
<option value=2>통솔</option>
|
||||||
<option value=3>무력</option>
|
<option value=3>무력</option>
|
||||||
<option value=4>지력</option>
|
<option value=4>지력</option>
|
||||||
<option value=5>명성</option>
|
<option value=5>명성</option>
|
||||||
<option value=6>계급</option>
|
<option value=6>계급</option>
|
||||||
<option value=7>관직</option>
|
<option value=7>관직</option>
|
||||||
<option value=8>삭턴</option>
|
<option value=8>삭턴</option>
|
||||||
<option value=9>벌점</option>
|
<option value=9>벌점</option>
|
||||||
<option value=10>Lv</option>
|
<option value=10>Lv</option>
|
||||||
<option value=11>성격</option>
|
<option value=11>성격</option>
|
||||||
<option value=12>내특</option>
|
<option value=12>내특</option>
|
||||||
<option value=13>전특</option>
|
<option value=13>전특</option>
|
||||||
<option value=14>연령</option>
|
<option value=14>연령</option>
|
||||||
<option value=15>NPC</option>
|
<option value=15>NPC</option>
|
||||||
</select>
|
</select>
|
||||||
<input type=submit value='정렬하기'></form>
|
<input type=submit value='정렬하기'></form>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
$nationname = [];
|
$nationname = [];
|
||||||
$nationlevel = [];
|
$nationlevel = [];
|
||||||
$nationname[0] = "-";
|
$nationname[0] = "-";
|
||||||
foreach (getAllNationStaticInfo() as $nation) {
|
foreach (getAllNationStaticInfo() as $nation) {
|
||||||
$nationname[$nation['nation']] = $nation['name'];
|
$nationname[$nation['nation']] = $nation['name'];
|
||||||
$nationlevel[$nation['nation']] = $nation['level'];
|
$nationlevel[$nation['nation']] = $nation['level'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[$orderKey, $orderDesc] = [
|
[$orderKey, $orderDesc] = [
|
||||||
1=>['nation', false],
|
1=>['nation', false],
|
||||||
2=>['leadership', true],
|
2=>['leadership', true],
|
||||||
3=>['strength', true],
|
3=>['strength', true],
|
||||||
4=>['intel', true],
|
4=>['intel', true],
|
||||||
5=>['experience', true],
|
5=>['experience', true],
|
||||||
6=>['dedication', true],
|
6=>['dedication', true],
|
||||||
7=>['officer_level', true],
|
7=>['officer_level', true],
|
||||||
8=>['killturn', false],
|
8=>['killturn', false],
|
||||||
9=>['connect', true],
|
9=>['connect', true],
|
||||||
10=>['experience', true],
|
10=>['experience', true],
|
||||||
11=>['personal', true],
|
11=>['personal', true],
|
||||||
12=>['special', true],
|
12=>['special', true],
|
||||||
13=>['special2', true],
|
13=>['special2', true],
|
||||||
14=>['age', true],
|
14=>['age', true],
|
||||||
15=>['npc', true],
|
15=>['npc', true],
|
||||||
][$type];
|
][$type];
|
||||||
|
|
||||||
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':'');
|
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':'');
|
||||||
|
|
||||||
echo"
|
echo"
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr>
|
<tr>
|
||||||
<td width=64 align=center id=bg1>얼 굴</td>
|
<td width=64 align=center id=bg1>얼 굴</td>
|
||||||
<td width=140 align=center id=bg1>이 름</td>
|
<td width=140 align=center id=bg1>이 름</td>
|
||||||
<td width=45 align=center id=bg1>연령</td>
|
<td width=45 align=center id=bg1>연령</td>
|
||||||
<td width=45 align=center id=bg1>성격</td>
|
<td width=45 align=center id=bg1>성격</td>
|
||||||
<td width=80 align=center id=bg1>특기</td>
|
<td width=80 align=center id=bg1>특기</td>
|
||||||
<td width=45 align=center id=bg1>레 벨</td>
|
<td width=45 align=center id=bg1>레 벨</td>
|
||||||
<td width=140 align=center id=bg1>국 가</td>
|
<td width=140 align=center id=bg1>국 가</td>
|
||||||
<td width=55 align=center id=bg1>명 성</td>
|
<td width=55 align=center id=bg1>명 성</td>
|
||||||
<td width=55 align=center id=bg1>계 급</td>
|
<td width=55 align=center id=bg1>계 급</td>
|
||||||
<td width=75 align=center id=bg1>관 직</td>
|
<td width=75 align=center id=bg1>관 직</td>
|
||||||
<td width=45 align=center id=bg1>통솔</td>
|
<td width=45 align=center id=bg1>통솔</td>
|
||||||
<td width=45 align=center id=bg1>무력</td>
|
<td width=45 align=center id=bg1>무력</td>
|
||||||
<td width=45 align=center id=bg1>지력</td>
|
<td width=45 align=center id=bg1>지력</td>
|
||||||
<td width=45 align=center id=bg1>삭턴</td>
|
<td width=45 align=center id=bg1>삭턴</td>
|
||||||
<td width=70 align=center id=bg1>벌점</td>
|
<td width=70 align=center id=bg1>벌점</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
foreach($generalList as $general){
|
foreach($generalList as $general){
|
||||||
$nation = $nationname[$general['nation']];
|
$nation = $nationname[$general['nation']];
|
||||||
|
|
||||||
$lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0);
|
$lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0);
|
||||||
if ($lbonus > 0) {
|
if ($lbonus > 0) {
|
||||||
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
|
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
|
||||||
} else {
|
} else {
|
||||||
$lbonusText = "";
|
$lbonusText = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($general['injury'] > 0) {
|
if ($general['injury'] > 0) {
|
||||||
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
|
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
|
||||||
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
|
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
|
||||||
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
|
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
|
||||||
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
|
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
|
||||||
$strength = "<font color=red>{$strength}</font>";
|
$strength = "<font color=red>{$strength}</font>";
|
||||||
$intel = "<font color=red>{$intel}</font>";
|
$intel = "<font color=red>{$intel}</font>";
|
||||||
} else {
|
} else {
|
||||||
$leadership = "{$general['leadership']}{$lbonusText}";
|
$leadership = "{$general['leadership']}{$lbonusText}";
|
||||||
$strength = "{$general['strength']}";
|
$strength = "{$general['strength']}";
|
||||||
$intel = "{$general['intel']}";
|
$intel = "{$general['intel']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($general['npc'] >= 2) {
|
if ($general['npc'] >= 2) {
|
||||||
$name = "<font color=cyan>{$general['name']}</font>";
|
$name = "<font color=cyan>{$general['name']}</font>";
|
||||||
} elseif ($general['npc'] == 1) {
|
} elseif ($general['npc'] == 1) {
|
||||||
$name = "<font color=skyblue>{$general['name']}</font>";
|
$name = "<font color=skyblue>{$general['name']}</font>";
|
||||||
} else {
|
} else {
|
||||||
$name = "{$general['name']}";
|
$name = "{$general['name']}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key_exists($general['owner'], $ownerNameList)){
|
if(key_exists($general['owner'], $ownerNameList)){
|
||||||
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$general['connect'] = Util::round($general['connect'], -1);
|
$general['connect'] = Util::round($general['connect'], -1);
|
||||||
|
|
||||||
$imageTemp = GetImageURL($general['imgsvr']);
|
$imageTemp = GetImageURL($general['imgsvr']);
|
||||||
echo "
|
echo "
|
||||||
<tr data-general-id='{$general['no']}'
|
<tr data-general-id='{$general['no']}'
|
||||||
data-general-wounded='{$general['injury']}'
|
data-general-wounded='{$general['injury']}'
|
||||||
data-general-leadership='{$general['leadership']}'
|
data-general-leadership='{$general['leadership']}'
|
||||||
data-general-leadership-bonus='{$lbonus}'
|
data-general-leadership-bonus='{$lbonus}'
|
||||||
data-general-strength='{$general['strength']}'
|
data-general-strength='{$general['strength']}'
|
||||||
data-general-intel='{$general['intel']}'
|
data-general-intel='{$general['intel']}'
|
||||||
data-is-npc='".($general['npc']>=2?'true':'false')."'
|
data-is-npc='".($general['npc']>=2?'true':'false')."'
|
||||||
>
|
>
|
||||||
<td align=center><img class='generalIcon' width='64' height='64' src='{$imageTemp}/{$general['picture']}'></img></td>
|
<td align=center><img class='generalIcon' width='64' height='64' src='{$imageTemp}/{$general['picture']}'></img></td>
|
||||||
<td align=center>$name</td>
|
<td align=center>$name</td>
|
||||||
<td align=center>{$general['age']}세</td>
|
<td align=center>{$general['age']}세</td>
|
||||||
<td align=center>".displayCharInfo($general['personal'])."</td>
|
<td align=center>".displayCharInfo($general['personal'])."</td>
|
||||||
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
|
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
|
||||||
<td align=center>Lv ".getExpLevel($general['experience'])."</td>
|
<td align=center>Lv ".getExpLevel($general['experience'])."</td>
|
||||||
<td align=center>{$nation}</td>
|
<td align=center>{$nation}</td>
|
||||||
<td align=center>".getHonor($general['experience'])."</td>
|
<td align=center>".getHonor($general['experience'])."</td>
|
||||||
<td align=center>".getDed($general['dedication'])."</td>
|
<td align=center>".getDed($general['dedication'])."</td>
|
||||||
<td align=center>";
|
<td align=center>";
|
||||||
echo getOfficerLevelText($general['officer_level']);
|
echo getOfficerLevelText($general['officer_level']);
|
||||||
echo "</td>
|
echo "</td>
|
||||||
<td align=center>$leadership</td>
|
<td align=center>$leadership</td>
|
||||||
<td align=center>$strength</td>
|
<td align=center>$strength</td>
|
||||||
<td align=center>$intel</td>
|
<td align=center>$intel</td>
|
||||||
<td align=center>{$general['killturn']}</td>
|
<td align=center>{$general['killturn']}</td>
|
||||||
<td align=center>{$general['connect']}";
|
<td align=center>{$general['connect']}";
|
||||||
echo "<br>【".getConnect($general['connect'])."】</td>
|
echo "<br>【".getConnect($general['connect'])."】</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
</table>
|
</table>
|
||||||
";
|
";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr><td><?=closeButton()?></td></tr>
|
<tr><td><?=closeButton()?></td></tr>
|
||||||
<tr><td><?=banner()?></td></tr>
|
<tr><td><?=banner()?></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#viewType").val("<?=$type?>").attr("selected", "selected");
|
$("#viewType").val("<?=$type?>").attr("selected", "selected");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,300 +1,292 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace sammo\Command\General;
|
namespace sammo\Command\General;
|
||||||
|
|
||||||
use\sammo\{
|
use\sammo\{
|
||||||
DB,
|
DB,
|
||||||
Util,
|
Util,
|
||||||
JosaUtil,
|
JosaUtil,
|
||||||
General,
|
General,
|
||||||
ActionLogger,
|
ActionLogger,
|
||||||
GameConst,
|
GameConst,
|
||||||
LastTurn,
|
LastTurn,
|
||||||
GameUnitConst,
|
GameUnitConst,
|
||||||
Command
|
Command
|
||||||
};
|
};
|
||||||
|
|
||||||
use function\sammo\{
|
use function\sammo\{
|
||||||
getDomesticExpLevelBonus,
|
getDomesticExpLevelBonus,
|
||||||
CriticalRatioDomestic,
|
CriticalRatioDomestic,
|
||||||
CriticalScoreEx,
|
CriticalScoreEx,
|
||||||
tryUniqueItemLottery,
|
tryUniqueItemLottery,
|
||||||
getAllNationStaticInfo
|
getAllNationStaticInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
use \sammo\Constraint\Constraint;
|
use \sammo\Constraint\Constraint;
|
||||||
use \sammo\Constraint\ConstraintHelper;
|
use \sammo\Constraint\ConstraintHelper;
|
||||||
|
|
||||||
|
|
||||||
class che_인재탐색 extends Command\GeneralCommand
|
class che_인재탐색 extends Command\GeneralCommand
|
||||||
{
|
{
|
||||||
static protected $actionName = '인재탐색';
|
static protected $actionName = '인재탐색';
|
||||||
|
|
||||||
protected function argTest(): bool
|
protected function argTest(): bool
|
||||||
{
|
{
|
||||||
$this->arg = null;
|
$this->arg = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function init()
|
protected function init()
|
||||||
{
|
{
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
|
|
||||||
$this->setNation();
|
$this->setNation();
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
$this->fullConditionConstraints = [
|
$this->fullConditionConstraints = [
|
||||||
ConstraintHelper::ReqGeneralGold($reqGold),
|
ConstraintHelper::ReqGeneralGold($reqGold),
|
||||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCommandDetailTitle(): string
|
public function getCommandDetailTitle(): string
|
||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
|
|
||||||
$maxGenCnt = $env['maxgeneral'];
|
$maxGenCnt = $env['maxgeneral'];
|
||||||
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
||||||
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
||||||
|
|
||||||
$name = $this->getName();
|
$name = $this->getName();
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
|
|
||||||
$foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt);
|
$foundProp = $this->calcFoundProp($maxGenCnt, $totalGenCnt, $totalNpcCnt);
|
||||||
$foundPropText = number_format($foundProp * 100, 1);
|
$foundPropText = number_format($foundProp * 100, 1);
|
||||||
|
|
||||||
$title = "{$name}(랜덤경험";
|
$title = "{$name}(랜덤경험";
|
||||||
if ($reqGold > 0) {
|
if ($reqGold > 0) {
|
||||||
$title .= ", 자금{$reqGold}";
|
$title .= ", 자금{$reqGold}";
|
||||||
}
|
}
|
||||||
if ($reqRice > 0) {
|
if ($reqRice > 0) {
|
||||||
$title .= ", 군량{$reqRice}";
|
$title .= ", 군량{$reqRice}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$title .= ", 확률 {$foundPropText}%)";
|
$title .= ", 확률 {$foundPropText}%)";
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCost(): array
|
public function getCost(): array
|
||||||
{
|
{
|
||||||
return [$this->env['develcost'], 0];
|
return [$this->env['develcost'], 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPreReqTurn(): int
|
public function getPreReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPostReqTurn(): int
|
public function getPostReqTurn(): int
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt): float
|
public function calcFoundProp(int $maxGenCnt, int $totalGenCnt, int $totalNpcCnt): float
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
|
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
|
||||||
$remainSlot = $maxGenCnt - $currCnt;
|
$remainSlot = $maxGenCnt - $currCnt;
|
||||||
if ($remainSlot < 0) {
|
if ($remainSlot < 0) {
|
||||||
$remainSlot = 0;
|
$remainSlot = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$foundPropMain = pow($remainSlot / $maxGenCnt, 6);
|
$foundPropMain = pow($remainSlot / $maxGenCnt, 6);
|
||||||
$foundPropSmall = 1 / ($totalNpcCnt / 3 + 1);
|
$foundPropSmall = 1 / ($totalNpcCnt / 3 + 1);
|
||||||
$foundPropBig = 1 / $maxGenCnt;
|
$foundPropBig = 1 / $maxGenCnt;
|
||||||
|
|
||||||
if ($totalNpcCnt < 50) {
|
if ($totalNpcCnt < 50) {
|
||||||
$foundProp = max($foundPropMain, $foundPropSmall);
|
$foundProp = max($foundPropMain, $foundPropSmall);
|
||||||
} else {
|
} else {
|
||||||
$foundProp = max($foundPropMain, $foundPropBig);
|
$foundProp = max($foundPropMain, $foundPropBig);
|
||||||
}
|
}
|
||||||
return $foundProp;
|
return $foundProp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
if (!$this->hasFullConditionMet()) {
|
if (!$this->hasFullConditionMet()) {
|
||||||
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$env = $this->env;
|
$env = $this->env;
|
||||||
$relYear = $env['year'] - $env['startyear'];
|
$relYear = $env['year'] - $env['startyear'];
|
||||||
|
|
||||||
$general = $this->generalObj;
|
$general = $this->generalObj;
|
||||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||||
|
|
||||||
$nationID = $general->getNationID();
|
$nationID = $general->getNationID();
|
||||||
|
|
||||||
$nationCnt = count(getAllNationStaticInfo());
|
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
||||||
|
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
||||||
$totalGenCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE npc <= 2');
|
|
||||||
$totalNpcCnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
$foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt));
|
||||||
|
|
||||||
$genCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc < 2', $nationID);
|
$logger = $general->getLogger();
|
||||||
$npcCnt = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND 3 <= npc AND npc <= 4', $nationID);
|
|
||||||
|
if (!$foundNpc) {
|
||||||
$currCnt = Util::toInt($totalGenCnt + $totalNpcCnt / 2);
|
$logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date</>");
|
||||||
$avgCnt = $currCnt / $nationCnt;
|
|
||||||
|
$incStat = Util::choiceRandomUsingWeight([
|
||||||
$foundNpc = Util::randBool($this->calcFoundProp($env['maxgeneral'], $totalGenCnt, $totalNpcCnt));
|
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
||||||
|
'strength_exp' => $general->getStrength(false, false, false, false),
|
||||||
$logger = $general->getLogger();
|
'intel_exp' => $general->getIntel(false, false, false, false)
|
||||||
|
]);
|
||||||
if (!$foundNpc) {
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
$logger->pushGeneralActionLog("인재를 찾을 수 없었습니다. <1>$date</>");
|
|
||||||
|
$exp = 100;
|
||||||
$incStat = Util::choiceRandomUsingWeight([
|
$ded = 70;
|
||||||
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
|
||||||
'strength_exp' => $general->getStrength(false, false, false, false),
|
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||||
'intel_exp' => $general->getIntel(false, false, false, false)
|
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||||
]);
|
$general->addExperience($exp);
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
$general->addDedication($ded);
|
||||||
|
$general->increaseVar($incStat, 1);
|
||||||
$exp = 100;
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$ded = 70;
|
$general->checkStatChange();
|
||||||
|
tryUniqueItemLottery($general);
|
||||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
$general->applyDB($db);
|
||||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
return true;
|
||||||
$general->addExperience($exp);
|
}
|
||||||
$general->addDedication($ded);
|
//인간적으로 너무 길어서 끊었다!
|
||||||
$general->increaseVar($incStat, 1);
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
$exp = 200;
|
||||||
$general->checkStatChange();
|
$ded = 300;
|
||||||
tryUniqueItemLottery($general);
|
|
||||||
$general->applyDB($db);
|
$pickTypeList = ['무' => 6, '지' => 6, '무지' => 3];
|
||||||
return true;
|
|
||||||
}
|
$pickType = Util::choiceRandomUsingWeight($pickTypeList);
|
||||||
//인간적으로 너무 길어서 끊었다!
|
|
||||||
|
$totalStat = GameConst::$defaultStatNPCTotal;
|
||||||
$exp = 200;
|
$minStat = GameConst::$defaultStatNPCMin;
|
||||||
$ded = 300;
|
$mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, GameConst::$defaultStatNPCMin);
|
||||||
|
$otherStat = $minStat + Util::randRangeInt(0, Util::toInt(GameConst::$defaultStatNPCMin/2));
|
||||||
$pickTypeList = ['무' => 6, '지' => 6, '무지' => 3];
|
$subStat = $totalStat - $mainStat - $otherStat;
|
||||||
|
if ($subStat < $minStat) {
|
||||||
$pickType = Util::choiceRandomUsingWeight($pickTypeList);
|
$subStat = $otherStat;
|
||||||
|
$otherStat = $minStat;
|
||||||
$totalStat = GameConst::$defaultStatNPCTotal;
|
$mainStat = $totalStat - $subStat - $otherStat;
|
||||||
$minStat = GameConst::$defaultStatNPCMin;
|
if ($mainStat) {
|
||||||
$mainStat = GameConst::$defaultStatNPCMax - Util::randRangeInt(0, GameConst::$defaultStatNPCMin);
|
throw new \LogicException('기본 스탯 설정값이 잘못되어 있음');
|
||||||
$otherStat = $minStat + Util::randRangeInt(0, Util::toInt(GameConst::$defaultStatNPCMin/2));
|
}
|
||||||
$subStat = $totalStat - $mainStat - $otherStat;
|
}
|
||||||
if ($subStat < $minStat) {
|
|
||||||
$subStat = $otherStat;
|
$avgGen = $db->queryFirstRow(
|
||||||
$otherStat = $minStat;
|
'SELECT avg(dedication) as ded,avg(experience) as exp,
|
||||||
$mainStat = $totalStat - $subStat - $otherStat;
|
avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5
|
||||||
if ($mainStat) {
|
from general where npc < 5',
|
||||||
throw new \LogicException('기본 스탯 설정값이 잘못되어 있음');
|
$nationID
|
||||||
}
|
);
|
||||||
}
|
$dexTotal = $avgGen['dex_t'];
|
||||||
|
|
||||||
$avgGen = $db->queryFirstRow(
|
if ($pickType == '무') {
|
||||||
'SELECT avg(dedication) as ded,avg(experience) as exp,
|
$leadership = $subStat;
|
||||||
avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5
|
$strength = $mainStat;
|
||||||
from general where npc < 5',
|
$intel = $otherStat;
|
||||||
$nationID
|
$dexVal = Util::choiceRandom([
|
||||||
);
|
[$dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal / 8],
|
||||||
$dexTotal = $avgGen['dex_t'];
|
[$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8],
|
||||||
|
[$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8],
|
||||||
if ($pickType == '무') {
|
]);
|
||||||
$leadership = $subStat;
|
} else if ($pickType == '지') {
|
||||||
$strength = $mainStat;
|
$leadership = $subStat;
|
||||||
$intel = $otherStat;
|
$strength = $otherStat;
|
||||||
$dexVal = Util::choiceRandom([
|
$intel = $mainStat;
|
||||||
[$dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8, $dexTotal / 8],
|
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8];
|
||||||
[$dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8, $dexTotal / 8],
|
} else {
|
||||||
[$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8],
|
$leadership = $otherStat;
|
||||||
]);
|
$strength = $subStat;
|
||||||
} else if ($pickType == '지') {
|
$intel = $mainStat;
|
||||||
$leadership = $subStat;
|
$dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4];
|
||||||
$strength = $otherStat;
|
}
|
||||||
$intel = $mainStat;
|
|
||||||
$dexVal = [$dexTotal / 8, $dexTotal / 8, $dexTotal * 5 / 8, $dexTotal / 8];
|
$leadership = Util::round($leadership);
|
||||||
} else {
|
$strength = Util::round($strength);
|
||||||
$leadership = $otherStat;
|
$intel = Util::round($intel);
|
||||||
$strength = $subStat;
|
|
||||||
$intel = $mainStat;
|
$scoutType = "발견";
|
||||||
$dexVal = [$dexTotal / 4, $dexTotal / 4, $dexTotal / 4, $dexTotal / 4];
|
$scoutLevel = 0;
|
||||||
}
|
$scoutNation = 0;
|
||||||
|
|
||||||
$leadership = Util::round($leadership);
|
$age = Util::randRangeInt(20, 25);
|
||||||
$strength = Util::round($strength);
|
$birthYear = $env['year'] - $age;
|
||||||
$intel = Util::round($intel);
|
$deathYear = $env['year'] + Util::randRangeInt(10, 50);
|
||||||
|
|
||||||
$scoutType = "발견";
|
$cityID = Util::choiceRandom(array_keys(\sammo\CityConst::all()));
|
||||||
$scoutLevel = 0;
|
$newNPC = new \sammo\Scenario\NPC(
|
||||||
$scoutNation = 0;
|
Util::randRangeInt(1, 150),
|
||||||
|
\sammo\getRandGenName(),
|
||||||
$age = Util::randRangeInt(20, 25);
|
null,
|
||||||
$birthYear = $env['year'] - $age;
|
$scoutNation,
|
||||||
$deathYear = $env['year'] + Util::randRangeInt(10, 50);
|
$cityID,
|
||||||
|
$leadership,
|
||||||
$cityID = Util::choiceRandom(array_keys(\sammo\CityConst::all()));
|
$strength,
|
||||||
$newNPC = new \sammo\Scenario\NPC(
|
$intel,
|
||||||
Util::randRangeInt(1, 150),
|
$scoutLevel,
|
||||||
\sammo\getRandGenName(),
|
$birthYear,
|
||||||
null,
|
$deathYear,
|
||||||
$scoutNation,
|
null,
|
||||||
$cityID,
|
null
|
||||||
$leadership,
|
);
|
||||||
$strength,
|
$newNPC->npc = 3;
|
||||||
$intel,
|
$newNPC->setMoney(1000, 1000);
|
||||||
$scoutLevel,
|
$newNPC->setExpDed($avgGen['exp'], $avgGen['ded']);
|
||||||
$birthYear,
|
$newNPC->setSpecYear(
|
||||||
$deathYear,
|
Util::round((GameConst::$retirementYear - $age) / 12) + $age,
|
||||||
null,
|
Util::round((GameConst::$retirementYear - $age) / 6) + $age
|
||||||
null
|
);
|
||||||
);
|
$newNPC->setDex(
|
||||||
$newNPC->npc = 3;
|
$dexVal[0],
|
||||||
$newNPC->setMoney(1000, 1000);
|
$dexVal[1],
|
||||||
$newNPC->setExpDed($avgGen['exp'], $avgGen['ded']);
|
$dexVal[2],
|
||||||
$newNPC->setSpecYear(
|
$dexVal[3],
|
||||||
Util::round((GameConst::$retirementYear - $age) / 12) + $age,
|
$avgGen['dex5']
|
||||||
Util::round((GameConst::$retirementYear - $age) / 6) + $age
|
);
|
||||||
);
|
|
||||||
$newNPC->setDex(
|
$newNPC->build($this->env);
|
||||||
$dexVal[0],
|
$npcName = $newNPC->realName;
|
||||||
$dexVal[1],
|
$josaRa = JosaUtil::pick($npcName, '라');
|
||||||
$dexVal[2],
|
|
||||||
$dexVal[3],
|
$generalName = $general->getName();
|
||||||
$avgGen['dex5']
|
$josaYi = JosaUtil::pick($generalName, '이');
|
||||||
);
|
|
||||||
|
$logger->pushGeneralActionLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}하였습니다! <1>$date</>");
|
||||||
$newNPC->build($this->env);
|
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}하였습니다!");
|
||||||
$npcName = $newNPC->realName;
|
$logger->pushGeneralHistoryLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
||||||
$josaRa = JosaUtil::pick($npcName, '라');
|
|
||||||
|
$incStat = Util::choiceRandomUsingWeight([
|
||||||
$generalName = $general->getName();
|
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
||||||
$josaYi = JosaUtil::pick($generalName, '이');
|
'strength_exp' => $general->getStrength(false, false, false, false),
|
||||||
|
'intel_exp' => $general->getIntel(false, false, false, false)
|
||||||
$logger->pushGeneralActionLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}하였습니다! <1>$date</>");
|
]);
|
||||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}하였습니다!");
|
[$reqGold, $reqRice] = $this->getCost();
|
||||||
$logger->pushGeneralHistoryLog("<Y>$npcName</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
|
||||||
|
$exp = 200;
|
||||||
$incStat = Util::choiceRandomUsingWeight([
|
$ded = 300;
|
||||||
'leadership_exp' => $general->getLeadership(false, false, false, false),
|
|
||||||
'strength_exp' => $general->getStrength(false, false, false, false),
|
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
||||||
'intel_exp' => $general->getIntel(false, false, false, false)
|
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
||||||
]);
|
$general->addExperience($exp);
|
||||||
[$reqGold, $reqRice] = $this->getCost();
|
$general->addDedication($ded);
|
||||||
|
$general->increaseVar($incStat, 3);
|
||||||
$exp = 200;
|
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||||
$ded = 300;
|
$general->checkStatChange();
|
||||||
|
tryUniqueItemLottery($general);
|
||||||
$general->increaseVarWithLimit('gold', -$reqGold, 0);
|
$general->applyDB($db);
|
||||||
$general->increaseVarWithLimit('rice', -$reqRice, 0);
|
return true;
|
||||||
$general->addExperience($exp);
|
}
|
||||||
$general->addDedication($ded);
|
}
|
||||||
$general->increaseVar($incStat, 3);
|
|
||||||
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
|
||||||
$general->checkStatChange();
|
|
||||||
tryUniqueItemLottery($general);
|
|
||||||
$general->applyDB($db);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ class GeneralAI
|
|||||||
if(!key_exists($userGeneral->getCityID(), $this->nationCities)){
|
if(!key_exists($userGeneral->getCityID(), $this->nationCities)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$city = $this->supplyCities[$userGeneral->getCityID()];
|
$city = $this->nationCities[$userGeneral->getCityID()];
|
||||||
$troopLeaderID = $userGeneral->getVar('troop');
|
$troopLeaderID = $userGeneral->getVar('troop');
|
||||||
if(!$troopLeaderID || !key_exists($troopLeaderID, $this->troopLeaders)){
|
if(!$troopLeaderID || !key_exists($troopLeaderID, $this->troopLeaders)){
|
||||||
continue;
|
continue;
|
||||||
@@ -2778,7 +2778,7 @@ class GeneralAI
|
|||||||
if($city['city'] === $candidate['city']){
|
if($city['city'] === $candidate['city']){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$realDevelRate = 0;
|
$realDevelRate = 0.0001; //하단의 나눗셈
|
||||||
|
|
||||||
foreach($this->calcCityDevelRate($candidate) as $develKey => [$develVal, $develType]){
|
foreach($this->calcCityDevelRate($candidate) as $develKey => [$develVal, $develType]){
|
||||||
if(!($this->genType & $develType)){
|
if(!($this->genType & $develType)){
|
||||||
|
|||||||
Reference in New Issue
Block a user