세력 일람 쿼리 최적화
This commit is contained in:
+52
-136
@@ -9,13 +9,10 @@ $userID = Session::getUserID();
|
|||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
increaseRefresh("세력일람", 2);
|
increaseRefresh("세력일람", 2);
|
||||||
|
|
||||||
$query = "select con,turntime from general where owner='{$userID}'";
|
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$me = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$con = checkLimit($me['con']);
|
$con = checkLimit($me['con']);
|
||||||
if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
||||||
@@ -43,97 +40,39 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
|||||||
<tr><td>세 력 일 람<br><?=closeButton()?></td></tr>
|
<tr><td>세 력 일 람<br><?=closeButton()?></td></tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
$query = "select nation,name,color,level,type,power,gennum,capital from nation order by power desc";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$count = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
for($i=1; $i <= $count; $i++) {
|
$nations = getAllNationStaticInfo();
|
||||||
$nation = MYDB_fetch_array($result); //국가정보
|
uasort($nations, function($lhs, $rhs){return $rhs['power']<=>$lhs['power'];});
|
||||||
|
|
||||||
$query = "select city,name from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
foreach($db->query('SELECT npc,name,city,nation,level,penalty,permission FROM general ORDER BY dedication DESC') as $general){
|
||||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$nationID = $general['nation'];
|
||||||
$citycount = MYDB_num_rows($cityresult);
|
if(!key_exists('generals', $nations[$nationID])){
|
||||||
|
$nations[$nationID]['generals'] = [];
|
||||||
|
}
|
||||||
|
$nations[$nationID]['generals'][] = $general;
|
||||||
|
}
|
||||||
|
|
||||||
$query = "select npc,name,city from general where nation='{$nation['nation']}' and level='12'";
|
foreach ($db->queryAllLists('SELECT city, name, nation FROM city') as [$cityID, $cityName, $nationID]) {
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
if(!key_exists('cities', $nations[$nationID])){
|
||||||
$level12 = MYDB_fetch_array($genresult);
|
$nations[$nationID]['cities'] = [];
|
||||||
|
}
|
||||||
|
$nations[$nationID]['cities'][$cityID] = $cityName;
|
||||||
|
}
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='11'";
|
foreach ($nations as $nation) {
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
if ($nation['nation'] == 0) {
|
||||||
$level11 = MYDB_fetch_array($genresult);
|
continue;
|
||||||
|
}
|
||||||
|
$generals = $nation['generals'];
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='10'";
|
$chiefs = [];
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level10 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='9'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level9 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='8'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level8 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='7'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level7 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='6'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level6 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and level='5'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level5 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select npc,name from general where nation='{$nation['nation']}' and npc != 5 order by dedication desc"; // 장수 목록
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$gencount = MYDB_num_rows($genresult);
|
|
||||||
|
|
||||||
if($level12['name'] == "") { $l12 = "-"; }
|
|
||||||
elseif($level12['npc'] >= 2) { $l12 = "<font color=cyan>{$level12['name']}</font>"; }
|
|
||||||
elseif($level12['npc'] == 1) { $l12 = "<font color=skyblue>{$level12['name']}</font>"; }
|
|
||||||
else { $l12 = $level12['name']; }
|
|
||||||
|
|
||||||
if($level11['name'] == "") { $l11 = "-"; }
|
|
||||||
elseif($level11['npc'] >= 2) { $l11 = "<font color=cyan>{$level11['name']}</font>"; }
|
|
||||||
elseif($level11['npc'] == 1) { $l11 = "<font color=skyblue>{$level11['name']}</font>"; }
|
|
||||||
else { $l11 = $level11['name']; }
|
|
||||||
|
|
||||||
if($level10['name'] == "") { $l10 = "-"; }
|
|
||||||
elseif($level10['npc'] >= 2) { $l10 = "<font color=cyan>{$level10['name']}</font>"; }
|
|
||||||
elseif($level10['npc'] == 1) { $l10 = "<font color=skyblue>{$level10['name']}</font>"; }
|
|
||||||
else { $l10 = $level10['name']; }
|
|
||||||
|
|
||||||
if($level9['name'] == "") { $l9 = "-"; }
|
|
||||||
elseif($level9['npc'] >= 2) { $l9 = "<font color=cyan>{$level9['name']}</font>"; }
|
|
||||||
elseif($level9['npc'] == 1) { $l9 = "<font color=skyblue>{$level9['name']}</font>"; }
|
|
||||||
else { $l9 = $level9['name']; }
|
|
||||||
|
|
||||||
if($level8['name'] == "") { $l8 = "-"; }
|
|
||||||
elseif($level8['npc'] >= 2) { $l8 = "<font color=cyan>{$level8['name']}</font>"; }
|
|
||||||
elseif($level8['npc'] == 1) { $l8 = "<font color=skyblue>{$level8['name']}</font>"; }
|
|
||||||
else { $l8 = $level8['name']; }
|
|
||||||
|
|
||||||
if($level7['name'] == "") { $l7 = "-"; }
|
|
||||||
elseif($level7['npc'] >= 2) { $l7 = "<font color=cyan>{$level7['name']}</font>"; }
|
|
||||||
elseif($level7['npc'] == 1) { $l7 = "<font color=skyblue>{$level7['name']}</font>"; }
|
|
||||||
else { $l7 = $level7['name']; }
|
|
||||||
|
|
||||||
if($level6['name'] == "") { $l6 = "-"; }
|
|
||||||
elseif($level6['npc'] >= 2) { $l6 = "<font color=cyan>{$level6['name']}</font>"; }
|
|
||||||
elseif($level6['npc'] == 1) { $l6 = "<font color=skyblue>{$level6['name']}</font>"; }
|
|
||||||
else { $l6 = $level6['name']; }
|
|
||||||
|
|
||||||
if($level5['name'] == "") { $l5 = "-"; }
|
|
||||||
elseif($level5['npc'] >= 2) { $l5 = "<font color=cyan>{$level5['name']}</font>"; }
|
|
||||||
elseif($level5['npc'] == 1) { $l5 = "<font color=skyblue>{$level5['name']}</font>"; }
|
|
||||||
else { $l5 = $level5['name']; }
|
|
||||||
|
|
||||||
$generals = $db->query('SELECT no,nation,npc,name,level,penalty,permission FROM general WHERE nation=%i ORDER BY no ASC', $nation['nation']);
|
|
||||||
$ambassadors = [];
|
$ambassadors = [];
|
||||||
$auditors = [];
|
$auditors = [];
|
||||||
foreach($generals as $general){
|
foreach($generals as $general){
|
||||||
|
$generalLevel = $general['level'];
|
||||||
|
if($generalLevel >= 5){
|
||||||
|
$chiefs[$generalLevel] = $general;
|
||||||
|
}
|
||||||
$generalPermission = checkSecretPermission($general, false);
|
$generalPermission = checkSecretPermission($general, false);
|
||||||
if($generalPermission == 4){
|
if($generalPermission == 4){
|
||||||
$ambassadors[] = $general['name'];
|
$ambassadors[] = $general['name'];
|
||||||
@@ -156,28 +95,19 @@ for($i=1; $i <= $count; $i++) {
|
|||||||
<td width=80 align=center id=bg1>국 력</td>
|
<td width=80 align=center id=bg1>국 력</td>
|
||||||
<td width=170 align=center>{$nation['power']}</td>
|
<td width=170 align=center>{$nation['power']}</td>
|
||||||
<td width=80 align=center id=bg1>장수 / 속령</td>
|
<td width=80 align=center id=bg1>장수 / 속령</td>
|
||||||
<td width=170 align=center>".count($generals)." / {$citycount}</td>
|
<td width=170 align=center>".count($generals)." / ".count($nation['cities'])."</td>
|
||||||
</tr>
|
";
|
||||||
<tr>
|
for($chiefLevel = 12; $chiefLevel >= 5; $chiefLevel--){
|
||||||
<td align=center id=bg1>".getLevelText(12, $nation['level'])."</td>
|
if($chiefLevel % 4 == 0){
|
||||||
<td align=center>$l12</td>
|
echo '</tr><tr>';
|
||||||
<td align=center id=bg1>".getLevelText(11, $nation['level'])."</td>
|
}
|
||||||
<td align=center>$l11</td>
|
$chief = $chiefs[$chiefLevel]??['name'=>'-','npc'=>0];
|
||||||
<td align=center id=bg1>".getLevelText(10, $nation['level'])."</td>
|
$levelText = getLevelText($chiefLevel, $nation['level']);
|
||||||
<td align=center>$l10</td>
|
$chiefText = getColoredName($chief['name'], $chief['npc']);
|
||||||
<td align=center id=bg1>".getLevelText( 9, $nation['level'])."</td>
|
echo "<td class='center bg1'>{$levelText}</td>
|
||||||
<td align=center>$l9</td>
|
<td class='center'>{$chiefText}</td>";
|
||||||
</tr>
|
}
|
||||||
<tr>
|
echo "</tr>
|
||||||
<td align=center id=bg1>".getLevelText( 8, $nation['level'])."</td>
|
|
||||||
<td align=center>$l8</td>
|
|
||||||
<td align=center id=bg1>".getLevelText( 7, $nation['level'])."</td>
|
|
||||||
<td align=center>$l7</td>
|
|
||||||
<td align=center id=bg1>".getLevelText( 6, $nation['level'])."</td>
|
|
||||||
<td align=center>$l6</td>
|
|
||||||
<td align=center id=bg1>".getLevelText( 5, $nation['level'])."</td>
|
|
||||||
<td align=center>$l5</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td align=center id=bg1>외교권자</td><td colspan=5>";
|
<td align=center id=bg1>외교권자</td><td colspan=5>";
|
||||||
echo join(', ', $ambassadors);
|
echo join(', ', $ambassadors);
|
||||||
@@ -189,20 +119,17 @@ for($i=1; $i <= $count; $i++) {
|
|||||||
if($nation['level'] > 0) {
|
if($nation['level'] > 0) {
|
||||||
echo "속령 일람 : ";
|
echo "속령 일람 : ";
|
||||||
|
|
||||||
for($j=0; $j < $citycount; $j++) {
|
foreach($nation['cities'] as $cityID => $cityName) {
|
||||||
$city = MYDB_fetch_array($cityresult);
|
if($cityID == $nation['capital']) {
|
||||||
if($city['city'] == $nation['capital']) {
|
echo "<font color=cyan>[{$cityName}]</font>, ";
|
||||||
echo "<font color=cyan>[{$city['name']}]</font>, ";
|
|
||||||
} else {
|
} else {
|
||||||
echo "{$city['name']}, ";
|
echo "{$cityName}, ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$query = "select name from city where city='{$level12['city']}'"; // 군주 위치 도시 이름
|
$cityName = CityConst::byID($chiefs[12]['city'])->name;
|
||||||
$cityResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($cityResult);
|
|
||||||
|
|
||||||
echo "현재 위치 : <font color=yellow>{$city['name']}</font>";
|
echo "현재 위치 : <font color=yellow>{$cityName}</font>";
|
||||||
}
|
}
|
||||||
echo"
|
echo"
|
||||||
</td>
|
</td>
|
||||||
@@ -222,14 +149,6 @@ for($i=1; $i <= $count; $i++) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//재야
|
//재야
|
||||||
$query = "select npc,name from general where nation='0'"; // 장수 목록
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$gencount = MYDB_num_rows($genresult);
|
|
||||||
|
|
||||||
$query = "select name from city where nation='0'"; // 도시 이름 목록
|
|
||||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$citycount = MYDB_num_rows($cityresult);
|
|
||||||
|
|
||||||
echo "
|
echo "
|
||||||
<table align=center width=1000 class='tb_layout bg2'>
|
<table align=center width=1000 class='tb_layout bg2'>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -238,26 +157,23 @@ echo "
|
|||||||
<tr>
|
<tr>
|
||||||
<td width=498 align=center> </td>
|
<td width=498 align=center> </td>
|
||||||
<td width=123 align=center id=bg1>장 수</td>
|
<td width=123 align=center id=bg1>장 수</td>
|
||||||
<td width=123 align=center>{$gencount}</td>
|
<td width=123 align=center>".count($nations[0]['generals'])."</td>
|
||||||
<td width=123 align=center id=bg1>속 령</td>
|
<td width=123 align=center id=bg1>속 령</td>
|
||||||
<td width=123 align=center>{$citycount}</td>
|
<td width=123 align=center>".count($nations[0]['cities'])."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5> 속령 일람 : ";
|
<td colspan=5> 속령 일람 : ";
|
||||||
for($j=0; $j < $citycount; $j++) {
|
foreach($nations[0]['cities'] as $cityName) {
|
||||||
$city = MYDB_fetch_array($cityresult);
|
echo "{$cityName}, ";
|
||||||
echo "{$city['name']}, ";
|
|
||||||
}
|
}
|
||||||
echo"
|
echo"
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5> 장수 일람 : ";
|
<td colspan=5> 장수 일람 : ";
|
||||||
for($j=0; $j < $gencount; $j++) {
|
foreach($nations[0]['generals'] as $general) {
|
||||||
$general = MYDB_fetch_array($genresult);
|
$generalText = getColoredName($general['name'], $general['npc']);
|
||||||
if($general['npc'] >= 2) { echo "<font color=cyan>{$general['name']}</font>, "; }
|
echo "{$generalText}, ";
|
||||||
elseif($general['npc'] == 1) { echo "<font color=skyblue>{$general['name']}</font>, "; }
|
|
||||||
else { echo "{$general['name']}, "; }
|
|
||||||
}
|
}
|
||||||
echo"
|
echo"
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
+11
-3
@@ -36,6 +36,10 @@ function getNationStaticInfo($nationID, $forceRefresh=false)
|
|||||||
if ($nationID === null) {
|
if ($nationID === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if($nationID === -1 && $nationList !== null){
|
||||||
|
return $nationList;
|
||||||
|
}
|
||||||
|
|
||||||
if($nationID === 0){
|
if($nationID === 0){
|
||||||
return [
|
return [
|
||||||
'nation'=>0,
|
'nation'=>0,
|
||||||
@@ -44,14 +48,18 @@ function getNationStaticInfo($nationID, $forceRefresh=false)
|
|||||||
'type'=>GameConst::$neutralNationType,
|
'type'=>GameConst::$neutralNationType,
|
||||||
'level'=>0,
|
'level'=>0,
|
||||||
'capital'=>0,
|
'capital'=>0,
|
||||||
'gennum'=>1
|
'gennum'=>1,
|
||||||
|
'power'=>1
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($nationList === null){
|
if($nationList === null){
|
||||||
$nationAll = DB::db()->query("select nation, name, color, type, level, capital, gennum from nation");
|
$nationAll = DB::db()->query("select nation, name, color, type, level, capital, gennum, power from nation");
|
||||||
$nationList = Util::convertArrayToDict($nationAll, "nation");
|
$nationList = Util::convertArrayToDict($nationAll, "nation");
|
||||||
$nationList[-1] = $nationAll;
|
}
|
||||||
|
|
||||||
|
if($nationID === -1){
|
||||||
|
return $nationList;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($nationList[$nationID])){
|
if(isset($nationList[$nationID])){
|
||||||
|
|||||||
@@ -638,12 +638,12 @@ function getNameColor(int $npcType):?string{
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function getColoredName(string $name, int $npcType):string{
|
function getColoredName(string $name, int $npcType):string{
|
||||||
$color = nameColor($npcType);
|
$color = getNameColor($npcType);
|
||||||
if($color === null){
|
if($color === null){
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
//TODO: font 폐기.
|
//TODO: font 폐기.
|
||||||
return "<font color='{$color}'>{$name}</font>";
|
return "<span style='color:{$color}'>{$name}</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function ConvertLog(?string $str, $type=1) : string {
|
function ConvertLog(?string $str, $type=1) : string {
|
||||||
|
|||||||
+24
-50
@@ -518,6 +518,7 @@ function postUpdateMonthly() {
|
|||||||
}
|
}
|
||||||
// 작위 업데이트
|
// 작위 업데이트
|
||||||
updateNationState();
|
updateNationState();
|
||||||
|
refreshNationStaticInfo();
|
||||||
// 천통여부 검사
|
// 천통여부 검사
|
||||||
checkEmperior();
|
checkEmperior();
|
||||||
//토너먼트 개시
|
//토너먼트 개시
|
||||||
@@ -942,8 +943,6 @@ function updateNationState() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$db->insertIgnore('nation_turn', $turnRows);
|
$db->insertIgnore('nation_turn', $turnRows);
|
||||||
|
|
||||||
refreshNationStaticInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$assemblerCnt = $assemblerCnts[$nation['nation']]??0;
|
$assemblerCnt = $assemblerCnts[$nation['nation']]??0;
|
||||||
@@ -983,7 +982,6 @@ function updateNationState() {
|
|||||||
$assemblerCnt += 1;
|
$assemblerCnt += 1;
|
||||||
$gameStor->assembler_id = $lastAssemblerID;
|
$gameStor->assembler_id = $lastAssemblerID;
|
||||||
}
|
}
|
||||||
refreshNationStaticInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1261,37 +1259,13 @@ function checkEmperior() {
|
|||||||
$poprate = round($city['totalpop']/$city['maxpop']*100, 2);
|
$poprate = round($city['totalpop']/$city['maxpop']*100, 2);
|
||||||
$poprate .= " %";
|
$poprate .= " %";
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='12'";
|
$chiefs = Util::convertArrayToDict(
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$db->query(
|
||||||
$level12 = MYDB_fetch_array($genresult);
|
'SELECT name,picture,belong,level FROM general WHERE nation=%i AND level >= 5',
|
||||||
|
$nation['nation']
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='11'";
|
),
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
'level'
|
||||||
$level11 = MYDB_fetch_array($genresult);
|
);
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='10'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level10 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='9'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level9 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='8'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level8 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='7'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level7 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='6'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level6 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='5'";
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$level5 = MYDB_fetch_array($genresult);
|
|
||||||
|
|
||||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
||||||
$oldNationGenerals = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
|
$oldNationGenerals = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
|
||||||
@@ -1407,22 +1381,22 @@ function checkEmperior() {
|
|||||||
'poprate'=>$poprate,
|
'poprate'=>$poprate,
|
||||||
'gold'=>$nation['gold'],
|
'gold'=>$nation['gold'],
|
||||||
'rice'=>$nation['rice'],
|
'rice'=>$nation['rice'],
|
||||||
'l12name'=>$level12['name'],
|
'l12name'=>$chiefs[12]['name'],
|
||||||
'l12pic'=>$level12['picture'],
|
'l12pic'=>$chiefs[12]['picture'],
|
||||||
'l11name'=>$level11['name'],
|
'l11name'=>$chiefs[11]['name'],
|
||||||
'l11pic'=>$level11['picture'],
|
'l11pic'=>$chiefs[11]['picture'],
|
||||||
'l10name'=>$level10['name'],
|
'l10name'=>$chiefs[10]['name'],
|
||||||
'l10pic'=>$level10['picture'],
|
'l10pic'=>$chiefs[10]['picture'],
|
||||||
'l9name'=>$level9['name'],
|
'l9name'=>$chiefs[9]['name'],
|
||||||
'l9pic'=>$level9['picture'],
|
'l9pic'=>$chiefs[9]['picture'],
|
||||||
'l8name'=>$level8['name'],
|
'l8name'=>$chiefs[8]['name'],
|
||||||
'l8pic'=>$level8['picture'],
|
'l8pic'=>$chiefs[8]['picture'],
|
||||||
'l7name'=>$level7['name'],
|
'l7name'=>$chiefs[7]['name'],
|
||||||
'l7pic'=>$level7['picture'],
|
'l7pic'=>$chiefs[7]['picture'],
|
||||||
'l6name'=>$level6['name'],
|
'l6name'=>$chiefs[6]['name'],
|
||||||
'l6pic'=>$level6['picture'],
|
'l6pic'=>$chiefs[6]['picture'],
|
||||||
'l5name'=>$level5['name'],
|
'l5name'=>$chiefs[5]['name'],
|
||||||
'l5pic'=>$level5['picture'],
|
'l5pic'=>$chiefs[5]['picture'],
|
||||||
'tiger'=>$tigerstr,
|
'tiger'=>$tigerstr,
|
||||||
'eagle'=>$eaglestr,
|
'eagle'=>$eaglestr,
|
||||||
'gen'=>$gen,
|
'gen'=>$gen,
|
||||||
|
|||||||
+16
-16
@@ -14,25 +14,25 @@ function processSpring() {
|
|||||||
//인구 증가
|
//인구 증가
|
||||||
popIncrease();
|
popIncrease();
|
||||||
// 1월엔 무조건 내정 1% 감소
|
// 1월엔 무조건 내정 1% 감소
|
||||||
$query = "update city set dead=0,agri=agri*0.99,comm=comm*0.99,secu=secu*0.99,def=def*0.99,wall=wall*0.99";
|
$db->update('city',[
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
'dead'=>0,
|
||||||
|
'agri'=>$db->sqleval('agri * 0.99'),
|
||||||
|
'comm'=>$db->sqleval('comm * 0.99'),
|
||||||
|
'secu'=>$db->sqleval('secu * 0.99'),
|
||||||
|
'def'=>$db->sqleval('def * 0.99'),
|
||||||
|
'wall'=>$db->sqleval('wall * 0.99'),
|
||||||
|
],true);
|
||||||
|
|
||||||
|
// > 10000 유지비 3%, > 1000 유지비 1%
|
||||||
// 유지비 1%
|
// 유지비 1%
|
||||||
$query = "update general set gold=gold*0.99 where gold>1000 and gold<=10000";
|
$db->update('general', [
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
'gold'=>$db->sqleval('IF(gold > 10000, gold * 0.97, gold * 0.99)')
|
||||||
// 유지비 3%
|
], 'gold > 1000');
|
||||||
$query = "update general set gold=gold*0.97 where gold>10000";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 유지비 1%
|
// > 100000 유지비 5%, > 100000 유지비 3%, > 1000 유지비 1%
|
||||||
$query = "update nation set gold=gold*0.99 where gold>1000 and gold<=10000";
|
$db->update('nation', [
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
'gold'=>$db->sqleval('IF(gold > 100000, gold * 0.95, IF(gold > 10000, gold * 0.97, gold * 0.99))')
|
||||||
// 유지비 3%
|
], 'gold > 1000');
|
||||||
$query = "update nation set gold=gold*0.97 where gold>10000 and gold<=100000";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
// 유지비 5%
|
|
||||||
$query = "update nation set gold=gold*0.95 where gold>100000";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year', 'month']);
|
$admin = $gameStor->getValues(['year', 'month']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user