forked from devsam/core
city의 officer를 general로 이동
This commit is contained in:
@@ -24,12 +24,14 @@ switch($btn) {
|
||||
if($nation == 0) {
|
||||
$db->update('general', [
|
||||
'nation'=>0,
|
||||
'level'=>0,
|
||||
'officer_level'=>0,
|
||||
'officer_city'=>0
|
||||
], 'owner=%i', $userID);
|
||||
} else {
|
||||
$db->update('general', [
|
||||
'nation'=>$nation,
|
||||
'level'=>1,
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0
|
||||
], 'owner=%i', $userID);
|
||||
$db->update('nation', [
|
||||
'gennum'=>$db->sqleval('gennum + 1')
|
||||
|
||||
+4
-4
@@ -94,7 +94,7 @@ foreach (getAllNationStaticInfo() as $nation) {
|
||||
4=>['intel', true],
|
||||
5=>['experience', true],
|
||||
6=>['dedication', true],
|
||||
7=>['level', true],
|
||||
7=>['officer_level', true],
|
||||
8=>['killturn', false],
|
||||
9=>['connect', true],
|
||||
10=>['experience', true],
|
||||
@@ -105,7 +105,7 @@ foreach (getAllNationStaticInfo() as $nation) {
|
||||
15=>['npc', true],
|
||||
][$type];
|
||||
|
||||
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,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"
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
@@ -129,7 +129,7 @@ echo"
|
||||
foreach($generalList as $general){
|
||||
$nation = $nationname[$general['nation']];
|
||||
|
||||
$lbonus = calcLeadershipBonus($general['level'], $nationlevel[$general['nation']]??0);
|
||||
$lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0);
|
||||
if ($lbonus > 0) {
|
||||
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
@@ -185,7 +185,7 @@ foreach($generalList as $general){
|
||||
<td align=center>".getHonor($general['experience'])."</td>
|
||||
<td align=center>".getDed($general['dedication'])."</td>
|
||||
<td align=center>";
|
||||
echo getLevelText($general['level']);
|
||||
echo getOfficerLevelText($general['officer_level']);
|
||||
echo "</td>
|
||||
<td align=center>$leadership</td>
|
||||
<td align=center>$strength</td>
|
||||
|
||||
@@ -46,7 +46,7 @@ uasort($nations, function($lhs, $rhs){return $rhs['power']<=>$lhs['power'];});
|
||||
|
||||
$nations[0] = getNationStaticInfo(0);
|
||||
|
||||
foreach($db->query('SELECT npc,name,city,nation,level,penalty,permission FROM general ORDER BY dedication DESC') as $general){
|
||||
foreach($db->query('SELECT npc,name,city,nation,officer_level,penalty,permission FROM general ORDER BY dedication DESC') as $general){
|
||||
$nationID = $general['nation'];
|
||||
|
||||
if(!key_exists('generals', $nations[$nationID])){
|
||||
@@ -73,9 +73,9 @@ foreach ($nations as $nation) {
|
||||
$ambassadors = [];
|
||||
$auditors = [];
|
||||
foreach($generals as $general){
|
||||
$generalLevel = $general['level'];
|
||||
if($generalLevel >= 5){
|
||||
$chiefs[$generalLevel] = $general;
|
||||
$officerLevel = $general['officer_level'];
|
||||
if($officerLevel >= 5){
|
||||
$chiefs[$officerLevel] = $general;
|
||||
}
|
||||
$generalPermission = checkSecretPermission($general, false);
|
||||
if($generalPermission == 4){
|
||||
@@ -106,9 +106,9 @@ foreach ($nations as $nation) {
|
||||
echo '</tr><tr>';
|
||||
}
|
||||
$chief = $chiefs[$chiefLevel]??['name'=>'-','npc'=>0];
|
||||
$levelText = getLevelText($chiefLevel, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText($chiefLevel, $nation['level']);
|
||||
$chiefText = getColoredName($chief['name'], $chief['npc']);
|
||||
echo "<td class='center bg1'>{$levelText}</td>
|
||||
echo "<td class='center bg1'>{$officerLevelText}</td>
|
||||
<td class='center'>{$chiefText}</td>";
|
||||
}
|
||||
echo "</tr>
|
||||
|
||||
@@ -58,7 +58,7 @@ $query = "select nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$query = "select no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
|
||||
+12
-23
@@ -16,7 +16,7 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("현재도시", 1);
|
||||
|
||||
$query = "select no,nation,level,city from general where owner='{$userID}'";
|
||||
$query = "select no,nation,officer_level,city from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -77,7 +77,7 @@ if(!$citylist){
|
||||
|
||||
// 재야일때는 현재 도시만
|
||||
$valid = 0;
|
||||
if($me['level'] == 0) {
|
||||
if($me['officer_level'] == 0) {
|
||||
$query = "select city,name,nation from city where city='{$me['city']}'";
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
@@ -178,26 +178,21 @@ $officer = [
|
||||
3=>['name'=>'-', 'npc'=>0],
|
||||
2=>['name'=>'-', 'npc'=>0]
|
||||
];
|
||||
$officerQuery = [];
|
||||
if($city['officer4']){ $officerQuery[] = $city['officer4']; }
|
||||
if($city['officer3']){ $officerQuery[] = $city['officer3']; }
|
||||
if($city['officer2']){ $officerQuery[] = $city['officer2']; }
|
||||
if($officerQuery){
|
||||
foreach($db->query('SELECT `name`, npc, `level` FROM general WHERE `no` IN %li', $city['officer4']) as $officerInfo){
|
||||
$officer[$officerInfo['level']] = $officerInfo;
|
||||
}
|
||||
|
||||
foreach($db->query('SELECT `name`, npc, `officer_level` FROM general WHERE `officer_city` = %i', $city['city']) as $officerInfo){
|
||||
$officer[$officerInfo['officer_level']] = $officerInfo;
|
||||
}
|
||||
|
||||
if($city['trade'] === null) {
|
||||
$city['trade'] = "- ";
|
||||
}
|
||||
|
||||
$query = "select npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,level,nation,crewtype,crew,train,atmos from general where city='{$city['city']}' order by dedication desc"; // 장수 목록
|
||||
$query = "select npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,officer_level,nation,crewtype,crew,train,atmos from general where city='{$city['city']}' order by dedication desc"; // 장수 목록
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
$generals = $db->query(
|
||||
'SELECT npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,level,nation,crewtype,crew,train,atmos from general where city=%i order by name',
|
||||
'SELECT npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,officer_level,nation,crewtype,crew,train,atmos from general where city=%i order by name',
|
||||
$city['city']
|
||||
);
|
||||
|
||||
@@ -256,16 +251,10 @@ for($j=0; $j < $gencount; $j++) {
|
||||
$strengthText = formatWounded($strength, $general['injury']);
|
||||
$intelText = formatWounded($intel, $general['injury']);
|
||||
|
||||
$level = $general['level'];
|
||||
$levelText = getLevelText($general['level']);
|
||||
$officerLevel = $general['officer_level'];
|
||||
$officerLevelText = getOfficerLevelText($officerLevel);
|
||||
|
||||
if($general['level'] == 12) {
|
||||
$leadershipBonus = $nationInfo['level'] * 2;
|
||||
} elseif($general['level'] >= 5) {
|
||||
$leadershipBonus = $nationInfo['level'];
|
||||
} else {
|
||||
$leadershipBonus = 0;
|
||||
}
|
||||
$lerdershipBonus = calcLeadershipBonus($officerLevel, $nationInfo['level']);
|
||||
$leadershipBonusText = formatLeadershipBonus($leadershipBonus);
|
||||
|
||||
if($ourGeneral){
|
||||
@@ -314,8 +303,8 @@ for($j=0; $j < $gencount; $j++) {
|
||||
'leadershipText'=>$leadershipText,
|
||||
'leadershipBonus'=>$leadershipBonus,
|
||||
'leadershipBonusText'=>$leadershipBonusText,
|
||||
'level'=>$level,
|
||||
'levelText'=>$levelText,
|
||||
'officerLevel'=>$officerLevel,
|
||||
'officerLevelText'=>$officerLevelText,
|
||||
'strength'=>$strength,
|
||||
'strengthText'=>$strengthText,
|
||||
'intel'=>$intel,
|
||||
|
||||
+3
-3
@@ -13,7 +13,7 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("내무부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$nationID = $me['nation'];
|
||||
$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,rate,scout,war,secretlimit,msg,scoutmsg,capital FROM nation WHERE nation = %i', $nationID);
|
||||
@@ -34,7 +34,7 @@ else if ($permission < 1) {
|
||||
die();
|
||||
}
|
||||
|
||||
if ($me['level'] >= 5) {
|
||||
if ($me['officer_level'] >= 5) {
|
||||
$btn = "submit";
|
||||
$read = "";
|
||||
} else {
|
||||
@@ -51,7 +51,7 @@ if ($me['level'] >= 5) {
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 내무부</title>
|
||||
<script>
|
||||
var editable = <?=(($me['level']>=5||$permission==4)?'true':'false')?>;
|
||||
var editable = <?=(($me['officer_level']>=5||$permission==4)?'true':'false')?>;
|
||||
var nationMsg = <?=Json::encode($nation['msg']??'')?>;
|
||||
var scoutmsg = <?=Json::encode($nation['scoutmsg']??'')?>;
|
||||
</script>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("암행부", 1);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$query = "select no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -100,7 +100,7 @@ switch ($type) {
|
||||
}
|
||||
|
||||
$generals = $db->query(
|
||||
'SELECT npc,defence_train,no,level,troop,city,injury,leadership,strength,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,nation from general WHERE nation = %i %l',
|
||||
'SELECT npc,defence_train,no,officer_level,troop,city,injury,leadership,strength,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,nation from general WHERE nation = %i %l',
|
||||
$me['nation'],
|
||||
$orderSQL
|
||||
);
|
||||
@@ -127,7 +127,7 @@ foreach ($generals as &$general) {
|
||||
$genCntEff += 1;
|
||||
}
|
||||
|
||||
$lbonus = calcLeadershipBonus($general['level'], $nationLevel);
|
||||
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
|
||||
if ($lbonus > 0) {
|
||||
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
|
||||
+113
-110
@@ -14,11 +14,12 @@ increaseRefresh("인사부", 1);
|
||||
//훼섭 추방을 위해 갱신
|
||||
TurnExecutionHelper::executeAllCommand();
|
||||
|
||||
$query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$query = "select no,nation,officer_level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
$nationID = $nationID;
|
||||
|
||||
$meLevel = $me['level'];
|
||||
$meLevel = $me['officer_level'];
|
||||
if($meLevel == 0) {
|
||||
echo "재야입니다.";
|
||||
exit();
|
||||
@@ -50,12 +51,12 @@ var myLevel = <?=$meLevel?>;
|
||||
|
||||
<?php
|
||||
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$me['nation']}'";
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$nationID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result); //국가정보
|
||||
|
||||
$ambassadors = $db->query('SELECT no, name, level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nation['nation']);
|
||||
$auditors = $db->query('SELECT no, name, level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nation['nation']);
|
||||
$ambassadors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nationID);
|
||||
$auditors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nationID);
|
||||
$candidateAmbassadors = [];
|
||||
$candidateAuditors = [];
|
||||
foreach($ambassadors as $ambassador){
|
||||
@@ -64,7 +65,7 @@ foreach($ambassadors as $ambassador){
|
||||
foreach($auditors as $auditor){
|
||||
$candidateAuditors[] = $auditor;
|
||||
}
|
||||
foreach($db->query('SELECT no, name, nation, level, penalty, permission FROM general WHERE nation = %i AND permission = \'normal\' AND level != 12', $nation['nation']) as $candidate){
|
||||
foreach($db->query('SELECT no, name, nation, officer_level, penalty, permission FROM general WHERE nation = %i AND permission = \'normal\' AND officer_level != 12', $nationID) as $candidate){
|
||||
$maxPermission = checkSecretMaxPermission($candidate);
|
||||
if($maxPermission == 4){
|
||||
$candidateAmbassadors[] = $candidate;
|
||||
@@ -107,19 +108,19 @@ $lv = getNationChiefLevel($nation['level']);
|
||||
if($meLevel >= 5) { $btn = "button"; }
|
||||
else { $btn = "hidden"; }
|
||||
|
||||
$query = "select name,level,picture,imgsvr,belong from general where nation='{$nation['nation']}' and level>={$lv} order by level desc";
|
||||
$query = "select name,officer_level,picture,imgsvr,belong from general where nation='{$nationID}' and officer_level>={$lv} order by officer_level desc";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$level = [];
|
||||
for($i=12; $i >= $lv; $i--) {
|
||||
$levels = MYDB_fetch_array($genresult);
|
||||
$level[$levels['level']] = $levels;
|
||||
$level[$levels['officer_level']] = $levels;
|
||||
}
|
||||
|
||||
|
||||
$tigers = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "warnum" AND value > 0 ORDER BY value DESC LIMIT 5',
|
||||
$nation['nation']
|
||||
$nationID
|
||||
);// 오호장군
|
||||
$tigerstr = join(', ', array_map(function($arr){
|
||||
$number = number_format($arr['value']);
|
||||
@@ -129,7 +130,7 @@ $tigerstr = join(', ', array_map(function($arr){
|
||||
$eagles = $db->query('SELECT value, name
|
||||
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
|
||||
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
|
||||
$nation['nation']
|
||||
$nationID
|
||||
);// 건안칠자
|
||||
$eaglestr = join(', ', array_map(function($arr){
|
||||
$number = number_format($arr['value']);
|
||||
@@ -150,10 +151,10 @@ for($i=12; $i >= $lv; $i-=2) {
|
||||
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
|
||||
?>
|
||||
<tr>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getLevelText($i1, $nation['level'])?></font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getOfficerLevelText($i1, $nation['level'])?></font></td>
|
||||
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i1]['name']??'-'?>(<?=$level[$i1]['belong']??'-'?>년)</font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getLevelText($i2, $nation['level'])?></font></td>
|
||||
<td width=98 align=center id=bg1><font size=4><?=getOfficerLevelText($i2, $nation['level'])?></font></td>
|
||||
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
|
||||
<td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
|
||||
</tr>
|
||||
@@ -182,7 +183,7 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
|
||||
echo "
|
||||
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
|
||||
|
||||
$query = "select no,npc,name,level,leadership,strength,intel,killturn from general where nation='{$me['nation']}' and level!='12' and no!='{$me['no']}' order by npc,binary(name)";
|
||||
$query = "select no,npc,name,officer_level,leadership,strength,intel,killturn from general where nation='{$nationID}' and officer_level!='12' and no!='{$me['no']}' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
|
||||
@@ -192,7 +193,7 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
|
||||
continue;
|
||||
}
|
||||
echo "
|
||||
<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
|
||||
<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
|
||||
}
|
||||
|
||||
echo "
|
||||
@@ -200,10 +201,10 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
|
||||
<input type=$btn id='btn_kick' value=추방>";
|
||||
}
|
||||
|
||||
$query = "select name,city from general where nation='{$me['nation']}' and level=12";
|
||||
$query = "select name,city from general where nation='{$nationID}' and officer_level=12";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$levelText = getLevelText(11, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText(11, $nation['level']);
|
||||
echo "
|
||||
</td>
|
||||
</tr>
|
||||
@@ -212,36 +213,36 @@ echo "
|
||||
<tr><td colspan=4 height=5></td></tr>
|
||||
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right id=bg1>".getLevelText(12, $nation['level'])."</td>
|
||||
<td width=98 align=right id=bg1>".getOfficerLevelText(12, $nation['level'])."</td>
|
||||
<td width=398>{$general['name']} 【".CityConst::byID($general['city'])->name."】</td>
|
||||
<td width=98 align=right id=bg1>{$levelText}</td>
|
||||
<td width=98 align=right id=bg1>{$officerLevelText}</td>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
if($meLevel >= 5 && $nation['l11set'] == 0) {
|
||||
echo "
|
||||
<select id='genlist_11' size=1 maxlength=15 style=color:white;background-color:black;>
|
||||
<option value=0 data-level='0' data-name=''>____공석____</option>";
|
||||
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' order by npc,binary(name)";
|
||||
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
|
||||
$query = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 11) {
|
||||
echo "<option style=color:red; selected data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
if($general['officer_level'] == 11) {
|
||||
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['officer_level'] > 1) {
|
||||
echo "<option style=color:orange; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
echo "<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input class='btn_appoint' type=$btn data-level='11' data-level-text='{$levelText}' value=임명>";
|
||||
<input class='btn_appoint' type=$btn data-officer_level='11' data-officer_level_text='{$officerLevelText}' value=임명>";
|
||||
} else {
|
||||
$query = "select name,city from general where nation='{$me['nation']}' and level='11'";
|
||||
$query = "select name,city from general where nation='{$nationID}' and officer_level='11'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general){
|
||||
@@ -255,18 +256,18 @@ echo "
|
||||
";
|
||||
|
||||
$queries = [];
|
||||
$queries[10] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[9] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[8] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[7] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[6] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[5] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[10] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[9] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[8] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[7] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[6] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$queries[5] = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
|
||||
for($i=10; $i >= $lv; $i--) {
|
||||
if($i % 2 == 0) { echo "<tr>"; }
|
||||
$levelText = getLevelText($i, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText($i, $nation['level']);
|
||||
echo "
|
||||
<td width=98 align=right id=bg1>{$levelText}</td>
|
||||
<td width=98 align=right id=bg1>{$officerLevelText}</td>
|
||||
<td width=398>
|
||||
";
|
||||
|
||||
@@ -274,7 +275,7 @@ for($i=10; $i >= $lv; $i--) {
|
||||
if($meLevel >= 5 && $nation["l{$i}set"] == 0) {
|
||||
echo "
|
||||
<select id='genlist_{$i}' size=1 style=color:white;background-color:black;>
|
||||
<option value=0 data-level='0' data-name=''>____공석____</option>";
|
||||
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
|
||||
|
||||
$query = $queries[$i];
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -282,20 +283,20 @@ for($i=10; $i >= $lv; $i--) {
|
||||
|
||||
for($k=0; $k < $gencount; $k++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == $i) {
|
||||
echo "<option style=color:red; selected data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
if($general['officer_level'] == $i) {
|
||||
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['officer_level'] > 1) {
|
||||
echo "<option style=color:orange; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
echo "<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input class='btn_appoint' type=$btn data-level='{$i}' data-level-text='$levelText' value=임명>";
|
||||
<input class='btn_appoint' type=$btn data-officer_level='{$i}' data-officer_level_text='$officerLevelText' value=임명>";
|
||||
} else {
|
||||
$query = "select name,city from general where nation='{$me['nation']}' and level={$i}";
|
||||
$query = "select name,city from general where nation='{$nationID}' and officer_level={$i}";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general){
|
||||
@@ -338,16 +339,16 @@ endif;
|
||||
<tr><td colspan=5 height=5></td></tr>
|
||||
<?php
|
||||
if($meLevel >= 5) {
|
||||
$levelText = getLevelText(4, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText(4, $nation['level']);
|
||||
echo "
|
||||
<tr><td colspan=5 align=center bgcolor=orange>도 시 관 직 임 명</td></tr>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>{$levelText} 임명</td>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_4' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nation['nation']}' and officer4set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer4set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -370,36 +371,36 @@ if($meLevel >= 5) {
|
||||
echo "
|
||||
</select>
|
||||
<select id='genlist_4' size=1 style=color:white;background-color:black;>
|
||||
<option value=0 data-level='0' data-name='' data-level-text='{$levelText}'>____공석____</option>
|
||||
<option value=0 data-officer_level='0' data-name='' data-officer_level_text='{$officerLevelText}'>____공석____</option>
|
||||
";
|
||||
|
||||
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$query = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and strength>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 4) {
|
||||
echo "<option style=color:red; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
if($general['officer_level'] == 4) {
|
||||
echo "<option style=color:red; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['officer_level'] > 1) {
|
||||
echo "<option style=color:orange; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
echo "<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input class='btn_appoint' type=$btn data-level='4' value=임명>
|
||||
<input class='btn_appoint' type=$btn data-officer_level='4' value=임명>
|
||||
</td>
|
||||
</tr>";
|
||||
$levelText = getLevelText(3, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText(3, $nation['level']);
|
||||
echo "<tr>
|
||||
<td colspan=3 align=right id=bg2>{$levelText} 임명</td>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_3' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nation['nation']}' and officer3set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer3set=0 order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -422,36 +423,36 @@ if($meLevel >= 5) {
|
||||
echo "
|
||||
</select>
|
||||
<select id='genlist_3' size=1 style=color:white;background-color:black;>
|
||||
<option value=0 data-level='0' data-name='' data-level-text='{$levelText}'>____공석____</option>
|
||||
<option value=0 data-officer_level='0' data-name='' data-officer_level_text='{$officerLevelText}'>____공석____</option>
|
||||
";
|
||||
|
||||
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$query = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' and intel>='".GameConst::$chiefStatMin."' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 3) {
|
||||
echo "<option style=color:red; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
if($general['officer_level'] == 3) {
|
||||
echo "<option style=color:red; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['officer_level'] > 1) {
|
||||
echo "<option style=color:orange; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
echo "<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input class='btn_appoint' type=$btn data-level='3' value=임명>
|
||||
<input class='btn_appoint' type=$btn data-officer_level='3' value=임명>
|
||||
</td>
|
||||
</tr>";
|
||||
$levelText = getLevelText(2, $nation['level']);
|
||||
$officerLevelText = getOfficerLevelText(2, $nation['level']);
|
||||
echo "<tr>
|
||||
<td colspan=3 align=right id=bg2>{$levelText} 임명</td>
|
||||
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
|
||||
<td colspan=2>
|
||||
<select id='citylist_2' size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
|
||||
$query = "select city,name,region from city where nation='{$nation['nation']}' and officer2set=0 order by region, level desc,binary(name)"; // 도시 이름 목록
|
||||
$query = "select city,name,region from city where nation='{$nationID}' and officer2set=0 order by region, level desc,binary(name)"; // 도시 이름 목록
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
@@ -474,26 +475,26 @@ if($meLevel >= 5) {
|
||||
echo "
|
||||
</select>
|
||||
<select id='genlist_2' size=1 style=color:white;background-color:black;>
|
||||
<option value=0>____<span class='name_field' data-level-text='{$levelText}'>공석</span>____</option>
|
||||
<option value=0>____<span class='name_field' data-officer_level_text='{$officerLevelText}'>공석</span>____</option>
|
||||
";
|
||||
|
||||
$query = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' order by npc,binary(name)";
|
||||
$query = "select no,name,officer_level,city from general where nation='{$nationID}' and officer_level!='12' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 2) {
|
||||
echo "<option style=color:red; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
if($general['officer_level'] == 2) {
|
||||
echo "<option style=color:red; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['officer_level'] > 1) {
|
||||
echo "<option style=color:orange; data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option data-level='{$general['level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
echo "<option data-officer_level='{$general['officer_level']} data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input class='btn_appoint' type=$btn data-level='2' value=임명>
|
||||
<input class='btn_appoint' type=$btn data-officer_level='2' value=임명>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td colspan=5>※ <font color=red>빨간색</font>은 현재 임명중인 장수, <font color=orange>노란색</font>은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다.</td></tr>
|
||||
@@ -510,46 +511,48 @@ echo "
|
||||
|
||||
$citylevel = getCityLevelList();
|
||||
|
||||
$query = "select city,name,officer4,officer3,officer2,level,region,officer4set,officer3set,officer2set from city where nation='{$nation['nation']}' order by region,level desc,binary(name)"; // 도시 이름 목록
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($cityresult);
|
||||
$officerList = [];
|
||||
|
||||
foreach($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer){
|
||||
$officerCityID = $officer['officer_city'];
|
||||
if(!key_exists($officerCityID, $officerList)){
|
||||
$officerList[$officerCityID] = [];
|
||||
}
|
||||
$officerList[$officerCityID][$officer['officer_level']] = $officer;
|
||||
}
|
||||
|
||||
$region = 0;
|
||||
for($j=0; $j < $citycount; $j++) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
$dummyOfficer = [
|
||||
'name'=>'-',
|
||||
'belong'=>0,
|
||||
];
|
||||
|
||||
$query = "select name,belong,city from general where no='{$city['officer4']}'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$officer4 = MYDB_fetch_array($genresult);
|
||||
$query = "select name,belong,city from general where no='{$city['officer3']}'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$officer3 = MYDB_fetch_array($genresult);
|
||||
$query = "select name,belong,city from general where no='{$city['officer2']}'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$officer2 = MYDB_fetch_array($genresult);
|
||||
$textColor = newColor($nation['color']);
|
||||
$nationColor = $nation['color'];
|
||||
|
||||
if($region != $city['region']) {
|
||||
echo "
|
||||
foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,officer2set from city where nation=$i order by region,level desc,binary(name)', $nationID) as $city) {
|
||||
$cityID = $city['city'];
|
||||
$cityOfficerList = $officerList[$cityID]??[];
|
||||
?>
|
||||
<tr>
|
||||
<td width=78 align=center style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'>【<?=$citylevel[$city['level']]?>】</td>
|
||||
<td width=78 align=right style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'><?=$city['name']?> </td>
|
||||
<?php if($region != $city['region']): ?>
|
||||
<tr><td colspan=5 height=3 id=bg1></td></tr>
|
||||
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 ".CityConst::$regionMap[$city['region']]." 】 </font></td></tr>";
|
||||
$region = $city['region'];
|
||||
}
|
||||
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 <?=CityConst::$regionMap[$city['region']]?> 】 </font></td></tr>";
|
||||
<?php endif; $region = $city['region']; ?>
|
||||
<?php foreach(Util::range(4, 1, -1) as $officerLevel): ?>
|
||||
<?php if(key_exists($officerLevel, $cityOfficerList)):
|
||||
$officer = $cityOfficerList[$officerLevel];
|
||||
?>
|
||||
<?=$officer['name']?>(<?=$officer['belong']?>년) 【<?=CityConst::byID($officer['city'])->name?>】
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$officer4['name'] = $officer4['name']==""?"-":$officer4['name']." ({$officer4['belong']}년) 【".CityConst::byID($officer4['city'])->name."】";
|
||||
$officer3['name'] = $officer3['name']==""?"-":$officer3['name']." ({$officer3['belong']}년) 【".CityConst::byID($officer3['city'])->name."】";
|
||||
$officer2['name'] = $officer2['name']==""?"-":$officer2['name']." ({$officer2['belong']}년) 【".CityConst::byID($officer2['city'])->name."】";
|
||||
if($city['officer4set'] == 1) { $officer4['name'] = "<font color=orange>".$officer4['name']."</font>"; }
|
||||
if($city['officer3set'] == 1) { $officer3['name'] = "<font color=orange>".$officer3['name']."</font>"; }
|
||||
if($city['officer2set'] == 1) { $officer2['name'] = "<font color=orange>".$officer2['name']."</font>"; }
|
||||
echo "
|
||||
<tr>
|
||||
<td width=78 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=3>【{$citylevel[$city['level']]}】</font></td>
|
||||
<td width=78 align=right style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=3>{$city['name']} </font></td>
|
||||
<td align=center>{$officer4['name']}</td>
|
||||
<td align=center>{$officer3['name']}</td>
|
||||
<td align=center>{$officer2['name']}</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
<tr><td colspan=5>※ <font color=orange>노란색</font>은 변경 불가능, 하얀색은 변경 가능 관직입니다.</td></tr>
|
||||
|
||||
+44
-32
@@ -18,11 +18,12 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("세력도시", 1);
|
||||
|
||||
$query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$query = "select no,nation,officer_level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
$nationID = $me['nation'];
|
||||
|
||||
if ($me['level'] == 0) {
|
||||
if ($me['officer_level'] == 0) {
|
||||
echo "재야입니다.";
|
||||
exit();
|
||||
}
|
||||
@@ -75,30 +76,51 @@ $sel = [$type => "selected"];
|
||||
|
||||
$nation = getNationStaticInfo($me['nation']); //국가정보
|
||||
|
||||
$query = "select *,pop/pop_max as poprate from city where nation='{$me['nation']}'";
|
||||
$officerList = [];
|
||||
foreach($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer){
|
||||
$officerCityID = $officer['officer_city'];
|
||||
if(!key_exists($officerCityID, $officerList)){
|
||||
$officerList[$officerCityID] = [];
|
||||
}
|
||||
$officerList[$officerCityID][$officer['officer_level']] = $officer;
|
||||
}
|
||||
|
||||
|
||||
$cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID);
|
||||
|
||||
|
||||
switch ($type) {
|
||||
case 1: break;
|
||||
case 2: $query .= " order by pop desc"; break;
|
||||
case 3: $query .= " order by poprate desc"; break;
|
||||
case 4: $query .= " order by trust desc"; break;
|
||||
case 5: $query .= " order by agri desc"; break;
|
||||
case 6: $query .= " order by comm desc"; break;
|
||||
case 7: $query .= " order by secu desc"; break;
|
||||
case 8: $query .= " order by def desc"; break;
|
||||
case 9: $query .= " order by wall desc"; break;
|
||||
case 10: $query .= " order by trade desc"; break;
|
||||
case 11: $query .= " order by region,level desc"; break;
|
||||
case 12: $query .= " order by level desc, region"; break;
|
||||
case 2: usort($cityList, function($lhs, $rhs){return $rhs['pop'] <=> $lhs['pop'];}); break;
|
||||
case 3: usort($cityList, function($lhs, $rhs){return $rhs['poprate'] <=> $lhs['poprate'];}); break;
|
||||
case 4: usort($cityList, function($lhs, $rhs){return $rhs['trust'] <=> $lhs['trust'];}); break;
|
||||
case 5: usort($cityList, function($lhs, $rhs){return $rhs['agri'] <=> $lhs['agri'];}); break;
|
||||
case 6: usort($cityList, function($lhs, $rhs){return $rhs['comm'] <=> $lhs['comm'];}); break;
|
||||
case 7: usort($cityList, function($lhs, $rhs){return $rhs['secu'] <=> $lhs['secu'];}); break;
|
||||
case 8: usort($cityList, function($lhs, $rhs){return $rhs['def'] <=> $lhs['def'];}); break;
|
||||
case 9: usort($cityList, function($lhs, $rhs){return $rhs['wall'] <=> $lhs['wall'];}); break;
|
||||
case 10: usort($cityList, function($lhs, $rhs){return $rhs['trade'] <=> $lhs['trade'];}); break;
|
||||
case 11: usort($cityList, function($lhs, $rhs){
|
||||
$cmpTrust = $lhs['region'] <=> $rhs['region'];
|
||||
if($cmpTrust != 0){
|
||||
return $cmpTrust;
|
||||
}
|
||||
return $rhs['level']<=>$lhs['level'];
|
||||
}); break;
|
||||
case 12: usort($cityList, function($lhs, $rhs){
|
||||
$cmpTrust = $rhs['level'] <=> $lhs['level'];
|
||||
if($cmpTrust != 0){
|
||||
return $cmpTrust;
|
||||
}
|
||||
return $lhs['region']<=>$rhs['region'];
|
||||
}); break;
|
||||
}
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$citycount = MYDB_num_rows($cityresult);
|
||||
|
||||
$region = 0;
|
||||
$level = 0;
|
||||
|
||||
for ($j=0; $j < $citycount; $j++) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
foreach($cityList as $city){
|
||||
$cityID = $city['city'];
|
||||
if ($city['city'] == $nation['capital']) {
|
||||
$city['name'] = "<font color=cyan>[{$city['name']}]</font>";
|
||||
}
|
||||
@@ -109,22 +131,12 @@ for ($j=0; $j < $citycount; $j++) {
|
||||
3=>'-',
|
||||
4=>'-'
|
||||
];
|
||||
if ($city['officer4'] > 0) {
|
||||
$officerQuery[] = $city['officer4'];
|
||||
}
|
||||
if ($city['officer3'] > 0) {
|
||||
$officerQuery[] = $city['officer3'];
|
||||
}
|
||||
if ($city['officer2'] > 0) {
|
||||
$officerQuery[] = $city['officer2'];
|
||||
}
|
||||
|
||||
if($officerQuery){
|
||||
foreach($db->query('SELECT `level`, `name` FROM general WHERE `no` IN %li', $officerQuery) as $genOfficer){
|
||||
$officerName[$genOfficer['level']] = $genOfficer['name'];
|
||||
}
|
||||
$cityOfficerList = $officerList[$cityID]??[];
|
||||
foreach($cityOfficerList as $cityOfficer){
|
||||
$officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']);
|
||||
}
|
||||
|
||||
|
||||
if ($type == 10 && $city['region'] != $region) {
|
||||
echo "<br>";
|
||||
$region = $city['region'];
|
||||
|
||||
+6
-6
@@ -18,9 +18,9 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("세력장수", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,level from general where owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level from general where owner=%i', $userID);
|
||||
|
||||
if($me['level'] == 0) {
|
||||
if($me['officer_level'] == 0) {
|
||||
echo "재야입니다.";
|
||||
exit();
|
||||
}
|
||||
@@ -82,7 +82,7 @@ if($gameStor->isunited){
|
||||
$nationLevel = DB::db()->queryFirstField('select level from nation where nation = %i', $me['nation']);
|
||||
|
||||
[$orderKey, $orderDesc] = [
|
||||
1=>['level', true],
|
||||
1=>['officer_level', true],
|
||||
2=>['dedication', true],
|
||||
3=>['experience', true],
|
||||
4=>['leadership', true],
|
||||
@@ -99,7 +99,7 @@ $nationLevel = DB::db()->queryFirstField('select level from nation where nation
|
||||
15=>['npc', true],
|
||||
][$type];
|
||||
|
||||
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,level,killturn,connect,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $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,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc?'desc':'');
|
||||
|
||||
echo"
|
||||
<table align=center class='tb_layout bg0'>
|
||||
@@ -122,7 +122,7 @@ echo"
|
||||
</tr>";
|
||||
foreach($generalList as $general){
|
||||
|
||||
$lbonus = calcLeadershipBonus($general['level'], $nationLevel);
|
||||
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
|
||||
if($lbonus > 0) {
|
||||
$lbonus = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
@@ -155,7 +155,7 @@ foreach($generalList as $general){
|
||||
<tr>
|
||||
<td align=center class='generalIcon' style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;' height=64></td>
|
||||
<td align=center>$name</td>
|
||||
<td align=center>"; echo getLevelText($general['level'], $nationLevel); echo "</td>
|
||||
<td align=center>"; echo getOfficerLevelText($general['officer_level'], $nationLevel); echo "</td>
|
||||
<td align=center>".getDed($general['dedication'])."</td>
|
||||
<td align=center>".getHonor($general['experience'])."</td>
|
||||
<td align=center>".getBill($general['dedication'])."</td>
|
||||
|
||||
@@ -47,7 +47,7 @@ if(!$isChiefTurn){
|
||||
$commandObj = buildGeneralCommandClass($commandType, $general, $env);
|
||||
}
|
||||
else{
|
||||
if($general->getVar('level') < 5){
|
||||
if($general->getVar('officer_level') < 5){
|
||||
die_redirect();
|
||||
}
|
||||
$commandObj = buildNationCommandClass($commandType, $general, $env, new LastTurn());
|
||||
|
||||
@@ -256,7 +256,7 @@ var defaultSpecialDomestic = <?=GameConst::$defaultSpecialDomestic?>;
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">직위</span>
|
||||
</div>
|
||||
<select class="custom-select form_general_level" style="width:8ch;">
|
||||
<select class="custom-select form_officer_level" style="width:8ch;">
|
||||
<option value="1">일반</option>
|
||||
<option value="4">태수</option>
|
||||
<option value="3">군사</option>
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ $userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$me = $db->queryFirstRow('SELECT `no`,nation,`level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
//내가 수뇌부이어야함
|
||||
$permission = checkSecretPermission($me);
|
||||
@@ -26,7 +26,7 @@ if($permission < 0){
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
else if ($me['level'] < 5 && $permission != 4) {
|
||||
else if ($me['officer_level'] < 5 && $permission != 4) {
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
+36
-125
@@ -140,6 +140,7 @@ function cityInfo(General $generalObj) {
|
||||
|
||||
// 도시 정보
|
||||
$city = $generalObj->getRawCity();
|
||||
$cityID = $city['city'];
|
||||
|
||||
$nation = getNationStaticInfo($city['nation']);
|
||||
|
||||
@@ -153,27 +154,16 @@ function cityInfo(General $generalObj) {
|
||||
$city['region'] = CityConst::$regionMap[$city['region']];
|
||||
$city['levelText'] = CityConst::$levelMap[$city['level']];
|
||||
|
||||
$officerQuery = [];
|
||||
$officerName = [
|
||||
2=>'-',
|
||||
3=>'-',
|
||||
4=>'-'
|
||||
];
|
||||
if ($city['officer4'] > 0) {
|
||||
$officerQuery[] = $city['officer4'];
|
||||
}
|
||||
if ($city['officer3'] > 0) {
|
||||
$officerQuery[] = $city['officer3'];
|
||||
}
|
||||
if ($city['officer2'] > 0) {
|
||||
$officerQuery[] = $city['officer2'];
|
||||
|
||||
foreach($db->query('SELECT `officer_level`, `name`, npc, no FROM general WHERE officer_city = %i', $cityID) as $officer){
|
||||
$officerName[$officer['officer_level']] = getColoredName($officer['name'], $officer['npc']);
|
||||
}
|
||||
|
||||
if($officerQuery){
|
||||
foreach($db->query('SELECT `level`, `name` FROM general WHERE `no` IN %li', $officerQuery) as $genOfficer){
|
||||
$officerName[$genOfficer['level']] = $genOfficer['name'];
|
||||
}
|
||||
}
|
||||
$city['officerName'] = $officerName;
|
||||
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
@@ -205,11 +195,11 @@ function myNationInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select name from general where nation='{$nation['nation']}' and level='12'";
|
||||
$query = "select name from general where nation='{$nation['nation']}' and officer_level='12'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$level12 = MYDB_fetch_array($genresult);
|
||||
|
||||
$query = "select name from general where nation='{$nation['nation']}' and level='11'";
|
||||
$query = "select name from general where nation='{$nation['nation']}' and officer_level='11'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$level11 = MYDB_fetch_array($genresult);
|
||||
|
||||
@@ -229,9 +219,9 @@ function myNationInfo() {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=68 class='bg1 center'><b>".getLevelText(12, $nation['level'])."</b></td>
|
||||
<td width=68 class='bg1 center'><b>".getOfficerLevelText(12, $nation['level'])."</b></td>
|
||||
<td width=178 class='center'>";echo $level12?$level12['name']:"-"; echo "</td>
|
||||
<td width=68 class='bg1 center'><b>".getLevelText(11, $nation['level'])."</b></td>
|
||||
<td width=68 class='bg1 center'><b>".getOfficerLevelText(11, $nation['level'])."</b></td>
|
||||
<td width=178 class='center'>";echo $level11?$level11['name']:"-"; echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -350,7 +340,7 @@ function checkSecretPermission($me, $checkSecretLimit=true){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($me['level'] == 0){
|
||||
if($me['officer_level'] == 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -363,7 +353,7 @@ function checkSecretPermission($me, $checkSecretLimit=true){
|
||||
$secretMax = checkSecretMaxPermission($me, $penalty);
|
||||
|
||||
|
||||
if($me['level'] == 12){
|
||||
if($me['officer_level'] == 12){
|
||||
$secretMin = 4;
|
||||
}
|
||||
else if($me['permission'] == 'ambassador'){
|
||||
@@ -372,10 +362,10 @@ function checkSecretPermission($me, $checkSecretLimit=true){
|
||||
else if($me['permission'] == 'auditor'){
|
||||
$secretMin = 3;
|
||||
}
|
||||
else if($me['level'] >= 5){
|
||||
else if($me['officer_level'] >= 5){
|
||||
$secretMin = 2;
|
||||
}
|
||||
else if($me['level'] > 1){
|
||||
else if($me['officer_level'] > 1){
|
||||
$secretMin = 1;
|
||||
}
|
||||
else if($checkSecretLimit){
|
||||
@@ -525,86 +515,6 @@ function chiefCommandTable(General $generalObj) {
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
function chiefCommandTable_old() {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$develcost = $gameStor->develcost;
|
||||
|
||||
$me = $db->queryFirstRow('select no,nation,city,level from general where owner=%i', $userID);
|
||||
$nation = $db->queryFirstRow('SELECT level,can_change_flag,gennum FROM nation WHERE nation=%i', $me['nation']);
|
||||
|
||||
$genCount = $nation['gennum'];
|
||||
$citySupply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i', $me['city']);
|
||||
|
||||
if($nation['level'] > 0) { $valid = 1; }
|
||||
else { $valid = 0; }
|
||||
if($citySupply == 0) { $valid = 0; }
|
||||
|
||||
echo "
|
||||
<select name=commandtype size=1 style='height:20px;color:white;background-color:black;font-size:13px;display:inline-block;'>";
|
||||
commandGroup("====== 휴 식 ======");
|
||||
addCommand("휴 식", 99);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 인 사 ======");
|
||||
addCommand("발령", 27, $valid);
|
||||
addCommand("포상", 23, $valid);
|
||||
addCommand("몰수", 24, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 외 교 ======");
|
||||
//addCommand("통합 제의", 53, $valid);
|
||||
|
||||
addCommand("항복 권고", 51, $valid);
|
||||
if($nation['level'] >= 2) {
|
||||
addCommand("물자 원조", 52, $valid);
|
||||
} else {
|
||||
addCommand("물자 원조", 52, 0);
|
||||
}
|
||||
addCommand("불가침 제의", 61, $valid);
|
||||
addCommand("선전 포고", 62, $valid);
|
||||
addCommand("종전 제의", 63, $valid);
|
||||
addCommand("파기 제의", 64, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 특 수 ======");
|
||||
addCommand("초토화", 65, $valid);
|
||||
addCommand("천도/3턴(금쌀{$develcost}0)", 66, $valid);
|
||||
$cost = $develcost * 500 + 60000; // 7만~13만
|
||||
addCommand("증축/6턴(금쌀{$cost})", 67, $valid);
|
||||
addCommand("감축/6턴", 68, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 전 략 ======");
|
||||
$term = Util::round(sqrt($genCount*8)*10);
|
||||
addCommand("필사즉생/3턴(전략{$term})", 71, $valid);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("백성동원/1턴(전략{$term})", 72, $valid);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("수몰/3턴(전략{$term})", 73, $valid);
|
||||
$term = Util::round(sqrt($genCount*4)*10);
|
||||
addCommand("허보/2턴(전략{$term})", 74, $valid);
|
||||
$term = Util::round(sqrt($genCount*2)*10);
|
||||
if($term < 72) { $term = 72; }
|
||||
addCommand("피장파장/3턴(전략{$term})", 75, $valid);
|
||||
$term = Util::round(sqrt($genCount*10)*10);
|
||||
addCommand("의병모집/3턴(전략{$term})", 76, $valid);
|
||||
$term = Util::round(sqrt($genCount*16)*10);
|
||||
addCommand("이호경식/1턴(전략{$term})", 77, $valid);
|
||||
$term = Util::round(sqrt($genCount*16)*10);
|
||||
addCommand("급습/1턴(전략{$term})", 78, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 기 타 ======");
|
||||
if($nation['can_change_flag'] > 0) {
|
||||
addCommand("국기 변경", 81, 1);
|
||||
} else {
|
||||
addCommand("국기 변경", 81, 0);
|
||||
}
|
||||
commandGroup("", 1);
|
||||
echo "
|
||||
</select>
|
||||
";
|
||||
}
|
||||
|
||||
function generalInfo(General $generalObj) {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
@@ -614,7 +524,7 @@ function generalInfo(General $generalObj) {
|
||||
|
||||
$nation = getNationStaticInfo($generalObj->getNationID());
|
||||
|
||||
$lbonus = calcLeadershipBonus($generalObj->getVar('level'), $nation['level']);
|
||||
$lbonus = calcLeadershipBonus($generalObj->getVar('officer_level'), $nation['level']);
|
||||
if($lbonus > 0) {
|
||||
$lbonus = "<font color=cyan>+{$lbonus}</font>";
|
||||
} else {
|
||||
@@ -638,13 +548,12 @@ function generalInfo(General $generalObj) {
|
||||
}
|
||||
}
|
||||
|
||||
$generalLevel = $generalObj->getVar('level');
|
||||
$levelText = getLevelText($generalLevel, $nation['level']);
|
||||
$officerLevel = $generalObj->getVar('officer_level');
|
||||
$officerLevelText = getOfficerLevelText($officerLevel, $nation['level']);
|
||||
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$cityOfficerKey = 'officer'.$generalLevel;
|
||||
$cityOfficerName = $db->queryFirstField('SELECT name FROM city where %b = %i',$cityOfficerKey, $generalObj->getID());
|
||||
$levelText = "{$cityOfficerName} {$levelText}";
|
||||
if(2 <= $officerLevel && $officerLevel <= 4){
|
||||
$cityOfficerName = CityConst::byID($generalObj->getVar('officer_city'))->name;
|
||||
$officerLevelText = "{$cityOfficerName} {$officerLevelText}";
|
||||
}
|
||||
|
||||
$call = getCall(...$generalObj->getVars('leadership', 'strength', 'intel'));
|
||||
@@ -722,7 +631,7 @@ function generalInfo(General $generalObj) {
|
||||
echo "<table width=498 class='tb_layout bg2'>
|
||||
<tr>
|
||||
<td width=64 height=64 rowspan=3 class='generalIcon' style='text-align:center;background:no-repeat center url(\"{$imagePath}\");background-size:64px;'> </td>
|
||||
<td colspan=9 height=16 style=text-align:center;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$generalObj->getName()} 【 {$levelText} | {$call} | {$color}{$injury}</font> 】 ".$generalObj->getTurnTime($generalObj::TURNTIME_HMS)."</td>
|
||||
<td colspan=9 height=16 style=text-align:center;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$generalObj->getName()} 【 {$officerLevelText} | {$call} | {$color}{$injury}</font> 】 ".$generalObj->getTurnTime($generalObj::TURNTIME_HMS)."</td>
|
||||
</tr>
|
||||
<tr height=16>
|
||||
<td style='text-align:center;' class='bg1'><b>통솔</b></td>
|
||||
@@ -1650,7 +1559,8 @@ function deleteNation(General $general) {
|
||||
|
||||
$general->setVar('belong', 0);
|
||||
$general->setVar('troop', 0);
|
||||
$general->setVar('level', 0);
|
||||
$general->setVar('officer_level', 0);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('nation', 0);
|
||||
$general->setVar('makelimit', 12);
|
||||
|
||||
@@ -1658,7 +1568,8 @@ function deleteNation(General $general) {
|
||||
$db->update('general', [
|
||||
'belong'=>0,
|
||||
'troop'=>0,
|
||||
'level'=>0,
|
||||
'officer_level'=>0,
|
||||
'officer_city'=>0,
|
||||
'nation'=>0,
|
||||
'makelimit'=>12,
|
||||
'permission'=>'normal',
|
||||
@@ -1667,9 +1578,6 @@ function deleteNation(General $general) {
|
||||
$db->update('city', [
|
||||
'nation'=>0,
|
||||
'front'=>0,
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0,
|
||||
], 'nation=%i', $nationID);
|
||||
// 부대 삭제
|
||||
$db->delete('troop', 'nation=%i', $nationID);
|
||||
@@ -1702,7 +1610,7 @@ function nextRuler(General $general) {
|
||||
//npc or npc유저인 경우 후계 찾기
|
||||
if($general->getVar('npc') > 0) {
|
||||
$candidate = $db->queryFirstRow(
|
||||
'SELECT no,name,nation,level,IF(ABS(affinity-%i)>75,150-ABS(affinity-%i),ABS(affinity-%i)) as npcmatch2 from general where nation=%i and level!=12 and npc>0 order by npcmatch2,rand() LIMIT 1',
|
||||
'SELECT no,name,nation,officer_level,IF(ABS(affinity-%i)>75,150-ABS(affinity-%i),ABS(affinity-%i)) as npcmatch2 from general where nation=%i and officer_level!=12 and npc>0 order by npcmatch2,rand() LIMIT 1',
|
||||
$general->getVar('affinity'),
|
||||
$general->getVar('affinity'),
|
||||
$nationID
|
||||
@@ -1710,13 +1618,13 @@ function nextRuler(General $general) {
|
||||
}
|
||||
if(!$candidate){
|
||||
$candidate = $db->queryFirstRow(
|
||||
'SELECT no,name,npc,level FROM general WHERE nation=%i and level!= 12 AND level >= 9 ORDER BY level DESC LIMIT 1',
|
||||
'SELECT no,name,npc,officer_level FROM general WHERE nation=%i and officer_level!= 12 AND officer_level >= 9 ORDER BY officer_level DESC LIMIT 1',
|
||||
$nationID
|
||||
);
|
||||
}
|
||||
if(!$candidate){
|
||||
$candidate = $db->queryFirstRow(
|
||||
'SELECT no,name,npc,level FROM general WHERE nation=%i and level!= 12 ORDER BY dedication DESC LIMIT 1',
|
||||
'SELECT no,name,npc,officer_level FROM general WHERE nation=%i and officer_level!= 12 ORDER BY dedication DESC LIMIT 1',
|
||||
$nationID
|
||||
);
|
||||
}
|
||||
@@ -1731,16 +1639,13 @@ function nextRuler(General $general) {
|
||||
$nextRulerID = $candidate['no'];
|
||||
$nextRulerName = $candidate['name'];
|
||||
|
||||
$general->setVar('level', 1);
|
||||
$general->setVar('officer_level', 1);
|
||||
$general->setVar('officer_city', 0);
|
||||
|
||||
$db->update('general', [
|
||||
'level'=>12
|
||||
'officer_level'=>12,
|
||||
'officer_city'=>0,
|
||||
], 'no=%i', $nextRulerID);
|
||||
if(2 <= $candidate['level'] && $candidate['level'] <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$candidate['level']=>0
|
||||
], "officer{$candidate['level']}=%i", $nextRulerID);
|
||||
}
|
||||
|
||||
$josaYi = JosaUtil::pick($nextRulerName, '이');
|
||||
|
||||
@@ -2066,6 +1971,9 @@ function getRandTurn($term, ?\DateTimeInterface $baseDateTime = null) {
|
||||
else if($baseDateTime instanceof \DateTime){
|
||||
$baseDateTime = \DateTimeImmutable::createFromMutable($baseDateTime);
|
||||
}
|
||||
else{
|
||||
throw new MustNotBeReachedException();
|
||||
}
|
||||
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000;//6자리 소수
|
||||
@@ -2081,6 +1989,9 @@ function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null)
|
||||
else if($baseDateTime instanceof \DateTime){
|
||||
$baseDateTime = \DateTimeImmutable::createFromMutable($baseDateTime);
|
||||
}
|
||||
else{
|
||||
throw new MustNotBeReachedException();
|
||||
}
|
||||
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
|
||||
$randFraction = Util::randRangeInt(0, 999999) / 1000000;//6자리 소수
|
||||
|
||||
|
||||
+13
-13
@@ -105,18 +105,18 @@ function repeatGeneralCommand(int $generalId, int $turnCnt){
|
||||
}
|
||||
}
|
||||
|
||||
function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
||||
function pushNationCommand(int $nationID, int $officerLevel, int $turnCnt=1){
|
||||
if($nationID == 0){
|
||||
return;
|
||||
}
|
||||
if($level < 5){
|
||||
if($officerLevel < 5){
|
||||
return;
|
||||
}
|
||||
if($turnCnt == 0){
|
||||
return;
|
||||
}
|
||||
if($turnCnt < 0){
|
||||
pullNationCommand($nationID, $level, -$turnCnt);
|
||||
pullNationCommand($nationID, $officerLevel, -$turnCnt);
|
||||
return;
|
||||
}
|
||||
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||
@@ -127,27 +127,27 @@ function pushNationCommand(int $nationID, int $level, int $turnCnt=1){
|
||||
|
||||
$db->update('nation_turn', [
|
||||
'turn_idx'=>$db->sqleval('turn_idx + %i', $turnCnt)
|
||||
], 'nation_id=%i AND level=%i ORDER BY turn_idx DESC', $nationID, $level);
|
||||
], 'nation_id=%i AND officer_level=%i ORDER BY turn_idx DESC', $nationID, $officerLevel);
|
||||
$db->update('nation_turn', [
|
||||
'turn_idx'=>$db->sqleval('turn_idx - %i', GameConst::$maxChiefTurn),
|
||||
'action'=>'휴식',
|
||||
'arg'=>'{}',
|
||||
'brief'=>'휴식'
|
||||
], 'nation_id=%i AND level=%i AND turn_idx >= %i ORDER BY turn_idx ASC', $nationID, $level, GameConst::$maxChiefTurn);
|
||||
], 'nation_id=%i AND officer_level=%i AND turn_idx >= %i ORDER BY turn_idx ASC', $nationID, $officerLevel, GameConst::$maxChiefTurn);
|
||||
}
|
||||
|
||||
function pullNationCommand(int $nationID, int $level, int $turnCnt=1){
|
||||
function pullNationCommand(int $nationID, int $officerLevel, int $turnCnt=1){
|
||||
if($nationID == 0){
|
||||
return;
|
||||
}
|
||||
if($level < 5){
|
||||
if($officerLevel < 5){
|
||||
return;
|
||||
}
|
||||
if($turnCnt == 0){
|
||||
return;
|
||||
}
|
||||
if($turnCnt < 0){
|
||||
pushNationCommand($nationID, $level, -$turnCnt);
|
||||
pushNationCommand($nationID, $officerLevel, -$turnCnt);
|
||||
return;
|
||||
}
|
||||
if($turnCnt >= GameConst::$maxChiefTurn){
|
||||
@@ -161,10 +161,10 @@ function pullNationCommand(int $nationID, int $level, int $turnCnt=1){
|
||||
'action'=>'휴식',
|
||||
'arg'=>'{}',
|
||||
'brief'=>'휴식',
|
||||
], 'nation_id=%i AND level=%i AND turn_idx < %i', $nationID, $level, $turnCnt);
|
||||
], 'nation_id=%i AND officer_level=%i AND turn_idx < %i', $nationID, $officerLevel, $turnCnt);
|
||||
$db->update('nation_turn', [
|
||||
'turn_idx'=>$db->sqleval('turn_idx - %i', $turnCnt)
|
||||
], 'nation_id=%i AND level=%i ORDER BY turn_idx ASC', $nationID, $level);
|
||||
], 'nation_id=%i AND officer_level=%i ORDER BY turn_idx ASC', $nationID, $officerLevel);
|
||||
}
|
||||
|
||||
function _setGeneralCommand(GeneralCommand $command, array $turnList):void {
|
||||
@@ -194,7 +194,7 @@ function _setNationCommand(NationCommand $command, array $turnList):void {
|
||||
$db = DB::db();
|
||||
|
||||
$nationID = $command->getNationID();
|
||||
$level = $command->getGeneralLevel();
|
||||
$officerLevel = $command->getOfficerLevel();
|
||||
$commandName = $command->getRawClassName();
|
||||
$arg = $command->getArg();
|
||||
$brief = $command->getBrief();
|
||||
@@ -203,7 +203,7 @@ function _setNationCommand(NationCommand $command, array $turnList):void {
|
||||
'action'=>$commandName,
|
||||
'arg'=>Json::encode($arg, JSON::EMPTY_ARRAY_IS_DICT),
|
||||
'brief'=>$brief
|
||||
], 'nation_id = %i AND level = %i AND turn_idx IN %li', $nationID, $level, $turnList);
|
||||
], 'nation_id = %i AND officer_level = %i AND turn_idx IN %li', $nationID, $officerLevel, $turnList);
|
||||
}
|
||||
|
||||
function checkCommandArg(?array $arg):?string{
|
||||
@@ -371,7 +371,7 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
|
||||
$env = $gameStor->getAll();
|
||||
$general = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
if($general->getVar('level') < 5){
|
||||
if($general->getVar('officer_level') < 5){
|
||||
return [
|
||||
'result'=>false,
|
||||
'reason'=>'수뇌가 아닙니다'
|
||||
|
||||
@@ -358,9 +358,9 @@ function buildWarUnitTriggerClass(?string $type, WarUnit $unit, ?array $args = n
|
||||
return $class->newInstanceArgs(array_merge([$unit], $args));
|
||||
}
|
||||
|
||||
function getLevelText($level, $nlevel=8) {
|
||||
if($level >= 0 && $level <= 4) { $nlevel = 0; }
|
||||
$code = $nlevel * 100 + $level;
|
||||
function getOfficerLevelText($officerLevel, $nlevel=8) {
|
||||
if($officerLevel >= 0 && $officerLevel <= 4) { $nlevel = 0; }
|
||||
$code = $nlevel * 100 + $officerLevel;
|
||||
return [
|
||||
812 => '군주',
|
||||
811 => '참모',
|
||||
|
||||
+22
-31
@@ -275,7 +275,7 @@ function preUpdateMonthly() {
|
||||
], 'supply = 0');
|
||||
//미보급도시 장수 병 훈 사 5%감소
|
||||
//NOTE: update inner join도 가능하지만, meekrodb 기준으로 깔끔하게.
|
||||
$unsuppliedCities = $db->query('SELECT city, nation, trust, name, officer4, officer3, officer2 FROM city WHERE supply = 0');
|
||||
$unsuppliedCities = $db->query('SELECT city, nation, trust, name FROM city WHERE supply = 0');
|
||||
foreach(Util::arrayGroupBy($unsuppliedCities, 'nation') as $nationID => $cityList){
|
||||
$cityIDList = Util::squeezeFromArray($cityList, 'city');
|
||||
$db->update('general', [
|
||||
@@ -286,37 +286,28 @@ function preUpdateMonthly() {
|
||||
}
|
||||
|
||||
//민심30이하 공백지 처리
|
||||
$lostCityGenerals = [];
|
||||
$lostCities = [];
|
||||
foreach($unsuppliedCities as $unsuppliedCity){
|
||||
if($unsuppliedCity['trust'] >= 30){
|
||||
continue;
|
||||
}
|
||||
$lostCities[$unsuppliedCity['city']] = $unsuppliedCity;
|
||||
$lostCityGenerals[$unsuppliedCity['officer4']] = true;
|
||||
$lostCityGenerals[$unsuppliedCity['officer3']] = true;
|
||||
$lostCityGenerals[$unsuppliedCity['officer2']] = true;
|
||||
}
|
||||
if(key_exists(0, $lostCityGenerals)){
|
||||
unset($lostCityGenerals[0]);
|
||||
}
|
||||
|
||||
if($lostCityGenerals){
|
||||
$db->update('general', [
|
||||
'level'=>1
|
||||
], 'no IN %li', array_keys($lostCityGenerals));
|
||||
}
|
||||
|
||||
if($lostCities){
|
||||
$history = [];
|
||||
foreach($lostCities as $lostCity){
|
||||
$josaYi = JosaUtil::pick($lostCity['name'], '이');
|
||||
$logger->pushGlobalHistoryLog("<R><b>【고립】</b></><G><b>{$lostCity['name']}</b></>{$josaYi} 보급이 끊겨 <R>미지배</> 도시가 되었습니다.");
|
||||
}
|
||||
$db->update('general', [
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0
|
||||
], 'officer_city IN %li', array_keys($lostCities));
|
||||
$db->update('city', [
|
||||
'nation'=>0,
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0,
|
||||
'officer4set'=>0,
|
||||
'officer3set'=>0,
|
||||
'officer2set'=>0,
|
||||
'conflict'=>'{}',
|
||||
'term'=>0,
|
||||
'front'=>0
|
||||
@@ -562,7 +553,7 @@ function checkWander() {
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`level` = 12');
|
||||
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`officer_level` = 12');
|
||||
|
||||
foreach(General::createGeneralObjListFromDB($wanderers) as $wanderer){
|
||||
$wanderCmd = buildGeneralCommandClass('che_해산', $wanderer, $admin);
|
||||
@@ -597,11 +588,11 @@ function checkMerge() {
|
||||
$dip = MYDB_fetch_array($dipresult);
|
||||
|
||||
// 아국군주
|
||||
$query = "select no,name,nation from general where nation='{$dip['me']}' and level='12'";
|
||||
$query = "select no,name,nation from general where nation='{$dip['me']}' and officer_level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
// 상대군주
|
||||
$query = "select no,name,nation,makenation from general where nation='{$dip['you']}' and level='12'";
|
||||
$query = "select no,name,nation,makenation from general where nation='{$dip['you']}' and officer_level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
// 모국
|
||||
@@ -686,10 +677,10 @@ function checkMerge() {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->delete('nation_turn', 'nation_id=%i', $me['nation']);
|
||||
// 아국 모든 도시들 상대국 소속으로
|
||||
$query = "update city set nation='{$you['nation']}',officer4='0',officer3='0',officer2='0',conflict='{}' where nation='{$me['nation']}'";
|
||||
$query = "update city set nation='{$you['nation']}',conflict='{}' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아국 모든 장수들 일반으로 하고 상대국 소속으로, 수도로 이동
|
||||
$query = "update general set belong=1,level=1,nation='{$you['nation']}' where nation='{$me['nation']}'";
|
||||
$query = "update general set belong=1,officer_level=1,officer_city=0,nation='{$you['nation']}' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 공헌도0.9, 명성0.9
|
||||
//TODO:experience General 객체로 이동
|
||||
@@ -753,11 +744,11 @@ function checkSurrender() {
|
||||
$dip = MYDB_fetch_array($dipresult);
|
||||
|
||||
// 아국군주
|
||||
$query = "select no,name,nation from general where nation='{$dip['me']}' and level='12'";
|
||||
$query = "select no,name,nation from general where nation='{$dip['me']}' and officer_level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
// 상대군주
|
||||
$query = "select no,name,nation,makenation from general where nation='{$dip['you']}' and level='12'";
|
||||
$query = "select no,name,nation,makenation from general where nation='{$dip['you']}' and officer_level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$you = MYDB_fetch_array($result);
|
||||
// 모국
|
||||
@@ -845,18 +836,18 @@ function checkSurrender() {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->delete('nation_turn', 'nation_id=%i', $me['nation']);
|
||||
// 군주가 있는 위치 구함
|
||||
$query = "select city from general where nation='{$you['nation']}' and level='12'";
|
||||
$query = "select city from general where nation='{$you['nation']}' and officer_level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$king = MYDB_fetch_array($result);
|
||||
// 아국 모든 도시들 상대국 소속으로
|
||||
$query = "update city set nation='{$you['nation']}',officer4='0',officer3='0',officer2='0',conflict='{}' where nation='{$me['nation']}'";
|
||||
$query = "update city set nation='{$you['nation']}',conflict='{}' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 제의국 모든 장수들 공헌도0.95, 명성0.95
|
||||
//TODO: experience를 General로
|
||||
$query = "update general set dedication=dedication*0.95,experience=experience*0.95 where nation='{$you['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아국 모든 장수들 일반으로 하고 상대국 소속으로, 수도로 이동, 공헌도1.1, 명성0.9
|
||||
$query = "update general set belong=1,level=1,nation='{$you['nation']}',city='{$king['city']}',dedication=dedication*1.1,experience=experience*0.9 where nation='{$me['nation']}'";
|
||||
$query = "update general set belong=1,officer_level=1,officer_city=0,nation='{$you['nation']}',city='{$king['city']}',dedication=dedication*1.1,experience=experience*0.9 where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 부대도 모두 국가 소속 변경
|
||||
$query = "update troop set nation='{$you['nation']}' where nation='{$me['nation']}'";
|
||||
@@ -958,7 +949,7 @@ function updateNationState() {
|
||||
foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx){
|
||||
$turnRows[] = [
|
||||
'nation_id'=>$nation['nation'],
|
||||
'level'=>$chiefLevel,
|
||||
'officer_level'=>$chiefLevel,
|
||||
'turn_idx'=>$turnIdx,
|
||||
'action'=>'휴식',
|
||||
'arg'=>null,
|
||||
@@ -1285,10 +1276,10 @@ function checkEmperior() {
|
||||
|
||||
$chiefs = Util::convertArrayToDict(
|
||||
$db->query(
|
||||
'SELECT name,picture,belong,level FROM general WHERE nation=%i AND level >= 5',
|
||||
'SELECT name,picture,belong,officer_level FROM general WHERE nation=%i AND officer_level >= 5',
|
||||
$nation['nation']
|
||||
),
|
||||
'level'
|
||||
'officer_level'
|
||||
);
|
||||
|
||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
||||
|
||||
@@ -5,9 +5,9 @@ function getMailboxList(){
|
||||
|
||||
$generalNations = [];
|
||||
|
||||
foreach(DB::db()->query('select `no`, `name`, `nation`, `level`, `npc`, `permission`, `penalty` from `general` where `npc` < 2') as $general)
|
||||
foreach(DB::db()->query('select `no`, `name`, `nation`, `officer_level`, `npc`, `permission`, `penalty` from `general` where `npc` < 2') as $general)
|
||||
{
|
||||
[$generalID, $generalName, $nationID, $level, $npc] = [$general['no'], $general['name'], $general['nation'], $general['level'], $general['npc']];
|
||||
[$generalID, $generalName, $nationID, $officerLevel, $npc] = [$general['no'], $general['name'], $general['nation'], $general['officer_level'], $general['npc']];
|
||||
if(!isset($generalNations[$nationID])){
|
||||
$generalNations[$nationID] = [];
|
||||
}
|
||||
@@ -15,7 +15,7 @@ function getMailboxList(){
|
||||
$obj = [$generalID, $generalName, 0];
|
||||
$permission = checkSecretPermission($general, false);
|
||||
|
||||
if($level == 12){
|
||||
if($officerLevel == 12){
|
||||
$obj[2] |= 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ function CriticalRatioDomestic(General $general, string $type) {
|
||||
);
|
||||
}
|
||||
|
||||
function calcLeadershipBonus($generalLevel, $nationLevel):int{
|
||||
if($generalLevel == 12) {
|
||||
function calcLeadershipBonus($officerLevel, $nationLevel):int{
|
||||
if($officerLevel == 12) {
|
||||
$lbonus = $nationLevel * 2;
|
||||
} elseif($generalLevel >= 5) {
|
||||
} elseif($officerLevel >= 5) {
|
||||
$lbonus = $nationLevel;
|
||||
} else {
|
||||
$lbonus = 0;
|
||||
|
||||
+25
-25
@@ -8,13 +8,13 @@ function process_51(&$general) {
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $gameStor->getValuesAsArray(['year','month','turnterm']);
|
||||
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
if($general['officer_level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['officer_level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
@@ -80,13 +80,13 @@ function process_53(&$general) {
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $gameStor->getValuesAsArray(['year','month','turnterm']);
|
||||
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
if($general['officer_level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['officer_level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
@@ -153,13 +153,13 @@ function process_63(&$general) {
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $gameStor->getValuesAsArray(['year','month','turnterm']);
|
||||
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
if($general['officer_level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['officer_level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
@@ -225,13 +225,13 @@ function process_64(&$general) {
|
||||
$date = substr($general['turntime'],11,5);
|
||||
list($year, $month, $turnterm) = $gameStor->getValuesAsArray(['year','month','turnterm']);
|
||||
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
if($general['officer_level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
|
||||
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['officer_level']}turn0", $general['nation']);
|
||||
|
||||
$command = DecodeCommand($myTurn);
|
||||
$which = $command[1];
|
||||
@@ -312,11 +312,11 @@ function process_65(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select nation,capital,name,surlimit,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,capital,name,surlimit,l{$general['officer_level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($nation["l{$general['officer_level']}turn0"]);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select city,name,nation,pop,officer4,officer3,officer2 from city where city='$which'";
|
||||
@@ -330,7 +330,7 @@ function process_65(&$general) {
|
||||
|
||||
if($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 초토화 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
} elseif($general['officer_level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 초토화 실패. <1>$date</>";
|
||||
} elseif($nation['capital'] == $destcity['city']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수도입니다. 초토화 실패. <1>$date</>";
|
||||
@@ -362,7 +362,7 @@ function process_65(&$general) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//직위해제
|
||||
$query = "update general set level=1 where no='{$destcity['officer4']}' or no='{$destcity['officer3']}' or no='{$destcity['officer2']}'";
|
||||
$query = "update general set officer_level=1 where no='{$destcity['officer4']}' or no='{$destcity['officer3']}' or no='{$destcity['officer2']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//성 공백지로
|
||||
@@ -398,11 +398,11 @@ function process_77(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['officer_level']}term,l{$general['officer_level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($nation["l{$general['officer_level']}turn0"]);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name from nation where nation='$which'";
|
||||
@@ -418,7 +418,7 @@ function process_77(&$general) {
|
||||
$term2 = 1;
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
$code = $nation["l{$general['officer_level']}term"];
|
||||
if($code%100 == 77) {
|
||||
$term = intdiv($code, 100) + 1;
|
||||
$code = $term * 100 + 77;
|
||||
@@ -431,7 +431,7 @@ function process_77(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 국가입니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
} elseif($general['officer_level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 이호경식 실패. <1>$date</>";
|
||||
} elseif($dip['state'] > 1) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 이호경식 실패. <1>$date</>";
|
||||
@@ -440,7 +440,7 @@ function process_77(&$general) {
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:이호경식 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
|
||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
||||
$query = "update nation set l{$general['officer_level']}term={$code} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:이호경식 발동! <1>$date</>";
|
||||
@@ -525,11 +525,11 @@ function process_78(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['officer_level']}term,l{$general['officer_level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($nation["l{$general['officer_level']}turn0"]);
|
||||
$which = $command[1];
|
||||
|
||||
$query = "select nation,name from nation where nation='$which'";
|
||||
@@ -545,7 +545,7 @@ function process_78(&$general) {
|
||||
$term2 = 1;
|
||||
$term3 = Util::round(sqrt($genCount*16)*10);
|
||||
|
||||
$code = $nation["l{$general['level']}term"];
|
||||
$code = $nation["l{$general['officer_level']}term"];
|
||||
if($code%100 == 78) {
|
||||
$term = intdiv($code, 100) + 1;
|
||||
$code = $term * 100 + 78;
|
||||
@@ -558,7 +558,7 @@ function process_78(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 국가입니다. 급습 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 급습 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
} elseif($general['officer_level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 급습 실패. <1>$date</>";
|
||||
} elseif($dip['state'] != 1) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:선포중인 상대국에만 가능합니다. 급습 실패. <1>$date</>";
|
||||
@@ -569,7 +569,7 @@ function process_78(&$general) {
|
||||
} elseif($term < $term2) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:급습 수행중... ({$term}/{$term2}) <1>$date</>";
|
||||
|
||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
||||
$query = "update nation set l{$general['officer_level']}term={$code} where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
$log[] = "<C>●</>{$admin['month']}월:급습 발동! <1>$date</>";
|
||||
@@ -648,11 +648,11 @@ function process_81(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,can_change_flag,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$query = "select nation,can_change_flag,name,type,strategic_cmd_limit,l{$general['officer_level']}term,l{$general['officer_level']}turn0 from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
||||
$command = DecodeCommand($nation["l{$general['officer_level']}turn0"]);
|
||||
$which = $command[1];
|
||||
$colors = GetNationColors();
|
||||
if($which >= count($colors)) { $which = 0; }
|
||||
@@ -660,7 +660,7 @@ function process_81(&$general) {
|
||||
|
||||
if($city['nation'] != $general['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 국기변경 실패. <1>$date</>";
|
||||
} elseif($general['level'] < 5) {
|
||||
} elseif($general['officer_level'] < 5) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 국기변경 실패. <1>$date</>";
|
||||
} elseif($nation['can_change_flag'] <= 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:더이상 변경이 불가능합니다. 국기변경 실패. <1>$date</>";
|
||||
|
||||
@@ -105,11 +105,8 @@ function displaySpecialDomesticInfo(?string $type):string{
|
||||
]);
|
||||
}
|
||||
|
||||
function allButton() {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$npcmode = $gameStor->npcmode;
|
||||
if($npcmode == 1) {
|
||||
function allButton(bool $seizeNPCMode) {
|
||||
if($seizeNPCMode) {
|
||||
$site = "a_npcList.php";
|
||||
$call = "빙의일람";
|
||||
} else {
|
||||
@@ -140,7 +137,7 @@ function commandButton() {
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow("select no,nation,level,belong,permission,penalty from general where owner=%i", $userID);
|
||||
$me = $db->queryFirstRow("select no,nation,officer_level,belong,permission,penalty from general where owner=%i", $userID);
|
||||
|
||||
$nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i",$me['nation'])??[
|
||||
'nation'=>0,
|
||||
@@ -158,14 +155,14 @@ function commandButton() {
|
||||
if($permission >= 1){
|
||||
$showSecret = true;
|
||||
}
|
||||
else if($me['level']== 0){
|
||||
else if($me['officer_level']== 0){
|
||||
$showSecret = false;
|
||||
}
|
||||
|
||||
return $templates->render('commandButton', [
|
||||
'bgColor'=>$bgColor,
|
||||
'fgColor'=>$fgColor,
|
||||
'meLevel'=>$me['level'],
|
||||
'meLevel'=>$me['officer_level'],
|
||||
'nationLevel'=>$nation['level'],
|
||||
'showSecret'=>$showSecret,
|
||||
'permission'=>$permission,
|
||||
|
||||
+17
-36
@@ -48,7 +48,7 @@ function processGoldIncome() {
|
||||
|
||||
$nationList = $db->query('SELECT name,nation,capital,gold,level,rate_tmp,bill,type from nation');
|
||||
$cityListByNation = Util::arrayGroupBy($db->query('SELECT * FROM city'), 'nation');
|
||||
$generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,gold,level,dedication,city FROM general'), 'nation');
|
||||
$generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,gold,officer_level,dedication,city FROM general'), 'nation');
|
||||
|
||||
//국가별 처리
|
||||
foreach($nationList as $nation) {
|
||||
@@ -98,7 +98,7 @@ function processGoldIncome() {
|
||||
$generalObj->increaseVar('gold', $gold);
|
||||
|
||||
$logger = $generalObj->getLogger();
|
||||
if($generalObj->getVar('level') > 4){
|
||||
if($generalObj->getVar('officer_level') > 4){
|
||||
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
||||
}
|
||||
$logger->pushGeneralActionLog("봉급으로 금 <C>$gold</>을 받았습니다.", $logger::PLAIN);
|
||||
@@ -226,9 +226,9 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$officers = [];
|
||||
foreach($db->queryAllLists('SELECT no, city FROM general WHERE nation = %i AND level IN (2,3,4)', $nationID) as [$genID, $cityID]){
|
||||
$officers[$genID] = $cityID;
|
||||
$officersCnt = [];
|
||||
foreach($db->queryAllLists('SELECT officer_city, count(*) FROM general WHERE nation = %i AND officer_level IN (2,3,4) AND city = officer_city GROUP BY officer_city', $nationID) as [$cityID, $cnt]){
|
||||
$officersCnt[$cityID] = $cnt;
|
||||
}
|
||||
|
||||
$nationTypeObj = buildNationTypeClass($nationType);
|
||||
@@ -236,14 +236,7 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
$cityIncome = 0;
|
||||
foreach($cityList as $rawCity){
|
||||
$cityID = $rawCity['city'];
|
||||
foreach ([2,3,4] as $officerLevel) {
|
||||
$officerCnt = 0;
|
||||
if($officers[$rawCity['officer'.$officerLevel]]??0 == $cityID){
|
||||
$officerCnt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
$cityIncome += calcCityGoldIncome($rawCity, $officerCnt, $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
$cityIncome += calcCityGoldIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
}
|
||||
|
||||
$cityIncome *= ($taxRate / 20);
|
||||
@@ -326,7 +319,7 @@ function processRiceIncome() {
|
||||
|
||||
$nationList = $db->query('SELECT name,level,nation,capital,rice,rate_tmp,bill,type from nation');
|
||||
$cityListByNation = Util::arrayGroupBy($db->query('SELECT * FROM city'), 'nation');
|
||||
$generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,rice,level,dedication,city FROM general'), 'nation');
|
||||
$generalRawListByNation = Util::arrayGroupBy($db->query('SELECT no,name,nation,rice,officer_level,dedication,city FROM general'), 'nation');
|
||||
|
||||
//국가별 처리
|
||||
foreach($nationList as $nation) {
|
||||
@@ -377,7 +370,7 @@ function processRiceIncome() {
|
||||
$generalObj->increaseVar('rice', $rice);
|
||||
|
||||
$logger = $generalObj->getLogger();
|
||||
if($generalObj->getVar('level') > 4){
|
||||
if($generalObj->getVar('officer_level') > 4){
|
||||
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
|
||||
}
|
||||
$logger->pushGeneralActionLog("봉급으로 쌀 <C>$rice</>을 받았습니다.", $logger::PLAIN);
|
||||
@@ -399,9 +392,9 @@ function getRiceIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$officers = [];
|
||||
foreach($db->queryAllLists('SELECT no, city FROM general WHERE nation = %i AND level IN (2,3,4)', $nationID) as [$genID, $cityID]){
|
||||
$officers[$genID] = $cityID;
|
||||
$officersCnt = [];
|
||||
foreach($db->queryAllLists('SELECT officer_city, count(*) FROM general WHERE nation = %i AND officer_level IN (2,3,4) AND city = officer_city GROUP BY officer_city', $nationID) as [$cityID, $cnt]){
|
||||
$officersCnt[$cityID] = $cnt;
|
||||
}
|
||||
|
||||
$nationTypeObj = buildNationTypeClass($nationType);
|
||||
@@ -409,14 +402,8 @@ function getRiceIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
$cityIncome = 0;
|
||||
foreach($cityList as $rawCity){
|
||||
$cityID = $rawCity['city'];
|
||||
foreach ([2,3,4] as $officerLevel) {
|
||||
$officerCnt = 0;
|
||||
if($officers[$rawCity['officer'.$officerLevel]]??0 == $cityID){
|
||||
$officerCnt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
$cityIncome += calcCityRiceIncome($rawCity, $officerCnt, $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
$cityIncome += calcCityRiceIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
}
|
||||
|
||||
$cityIncome *= ($taxRate / 20);
|
||||
@@ -431,9 +418,9 @@ function getWallIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$officers = [];
|
||||
foreach($db->queryAllLists('SELECT no, city FROM general WHERE nation = %i AND level IN (2,3,4)', $nationID) as [$genID, $cityID]){
|
||||
$officers[$genID] = $cityID;
|
||||
$officersCnt = [];
|
||||
foreach($db->queryAllLists('SELECT officer_city, count(*) FROM general WHERE nation = %i AND officer_level IN (2,3,4) AND city = officer_city GROUP BY officer_city', $nationID) as [$cityID, $cnt]){
|
||||
$officersCnt[$cityID] = $cnt;
|
||||
}
|
||||
|
||||
$nationTypeObj = buildNationTypeClass($nationType);
|
||||
@@ -441,14 +428,8 @@ function getWallIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
|
||||
$cityIncome = 0;
|
||||
foreach($cityList as $rawCity){
|
||||
$cityID = $rawCity['city'];
|
||||
foreach ([2,3,4] as $officerLevel) {
|
||||
$officerCnt = 0;
|
||||
if($officers[$rawCity['officer'.$officerLevel]]??0 == $cityID){
|
||||
$officerCnt += 1;
|
||||
}
|
||||
}
|
||||
|
||||
$cityIncome += calcCityWallRiceIncome($rawCity, $officerCnt, $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
|
||||
$cityIncome += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID], $capitalID == $cityID, $nationLevel, $nationTypeObj);
|
||||
}
|
||||
|
||||
$cityIncome *= ($taxRate / 20);
|
||||
|
||||
@@ -274,7 +274,7 @@ function startTournament($auto, $type) {
|
||||
], true);
|
||||
$db->query('TRUNCATE TABLE tournament');
|
||||
|
||||
$opener = $db->queryFirstField('SELECT `general`.`name` FROM `general` JOIN `nation` ON `general`.`nation` = `nation`.`nation` WHERE `general`.`level` = 12 AND `nation`.`level` = 7 ORDER BY rand() LIMIT 1');
|
||||
$opener = $db->queryFirstField('SELECT `general`.`name` FROM `general` JOIN `nation` ON `general`.`nation` = `nation`.`nation` WHERE `general`.`officer_level` = 12 AND `nation`.`level` = 7 ORDER BY rand() LIMIT 1');
|
||||
if(!$opener){
|
||||
$opener = $gameStor->prev_winner;
|
||||
}
|
||||
|
||||
+5
-5
@@ -26,7 +26,7 @@ if(!$session->isGameLoggedIn()){
|
||||
}
|
||||
|
||||
$me = $db->queryFirstRow(
|
||||
'SELECT no,con,turntime,newmsg,newvote,`level` from general where owner = %i',
|
||||
'SELECT no,con,turntime,newmsg,newvote,`officer_level` from general where owner = %i',
|
||||
$userID
|
||||
);
|
||||
|
||||
@@ -128,7 +128,7 @@ $(function(){
|
||||
<body class="img_back">
|
||||
|
||||
<div id="container">
|
||||
<div><?=allButton()?></div>
|
||||
<div><?=allButton($gameStor->npcmode!=0)?></div>
|
||||
<table class="tb_layout bg0" style="width:1000px;">
|
||||
<tr height=50>
|
||||
<td colspan=5 id="server_title" align=center><font size=4>삼국지 모의전투 HiDCHe <?=$serverName.$serverCnt?>기 (<font color=cyan><?=$scenario?></font>)</font></td>
|
||||
@@ -293,7 +293,7 @@ else if($session->userGrade == 4){
|
||||
></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right style="'width:650px;border:none;"><br>
|
||||
<td align=right style="width:650px;border:none;"><br>
|
||||
<?php printCommandTable($generalObj)?>
|
||||
<input type=button value='실 행' id="reserveTurn"
|
||||
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
|
||||
@@ -336,7 +336,7 @@ else if($session->userGrade == 4){
|
||||
<button id="msg_submit">서신전달&갱신</button><br>
|
||||
내용 없이 '서신전달&갱신'을 누르면 메세지창이 갱신됩니다.
|
||||
</div>
|
||||
<div><?=allButton()?></div>
|
||||
<div><?=allButton($gameStor->npcmode!=0)?></div>
|
||||
<div id="message_board"><div style="left:0;" class="board_side bg0">
|
||||
<div class="board_header bg0" id='public_talk_position'>전체 메시지(최고99자)</div>
|
||||
<section class="public_message">
|
||||
@@ -356,7 +356,7 @@ else if($session->userGrade == 4){
|
||||
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="diplomacy">이전 메시지 불러오기</button>
|
||||
</section>
|
||||
</div></div>
|
||||
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||
<div style="clear:left;"><?=allButton($gameStor->npcmode!=0)?><?=banner()?></div>
|
||||
</div>
|
||||
<?php
|
||||
if ($con == 1) {
|
||||
|
||||
@@ -12,7 +12,7 @@ $result = [
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$generalInfo = DB::db()->queryFirstRow('SELECT `no`, `nation`, `level`, belong, penalty, permission from `general` where `owner`=%i', $userID);
|
||||
$generalInfo = DB::db()->queryFirstRow('SELECT `no`, `nation`, `officer_level`, belong, penalty, permission from `general` where `owner`=%i', $userID);
|
||||
if(!$generalInfo){
|
||||
Json::die($result);
|
||||
}
|
||||
@@ -22,8 +22,8 @@ $permission = checkSecretPermission($generalInfo);
|
||||
|
||||
$result['generalID'] = $generalInfo['no'];
|
||||
$result['myNationID'] = $generalInfo['nation'];
|
||||
$result['isChief'] = ($generalInfo['level'] == 12);
|
||||
$result['generalLevel'] = $generalInfo['level'];
|
||||
$result['isChief'] = ($generalInfo['officer_level'] == 12);
|
||||
$result['officerLevel'] = $generalInfo['officer_level'];
|
||||
$result['permission'] = $permission;
|
||||
|
||||
Json::die($result);
|
||||
@@ -15,7 +15,7 @@ $text = Util::getReq('text');
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty, `picture`,`imgsvr` FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, officer_level, permission, con, turntime, belong, penalty, `picture`,`imgsvr` FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -14,7 +14,7 @@ $text = Util::getReq('text');
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -14,7 +14,7 @@ $isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
|
||||
@@ -10,7 +10,7 @@ $userID = Session::getUserID();
|
||||
$turnAmount = Util::getReq('amount', 'int');
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT no,nation,level FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level FROM general WHERE owner=%i', $userID);
|
||||
|
||||
if($me['nation'] == 0){
|
||||
Json::die([
|
||||
@@ -19,7 +19,7 @@ if($me['nation'] == 0){
|
||||
]);
|
||||
}
|
||||
|
||||
if($me['level'] < 5){
|
||||
if($me['officer_level'] < 5){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'수뇌가 아닙니다.',
|
||||
@@ -27,10 +27,10 @@ if($me['level'] < 5){
|
||||
}
|
||||
|
||||
if($turnAmount > 0){
|
||||
pushNationCommand($me['nation'], $me['level']);
|
||||
pushNationCommand($me['nation'], $me['officer_level']);
|
||||
}
|
||||
else{
|
||||
pullNationCommand($me['nation'], $me['level']);
|
||||
pullNationCommand($me['nation'], $me['officer_level']);
|
||||
}
|
||||
|
||||
Json::die([
|
||||
|
||||
@@ -13,7 +13,7 @@ $letterNo = Util::getReq('letterNo', 'int');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, officer_level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -14,7 +14,7 @@ $isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
|
||||
@@ -18,7 +18,7 @@ $reason = Util::getReq('reason', 'string', '');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, officer_level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -13,7 +13,7 @@ $letterNo = Util::getReq('letterNo', 'int');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, officer_level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -20,7 +20,7 @@ if($prevNo < 1){
|
||||
$prevNo = null;
|
||||
}
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, officer_level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
|
||||
@@ -3,7 +3,6 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $level, $genlist, $outlist
|
||||
|
||||
//TODO: 변경이 완료되면 항상 공지되어야함
|
||||
|
||||
@@ -17,9 +16,9 @@ $userID = Session::getUserID();
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, level, nation FROM general WHERE owner = %i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, officer_level, nation FROM general WHERE owner = %i', $userID);
|
||||
|
||||
if(!$me || $me['level'] != 12){
|
||||
if(!$me || $me['officer_level'] != 12){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'군주가 아닙니다',
|
||||
@@ -55,7 +54,7 @@ if(!$genlist){
|
||||
]);
|
||||
}
|
||||
$realCandidates = [];
|
||||
foreach($db->query('SELECT no, nation, level, penalty, permission FROM general WHERE nation = %i AND level != 12 AND permission = \'normal\' AND no IN %li', $nationID, $genlist) as $candidate){
|
||||
foreach($db->query('SELECT no, nation, officer_level, penalty, permission FROM general WHERE nation = %i AND officer_level != 12 AND permission = \'normal\' AND no IN %li', $nationID, $genlist) as $candidate){
|
||||
$maxPermission = checkSecretMaxPermission($candidate);
|
||||
if($maxPermission < $targetLevel){
|
||||
continue;
|
||||
|
||||
+14
-14
@@ -12,7 +12,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("사령부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,penalty,permission FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$nationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation = %i', $me['nation']);
|
||||
$nationID = $me['nation'];
|
||||
@@ -49,34 +49,34 @@ $lv = getNationChiefLevel($nationLevel);
|
||||
$turn = [];
|
||||
|
||||
$generals = [];
|
||||
foreach($db->query('SELECT no,name,turntime,npc,city,nation,level FROM general WHERE nation = %i AND level >= 5',$nationID) as $rawGeneral){
|
||||
$generals[$rawGeneral['level']] = new General($rawGeneral, null, $year, $month, false);
|
||||
foreach($db->query('SELECT no,name,turntime,npc,city,nation,officer_level FROM general WHERE nation = %i AND officer_level >= 5',$nationID) as $rawGeneral){
|
||||
$generals[$rawGeneral['officer_level']] = new General($rawGeneral, null, $year, $month, false);
|
||||
}
|
||||
|
||||
$nationTurnList = [];
|
||||
|
||||
foreach(
|
||||
$db->queryAllLists(
|
||||
'SELECT level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY level DESC, turn_idx ASC',
|
||||
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
|
||||
$me['nation']
|
||||
) as [$level, $turn_idx, $action, $arg, $brief]
|
||||
) as [$officer_level, $turn_idx, $action, $arg, $brief]
|
||||
){
|
||||
if(!key_exists($level, $nationTurnList)){
|
||||
$nationTurnList[$level] = [];
|
||||
if(!key_exists($officer_level, $nationTurnList)){
|
||||
$nationTurnList[$officer_level] = [];
|
||||
}
|
||||
$nationTurnList[$level][$turn_idx] = $brief;
|
||||
$nationTurnList[$officer_level][$turn_idx] = $brief;
|
||||
}
|
||||
|
||||
$nationTurnBrief = [];
|
||||
foreach($nationTurnList as $level=>$turnBrief){
|
||||
if(!key_exists($level, $generals)){
|
||||
foreach($nationTurnList as $officer_level=>$turnBrief){
|
||||
if(!key_exists($officer_level, $generals)){
|
||||
continue;
|
||||
}
|
||||
$general = $generals[$level];
|
||||
$nationTurnBrief[$level] = [
|
||||
$general = $generals[$officer_level];
|
||||
$nationTurnBrief[$officer_level] = [
|
||||
'name'=>$general->getName(),
|
||||
'turnTime'=>$general->getTurnTime($general::TURNTIME_FULL),
|
||||
'levelText'=>getLevelText($general->getVar('level'), $nationLevel),
|
||||
'officerlevelText'=>getOfficerLevelText($general->getVar('officer_level'), $nationLevel),
|
||||
'npcType'=>$general->getVar('npc'),
|
||||
'turn'=>$turnBrief
|
||||
];
|
||||
@@ -89,6 +89,6 @@ Json::die([
|
||||
'reason'=>'success',
|
||||
'date'=>$date,
|
||||
'nationTurnBrief'=>$nationTurnBrief,
|
||||
'isChief'=>($me['level'] > 4),
|
||||
'isChief'=>($me['officer_level'] > 4),
|
||||
'turnTerm'=>$turnterm
|
||||
]);
|
||||
@@ -42,7 +42,7 @@ else{
|
||||
|
||||
$session->setReadOnly();
|
||||
|
||||
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,level,killturn,connect from general');
|
||||
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general');
|
||||
|
||||
$ownerNameList = [];
|
||||
if($gameStor->isunited){
|
||||
@@ -53,14 +53,14 @@ if($gameStor->isunited){
|
||||
|
||||
$generalList = [];
|
||||
foreach($rawGeneralList as $rawGeneral){
|
||||
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$level,$killturn,$connect] = $rawGeneral;
|
||||
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$officerLevel,$killturn,$connect] = $rawGeneral;
|
||||
|
||||
if(key_exists($owner, $ownerNameList)){
|
||||
$ownerName = $ownerNameList[$owner];
|
||||
}
|
||||
|
||||
$nationArr = getNationStaticInfo($nation);
|
||||
$lbonus = calcLeadershipBonus($level, $nationArr['level']);
|
||||
$lbonus = calcLeadershipBonus($officerLevel, $nationArr['level']);
|
||||
|
||||
$generalList[] = [
|
||||
$no,
|
||||
@@ -82,7 +82,7 @@ foreach($rawGeneralList as $rawGeneral){
|
||||
getExpLevel($experience),
|
||||
getHonor($experience),
|
||||
getDed($dedication),
|
||||
getLevelText($level, $nationArr['level']),
|
||||
getOfficerLevelText($officerLevel, $nationArr['level']),
|
||||
$killturn,
|
||||
$connect
|
||||
];
|
||||
|
||||
@@ -17,7 +17,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("세력장수", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT con, turntime, nation, level, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT con, turntime, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
@@ -42,7 +42,7 @@ $viewColumns = [
|
||||
'owner_name'=>9,
|
||||
'nation'=>1,
|
||||
'city'=>1,
|
||||
'level'=>1,
|
||||
'officer_level'=>9,
|
||||
'npc'=>1,
|
||||
'defence_train'=>2,
|
||||
'troop'=>2,
|
||||
@@ -76,14 +76,18 @@ $viewColumns = [
|
||||
];
|
||||
|
||||
$customViewColumns = [
|
||||
'officerLevel'=>1,
|
||||
'officerlevelText'=>1,
|
||||
'lbonus'=>1,
|
||||
'ownerName'=>1,
|
||||
'levelText'=>1,
|
||||
'honorText'=>1,
|
||||
'expLevelText'=>1,
|
||||
];
|
||||
|
||||
$specialViewFilter = [
|
||||
'officerLevel'=>function($rawGeneral){
|
||||
return $rawGeneral['officer_level'];
|
||||
},
|
||||
'special'=>function($rawGeneral){
|
||||
return getGeneralSpecialDomesticName($rawGeneral['special']);
|
||||
},
|
||||
@@ -94,7 +98,7 @@ $specialViewFilter = [
|
||||
return getGenChar($rawGeneral['personal']);
|
||||
},
|
||||
'lbonus'=>function($rawGeneral)use($nationArr){
|
||||
return calcLeadershipBonus($rawGeneral['level'], $nationArr['level']);
|
||||
return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']);
|
||||
},
|
||||
'ownerName'=>function($rawGeneral){
|
||||
if($rawGeneral['npc']!=1){
|
||||
@@ -102,8 +106,8 @@ $specialViewFilter = [
|
||||
}
|
||||
return $rawGeneral['owner_name'];
|
||||
},
|
||||
'levelText'=>function($rawGeneral)use($nationArr){
|
||||
return getLevelText($rawGeneral['level'], $nationArr['level']);
|
||||
'officerlevelText'=>function($rawGeneral)use($nationArr){
|
||||
return getOfficerLevelText($rawGeneral['officer_level'], $nationArr['level']);
|
||||
},
|
||||
'honorText'=>function($rawGeneral){
|
||||
return getHonor($rawGeneral['experience']);
|
||||
|
||||
@@ -29,7 +29,7 @@ if ($msgID === null || !is_bool($msgResponse)) {
|
||||
]);
|
||||
}
|
||||
|
||||
$general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID);
|
||||
$general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `officer_level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID);
|
||||
if(!$general){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -50,7 +50,7 @@ if($delayTime){
|
||||
}
|
||||
$session->setReadOnly();
|
||||
|
||||
$me = DB::db()->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
$me = DB::db()->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if($me === null){
|
||||
Json::die([
|
||||
|
||||
@@ -38,7 +38,7 @@ $session->setReadOnly();
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if($me === null){
|
||||
Json::die([
|
||||
|
||||
@@ -49,7 +49,7 @@ $now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission,belong FROM general WHERE `owner`=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission,belong FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if(!$me){
|
||||
$session->logoutGame();
|
||||
@@ -150,7 +150,7 @@ if($mailbox > 0) {
|
||||
|
||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i',$mailbox);
|
||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i',$mailbox);
|
||||
|
||||
if(!$destUser){
|
||||
Json::die([
|
||||
|
||||
+45
-73
@@ -3,10 +3,9 @@ namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $action, $level, $genlist, $outlist
|
||||
|
||||
$action = Util::getReq('action');
|
||||
$level = Util::getReq('level', 'int');
|
||||
$officerLevel = Util::getReq('officerLevel', 'int');
|
||||
$destGeneralID = Util::getReq('destGeneralID', 'int');
|
||||
$destCityID = Util::getReq('destCityID', 'int');
|
||||
|
||||
@@ -18,12 +17,12 @@ $db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->cacheValues(['startyear','year','month','scenario']);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no,nation,level from general where owner=%i', $userID);
|
||||
$myLevel = $me['level'];
|
||||
$me = $db->queryFirstRow('SELECT no,nation,officer_level from general where owner=%i', $userID);
|
||||
$myOfficerLevel = $me['officer_level'];
|
||||
$nationID = $nationID;
|
||||
|
||||
//수뇌가 아니면 아무것도 할 수 없음
|
||||
if($myLevel < 5){
|
||||
if($myOfficerLevel < 5){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'수뇌가 아닙니다.'
|
||||
@@ -41,12 +40,12 @@ if($destGeneralID==0){
|
||||
$general = new DummyGeneral(true);
|
||||
}
|
||||
else{
|
||||
$general = General::createGeneralObjFromDB($destGeneralID, ['name', 'leadership', 'strength', 'intel', 'gold','rice','troop','level','npc','picture','imgsvr','permission','penalty','belong'], 1);
|
||||
$general = General::createGeneralObjFromDB($destGeneralID, ['name', 'leadership', 'strength', 'intel', 'gold','rice','troop','officer_level','npc','picture','imgsvr','permission','penalty','belong'], 1);
|
||||
|
||||
if($general instanceof DummyGeneral){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바릦 않은 장수입니다.'
|
||||
'reason'=>'올바르지 않은 장수입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -58,28 +57,28 @@ else{
|
||||
}
|
||||
}
|
||||
|
||||
if($generalLevel == 12){
|
||||
if($officerLevel == 12){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'군주를 대상으로 할 수 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
function do수뇌임명(General $general, int $targetLevel):?string{
|
||||
global $myLevel;
|
||||
function do수뇌임명(General $general, int $targetOfficerLevel):?string{
|
||||
global $myOfficerLevel;
|
||||
$generalID = $general->getID();
|
||||
$generalLevel = $general->getVar('level');
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
$generalName = $general->getVar('name');
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
[$levelSet, $nationLevel] = $db->queryFirstList('SELECT $b,level FROM nation WHERE nation = %i', "l{$targetLevel}set", $nationID);
|
||||
[$levelSet, $nationLevel] = $db->queryFirstList('SELECT %b,level FROM nation WHERE nation = %i', "l{$targetOfficerLevel}set", $nationID);
|
||||
|
||||
// 임명가능 레벨
|
||||
$lv = getNationChiefLevel($nationLevel);
|
||||
|
||||
if($targetLevel < $lv){
|
||||
if($targetOfficerLevel < $lv){
|
||||
return '임명불가능한 관직입니다.';
|
||||
}
|
||||
|
||||
@@ -89,13 +88,14 @@ function do수뇌임명(General $general, int $targetLevel):?string{
|
||||
|
||||
//기존 장수 일반으로
|
||||
$db->update('general', [
|
||||
'level'=>1,
|
||||
], 'nation=%i AND level=%i', $nationID, $targetLevel);
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0,
|
||||
], 'nation=%i AND officer_level=%i', $nationID, $targetOfficerLevel);
|
||||
|
||||
if($targetLevel === 11){
|
||||
if($targetOfficerLevel === 11){
|
||||
|
||||
}
|
||||
else if($targetLevel % 2 == 0){
|
||||
else if($targetOfficerLevel % 2 == 0){
|
||||
if($general->getVar('strength') < GameConst::$chiefStatMin){
|
||||
return '무력이 부족합니다.';
|
||||
}
|
||||
@@ -107,80 +107,58 @@ function do수뇌임명(General $general, int $targetLevel):?string{
|
||||
}
|
||||
}
|
||||
|
||||
// 신임 장수의 원래 자리 해제
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$generalLevel=>0
|
||||
], "officer{$generalLevel} = %i", $generalID);
|
||||
}
|
||||
//신임 장수
|
||||
$general->setVar('level', $targetLevel);
|
||||
$general->setVar('officer_level', $targetOfficerLevel);
|
||||
$general->setVar('officer_city', 0);
|
||||
$db->update('nation', [
|
||||
"l{$targetLevel}set"=>1,
|
||||
"l{$targetOfficerLevel}set"=>1,
|
||||
], 'nation=%i', $nationID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function do도시임명(General $general, int $cityID, int $targetLevel):?string{
|
||||
$generalID = $general->getID();
|
||||
$generalLevel = $general->getVar('level');
|
||||
function do도시임명(General $general, int $cityID, int $targetOfficerLevel):?string{
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
$genlv = 'officer'.$targetLevel;
|
||||
$genlvset = 'officer'.$targetLevel.'set';
|
||||
$genlvset = 'officer'.$targetOfficerLevel.'set';
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$oldOfficerID = $db->queryFirstField('SELECT %b FROM city WHERE nation=%i AND city=%i', $genlv, $nationID, $cityID);
|
||||
|
||||
if($oldOfficerID === null){
|
||||
if(CityConst::byID($cityID) === null){
|
||||
return '올바르지 않은 도시입니다';
|
||||
}
|
||||
|
||||
if($oldOfficerID !== 0) {
|
||||
//기존 장수 일반으로
|
||||
$db->update('general', [
|
||||
'level'=>1
|
||||
], 'no=%i', $oldOfficerID);
|
||||
//기존 자리 공석으로
|
||||
$db->update('city', [
|
||||
$genlv=>0
|
||||
], 'city = %i AND nation = %i', $cityID , $nationID);
|
||||
}
|
||||
//기존 장수 일반으로
|
||||
$db->update('general', [
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0,
|
||||
], 'officer_level=%i AND officer_city=%i', $targetOfficerLevel, $cityID);
|
||||
|
||||
if($general instanceof DummyGeneral){
|
||||
return null;
|
||||
}
|
||||
|
||||
if($targetLevel === 4 && $general->getVar('strength') < GameConst::$chiefStatMin){
|
||||
if($targetOfficerLevel === 4 && $general->getVar('strength') < GameConst::$chiefStatMin){
|
||||
return '무력이 부족합니다.';
|
||||
}
|
||||
|
||||
if($targetLevel === 3 && $general->getVar('intel') < GameConst::$chiefStatMin){
|
||||
if($targetOfficerLevel === 3 && $general->getVar('intel') < GameConst::$chiefStatMin){
|
||||
return '지력이 부족합니다.';
|
||||
}
|
||||
|
||||
// 신임 장수의 원래 자리 해제
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$generalLevel=>0
|
||||
], "officer{$generalLevel} = %i", $generalID);
|
||||
}
|
||||
|
||||
//신임 장수
|
||||
$db->update('city', [
|
||||
$genlv=>$generalID,
|
||||
$genlvset=>1
|
||||
], 'city=%i AND nation=%i', $cityID, $nationID);
|
||||
$general->setVar('level', $targetLevel);
|
||||
$general->setVar('officer_level', $targetOfficerLevel);
|
||||
$general->setVar('officer_city', $cityID);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function do추방(General $general, int $myLevel):?string{
|
||||
function do추방(General $general, int $myOfficerLevel):?string{
|
||||
$generalID = $general->getID();
|
||||
$generalLevel = $general->getVar('level');
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
$generalName = $general->getVar('name');
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
@@ -201,13 +179,13 @@ function do추방(General $general, int $myLevel):?string{
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$env = $gameStor->getValues(['startyear','year','month','scenario']);
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT name,%b,color FROM nation WHERE nation=%i',"l{$myLevel}set", $nationID);
|
||||
$nation = $db->queryFirstRow('SELECT name,%b,color FROM nation WHERE nation=%i',"l{$myOfficerLevel}set", $nationID);
|
||||
$nationName = $nation['name'];
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
//이미 지정했다면 무시
|
||||
if($nation["l{$myLevel}set"] == 1 || $generalLevel == 0 && $generalLevel == 12) {
|
||||
if($nation["l{$myOfficerLevel}set"] == 1 || $officerLevel == 0 && $officerLevel == 12) {
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
@@ -227,7 +205,8 @@ function do추방(General $general, int $myLevel):?string{
|
||||
}
|
||||
|
||||
$general->setVar('nation', 0);
|
||||
$general->setVar('level', 0);
|
||||
$general->setVar('officer_level', 0);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('belong', 0);
|
||||
$oldMakeLimit = $general->getVar('makelimit');
|
||||
$general->setVar('makelimit', 12);
|
||||
@@ -268,13 +247,6 @@ function do추방(General $general, int $myLevel):?string{
|
||||
}
|
||||
$general->setVar('troop', 0);
|
||||
|
||||
// 도시관직해제
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$generalLevel=>0
|
||||
], "officer{$generalLevel} = %i", $general->getID());
|
||||
}
|
||||
|
||||
if($general->getVar('npc') >= 2 && ($env['scenario'] < 100 || Util::randBool(0.01))) {
|
||||
|
||||
$str = Util::choiceRandom([
|
||||
@@ -309,7 +281,7 @@ function do추방(General $general, int $myLevel):?string{
|
||||
//초반엔 군주 부상 증가(엔장 임관지양)
|
||||
$db->update('general', [
|
||||
'injury'=>$db->sqleval('least(injury + 1, %i)', 80),
|
||||
], 'nation=%i AND level=12', $nationID);
|
||||
], 'nation=%i AND officer_level=12', $nationID);
|
||||
|
||||
$db->update('nation', [
|
||||
'gennum'=>$db->sqleval('gennum - 1'),
|
||||
@@ -319,7 +291,7 @@ function do추방(General $general, int $myLevel):?string{
|
||||
} else {
|
||||
//이번분기는 추방불가(초반 제외)
|
||||
$db->update('nation', [
|
||||
"l{$myLevel}set"=>1,
|
||||
"l{$myOfficerLevel}set"=>1,
|
||||
'gennum'=>$db->sqleval('gennum - 1'),
|
||||
'gold'=>$db->sqleval('gold + %i', $gold),
|
||||
'rice'=>$db->sqleval('rice + %i', $rice),
|
||||
@@ -334,14 +306,14 @@ function do추방(General $general, int $myLevel):?string{
|
||||
|
||||
|
||||
if($action == "임명") {
|
||||
if(2 <= $level && $level <= 4){
|
||||
if(2 <= $officerLevel && $officerLevel <= 4){
|
||||
if(!$destCityID){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'도시가 지정되지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
$result = do도시임명($general, $destCityID, $level);
|
||||
$result = do도시임명($general, $destCityID, $officerLevel);
|
||||
if($result !== null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
@@ -354,8 +326,8 @@ if($action == "임명") {
|
||||
]);
|
||||
}
|
||||
|
||||
if(5 <= $level && $level < 12){
|
||||
$result = do수뇌임명($general, $level);
|
||||
if(5 <= $officerLevel && $officerLevel < 12){
|
||||
$result = do수뇌임명($general, $officerLevel);
|
||||
if($result !== null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
@@ -375,7 +347,7 @@ if($action == "임명") {
|
||||
}
|
||||
|
||||
if($action == "추방") {
|
||||
$result = do추방($general, $myLevel);
|
||||
$result = do추방($general, $myOfficerLevel);
|
||||
if($result !== null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -83,13 +83,13 @@ $generalCheck = [
|
||||
'required'=>[
|
||||
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
||||
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
|
||||
'explevel', 'experience', 'dedication', 'level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||
'explevel', 'experience', 'dedication', 'officer_level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||
'recent_war'
|
||||
],
|
||||
'integer'=>[
|
||||
'no', 'nation', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
|
||||
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
|
||||
'explevel', 'experience', 'dedication', 'level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||
'explevel', 'experience', 'dedication', 'officer_level', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||
],
|
||||
'min'=>[
|
||||
['no', 1],
|
||||
@@ -112,7 +112,7 @@ $generalCheck = [
|
||||
['atmos', [40, GameConst::$maxAtmosByWar]],
|
||||
['explevel', [0, 300]],
|
||||
['injury', [0, 80]],
|
||||
['level', [1, 12]]
|
||||
['officer_level', [1, 12]]
|
||||
],
|
||||
'in'=>[
|
||||
['personal', array_keys(getCharacterList())],
|
||||
@@ -156,7 +156,7 @@ $cityCheck = [
|
||||
'pop', 'agri', 'comm', 'secu', 'def', 'wall',
|
||||
'trust', 'level',
|
||||
'pop_max', 'agri_max', 'comm_max', 'secu_max', 'def_max', 'wall_max',
|
||||
'dead', 'state', 'officer4', 'officer3', 'officer2', 'conflict',
|
||||
'dead', 'state', 'conflict',
|
||||
],
|
||||
'numeric'=>[
|
||||
'pop', 'agri', 'comm', 'secu', 'def', 'wall', 'trust', 'dead'
|
||||
@@ -164,7 +164,7 @@ $cityCheck = [
|
||||
'integer'=>[
|
||||
'city', 'nation', 'supply',
|
||||
'pop_max', 'agri_max', 'comm_max', 'secu_max', 'def_max', 'wall_max',
|
||||
'state', 'officer4', 'officer3', 'officer2'
|
||||
'state',
|
||||
],
|
||||
'min'=>[
|
||||
['def', 0],
|
||||
@@ -215,9 +215,6 @@ $nationCheck = [
|
||||
['gold', 0],
|
||||
['rice', 0],
|
||||
['gennum', 1],
|
||||
['officer4', 0],
|
||||
['officer3', 0],
|
||||
['officer2', 0],
|
||||
],
|
||||
'in'=>[
|
||||
['type', array_keys(getNationTypeList())],
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ $db->insert('general', [
|
||||
'crew' => 0,
|
||||
'train' => 0,
|
||||
'atmos' => 0,
|
||||
'level' => 0,
|
||||
'officer_level' => 0,
|
||||
'turntime' => $turntime,
|
||||
'killturn' => 6,
|
||||
'lastconnect' => $lastconnect,
|
||||
|
||||
@@ -152,7 +152,7 @@ jQuery(function($){
|
||||
|
||||
setVal('.form_general_name', data.name);
|
||||
|
||||
setVal('.form_general_level', data.level);
|
||||
setVal('.form_officer_level', data.officer_level);
|
||||
setVal('.form_exp_level', data.explevel);
|
||||
setVal('.form_injury', data.injury);
|
||||
|
||||
@@ -200,7 +200,7 @@ jQuery(function($){
|
||||
return {
|
||||
no:getGeneralNo($general),
|
||||
name:getVal('.form_general_name'),
|
||||
level:getInt('.form_general_level'),
|
||||
officer_level:getInt('.form_officer_level'),
|
||||
explevel:getInt('.form_exp_level'),
|
||||
|
||||
leadership:getInt('.form_leadership'),
|
||||
@@ -602,9 +602,6 @@ jQuery(function($){
|
||||
dead:0,
|
||||
|
||||
state:0,
|
||||
officer4:0,
|
||||
officer3:0,
|
||||
officer2:0,
|
||||
|
||||
conflict:'{}',
|
||||
};
|
||||
@@ -618,14 +615,8 @@ jQuery(function($){
|
||||
attackerCity.city = 1;
|
||||
|
||||
var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral);
|
||||
if(attackerGeneral.level == 4){
|
||||
attackerCity.officer4 = attackerGeneral.no;
|
||||
}
|
||||
if(attackerGeneral.level == 3){
|
||||
attackerCity.officer3 = attackerGeneral.no;
|
||||
}
|
||||
if(attackerGeneral.level == 2){
|
||||
attackerCity.officer2 = attackerGeneral.no;
|
||||
if(2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4){
|
||||
attackerCity.officer_city = 1;
|
||||
}
|
||||
|
||||
var defenderNation = $.extend({}, defaultNation, allData.defenderNation);
|
||||
@@ -641,14 +632,8 @@ jQuery(function($){
|
||||
var defenderGenerals = [];
|
||||
$.each(allData.defenderGenerals, function(){
|
||||
var defenderGeneral = extendGeneralInfoForDB(this);
|
||||
if(defenderGeneral.level == 4){
|
||||
defenderCity.officer4 = defenderGeneral.no;
|
||||
}
|
||||
if(defenderGeneral.level == 3){
|
||||
defenderCity.officer3 = defenderGeneral.no;
|
||||
}
|
||||
if(defenderGeneral.level == 2){
|
||||
defenderCity.officer2 = defenderGeneral.no;
|
||||
if(2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4){
|
||||
defenderGeneral.officer_city = 3;
|
||||
}
|
||||
|
||||
defenderGenerals.push(defenderGeneral);
|
||||
|
||||
+15
-15
@@ -114,31 +114,31 @@ $(function(){
|
||||
|
||||
$('.btn_appoint').click(function(){
|
||||
var $btn = $(this);
|
||||
var level = $btn.data('level');
|
||||
var officerLevel = $btn.data('officer_level');
|
||||
var officerLevelText = $btn.data('officer_level_text');
|
||||
var cityID = 0;
|
||||
var cityName = '_';
|
||||
var $generalSelect = $('.genlist_{0} option:selected'.format(level));
|
||||
var $citySelect = $('.citylist_{0} option:selected'.format(level));
|
||||
var levelText = $btn.data('level-text');
|
||||
var $generalSelect = $('.genlist_{0} option:selected'.format(officerLevel));
|
||||
var $citySelect = $('.citylist_{0} option:selected'.format(officerLevel));
|
||||
|
||||
var generalID = $generalSelect.val();
|
||||
var generalName = $generalSelect.data('name');
|
||||
var generalLevel = $generalSelect.data('level');
|
||||
var generalOfficerLevel = $generalSelect.data('officer_level');
|
||||
|
||||
|
||||
if(level >= 5){
|
||||
if(officerLevel >= 5){
|
||||
if(generalID == 0){
|
||||
if(!confirm('{0}직을 비우시겠습니까?'.format(levelText))){
|
||||
if(!confirm('{0}직을 비우시겠습니까?'.format(officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(generalLevel >= 5){
|
||||
if(!confirm('이미 수뇌인 {0}를 {1}직에 임명하시겠습니까?'.format(generalName, levelText))){
|
||||
else if(generalOfficerLevel >= 5){
|
||||
if(!confirm('이미 수뇌인 {0}를 {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!confirm('{0}를 {1}직에 임명하시겠습니까?'.format(generalName, levelText))){
|
||||
if(!confirm('{0}를 {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -152,17 +152,17 @@ $(function(){
|
||||
cityName = $citySelect.find('option:selected .name_field').text();
|
||||
|
||||
if(generalID == 0){
|
||||
if(!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, levelText))){
|
||||
if(!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if(generalLevel >= 5){
|
||||
if(!confirm('수뇌인 {0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, levelText))){
|
||||
else if(generalOfficerLevel >= 5){
|
||||
if(!confirm('수뇌인 {0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!confirm('{0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, levelText))){
|
||||
if(!confirm('{0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ $(function(){
|
||||
action:'임명',
|
||||
destGeneralID:generalID,
|
||||
destCityID:cityID,
|
||||
level:level
|
||||
officerLevel:officerLevel
|
||||
},
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
|
||||
@@ -14,7 +14,7 @@ function genChiefTableObj(){
|
||||
|
||||
for(var chiefIdx = 5; chiefIdx <= 12; chiefIdx++){
|
||||
var $plate = $('#chief_{0}'.format(chiefIdx));
|
||||
var $levelText = $plate.find('.chiefLevelText');
|
||||
var $officerLevelText = $plate.find('.chiefLevelText');
|
||||
var $name = $plate.find('.chiefName');
|
||||
var turn = [];
|
||||
for(var turnIdx=0;turnIdx<maxChiefTurn;turnIdx++){
|
||||
@@ -25,7 +25,7 @@ function genChiefTableObj(){
|
||||
turn.push({turnTime:$turnTime,turnPad:$turnPad,turnText:$turnText});
|
||||
}
|
||||
objTable[chiefIdx] = {
|
||||
levelText: $levelText,
|
||||
officerLevelText: $officerLevelText,
|
||||
name: $name,
|
||||
turn: turn
|
||||
};
|
||||
@@ -70,7 +70,7 @@ function reloadTable(){
|
||||
if(nameColor){
|
||||
$name.css('color',nameColor);
|
||||
}
|
||||
plateObj.levelText.text(chiefInfo.levelText);
|
||||
plateObj.officerLevelText.text(chiefInfo.officerLevelText);
|
||||
plateObj.name.html($name);
|
||||
|
||||
var turnTimeObj = moment(chiefInfo.turnTime);
|
||||
|
||||
+10
-10
@@ -175,11 +175,11 @@ $(function() {
|
||||
|
||||
var cityInfo = subCityList[cityVal].city;
|
||||
|
||||
$.post(basicPath+'c_myBossInfo.php',{
|
||||
citylist:cityVal,
|
||||
genlist:userVal,
|
||||
level:type,
|
||||
btn:'임명'
|
||||
$.post(basicPath+'j_myBossInfo.php',{
|
||||
destCityID:cityVal,
|
||||
destGeneralID:userVal,
|
||||
officerLevel:type,
|
||||
action:'임명'
|
||||
},function(rawData){
|
||||
|
||||
cityInfo['p'+text]=false;
|
||||
@@ -451,11 +451,11 @@ $(function() {
|
||||
}
|
||||
}
|
||||
|
||||
$.post(basicPath+'c_myBossInfo.php',{
|
||||
citylist:cityVal,
|
||||
genlist:userInfo.val,
|
||||
level:type,
|
||||
btn:'임명'
|
||||
$.post(basicPath+'j_myBossInfo.php',{
|
||||
destCityID:cityVal,
|
||||
destGeneralID:userInfo.val,
|
||||
officerLevel:type,
|
||||
action:'임명'
|
||||
},function(rawData){
|
||||
|
||||
cityInfo['p'+text]=false;
|
||||
|
||||
+1
-1
@@ -449,7 +449,7 @@ function registerGlobal(basicInfo){
|
||||
};
|
||||
window.myGeneralID = basicInfo.generalID;
|
||||
window.isChief = basicInfo.isChief;
|
||||
window.myGeneralLevel = basicInfo.generalLevel;
|
||||
window.myOfficerLevel = basicInfo.officerLevel;
|
||||
window.permissionLevel = basicInfo.permission;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ var templateGeneralRow =
|
||||
<td><%nation%></td>\
|
||||
<td><%experience%></td>\
|
||||
<td><%dedication%></td>\
|
||||
<td><%level%></td>\
|
||||
<td><%officerLevel%></td>\
|
||||
<td><%total%></td>\
|
||||
<td><%leadership%></td>\
|
||||
<td><%strength%></td>\
|
||||
@@ -188,7 +188,7 @@ function printGeneralList(value){
|
||||
explevel:general[16],
|
||||
experience:general[17],
|
||||
dedication:general[18],
|
||||
level:general[19],
|
||||
officerLevel:general[19],
|
||||
killturn:general[20],
|
||||
connect:general[21],
|
||||
reserved:0
|
||||
|
||||
+8
-10
@@ -583,7 +583,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//아국 수뇌부에게 로그 전달
|
||||
$query = "select no,name,nation from general where nation='{$general['nation']}' and level>='9'";
|
||||
$query = "select no,name,nation from general where nation='{$general['nation']}' and officer_level>='9'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog[0] = "<C>●</><D><b>{$losenation['name']}</b></> 정복으로 금<C>{$losenation['gold']}</> 쌀<C>{$losenation['rice']}</>을 획득했습니다.";
|
||||
@@ -600,10 +600,10 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$query = "update general set dedication=dedication*0.5,experience=experience*0.9 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 도시 공백지로
|
||||
$query = "update city set nation='0',officer4='0',officer3='0',officer2='0',conflict='{}',term=0 where nation='{$city['nation']}'";
|
||||
$query = "update city set nation='0',conflict='{}',term=0 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 장수 소속 무소속으로, 재야로, 부대 탈퇴
|
||||
$query = "update general set nation='0',belong='0',level='0',troop='0' where nation='{$city['nation']}'";
|
||||
$query = "update general set nation='0',belong='0',officer_level='0',officer_city=0,troop='0' where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 부대도 삭제
|
||||
$query = "delete from troop where nation='{$city['nation']}'";
|
||||
@@ -626,8 +626,9 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
} else {
|
||||
// 태수,군사,종사은 일반으로...
|
||||
$db->update('general',[
|
||||
'level'=>1
|
||||
], 'no IN %li',[$city['officer4'], $city['officer3'], $city['officer2']]);
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0,
|
||||
], 'officer_city = %i',$city['city']);
|
||||
|
||||
//수도였으면 긴급 천도
|
||||
if(isset($destnation['capital']) && $destnation['capital'] == $city['city']) {
|
||||
@@ -639,7 +640,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<M><b>【긴급천도】</b></><D><b>{$destnation['name']}</b></>{$josaYi} 수도가 함락되어 <G><b>$minCityName</b></>으로 긴급천도하였습니다.";
|
||||
|
||||
//아국 수뇌부에게 로그 전달
|
||||
$query = "select no,name,nation from general where nation='{$destnation['nation']}' and level>='5'";
|
||||
$query = "select no,name,nation from general where nation='{$destnation['nation']}' and officer_level>='5'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog = ["<C>●</>수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다."];
|
||||
@@ -654,7 +655,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$query = "update city set supply=1 where city='$minCity'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//수뇌부 이동
|
||||
$query = "update general set city='$minCity' where nation='{$destnation['nation']}' and level>='5'";
|
||||
$query = "update general set city='$minCity' where nation='{$destnation['nation']}' and officer_level>='5'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//장수 사기 감소
|
||||
$query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'";
|
||||
@@ -690,9 +691,6 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0,
|
||||
'officer4set'=>0,
|
||||
'officer3set'=>0,
|
||||
'officer2set'=>0
|
||||
|
||||
@@ -242,9 +242,6 @@ class CityConstBase{
|
||||
protected static $buildInitCommon = [
|
||||
'trust'=>50,
|
||||
'trade'=>100,
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0
|
||||
];
|
||||
|
||||
protected static $buildInit = [
|
||||
|
||||
@@ -226,8 +226,8 @@ abstract class BaseCommand{
|
||||
return $this->generalObj->getNationID();
|
||||
}
|
||||
|
||||
public function getGeneralLevel(){
|
||||
return $this->generalObj->getVar('level');
|
||||
public function getOfficerLevel(){
|
||||
return $this->generalObj->getVar('officer_level');
|
||||
}
|
||||
|
||||
public function getBrief():string{
|
||||
|
||||
@@ -128,7 +128,7 @@ class che_강행 extends Command\GeneralCommand{
|
||||
$exp = 100;
|
||||
$general->setVar('city', $destCityID);
|
||||
|
||||
if($general->getVar('level') == 12 && $this->nation['level'] == 0){
|
||||
if($general->getVar('officer_level') == 12 && $this->nation['level'] == 0){
|
||||
|
||||
$generalList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no!=%i', $general->getNationID(), $general->getID());
|
||||
if($generalList){
|
||||
|
||||
@@ -135,7 +135,7 @@ class che_거병 extends Command\GeneralCommand{
|
||||
foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx){
|
||||
$turnRows[] = [
|
||||
'nation_id'=>$nationID,
|
||||
'level'=>$chiefLevel,
|
||||
'officer_level'=>$chiefLevel,
|
||||
'turn_idx'=>$turnIdx,
|
||||
'action'=>'휴식',
|
||||
'arg'=>null,
|
||||
@@ -161,7 +161,8 @@ class che_거병 extends Command\GeneralCommand{
|
||||
$general->addExperience($exp);
|
||||
$general->addDedication($ded);
|
||||
$general->setVar('belong', 1);
|
||||
$general->setVar('level', 12);
|
||||
$general->setVar('officer_level', 12);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('nation', $nationID);
|
||||
|
||||
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
|
||||
|
||||
@@ -12,6 +12,7 @@ use \sammo\{
|
||||
|
||||
|
||||
use function \sammo\{
|
||||
function getNationStaticInfo,
|
||||
tryUniqueItemLottery
|
||||
};
|
||||
|
||||
@@ -71,32 +72,28 @@ class che_귀환 extends Command\GeneralCommand{
|
||||
$env = $this->env;
|
||||
|
||||
$general = $this->generalObj;
|
||||
$generalID = $general->getID();
|
||||
$date = $general->getTurnTime($general::TURNTIME_HM);
|
||||
|
||||
$generalLevel = $general->getVar('level');
|
||||
$target = null;
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$target = $db->queryFirstList(
|
||||
'SELECT city, name FROM city WHERE %b=%i AND nation = %i',
|
||||
'officer'.$general->getVar('level'), $generalID, $general->getNationID()
|
||||
);
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
$destCityID = null;
|
||||
if(2 <= $officerLevel && $officerLevel <= 4){
|
||||
$destCityID = $general->getVar('officer_city');
|
||||
}
|
||||
if(!$target){
|
||||
$target = $db->queryFirstList('SELECT city, name FROM city WHERE city=%i', $this->nation['capital']);
|
||||
else{
|
||||
$destCityID = $this->nation['capital'];
|
||||
}
|
||||
$destCityName = CityConst::byID($destCityID)->name;
|
||||
|
||||
[$cityID, $cityName] = $target;
|
||||
$josaRo = JosaUtil::pick($cityName, '로');
|
||||
$josaRo = JosaUtil::pick($destCityName, '로');
|
||||
|
||||
$logger = $general->getLogger();
|
||||
|
||||
$logger->pushGeneralActionLog("<G><b>{$cityName}</b></>{$josaRo} 귀환했습니다. <1>$date</>");
|
||||
$logger->pushGeneralActionLog("<G><b>{$destCityName}</b></>{$josaRo} 귀환했습니다. <1>$date</>");
|
||||
|
||||
$exp = 70;
|
||||
$ded = 100;
|
||||
|
||||
$general->setVar('city', $cityID);
|
||||
$general->setVar('city', $destCityID);
|
||||
|
||||
$general->addExperience($exp);
|
||||
$general->addDedication($ded);
|
||||
|
||||
@@ -78,7 +78,7 @@ class che_등용 extends Command\GeneralCommand{
|
||||
ConstraintHelper::ReqGeneralRice($reqRice),
|
||||
];
|
||||
|
||||
if($this->destGeneralObj->getVar('level') == 12){
|
||||
if($this->destGeneralObj->getVar('officer_level') == 12){
|
||||
$this->runnableConstraints[] = ConstraintHelper::AlwaysFail('군주에게는 등용장을 보낼 수 없습니다.');
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class che_등용 extends Command\GeneralCommand{
|
||||
$db = DB::db();
|
||||
|
||||
$destGenerals = [];
|
||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND officer_level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$destNationID = $destGeneral['nation'];
|
||||
if(!key_exists($destNationID, $destGenerals)){
|
||||
|
||||
@@ -92,7 +92,7 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
ConstraintHelper::AllowJoinDestNation($relYear),
|
||||
ConstraintHelper::ReqDestNationValue('level', '국가규모', '>', 0, '방랑군에는 임관할 수 없습니다.'),
|
||||
ConstraintHelper::DifferentDestNation(),
|
||||
ConstraintHelper::ReqGeneralValue('level', '직위', '!=', 12, '군주는 등용장을 수락할 수 없습니다')
|
||||
ConstraintHelper::ReqGeneralValue('officer_level', '직위', '!=', 12, '군주는 등용장을 수락할 수 없습니다')
|
||||
];
|
||||
}
|
||||
|
||||
@@ -138,7 +138,6 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$destGeneral->addExperience(100);
|
||||
$destGeneral->addDedication(100);
|
||||
|
||||
$setOriginalCityValues = [];
|
||||
$setOriginalNationValues = [
|
||||
'gennum'=>$db->sqleval('gennum - 1')
|
||||
];
|
||||
@@ -159,12 +158,9 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$general->setVar('rice', GameConst::$defaultRice);
|
||||
}
|
||||
|
||||
$generalLevel = $general->getVar('level');
|
||||
if(5 <= $generalLevel && $generalLevel <= 11){
|
||||
$setOriginalNationValues["l{$generalLevel}set"] = 0;
|
||||
}
|
||||
else if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$setOriginalCityValues['officer'.$generalLevel] = 0;
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
if(5 <= $officerLevel && $officerLevel <= 11){
|
||||
$setOriginalNationValues["l{$officerLevel}set"] = 0;
|
||||
}
|
||||
|
||||
// 재야가 아니면 명성N*10% 공헌N*10%감소
|
||||
@@ -201,14 +197,12 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$db->update('nation', $setOriginalNationValues, 'nation=%i', $nationID);
|
||||
}
|
||||
$db->update('nation', $setScoutNationValues, 'nation=%i', $destNationID);
|
||||
if($setOriginalCityValues){
|
||||
$db->update('city', $setOriginalCityValues, 'city=%i', $cityID);
|
||||
}
|
||||
|
||||
|
||||
$general->setVar('permission', 'normal');
|
||||
$general->setVar('belong', 1);
|
||||
$general->setVar('level', 1);
|
||||
$general->setVar('officer_level', 1);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('nation', $destNationID);
|
||||
$general->setVar('city', $this->destNation['capital']);
|
||||
$general->setVar('troop', 0);
|
||||
@@ -234,7 +228,7 @@ class che_등용수락 extends Command\GeneralCommand{
|
||||
$db = DB::db();
|
||||
|
||||
$destGenerals = [];
|
||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,npc,nation FROM general WHERE npc < 2 AND no != %i AND officer_level != 12 ORDER BY npc,binary(name)',$this->generalObj->getID());
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$destNationID = $destGeneral['nation'];
|
||||
if(!key_exists($destNationID, $destGenerals)){
|
||||
|
||||
@@ -110,14 +110,14 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
||||
if ($general->getVar('npc') >= 2 && !$env['fiction'] && 1000 <= $env['scenario'] && $env['scenario'] < 2000) {
|
||||
if($notIn){
|
||||
$nations = $db->query(
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE scout=0 and gennum<%i and nation.nation not in %li',
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.officer_level = 12 WHERE scout=0 and gennum<%i and nation.nation not in %li',
|
||||
$relYear<3?GameConst::$initialNationGenLimit:GameConst::$defaultMaxGeneral,
|
||||
$notIn
|
||||
);
|
||||
}
|
||||
else{
|
||||
$nations = $db->query(
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE scout=0 and gennum<%i',
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.officer_level = 12 WHERE scout=0 and gennum<%i',
|
||||
$relYear<3?GameConst::$initialNationGenLimit:GameConst::$defaultMaxGeneral
|
||||
);
|
||||
}
|
||||
@@ -239,14 +239,15 @@ class che_랜덤임관 extends Command\GeneralCommand{
|
||||
}
|
||||
|
||||
$general->setVar('nation', $destNationID);
|
||||
$general->setVar('level', 1);
|
||||
$general->setVar('officer_level', 1);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('belong', 1);
|
||||
|
||||
if($this->destGeneralObj !== null){
|
||||
$general->setVar('city', $this->destGeneralObj->getCityID());
|
||||
}
|
||||
else{
|
||||
$targetCityID = $db->queryFirstField('SELECT city FROM general WHERE nation = %i AND level=12', $destNationID);
|
||||
$targetCityID = $db->queryFirstField('SELECT city FROM general WHERE nation = %i AND officer_level=12', $destNationID);
|
||||
$general->setVar('city', $targetCityID);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
|
||||
$nationID = $general->getNationID();
|
||||
|
||||
$lordID = $db->queryFirstField('SELECT no FROM general WHERE nation = %i AND level = 12', $nationID);
|
||||
$lordID = $db->queryFirstField('SELECT no FROM general WHERE nation = %i AND officer_level = 12', $nationID);
|
||||
|
||||
$lordGeneral = General::createGeneralObjFromDB($lordID);
|
||||
|
||||
@@ -82,16 +82,12 @@ class che_모반시도 extends Command\GeneralCommand{
|
||||
$logger = $general->getLogger();
|
||||
$lordLogger = $this->destGeneralObj->getLogger();
|
||||
|
||||
$generalLevel = $general->getVar('level');
|
||||
$general->setVar('level', 12);
|
||||
$lordGeneral->setVar('level', 1);
|
||||
$general->setVar('officer_level', 12);
|
||||
$general->setVar('officer_city', 0);
|
||||
$lordGeneral->setVar('officer_level', 1);
|
||||
$lordGeneral->setVar('officer_city', 0);
|
||||
$lordGeneral->multiplyVar('experience', 0.7);
|
||||
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$generalLevel=>0
|
||||
], "officer{$generalLevel}=%i", $general->getID());
|
||||
}
|
||||
|
||||
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$logger->pushGlobalHistoryLog("<Y><b>【모반】</b></><Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>의 군주 자리를 찬탈했습니다.");
|
||||
|
||||
@@ -107,17 +107,16 @@ class che_방랑 extends Command\GeneralCommand{
|
||||
'makelimit'=>12
|
||||
], 'nation=%i', $nationID);
|
||||
$general->setVar('makelimit', 12);
|
||||
$general->setVar('officer_city', 0);
|
||||
|
||||
$db->update('general', [
|
||||
'level'=>1,
|
||||
], 'nation=%i AND level < 12', $nationID);
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0,
|
||||
], 'nation=%i AND officer_level < 12', $nationID);
|
||||
|
||||
$db->update('city', [
|
||||
'nation'=>0,
|
||||
'front'=>0,
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0,
|
||||
'conflict'=>'{}'
|
||||
], 'nation=%i', $nationID);
|
||||
|
||||
|
||||
@@ -109,17 +109,12 @@ class che_선양 extends Command\GeneralCommand{
|
||||
$logger = $general->getLogger();
|
||||
$destLogger = $destGeneral->getLogger();
|
||||
|
||||
$destGeneralLevel = $destGeneral->getVar('level');
|
||||
$destGeneral->setVar('level', 12);
|
||||
$general->setVar('level', 1);
|
||||
$destGeneral->setVar('officer_level', 12);
|
||||
$destGeneral->setVar('officer_city', 0);
|
||||
$general->setVar('officer_level', 1);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->multiplyVar('experience', 0.7);
|
||||
|
||||
if(2 <= $destGeneralLevel && $destGeneralLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$destGeneralLevel=>0
|
||||
], "officer{$destGeneralLevel}=%i", $destGeneral->getID());
|
||||
}
|
||||
|
||||
$josaYi = JosaUtil::pick($generalName, '이');
|
||||
$logger->pushGlobalHistoryLog("<Y><b>【선양】</b></><Y>{$generalName}</>{$josaYi} <D><b>{$nationName}</b></>의 군주 자리를 <Y>{$destGeneralName}</>에게 선양했습니다.");
|
||||
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <Y>{$destGeneralName}</>에게 선양");
|
||||
@@ -143,7 +138,7 @@ class che_선양 extends Command\GeneralCommand{
|
||||
//TODO: 암행부처럼 보여야...
|
||||
$db = DB::db();
|
||||
|
||||
$destRawGenerals = $db->query('SELECT no,name,level,npc FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
ob_start();
|
||||
?>
|
||||
군주의 자리를 다른 장수에게 물려줍니다.<br>
|
||||
@@ -155,7 +150,7 @@ class che_선양 extends Command\GeneralCommand{
|
||||
$color = " style='color:{$color}'";
|
||||
}
|
||||
$name = $destGeneral['name'];
|
||||
if($destGeneral['level'] >= 5){
|
||||
if($destGeneral['officer_level'] >= 5){
|
||||
$name = "*{$name}*";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -129,7 +129,7 @@ class che_이동 extends Command\GeneralCommand{
|
||||
|
||||
$general->setVar('city', $destCityID);
|
||||
|
||||
if($general->getVar('level') == 12 && $this->nation['level'] == 0){
|
||||
if($general->getVar('officer_level') == 12 && $this->nation['level'] == 0){
|
||||
$generalList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND no!=%i', $general->getNationID(), $general->getID());
|
||||
if($generalList){
|
||||
$db->update('general', [
|
||||
|
||||
@@ -154,14 +154,15 @@ class che_임관 extends Command\GeneralCommand{
|
||||
}
|
||||
|
||||
$general->setVar('nation', $destNationID);
|
||||
$general->setVar('level', 1);
|
||||
$general->setVar('officer_level', 1);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('belong', 1);
|
||||
|
||||
if($this->destGeneralObj !== null){
|
||||
$general->setVar('city', $this->destGeneralObj->getCityID());
|
||||
}
|
||||
else{
|
||||
$targetCityID = $db->queryFirstField('SELECT city FROM general WHERE nation = %i AND level=12', $destNationID);
|
||||
$targetCityID = $db->queryFirstField('SELECT city FROM general WHERE nation = %i AND officer_level=12', $destNationID);
|
||||
$general->setVar('city', $targetCityID);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ class che_증여 extends Command\GeneralCommand{
|
||||
//TODO: 암행부처럼 보여야...
|
||||
$db = DB::db();
|
||||
|
||||
$destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation != 0 AND nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
ob_start();
|
||||
?>
|
||||
자신의 자금이나 군량을 다른 장수에게 증여합니다.<br>
|
||||
@@ -177,7 +177,7 @@ class che_증여 extends Command\GeneralCommand{
|
||||
$color = " style='color:{$color}'";
|
||||
}
|
||||
$name = $destGeneral['name'];
|
||||
if($destGeneral['level'] >= 5){
|
||||
if($destGeneral['officer_level'] >= 5){
|
||||
$name = "*{$name}*";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -117,7 +117,8 @@ class che_하야 extends Command\GeneralCommand{
|
||||
\sammo\refreshNationStaticInfo();
|
||||
|
||||
$general->setVar('nation', 0);
|
||||
$general->setVar('level', 0);
|
||||
$general->setVar('officer_level', 0);
|
||||
$general->setVar('officer_city', 0);
|
||||
$general->setVar('belong', 0);
|
||||
$general->setVar('makelimit', 12);
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ class che_화계 extends Command\GeneralCommand{
|
||||
[$year, $month] = [$env['year'], $env['month']];
|
||||
|
||||
foreach($db->query(
|
||||
'SELECT `no`,name,city,nation,level,leadership,horse,strength,weapon,intel,book,item,last_turn,injury,special,special2,injury,crew,atmos,train FROM general WHERE city = %i',
|
||||
'SELECT `no`,name,city,nation,officer_level,leadership,horse,strength,weapon,intel,book,item,last_turn,injury,special,special2,injury,crew,atmos,train FROM general WHERE city = %i',
|
||||
$destCityID,
|
||||
$destNationID
|
||||
) as $rawDestCityGeneral){
|
||||
|
||||
@@ -193,7 +193,7 @@ class che_몰수 extends Command\NationCommand{
|
||||
//TODO: 암행부처럼 보여야...
|
||||
$db = DB::db();
|
||||
|
||||
$destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destGeneralList = [];
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
||||
@@ -202,7 +202,7 @@ class che_몰수 extends Command\NationCommand{
|
||||
}
|
||||
|
||||
$name = $destGeneral['name'];
|
||||
if($destGeneral['level'] >= 5){
|
||||
if($destGeneral['officer_level'] >= 5){
|
||||
$name = "*{$name}*";
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ class che_물자원조 extends Command\NationCommand{
|
||||
|
||||
$broadcastMessage = "<D><b>{$destNationName}</b></>{$josaRo} 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 지원했습니다.";
|
||||
|
||||
$chiefList = $db->queryFirstColumn('SELECT no FROM general WHERE level >= 5 AND no != %i AND nation = %i', $generalID, $nationID);
|
||||
$chiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND no != %i AND nation = %i', $generalID, $nationID);
|
||||
foreach($chiefList as $chiefID){
|
||||
$chiefLogger = new ActionLogger($chiefID, $nationID, $year, $month);
|
||||
$chiefLogger->pushGeneralActionLog($broadcastMessage, ActionLogger::PLAIN);
|
||||
@@ -193,7 +193,7 @@ class che_물자원조 extends Command\NationCommand{
|
||||
$logger->pushGeneralActionLog("<D><b>{$destNationName}</b></>{$josaRo} 물자를 지원합니다. <1>$date</>", ActionLogger::PLAIN);
|
||||
|
||||
$destBroadcastMessage = $broadcastMessage = "<D><b>{$nationName}</b></>에서 금<C>{$goldAmountText}</> 쌀<C>{$riceAmountText}</>을 원조했습니다.";
|
||||
$destChiefList = $db->queryFirstColumn('SELECT no FROM general WHERE level >= 5 AND nation = %i', $destNationID);
|
||||
$destChiefList = $db->queryFirstColumn('SELECT no FROM general WHERE officer_level >= 5 AND nation = %i', $destNationID);
|
||||
foreach($destChiefList as $destChiefID){
|
||||
$destChiefLogger = new ActionLogger($destChiefID, $nationID, $year, $month);
|
||||
$destChiefLogger->pushGeneralActionLog($destBroadcastMessage, ActionLogger::PLAIN);
|
||||
|
||||
@@ -159,7 +159,7 @@ class che_발령 extends Command\NationCommand{
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
$destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destGeneralList = [];
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
||||
@@ -168,7 +168,7 @@ class che_발령 extends Command\NationCommand{
|
||||
}
|
||||
|
||||
$name = $destGeneral['name'];
|
||||
if($destGeneral['level'] >= 5){
|
||||
if($destGeneral['officer_level'] >= 5){
|
||||
$name = "*{$name}*";
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ class che_천도 extends Command\NationCommand{
|
||||
$nationStor = \sammo\KVStorage::getStorage(DB::db(), 'nation_env');
|
||||
$general = $this->getGeneral();
|
||||
$nationID = $general->getNationID();
|
||||
$nationStor->setValue("last천도Trial_{$nationID}", [$general->getVar('level'), $general->getTurnTime()]);
|
||||
$nationStor->setValue("last천도Trial_{$nationID}", [$general->getVar('officer_level'), $general->getTurnTime()]);
|
||||
|
||||
if($lastTurn->getCommand() != $commandName && $lastTurn->getArg() !== $this->arg){
|
||||
$this->setResultTurn(new LastTurn(
|
||||
|
||||
@@ -162,7 +162,7 @@ class che_포상 extends Command\NationCommand{
|
||||
//TODO: 암행부처럼 보여야...
|
||||
$db = DB::db();
|
||||
|
||||
$destRawGenerals = $db->query('SELECT no,name,level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destRawGenerals = $db->query('SELECT no,name,officer_level,npc,gold,rice FROM general WHERE nation = %i AND no != %i ORDER BY npc,binary(name)',$this->generalObj->getNationID(), $this->generalObj->getID());
|
||||
$destGeneralList = [];
|
||||
foreach($destRawGenerals as $destGeneral){
|
||||
$nameColor = \sammo\getNameColor($destGeneral['npc']);
|
||||
@@ -171,7 +171,7 @@ class che_포상 extends Command\NationCommand{
|
||||
}
|
||||
|
||||
$name = $destGeneral['name'];
|
||||
if($destGeneral['level'] >= 5){
|
||||
if($destGeneral['officer_level'] >= 5){
|
||||
$name = "*{$name}*";
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class AllowRebellion extends Constraint{
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$lord = $db->queryFirstRow('SELECT no, killturn, npc FROM general WHERE nation = %i AND level = 12', $nationID);
|
||||
$lord = $db->queryFirstRow('SELECT no, killturn, npc FROM general WHERE nation = %i AND officer_level = 12', $nationID);
|
||||
|
||||
if(!$lord){
|
||||
throw new MustNotBeReachedException('군주가 없음');
|
||||
|
||||
@@ -10,9 +10,9 @@ class BeChief extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!key_exists('level', $this->general)){
|
||||
if(!key_exists('officer_level', $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require level in general");
|
||||
throw new \InvalidArgumentException("require officer_level in general");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -22,7 +22,7 @@ class BeChief extends Constraint{
|
||||
$this->checkInputValues();
|
||||
$this->tested = true;
|
||||
|
||||
if($this->general['level'] > 4){
|
||||
if($this->general['officer_level'] > 4){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ class BeLord extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!key_exists('level', $this->general)){
|
||||
if(!key_exists('officer_level', $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require level in general");
|
||||
throw new \InvalidArgumentException("require officer_level in general");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -22,7 +22,7 @@ class BeLord extends Constraint{
|
||||
$this->checkInputValues();
|
||||
$this->tested = true;
|
||||
|
||||
if($this->general['level'] == 12){
|
||||
if($this->general['officer_level'] == 12){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,9 @@ class NotCapital extends Constraint{
|
||||
throw new \InvalidArgumentException("require city in general");
|
||||
}
|
||||
|
||||
if(!key_exists('level', $this->general)){
|
||||
if(!key_exists('officer_level', $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require level in general");
|
||||
throw new \InvalidArgumentException("require officer_level in general");
|
||||
}
|
||||
|
||||
if(!key_exists('capital', $this->nation)){
|
||||
@@ -36,7 +36,7 @@ class NotCapital extends Constraint{
|
||||
return true;
|
||||
}
|
||||
|
||||
if($this->arg && 2 <= $this->general['level'] && $this->general['level'] <= 4){
|
||||
if($this->arg && 2 <= $this->general['officer_level'] && $this->general['officer_level'] <= 4){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ class NotChief extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!key_exists('level', $this->general)){
|
||||
if(!key_exists('officer_level', $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require level in general");
|
||||
throw new \InvalidArgumentException("require officer_level in general");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -22,7 +22,7 @@ class NotChief extends Constraint{
|
||||
$this->checkInputValues();
|
||||
$this->tested = true;
|
||||
|
||||
if($this->general['level'] <= 4){
|
||||
if($this->general['officer_level'] <= 4){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ class NotLord extends Constraint{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!key_exists('level', $this->general)){
|
||||
if(!key_exists('officer_level', $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require level in general");
|
||||
throw new \InvalidArgumentException("require officer_level in general");
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -22,7 +22,7 @@ class NotLord extends Constraint{
|
||||
$this->checkInputValues();
|
||||
$this->tested = true;
|
||||
|
||||
if($this->general['level'] != 12){
|
||||
if($this->general['officer_level'] != 12){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class ReqGeneralCrewMargin extends Constraint{
|
||||
throw new \InvalidArgumentException("{$this->arg} is invalid crewtype");
|
||||
}
|
||||
|
||||
foreach(['leadership','strength','intel','crew','crewtype','nation','level'] as $key){
|
||||
foreach(['leadership','strength','intel','crew','crewtype','nation','officer_level'] as $key){
|
||||
if(!key_exists($key, $this->general)){
|
||||
if(!$throwExeception){return false; }
|
||||
throw new \InvalidArgumentException("require {$key} in general");
|
||||
|
||||
@@ -268,7 +268,7 @@ class DiplomaticMessage extends Message{
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, nation, `level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
'SELECT `name`, nation, `officer_level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
$receiverID,
|
||||
$this->dest->nationID
|
||||
);
|
||||
@@ -373,7 +373,7 @@ class DiplomaticMessage extends Message{
|
||||
|
||||
$db = DB::db();
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, nation, `level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
'SELECT `name`, nation, `officer_level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
$receiverID,
|
||||
$this->dest->nationID
|
||||
);
|
||||
|
||||
@@ -8,7 +8,7 @@ class DummyGeneral extends General{
|
||||
'name'=>'Dummy',
|
||||
'city'=>0,
|
||||
'nation'=>0,
|
||||
'level'=>0,
|
||||
'officer_level'=>0,
|
||||
'crewtype'=>-1,
|
||||
'turntime'=>'2012-03-04 05:06:07.000000',
|
||||
'experience'=>0,
|
||||
|
||||
@@ -64,24 +64,13 @@ class RaiseInvader extends \sammo\Event\Action{
|
||||
$db->update('general', ['city'=>$newCapital], 'nation=%i and city=%i', $nation, $oldCapital);
|
||||
}
|
||||
|
||||
$generals = [];
|
||||
foreach($db->query('SELECT officer4, officer3, officer2 from city where city in %li', $cities) as $city){
|
||||
list($officer4, $officer3, $officer2) = $city;
|
||||
if($officer4 != 0) $generals[]=$officer4;
|
||||
if($officer3 != 0) $generals[]=$officer3;
|
||||
if($officer2 != 0) $generals[]=$officer2;
|
||||
}
|
||||
|
||||
if($generals){
|
||||
$db->update('general', [
|
||||
'level'=>1
|
||||
], 'no in %li', $generals);
|
||||
}
|
||||
$db->update('general', [
|
||||
'officer_level'=>1,
|
||||
'officer_city'=>0
|
||||
], 'officer_city in %li', $cities);
|
||||
|
||||
$db->update('city', [
|
||||
'officer4'=>0,
|
||||
'officer3'=>0,
|
||||
'officer2'=>0,
|
||||
'nation'=>0
|
||||
], 'city in %li', $cities);
|
||||
}
|
||||
|
||||
+22
-29
@@ -10,7 +10,7 @@ class General implements iAction{
|
||||
|
||||
/**
|
||||
* @var iAction $nationType
|
||||
* @var iAction $levelObj
|
||||
* @var iAction $officerLevelObj
|
||||
* @var iAction $specialDomesticObj
|
||||
* @var iAction $specialWarObj
|
||||
* @var iAction $personalityObj
|
||||
@@ -33,7 +33,7 @@ class General implements iAction{
|
||||
protected $isFinished = false;
|
||||
|
||||
protected $nationType = null;
|
||||
protected $levelObj = null;
|
||||
protected $officerLevelObj = null;
|
||||
protected $specialDomesticObj = null;
|
||||
protected $specialWarObj = null;
|
||||
protected $personalityObj = null;
|
||||
@@ -62,8 +62,8 @@ class General implements iAction{
|
||||
'power'=>1,
|
||||
'intel'=>1,
|
||||
'nation'=>2,
|
||||
'level'=>1,
|
||||
//NOTE: levelObj로 인해 국가의 '레벨'이 바뀌는 것도 조심해야 하나, 국가 레벨의 변경은 월 초/말에만 일어남.
|
||||
'officer_level'=>1,
|
||||
//NOTE: officerLevelObj로 인해 국가의 '레벨'이 바뀌는 것도 조심해야 하나, 국가 레벨의 변경은 월 초/말에만 일어남.
|
||||
'special'=>1,
|
||||
'special2'=>1,
|
||||
'personal'=>1,
|
||||
@@ -79,7 +79,7 @@ class General implements iAction{
|
||||
* @param null|array $city DB city 테이블의 row값
|
||||
* @param int $year 게임 연도
|
||||
* @param int $month 게임 월
|
||||
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, level 정도로 초기화 가능
|
||||
* @param bool $fullConstruct iAction, 및 ActionLogger 초기화 여부, false인 경우 no, name, city, nation, officer_level 정도로 초기화 가능
|
||||
*/
|
||||
public function __construct(array $raw, ?array $rawRank, ?array $city, ?int $year, ?int $month, bool $fullConstruct=true){
|
||||
//TODO: 밖에서 가져오도록 하면 버그 확률이 높아짐. 필요한 raw 값을 직접 구해야함.
|
||||
@@ -102,7 +102,7 @@ class General implements iAction{
|
||||
}
|
||||
|
||||
$this->nationType = buildNationTypeClass($staticNation['type']);
|
||||
$this->levelObj = new TriggerGeneralLevel($this->raw, $staticNation['level'], $city);
|
||||
$this->officerLevelObj = new TriggerOfficerLevel($this->raw, $staticNation['level']);
|
||||
|
||||
$this->specialDomesticObj = buildGeneralSpecialDomesticClass($raw['special']);
|
||||
$this->specialWarObj = buildGeneralSpecialWarClass($raw['special2']);
|
||||
@@ -260,8 +260,8 @@ class General implements iAction{
|
||||
return $this->nationType;
|
||||
}
|
||||
|
||||
public function getGeneralLevelObj():iAction{
|
||||
return $this->levelObj;
|
||||
public function getOfficerLevelObj():iAction{
|
||||
return $this->officerLevelObj;
|
||||
}
|
||||
|
||||
function getCrewTypeObj():GameUnitDetail{
|
||||
@@ -379,7 +379,7 @@ class General implements iAction{
|
||||
if($withIActionObj){
|
||||
foreach([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj
|
||||
@@ -516,18 +516,11 @@ class General implements iAction{
|
||||
$generalName = $this->getName();
|
||||
|
||||
// 군주였으면 유지 이음
|
||||
$generalLevel = $this->getVar('level');
|
||||
if($generalLevel == 12) {
|
||||
$officerLevel = $this->getVar('officer_level');
|
||||
if($officerLevel == 12) {
|
||||
nextRuler($this);
|
||||
}
|
||||
|
||||
//도시의 태수, 군사, 종사직도 초기화
|
||||
if(2 <= $generalLevel && $generalLevel <= 4){
|
||||
$db->update('city', [
|
||||
'officer'.$generalLevel=>0
|
||||
], "officer{$generalLevel} = %i", $generalID);
|
||||
}
|
||||
|
||||
// 부대 처리
|
||||
$troopLeaderID = $this->getVar('troop');
|
||||
if($troopLeaderID == $generalID){
|
||||
@@ -713,7 +706,7 @@ class General implements iAction{
|
||||
$caller = new GeneralTriggerCaller();
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -735,7 +728,7 @@ class General implements iAction{
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -754,7 +747,7 @@ class General implements iAction{
|
||||
//xxx: $general?
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -772,7 +765,7 @@ class General implements iAction{
|
||||
public function onCalcStrategic(string $turnType, string $varType, $value){
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -790,7 +783,7 @@ class General implements iAction{
|
||||
public function onCalcNationalIncome(string $type, int $amount):int{
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -811,7 +804,7 @@ class General implements iAction{
|
||||
$def = 1;
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -831,7 +824,7 @@ class General implements iAction{
|
||||
$caller = new WarUnitTriggerCaller();
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -858,7 +851,7 @@ class General implements iAction{
|
||||
);
|
||||
foreach(array_merge([
|
||||
$this->nationType,
|
||||
$this->levelObj,
|
||||
$this->officerLevelObj,
|
||||
$this->specialDomesticObj,
|
||||
$this->specialWarObj,
|
||||
$this->personalityObj,
|
||||
@@ -875,16 +868,16 @@ class General implements iAction{
|
||||
}
|
||||
|
||||
static public function mergeQueryColumn(?array $reqColumns=null, int $constructMode=2):array{
|
||||
$minimumColumn = ['no', 'name', 'city', 'nation', 'level'];
|
||||
$minimumColumn = ['no', 'name', 'city', 'nation', 'officer_level', 'officer_city'];
|
||||
$defaultEventColumn = [
|
||||
'no', 'name', 'city', 'nation', 'level',
|
||||
'no', 'name', 'city', 'nation', 'officer_level', 'officer_city',
|
||||
'special', 'special2', 'personal',
|
||||
'horse', 'weapon', 'book', 'item', 'last_turn'
|
||||
];
|
||||
$fullColumn = [
|
||||
'no', 'name', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity',
|
||||
'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item',
|
||||
'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
||||
'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
||||
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
|
||||
'personal', 'special', 'special2', 'defence_train', 'tnmt', 'npc', 'npc_org', 'deadyear', 'npcmsg',
|
||||
'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
|
||||
|
||||
+34
-41
@@ -1437,7 +1437,7 @@ class GeneralAI
|
||||
{
|
||||
$general = $this->general;
|
||||
|
||||
if($general->getVar('level') < 12){
|
||||
if($general->getVar('officer_level') < 12){
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1476,7 +1476,7 @@ class GeneralAI
|
||||
if($lastTurn->getCommand() === 'che_천도'){
|
||||
$cmd = buildNationCommandClass('che_천도', $general, $this->env, $lastTurn, $lastTurn->getArg());
|
||||
if($cmd->isRunnable()){
|
||||
$nationStor->setValue("last천도Trial_{$this->nation['nation']}", [$general->getVar('level'), $general->getTurnTime()]);
|
||||
$nationStor->setValue("last천도Trial_{$this->nation['nation']}", [$general->getVar('officer_level'), $general->getTurnTime()]);
|
||||
return $cmd;
|
||||
}
|
||||
}
|
||||
@@ -1489,7 +1489,7 @@ class GeneralAI
|
||||
date_create_immutable($general->getTurnTime())
|
||||
)
|
||||
);
|
||||
if($timeDiffSeconds < $turnTerm * 30 && $lastTrialLevel !== $general->getVar('level')){ //0.5Turn
|
||||
if($timeDiffSeconds < $turnTerm * 30 && $lastTrialLevel !== $general->getVar('officer_level')){ //0.5Turn
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1597,7 +1597,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
|
||||
$nationStor->setValue("last천도Trial_{$this->nation['nation']}", [$general->getVar('level'), $general->getTurnTime()]);
|
||||
$nationStor->setValue("last천도Trial_{$this->nation['nation']}", [$general->getVar('officer_level'), $general->getTurnTime()]);
|
||||
|
||||
return $cmd;
|
||||
}
|
||||
@@ -2334,6 +2334,7 @@ class GeneralAI
|
||||
}
|
||||
|
||||
$this->categorizeNationCities();
|
||||
$this->categorizeNationGeneral();
|
||||
|
||||
$candidateCities = [];
|
||||
|
||||
@@ -2452,7 +2453,7 @@ class GeneralAI
|
||||
$db = DB::db();
|
||||
|
||||
$general = $this->general;
|
||||
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.level = 12 AND city.nation = 0');
|
||||
$lordCities = $db->queryFirstColumn('SELECT city.city as city FROM general LEFT JOIN city ON general.city = city.city WHERE general.officer_level = 12 AND city.nation = 0');
|
||||
$nationCities = $db->queryFirstColumn('SELECT city a FROM city WHERE nation != 0');+
|
||||
|
||||
$occupiedCities = [];
|
||||
@@ -2580,7 +2581,7 @@ class GeneralAI
|
||||
// 오랑캐는 바로 임관
|
||||
if ($general->getVar('npc') == 9) {
|
||||
$rulerNation = $db->queryFirstField(
|
||||
'SELECT nation FROM general WHERE `level`=12 AND npc=9 and nation not in %li ORDER BY RAND() limit 1',
|
||||
'SELECT nation FROM general WHERE `officer_level`=12 AND npc=9 and nation not in %li ORDER BY RAND() limit 1',
|
||||
$general->getAuxVar('joinedNations') ?? [0]
|
||||
);
|
||||
|
||||
@@ -2711,20 +2712,7 @@ class GeneralAI
|
||||
|
||||
$nationCity['dev'] = $dev;
|
||||
|
||||
$importantScore = 1;
|
||||
if ($nationCity['officer4']) {
|
||||
$importantScore += 1;
|
||||
}
|
||||
|
||||
if ($nationCity['officer3']) {
|
||||
$importantScore += 1;
|
||||
}
|
||||
|
||||
if ($nationCity['officer2']) {
|
||||
$importantScore += 1;
|
||||
}
|
||||
|
||||
$nationCity['important'] = $importantScore;
|
||||
$nationCity['important'] = 1;
|
||||
|
||||
if($nationCity['supply']){
|
||||
$supplyCities[$cityID] = &$nationCity;
|
||||
@@ -2785,10 +2773,14 @@ class GeneralAI
|
||||
$generalID = $nationGeneral->getID();
|
||||
$cityID = $nationGeneral->getCityID();
|
||||
$npcType = $nationGeneral->getVar('npc');
|
||||
$generalLevel = $nationGeneral->getVar('level');
|
||||
$officerLevel = $nationGeneral->getVar('officer_level');
|
||||
$officerCity = $nationGeneral->getVar('officer_city');
|
||||
|
||||
if($generalLevel > 4){
|
||||
$chiefGenerals[$generalLevel] = $nationGeneral;
|
||||
if($officerLevel > 4){
|
||||
$chiefGenerals[$officerLevel] = $nationGeneral;
|
||||
}
|
||||
else if($officerLevel > 2){
|
||||
$nationCities[$officerCity]['important'] += 1;
|
||||
}
|
||||
|
||||
if (key_exists($cityID, $nationCities)) {
|
||||
@@ -2855,7 +2847,7 @@ class GeneralAI
|
||||
$this->categorizeNationGeneral();
|
||||
$this->categorizeNationCities();
|
||||
|
||||
if($general->getVar('level') == 12){
|
||||
if($general->getVar('officer_level') == 12){
|
||||
$month = $this->env['month'];
|
||||
if (in_array($month, [1, 4, 7, 10])) {
|
||||
$this->choosePromotion();
|
||||
@@ -2950,7 +2942,7 @@ class GeneralAI
|
||||
$general->setVar('defence_train', 80);
|
||||
}
|
||||
|
||||
if($general->getVar('level') === 12 && $this->generalPolicy->can선양){
|
||||
if($general->getVar('officer_level') === 12 && $this->generalPolicy->can선양){
|
||||
$result = $this->do선양($reservedCommand);
|
||||
if($result !== null){
|
||||
return $result;
|
||||
@@ -2984,7 +2976,7 @@ class GeneralAI
|
||||
return $this->do중립($reservedCommand);
|
||||
}
|
||||
|
||||
if($npcType >= 2 && $general->getVar('level') == 12 && !$this->nation['capital']){
|
||||
if($npcType >= 2 && $general->getVar('officer_level') == 12 && !$this->nation['capital']){
|
||||
//방랑군 건국
|
||||
$result = $this->do건국($reservedCommand);
|
||||
if($result !== null){
|
||||
@@ -3089,7 +3081,7 @@ class GeneralAI
|
||||
foreach(Util::range(5) as $idx){
|
||||
/** @var General */
|
||||
$randGeneral = Util::choiceRandom($this->npcWarGenerals);
|
||||
if($randGeneral->getVar('level') != 1){
|
||||
if($randGeneral->getVar('officer_level') != 1){
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3116,7 +3108,8 @@ class GeneralAI
|
||||
continue;
|
||||
}
|
||||
|
||||
$randGeneral->setVar('level', $chiefLevel);
|
||||
$randGeneral->setVar('officer_level', $chiefLevel);
|
||||
$randGeneral->setVar('officer_city', 0);
|
||||
$randGeneral->applyDB($db);
|
||||
}
|
||||
}
|
||||
@@ -3149,29 +3142,29 @@ class GeneralAI
|
||||
|
||||
$db->update('general', [
|
||||
'permission' => 'ambassador',
|
||||
], 'nation=%i AND npc < 2 AND level > 4', $nationID);
|
||||
], 'nation=%i AND npc < 2 AND officer_level > 4', $nationID);
|
||||
|
||||
foreach($db->query(
|
||||
'SELECT no, npc, level, killturn FROM general WHERE nation = %i AND 12 > level AND level > 4',
|
||||
'SELECT no, npc, officer_level, killturn FROM general WHERE nation = %i AND 12 > officer_level AND officer_level > 4',
|
||||
$nationID
|
||||
) as $chief) {
|
||||
|
||||
if ($chief['npc'] < 2 && $chief['killturn'] < $minKillturn) {
|
||||
$chiefCandidate[$chief['level']] = $chief['no'];
|
||||
$userChief[$chief['no']] = $chief['level'];
|
||||
$chiefCandidate[$chief['officer_level']] = $chief['no'];
|
||||
$userChief[$chief['no']] = $chief['officer_level'];
|
||||
}
|
||||
}
|
||||
|
||||
$db->update('general', [
|
||||
'level' => 1
|
||||
], 'level < 12 AND level > 4 AND nation = %i', $nationID);
|
||||
'officer_level' => 1
|
||||
], 'officer_level < 12 AND officer_level > 4 AND nation = %i', $nationID);
|
||||
|
||||
$maxBelong = $db->queryFirstField('SELECT max(belong) FROM `general` WHERE nation=%i', $nationID);
|
||||
$maxBelong = min($maxBelong - 1, 3);
|
||||
|
||||
if (!$userChief) {
|
||||
$candUserChief = $db->queryFirstField(
|
||||
'SELECT no FROM general WHERE nation = %i AND level = 1 AND killturn > %i AND npc < 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND killturn > %i AND npc < 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
$nationID,
|
||||
$minKillturn,
|
||||
$maxBelong
|
||||
@@ -3186,7 +3179,7 @@ class GeneralAI
|
||||
|
||||
if (!key_exists(11, $chiefCandidate)) {
|
||||
$candChiefHead = $db->queryFirstField(
|
||||
'SELECT no FROM general WHERE nation = %i AND level = 1 AND npc >= 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
'SELECT no FROM general WHERE nation = %i AND officer_level = 1 AND npc >= 2 AND belong >= %i ORDER BY leadership DESC LIMIT 1',
|
||||
$nationID,
|
||||
$maxBelong
|
||||
);
|
||||
@@ -3199,7 +3192,7 @@ class GeneralAI
|
||||
if ($minChiefLevel < 11) {
|
||||
//무장 수뇌 후보
|
||||
$candChiefStrength = $db->queryFirstColumn(
|
||||
'SELECT no FROM general WHERE nation = %i AND strength >= %i AND level = 1 AND belong >= %i ORDER BY strength DESC LIMIT %i',
|
||||
'SELECT no FROM general WHERE nation = %i AND strength >= %i AND officer_level = 1 AND belong >= %i ORDER BY strength DESC LIMIT %i',
|
||||
$nationID,
|
||||
GameConst::$chiefStatMin,
|
||||
$maxBelong,
|
||||
@@ -3207,7 +3200,7 @@ class GeneralAI
|
||||
);
|
||||
//지장 수뇌 후보
|
||||
$candChiefIntel = $db->queryFirstColumn(
|
||||
'SELECT no FROM general WHERE nation = %i AND intel >= %i AND level = 1 AND belong >= %i ORDER BY intel DESC LIMIT %i',
|
||||
'SELECT no FROM general WHERE nation = %i AND intel >= %i AND officer_level = 1 AND belong >= %i ORDER BY intel DESC LIMIT %i',
|
||||
$nationID,
|
||||
GameConst::$chiefStatMin,
|
||||
$maxBelong,
|
||||
@@ -3243,7 +3236,7 @@ class GeneralAI
|
||||
|
||||
foreach ($chiefCandidate as $chiefLevel => $chiefID) {
|
||||
$db->update('general', [
|
||||
'level' => $chiefLevel
|
||||
'officer_level' => $chiefLevel
|
||||
], 'no=%i', $chiefID);
|
||||
}
|
||||
}
|
||||
@@ -3298,7 +3291,7 @@ class GeneralAI
|
||||
$dedicationList = array_map(function(General $general){
|
||||
return $general->getRaw();
|
||||
}, array_filter($this->nationGenerals, function(General $rawGeneral){
|
||||
return $rawGeneral->getVar('level') != 5;
|
||||
return $rawGeneral->getVar('officer_level') != 5;
|
||||
}));
|
||||
|
||||
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
|
||||
@@ -3340,7 +3333,7 @@ class GeneralAI
|
||||
$dedicationList = array_map(function(General $general){
|
||||
return $general->getRaw();
|
||||
}, array_filter($this->nationGenerals, function(General $rawGeneral){
|
||||
return $rawGeneral->getVar('level') != 5;
|
||||
return $rawGeneral->getVar('officer_level') != 5;
|
||||
}));
|
||||
|
||||
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
|
||||
|
||||
@@ -406,7 +406,7 @@ class Message
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'nation = %i AND (level = 12 OR permission IN (\'ambassador\', \'auditor\')) ',$this->dest->nationID);
|
||||
], 'nation = %i AND (officer_level = 12 OR permission IN (\'ambassador\', \'auditor\')) ',$this->dest->nationID);
|
||||
}
|
||||
return $this->sendRaw($this->dest->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class Scenario{
|
||||
|
||||
list(
|
||||
$affinity, $name, $picturePath, $nationName, $locatedCity,
|
||||
$leadership, $strength, $intel, $level, $birth, $death, $ego,
|
||||
$leadership, $strength, $intel, $officerLevel, $birth, $death, $ego,
|
||||
$char, $text
|
||||
) = $rawGeneral;
|
||||
|
||||
@@ -104,7 +104,7 @@ class Scenario{
|
||||
$leadership,
|
||||
$strength,
|
||||
$intel,
|
||||
$level,
|
||||
$officerLevel,
|
||||
$birth,
|
||||
$death,
|
||||
$ego,
|
||||
@@ -120,7 +120,7 @@ class Scenario{
|
||||
|
||||
list(
|
||||
$affinity, $name, $picturePath, $nationName, $locatedCity,
|
||||
$leadership, $strength, $intel, $level, $birth, $death, $ego,
|
||||
$leadership, $strength, $intel, $officerLevel, $birth, $death, $ego,
|
||||
$char, $text
|
||||
) = $rawGeneral;
|
||||
|
||||
@@ -145,7 +145,7 @@ class Scenario{
|
||||
$leadership,
|
||||
$strength,
|
||||
$intel,
|
||||
$level,
|
||||
$officerLevel,
|
||||
$birth,
|
||||
$death,
|
||||
$ego,
|
||||
@@ -162,7 +162,7 @@ class Scenario{
|
||||
|
||||
list(
|
||||
$affinity, $name, $picturePath, $nationName, $locatedCity,
|
||||
$leadership, $strength, $intel, $level, $birth, $death, $ego,
|
||||
$leadership, $strength, $intel, $officerLevel, $birth, $death, $ego,
|
||||
$char, $text
|
||||
) = $rawGeneral;
|
||||
|
||||
@@ -187,7 +187,7 @@ class Scenario{
|
||||
$leadership,
|
||||
$strength,
|
||||
$intel,
|
||||
$level,
|
||||
$officerLevel,
|
||||
$birth,
|
||||
$death,
|
||||
$ego,
|
||||
|
||||
@@ -22,7 +22,7 @@ class NPC{
|
||||
public $leadership;
|
||||
public $strength;
|
||||
public $intel;
|
||||
public $level;
|
||||
public $officerLevel;
|
||||
public $birth;
|
||||
public $death;
|
||||
public $ego;
|
||||
@@ -67,7 +67,7 @@ class NPC{
|
||||
int $leadership,
|
||||
int $strength,
|
||||
int $intel,
|
||||
int $level = 0,
|
||||
int $officerLevel = 0,
|
||||
int $birth = 160,
|
||||
int $death = 300,
|
||||
$ego = null,
|
||||
@@ -82,7 +82,7 @@ class NPC{
|
||||
$this->leadership = $leadership;
|
||||
$this->strength = $strength;
|
||||
$this->intel = $intel;
|
||||
$this->level = $level;
|
||||
$this->officerLevel = $officerLevel;
|
||||
$this->birth = $birth;
|
||||
$this->death = $death;
|
||||
$this->ego = $ego;
|
||||
@@ -289,9 +289,9 @@ class NPC{
|
||||
|
||||
$experience = $this->experience?:$age * 100;
|
||||
$dedication = $this->dedication?:$age * 100;
|
||||
$level = $this->level;
|
||||
if(!$level || $isNewGeneral){
|
||||
$level = $nationID?1:0;
|
||||
$officerLevel = $this->officerLevel;
|
||||
if(!$officerLevel || $isNewGeneral){
|
||||
$officerLevel = $nationID?1:0;
|
||||
}
|
||||
|
||||
$turntime = \sammo\getRandTurn($env['turnterm'], new \DateTimeImmutable($env['turntime']));
|
||||
@@ -319,7 +319,7 @@ class NPC{
|
||||
'intel'=>$this->intel,
|
||||
'experience'=>$experience,
|
||||
'dedication'=>$dedication,
|
||||
'level'=>$level,
|
||||
'officer_level'=>$officerLevel,
|
||||
'gold'=>$this->gold,
|
||||
'rice'=>$this->rice,
|
||||
'crew'=>0,
|
||||
|
||||
@@ -144,10 +144,10 @@ class Nation{
|
||||
], 'nation=%i', $this->id);
|
||||
|
||||
//군주가 없는지 확인
|
||||
$hasRuler = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i AND level=12', $this->id);
|
||||
$hasRuler = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i AND officer_level=12', $this->id);
|
||||
if(!$hasRuler){
|
||||
$newRuler = $db->queryFirstField('SELECT `no` FROM general WHERE nation=%i ORDER BY leadership+strength+intel DESC LIMIT 1', $this->id);
|
||||
$db->update('general',['level'=>12], 'no=%i', $newRuler);
|
||||
$db->update('general',['officer_level'=>12], 'no=%i', $newRuler);
|
||||
}
|
||||
|
||||
$turnRows = [];
|
||||
@@ -155,7 +155,7 @@ class Nation{
|
||||
foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx){
|
||||
$turnRows[] = [
|
||||
'nation_id'=>$this->id,
|
||||
'level'=>$chiefLevel,
|
||||
'officer_level'=>$chiefLevel,
|
||||
'turn_idx'=>$turnIdx,
|
||||
'action'=>'휴식',
|
||||
'arg'=>'{}',
|
||||
|
||||
@@ -166,12 +166,12 @@ class ScoutMessage extends Message{
|
||||
|
||||
$db = DB::db();
|
||||
$srcGeneral = $db->queryFirstRow('SELECT `name`, nation FROM general WHERE `no`=%i', $srcGeneralID);
|
||||
$destGeneral = $db->queryFirstRow('SELECT `name`, nation, `level` FROM general WHERE `no`=%i', $destGeneralID);
|
||||
$destGeneral = $db->queryFirstRow('SELECT `name`, nation, `officer_level` FROM general WHERE `no`=%i', $destGeneralID);
|
||||
if($date === null){
|
||||
$date = new \DateTime();
|
||||
}
|
||||
|
||||
if($destGeneral['level'] == 12){
|
||||
if($destGeneral['officer_level'] == 12){
|
||||
if($reason !== null){
|
||||
$reason = '군주에게 등용장을 보낼 수 없습니다';
|
||||
}
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class TriggerGeneralLevel implements iAction{
|
||||
class TriggerOfficerLevel implements iAction{
|
||||
use DefaultAction;
|
||||
|
||||
protected $generalLevel;
|
||||
protected $officerLevel;
|
||||
protected $nationLevel;
|
||||
protected $lbonus;
|
||||
|
||||
public function __construct(array $general, int $nationLevel, ?array $city){
|
||||
$this->generalLevel = $general['level'];
|
||||
public function __construct(array $general, int $nationLevel){
|
||||
$this->officerLevel = $general['officer_level'];
|
||||
|
||||
$this->nationLevel = $nationLevel;
|
||||
|
||||
if($city === null){
|
||||
if(2 <= $this->generalLevel || $this->generalLevel <= 4){
|
||||
$this->generalLevel = 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(2 <= $this->generalLevel && $this->generalLevel <= 4 && $city['officer'.$this->generalLevel] != $general['no']){
|
||||
$this->generalLevel = 1;
|
||||
}
|
||||
if(2 <= $this->officerLevel && $this->officerLevel <= 4 && $general['officer_city'] != $general['city']){
|
||||
$this->officerLevel = 1;
|
||||
}
|
||||
|
||||
$this->lbonus = calcLeadershipBonus($this->generalLevel, $nationLevel);
|
||||
$this->lbonus = calcLeadershipBonus($this->officerLevel, $nationLevel);
|
||||
}
|
||||
|
||||
public function getLbonus():int{
|
||||
@@ -33,22 +26,22 @@ class TriggerGeneralLevel implements iAction{
|
||||
|
||||
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
|
||||
if($turnType == '농업' || $turnType == '상업'){
|
||||
if(in_array($this->generalLevel, [12, 11, 9, 7, 5, 3])){
|
||||
if(in_array($this->officerLevel, [12, 11, 9, 7, 5, 3])){
|
||||
return $value * 1.05;
|
||||
}
|
||||
}
|
||||
else if($turnType == '기술'){
|
||||
if(in_array($this->generalLevel, [12, 11, 9, 7, 5])){
|
||||
if(in_array($this->officerLevel, [12, 11, 9, 7, 5])){
|
||||
return $value * 1.05;
|
||||
}
|
||||
}
|
||||
else if($turnType == '민심' || $turnType == '인구'){
|
||||
if(in_array($this->generalLevel, [12, 11, 2])){
|
||||
if(in_array($this->officerLevel, [12, 11, 2])){
|
||||
return $value * 1.05;
|
||||
}
|
||||
}
|
||||
else if($turnType == '수비' || $turnType == '성벽' || $turnType == '치안'){
|
||||
if(in_array($this->generalLevel, [12, 11, 10, 8, 6, 4])){
|
||||
if(in_array($this->officerLevel, [12, 11, 10, 8, 6, 4])){
|
||||
return $value * 1.05;
|
||||
}
|
||||
}
|
||||
@@ -243,15 +243,15 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
$generalCommandObj = buildGeneralCommandClass($generalCommand, $general, $env, $generalArg);
|
||||
|
||||
$hasNationTurn = false;
|
||||
if($general->getVar('nation') != 0 && $general->getVar('level') >= 5){
|
||||
if($general->getVar('nation') != 0 && $general->getVar('officer_level') >= 5){
|
||||
$nationStor = KVStorage::getStorage($db, 'nation_env');
|
||||
$lastNationTurnKey = "turn_last_{$general->getVar('nation')}_{$general->getVar('level')}";
|
||||
$lastNationTurnKey = "turn_last_{$general->getVar('nation')}_{$general->getVar('officer_level')}";
|
||||
$lastNationTurn = $nationStor->getValue($lastNationTurnKey);
|
||||
//수뇌 몇 없는데 매번 left join 하는건 낭비인것 같다.
|
||||
$rawNationTurn = $db->queryFirstRow(
|
||||
'SELECT action, arg FROM nation_turn WHERE nation_id = %i AND level = %i AND turn_idx =0',
|
||||
'SELECT action, arg FROM nation_turn WHERE nation_id = %i AND officer_level = %i AND turn_idx =0',
|
||||
$general->getVar('nation'),
|
||||
$general->getVar('level')
|
||||
$general->getVar('officer_level')
|
||||
)??[];
|
||||
$hasNationTurn = true;
|
||||
$nationCommand = $rawNationTurn['action']??null;
|
||||
@@ -281,7 +281,7 @@ WHERE turntime < %s ORDER BY turntime ASC, `no` ASC',
|
||||
}
|
||||
$turnObj->processCommand($generalCommandObj);
|
||||
}
|
||||
pullNationCommand($general->getVar('nation'), $general->getVar('level'));
|
||||
pullNationCommand($general->getVar('nation'), $general->getVar('officer_level'));
|
||||
pullGeneralCommand($general->getID());
|
||||
|
||||
$currentTurn = $general->getTurnTime();
|
||||
|
||||
@@ -153,25 +153,26 @@ class WarUnitGeneral extends WarUnit{
|
||||
[$warPower,$opposeWarPowerMultiply] = parent::computeWarPower();
|
||||
|
||||
$general = $this->general;
|
||||
$generalNo = $general->getVar('no');
|
||||
$genLevel = $general->getVar('level');
|
||||
$cityID = $general->getCityID();
|
||||
$officerLevel = $general->getVar('officer_level');
|
||||
$officerCity = $general->getVar('officer_city');
|
||||
|
||||
if($this->isAttacker){
|
||||
if($genLevel == 12){
|
||||
if($officerLevel == 12){
|
||||
$warPower *= 1.10;
|
||||
}
|
||||
else if($genLevel == 11 | $genLevel == 10 || $genLevel == 8 || $genLevel == 6){
|
||||
else if($officerLevel == 11 | $officerLevel == 10 || $officerLevel == 8 || $officerLevel == 6){
|
||||
$warPower *= 1.05;
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($genLevel == 12){
|
||||
if($officerLevel == 12){
|
||||
$opposeWarPowerMultiply *= 0.90;
|
||||
}
|
||||
else if($genLevel == 11 || $genLevel == 9 || $genLevel == 7 || $genLevel == 5){
|
||||
else if($officerLevel == 11 || $officerLevel == 9 || $officerLevel == 7 || $officerLevel == 5){
|
||||
$opposeWarPowerMultiply *= 0.95;
|
||||
}
|
||||
else if(2 <= $genLevel && $genLevel <= 4 && $generalNo == $this->getCityVar('officer'.$genLevel)){
|
||||
else if(2 <= $officerLevel && $officerLevel <= 4 && $officerCity == $cityID){
|
||||
$opposeWarPowerMultiply *= 0.95;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -38,7 +38,8 @@ CREATE TABLE `general` (
|
||||
`dex3` INT(8) NOT NULL DEFAULT '0',
|
||||
`dex4` INT(8) NOT NULL DEFAULT '0',
|
||||
`dex5` INT(8) NOT NULL DEFAULT '0',
|
||||
`level` INT(2) NOT NULL DEFAULT '0',
|
||||
`officer_level` INT(2) NOT NULL DEFAULT '0',
|
||||
`officer_city` INT(4) NOT NULL DEFAULT '0',
|
||||
`permission` ENUM('normal','auditor','ambassador') NULL DEFAULT 'normal',
|
||||
`gold` INT(6) NOT NULL DEFAULT '1000',
|
||||
`rice` INT(6) NOT NULL DEFAULT '1000',
|
||||
@@ -86,7 +87,8 @@ CREATE TABLE `general` (
|
||||
INDEX `no_member` (`owner`),
|
||||
INDEX `npc` (`npc`),
|
||||
INDEX `troop` (`troop`, `turntime`),
|
||||
INDEX `level` (`nation`, `level`),
|
||||
INDEX `officer_level` (`nation`, `officer_level`),
|
||||
INDEX `officer_city` (`officer_city`, `officer_level`)
|
||||
INDEX `name` (`name`)
|
||||
)
|
||||
DEFAULT CHARSET=utf8mb4
|
||||
@@ -155,14 +157,14 @@ ENGINE=Aria DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE `nation_turn` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`nation_id` INT(11) NOT NULL,
|
||||
`level` INT(4) NOT NULL,
|
||||
`officer_level` INT(4) NOT NULL,
|
||||
`turn_idx` INT(4) NOT NULL,
|
||||
`action` VARCHAR(16) NOT NULL,
|
||||
`arg` TEXT NULL DEFAULT NULL,
|
||||
`brief` TEXT NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `nation` (`nation_id`, `level`, `turn_idx`),
|
||||
INDEX `action` (`action`, `turn_idx`, `nation_id`, `level`)
|
||||
UNIQUE INDEX `nation` (`nation_id`, `officer_level`, `turn_idx`),
|
||||
INDEX `action` (`action`, `turn_idx`, `nation_id`, `officer_level`)
|
||||
)
|
||||
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
@@ -223,9 +225,6 @@ CREATE TABLE `city` (
|
||||
`def_max` INT(5) NOT NULL,
|
||||
`wall` INT(5) NOT NULL,
|
||||
`wall_max` INT(5) NOT NULL,
|
||||
`officer4` INT(4) NOT NULL DEFAULT '0',
|
||||
`officer3` INT(4) NOT NULL DEFAULT '0',
|
||||
`officer2` INT(4) NOT NULL DEFAULT '0',
|
||||
`officer4set` INT(1) NOT NULL DEFAULT '0',
|
||||
`officer3set` INT(1) NOT NULL DEFAULT '0',
|
||||
`officer2set` INT(1) NOT NULL DEFAULT '0',
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ $isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
//increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
increaseRefresh("내무부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, officer_level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
data-general-leadership="<?=$leadership?>"
|
||||
data-general-strength="<?=$strength?>"
|
||||
data-general-intel="<?=$intel?>"
|
||||
data-general-level="<?=$level?>"
|
||||
data-general-officer-level="<?=$officerLevel?>"
|
||||
data-general-leadership-bonus="<?=$leadershipBonus?>"
|
||||
<?php if($ourGeneral): ?>
|
||||
data-general-defence-train="<?=$defenceTrain?>"
|
||||
@@ -25,7 +25,7 @@
|
||||
<td><?=$leadershipText?><?=$leadershipBonusText?></td>
|
||||
<td><?=$strengthText?></td>
|
||||
<td><?=$intelText?></td>
|
||||
<td class="general_level"><?=$levelText?></td>
|
||||
<td class="general_officer_level"><?=$officerLevelText?></td>
|
||||
<?php if($ourGeneral): ?>
|
||||
<td><?=$defenceTrainText?></td>
|
||||
<td class="general_crew_type"><?=$crewTypeText?></td>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
data-general-leadership="<?=$general['leadership']?>"
|
||||
data-general-strength="<?=$general['strength']?>"
|
||||
data-general-intel="<?=$general['intel']?>"
|
||||
data-general-level="<?=$general['expLevelText']?>"
|
||||
data-general-exp-level="<?=$general['expLevelText']?>"
|
||||
data-general-leadership-bonus="<?=$general['lbonus']?>"
|
||||
data-general-defence-train="<?=$general['defence_train']?>"
|
||||
data-general-crew-type="<?=$general['crewtype']?>"
|
||||
|
||||
Reference in New Issue
Block a user