forked from devsam/core
통합 세력장수,암행부 query
This commit is contained in:
+4
-15
@@ -137,14 +137,14 @@ $eaglestr = join(', ', array_map(function($arr){
|
||||
return "{$arr['name']}【{$number}】";
|
||||
}, $eagles));
|
||||
|
||||
echo "
|
||||
?>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']} colspan=6>
|
||||
<td align=center style='color:<?=newColor($nation['color'])?>; bgcolor=<?=$nation['color']?>' colspan=6>
|
||||
<font size=5>【 {$nation['name']} 】</font>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
<?php
|
||||
for($i=12; $i >= $lv; $i-=2) {
|
||||
$i1 = $i; $i2 = $i - 1;
|
||||
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0);
|
||||
@@ -172,7 +172,6 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
</tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<tr><td colspan=6 height=5></td></tr>
|
||||
<tr><td colspan=2 align=center bgcolor=red>추 방</td></tr>
|
||||
<tr>
|
||||
@@ -208,7 +207,6 @@ $general = MYDB_fetch_array($result);
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td colspan=4 height=5></td></tr>
|
||||
@@ -217,7 +215,6 @@ echo "
|
||||
<td width=98 align=right id=bg1>".getLevelText(12, $nation['level'])."</td>
|
||||
<td width=398>{$general['name']} 【".CityConst::byID($general['city'])->name."】</td>
|
||||
<td width=98 align=right id=bg1>".getLevelText(11, $nation['level'])."</td>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
@@ -255,7 +252,6 @@ if($meLevel >= 5 && $nation['l11set'] == 0) {
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
";
|
||||
|
||||
@@ -271,7 +267,6 @@ for($i=10; $i >= $lv; $i--) {
|
||||
if($i % 2 == 0) { echo "<tr>"; }
|
||||
echo "
|
||||
<td width=98 align=right id=bg1>".getLevelText($i, $nation['level'])."</td>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
@@ -307,7 +302,7 @@ for($i=10; $i >= $lv; $i--) {
|
||||
echo "{$general['name']} 【".CityConst::byID($general['city'])->name."】";
|
||||
}
|
||||
}
|
||||
echo "</td></form>";
|
||||
echo "</td>";
|
||||
if($i % 2 == 1) { echo "</tr>"; }
|
||||
}
|
||||
echo "
|
||||
@@ -345,7 +340,6 @@ endif;
|
||||
if($meLevel >= 5) {
|
||||
echo "
|
||||
<tr><td colspan=5 align=center bgcolor=orange>도 시 관 직 임 명</td></tr>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>태 수 임 명</td>
|
||||
<td colspan=2>
|
||||
@@ -398,8 +392,6 @@ if($meLevel >= 5) {
|
||||
<input type=$btn name=btn value=임명>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>군 사 임 명</td>
|
||||
<td colspan=2>
|
||||
@@ -452,8 +444,6 @@ if($meLevel >= 5) {
|
||||
<input type=$btn name=btn value=임명>
|
||||
</td>
|
||||
</tr>
|
||||
</form>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>종 사 임 명</td>
|
||||
<td colspan=2>
|
||||
@@ -507,7 +497,6 @@ if($meLevel >= 5) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=5>※ <font color=red>빨간색</font>은 현재 임명중인 장수, <font color=orange>노란색</font>은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다.</td></tr>
|
||||
</form>
|
||||
";
|
||||
}
|
||||
echo "
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
//통합 세력장수&암행부 viewer
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$reqType = Util::getReq('req', 'int', 1);
|
||||
$reqForce = Util::getReq('force', 'bool', false);
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("세력장수", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT con, turntime, nation, level, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$nationID = $me['nation'];
|
||||
$permission = checkSecretPermission($me, true);
|
||||
if($reqForce && $reqType > $permission){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다.'
|
||||
]);
|
||||
}
|
||||
$permission = min($reqType, $permission);
|
||||
$nationArr = getNationStaticInfo($nationID);
|
||||
$viewColumns = [
|
||||
'no'=>1,
|
||||
'name'=>1,
|
||||
'owner_name'=>9,
|
||||
'nation'=>1,
|
||||
'city'=>1,
|
||||
'level'=>1,
|
||||
'npc'=>1,
|
||||
'defence_train'=>2,
|
||||
'troop'=>2,
|
||||
'injury'=>1,
|
||||
'leadership'=>1,
|
||||
'strength'=>1,
|
||||
'intel'=>1,
|
||||
'experience'=>1,
|
||||
'explevel'=>1,
|
||||
'dedication'=>1,
|
||||
'dedlevel'=>1,
|
||||
'gold'=>1,
|
||||
'rice'=>1,
|
||||
'crewtype'=>2,
|
||||
'crew'=>2,
|
||||
'train'=>2,
|
||||
'atmos'=>2,
|
||||
'killturn'=>1,
|
||||
'turntime'=>2,
|
||||
'picture'=>1,
|
||||
'imgsvr'=>1,
|
||||
'age'=>1,
|
||||
'special'=>1,
|
||||
'special2'=>1,
|
||||
'personal'=>1,
|
||||
'horse'=>3,
|
||||
'weapon'=>3,
|
||||
'book'=>3,
|
||||
'item'=>3,
|
||||
'connect'=>1
|
||||
];
|
||||
|
||||
$customViewColumns = [
|
||||
'lbonus'=>1,
|
||||
'ownerName'=>1,
|
||||
'levelText'=>1,
|
||||
'honorText'=>1,
|
||||
'expLevelText'=>1,
|
||||
];
|
||||
|
||||
$specialViewFilter = [
|
||||
'special'=>function($rawGeneral){
|
||||
return getGeneralSpecialDomesticName($rawGeneral['special']);
|
||||
},
|
||||
'special2'=>function($rawGeneral){
|
||||
return getGeneralSpecialWarName($rawGeneral['special2']);
|
||||
},
|
||||
'personal'=>function($rawGeneral){
|
||||
return getGenChar($rawGeneral['personal']);
|
||||
},
|
||||
'lbonus'=>function($rawGeneral)use($nationArr){
|
||||
return calcLeadershipBonus($rawGeneral['level'], $nationArr['level']);
|
||||
},
|
||||
'ownerName'=>function($rawGeneral){
|
||||
if($rawGeneral['npc']!=1){
|
||||
return null;
|
||||
}
|
||||
return $rawGeneral['owner_name'];
|
||||
},
|
||||
'levelText'=>function($rawGeneral)use($nationArr){
|
||||
return getLevelText($rawGeneral['level'], $nationArr['level']);
|
||||
},
|
||||
'honorText'=>function($rawGeneral){
|
||||
return getHonor($rawGeneral['experience']);
|
||||
},
|
||||
'dedLevelText'=>function($rawGeneral){
|
||||
return getDedLevelText($rawGeneral['dedLevel']);
|
||||
},
|
||||
'turntime'=>function($rawGeneral){
|
||||
//'0000-00-00 11:23';
|
||||
return substr($rawGeneral['turntime'], 11, 5);
|
||||
}
|
||||
|
||||
];
|
||||
|
||||
$queryColumns = General::mergeQueryColumn(array_keys($viewColumns), 1);
|
||||
|
||||
$rawGeneralList = Util::convertArrayToDict($db->queryAllLists('SELECT %lb from general WHERE nation = %i', $queryColumns, $nationID), 'no');
|
||||
|
||||
$resultColumns = [];
|
||||
foreach($viewColumns as $column=>$reqPermission){
|
||||
if($reqPermission > $permission){
|
||||
continue;
|
||||
}
|
||||
$resultColumns[] = $column;
|
||||
}
|
||||
|
||||
foreach($customViewColumns as $column=>$reqPermission){
|
||||
if($reqPermission > $permission){
|
||||
continue;
|
||||
}
|
||||
$resultColumns[] = $column;
|
||||
}
|
||||
|
||||
foreach($rawGeneralList as $rawGeneral){
|
||||
//General 생성?
|
||||
|
||||
$item = [];
|
||||
foreach($resultColumns as $column){
|
||||
$value = $rawGeneral[$column];
|
||||
if(key_exists($column, $specialViewFilter)){
|
||||
$value = $specialViewFilter[$column]($rawGeneral);
|
||||
}
|
||||
$item[] = $value;
|
||||
}
|
||||
|
||||
$generalList[] = $item;
|
||||
}
|
||||
|
||||
$result = [
|
||||
'result'=>true,
|
||||
'column'=>$resultColumns,
|
||||
'list'=>$generalList,
|
||||
];
|
||||
|
||||
Json::die($result);
|
||||
@@ -874,9 +874,7 @@ class General implements iAction{
|
||||
return $caller;
|
||||
}
|
||||
|
||||
//TODO:createGeneralObjListFromDB로, 조건으로 select query나 generalIDList가 들어가는 녀석이 필요할 수 있음
|
||||
|
||||
static private function mergeQueryColumn(?array $reqColumns=null, int $constructMode=2):array{
|
||||
static public function mergeQueryColumn(?array $reqColumns=null, int $constructMode=2):array{
|
||||
$minimumColumn = ['no', 'name', 'city', 'nation', 'level'];
|
||||
$defaultEventColumn = [
|
||||
'no', 'name', 'city', 'nation', 'level',
|
||||
@@ -1052,6 +1050,7 @@ class General implements iAction{
|
||||
* @return GeneralCommand[][]
|
||||
*/
|
||||
static public function getReservedTurnListByGeneralList(array $generalList, int $turnIdxFrom, int $turnIdxTo, array $env){
|
||||
//XXX: static인데 return값이 General이 아니라고?? GeneralCommandHelper같은게 있어야하지 않을까?
|
||||
if(!$generalList){
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user