왕조 일람에서 서버 정보와 국가 정보를 보관하도록 변경
This commit is contained in:
+43
-41
@@ -11,7 +11,7 @@ extractMissingPostToGlobals();
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("왕조일람", 2);
|
||||
increaseRefresh("왕조일람", 1);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -77,131 +77,133 @@ if ($select == 0) {
|
||||
<td align=center>{$emperior['l9name']}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>";
|
||||
</form>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=closeButton()?></td></tr>
|
||||
<tr><td><?=banner()?></td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>";
|
||||
}
|
||||
} else {
|
||||
$query = "select * from emperior where no='$select'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$emperior = MYDB_fetch_array($result);
|
||||
die();
|
||||
}
|
||||
|
||||
echo "
|
||||
$emperior = $db->queryFirstRow('SELECT * FROM emperior WHERE `no`=%i',$select);
|
||||
|
||||
?>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td bgcolor=skyblue align=center colspan=6>
|
||||
<form action=a_emperior.php method=get>
|
||||
<font size=5>{$emperior['phase']}</font>
|
||||
<font size=5><?=$emperior['phase']?></font>
|
||||
<input type=submit value='전체보기'>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>국 가 수<br>(최종 / 최대)</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['nation_count']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['nation_count']?></td>
|
||||
<td id=bg1 width=98 align=center>장 수 수<br>(최종 / 최대)</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['gen_count']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['gen_count']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>등 장 국 가</td>
|
||||
<td colspan=5>{$emperior['nation_name']}</td>
|
||||
<td colspan=5><?=$emperior['nation_name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>국가별 성향</td>
|
||||
<td colspan=5>{$emperior['nation_hist']}</td>
|
||||
<td colspan=5><?=$emperior['nation_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 성 격</td>
|
||||
<td colspan=5>{$emperior['personal_hist']}</td>
|
||||
<td colspan=5><?=$emperior['personal_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 특 기</td>
|
||||
<td colspan=5>{$emperior['special_hist']}</td>
|
||||
<td colspan=5><?=$emperior['special_hist']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center style=color:".newColor($emperior['color'])."; bgcolor={$emperior['color']} colspan=6>
|
||||
<font size=5>{$emperior['name']} ({$emperior['year']}年 {$emperior['month']}月)</font>
|
||||
<td align=center style=color:<?=newColor($emperior['color'])?>; bgcolor=<?=$emperior['color']?> colspan=6>
|
||||
<font size=5><?=$emperior['name']?> (<?=$emperior['year']?>年 <?=$emperior['month']?>月)</font>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>국 력</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['power']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['power']?></td>
|
||||
<td id=bg1 width=98 align=center>성 향</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['type']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['type']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 width=98 align=center>장 수</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['gennum']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['gennum']?></td>
|
||||
<td id=bg1 width=98 align=center>속 령</td>
|
||||
<td align=center width=398 colspan=2>{$emperior['citynum']}</td>
|
||||
<td align=center width=398 colspan=2><?=$emperior['citynum']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>총 인 구</td>
|
||||
<td align=center colspan=2>{$emperior['pop']}</td>
|
||||
<td align=center colspan=2><?=$emperior['pop']?></td>
|
||||
<td id=bg1 align=center>인 구 율</td>
|
||||
<td align=center colspan=2>{$emperior['poprate']}</td>
|
||||
<td align=center colspan=2><?=$emperior['poprate']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>국 고</td>
|
||||
<td align=center colspan=2>{$emperior['gold']}</td>
|
||||
<td align=center colspan=2><?=$emperior['gold']?></td>
|
||||
<td id=bg1 align=center>병 량</td>
|
||||
<td align=center colspan=2>{$emperior['rice']}</td>
|
||||
<td align=center colspan=2><?=$emperior['rice']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>황 제</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l12name']}</td>
|
||||
<td width=332><?=$emperior['l12name']?></td>
|
||||
<td id=bg1 align=center>승 상</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l11name']}</td>
|
||||
<td width=332><?=$emperior['l11name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>위 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l10name']}</td>
|
||||
<td width=332><?=$emperior['l10name']?></td>
|
||||
<td id=bg1 align=center>사 공</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l9name']}</td>
|
||||
<td width=332><?=$emperior['l9name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>표 기 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l8name']}</td>
|
||||
<td width=332><?=$emperior['l8name']?></td>
|
||||
<td id=bg1 align=center>태 위</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l7name']}</td>
|
||||
<td width=332><?=$emperior['l7name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>거 기 장 군</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l6name']}</td>
|
||||
<td width=332><?=$emperior['l6name']?></td>
|
||||
<td id=bg1 align=center>사 도</td>
|
||||
<td width=64> </td>
|
||||
<td width=332>{$emperior['l5name']}</td>
|
||||
<td width=332><?=$emperior['l5name']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>오 호 장 군</td>
|
||||
<td colspan=5>{$emperior['tiger']}</td>
|
||||
<td colspan=5><?=$emperior['tiger']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>건 안 칠 자</td>
|
||||
<td colspan=5>{$emperior['eagle']}</td>
|
||||
<td colspan=5><?=$emperior['eagle']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>장 수 들<br>(공헌도 순서)</td>
|
||||
<td colspan=5>{$emperior['gen']}</td>
|
||||
<td colspan=5><?=$emperior['gen']?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id=bg1 align=center>역 사 기 록</td>
|
||||
<td colspan=5>".ConvertLog($emperior['history'], 1)."</td>
|
||||
<td colspan=5><?=ConvertLog($emperior['history'], 1)?></td>
|
||||
</tr>
|
||||
</table>
|
||||
";
|
||||
}
|
||||
?>
|
||||
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=closeButton()?></td></tr>
|
||||
<tr><td><?=banner()?></td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
@@ -791,7 +791,10 @@ function getItemCost($weap) : int {
|
||||
|
||||
|
||||
|
||||
function ConvertLog(string $str, $type=1) : string {
|
||||
function ConvertLog(?string $str, $type=1) : string {
|
||||
if(!$str){
|
||||
return '';
|
||||
}
|
||||
//TODO: 이 함수는 없애야 한다. CSS로 대신하자
|
||||
if($type > 0) {
|
||||
$str = str_replace("<1>", "<font size=1>", $str);
|
||||
|
||||
+317
-288
@@ -943,53 +943,79 @@ function updateNationState() {
|
||||
function checkStatistic() {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
$nationHists = [];
|
||||
$specialHists = [];
|
||||
$personalHists = [];
|
||||
$specialHists2 = [0];
|
||||
$specialHists2 = [];
|
||||
$crewtypeHists = [];
|
||||
|
||||
$etc = '';
|
||||
|
||||
$query = "select avg(gold) as avggold, avg(rice) as avgrice, avg(dex0+dex10+dex20+dex30) as avgdex, max(dex0+dex10+dex20+dex30) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general['avggold'] = Util::round($general['avggold']);
|
||||
$general['avgrice'] = Util::round($general['avgrice']);
|
||||
$general['avgdex'] = Util::round($general['avgdex']);
|
||||
$general['avgexpded'] = Util::round($general['avgexpded']);
|
||||
$etc .= "평균 금/쌀 ({$general['avggold']}/{$general['avgrice']}), 평균/최고 숙련({$general['avgdex']}/{$general['maxdex']}), 평균/최고 경험공헌({$general['avgexpded']}/{$general['maxexpded']}), ";
|
||||
$auxData = [
|
||||
'generals'=>[],
|
||||
'nations'=>[],
|
||||
];
|
||||
|
||||
$query = "select min(tech) as mintech, max(tech) as maxtech, avg(tech) as avgtech, min(power) as minpower, max(power) as maxpower, avg(power) as avgpower from nation where level>0";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
$nation['avgtech'] = Util::round($nation['avgtech']);
|
||||
$nation['avgpower'] = Util::round($nation['avgpower']);
|
||||
$etc .= "최저/평균/최고 기술({$nation['mintech']}/{$nation['avgtech']}/{$nation['maxtech']}), ";
|
||||
$etc .= "최저/평균/최고 국력({$nation['minpower']}/{$nation['avgpower']}/{$nation['maxpower']}), ";
|
||||
$avgGeneral = $db->queryFirstRow(
|
||||
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex0+dex10+dex20+dex30) as avgdex,
|
||||
max(dex0+dex10+dex20+dex30) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded
|
||||
FROM general'
|
||||
);
|
||||
$auxData['generals']['avg'] = $avgGeneral;
|
||||
|
||||
$avgGeneral['avggold'] = Util::round($avgGeneral['avggold']);
|
||||
$avgGeneral['avgrice'] = Util::round($avgGeneral['avgrice']);
|
||||
$avgGeneral['avgdex'] = Util::round($avgGeneral['avgdex']);
|
||||
$avgGeneral['avgexpded'] = Util::round($avgGeneral['avgexpded']);
|
||||
$etc .= "평균 금/쌀 ({$avgGeneral['avggold']}/{$avgGeneral['avgrice']}), 평균/최고 숙련({$avgGeneral['avgdex']}/{$avgGeneral['maxdex']}), 평균/최고 경험공헌({$avgGeneral['avgexpded']}/{$avgGeneral['maxexpded']}), ";
|
||||
|
||||
$avgNation = $db->queryFirstRow(
|
||||
'SELECT min(tech) as mintech, max(tech) as maxtech, avg(tech) as avgtech,
|
||||
min(power) as minpower, max(power) as maxpower, avg(power) as avgpower from nation where level>0');
|
||||
$auxData['nations']['avg'] = $avgNation;
|
||||
|
||||
$avgNation['avgtech'] = Util::round($avgNation['avgtech']);
|
||||
$avgNation['avgpower'] = Util::round($avgNation['avgpower']);
|
||||
$etc .= "최저/평균/최고 기술({$avgNation['mintech']}/{$avgNation['avgtech']}/{$avgNation['maxtech']}), ";
|
||||
$etc .= "최저/평균/최고 국력({$avgNation['minpower']}/{$avgNation['avgpower']}/{$avgNation['maxpower']}), ";
|
||||
|
||||
$nationName = '';
|
||||
$power_hist = '';
|
||||
$powerHist = '';
|
||||
|
||||
$query = "select nation,name,type,power,gennum,round((gold+rice)/100) as goldrice from nation where level>0 order by power desc";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nationCount = MYDB_num_rows($result);
|
||||
for($i=0; $i < $nationCount; $i++) {
|
||||
$nation = MYDB_fetch_array($result);
|
||||
$nations = Util::convertArrayToDict(
|
||||
$db->query(
|
||||
'SELECT nation,name,type,power,gennum,gold+rice as goldrice from nation where level>0 order by power desc', 'nation'
|
||||
),
|
||||
'nation'
|
||||
);
|
||||
$nationCount = count($nations);
|
||||
|
||||
$query = "select sum(leader+power+intel) as abil,round(sum(gold+rice)/100) as goldrice,round(sum(dex0+dex10+dex20+dex30)/1000) as dex,round(sum(experience+dedication)/100) as expded from general where nation='{$nation['nation']}'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result2);
|
||||
$nationGeneralInfos = Util::convertArrayToDict(
|
||||
$db->query(
|
||||
'SELECT nation, sum(leader+power+intel) as abil,sum(gold+rice) as goldrice,
|
||||
sum(dex0+dex10+dex20+dex30) as dex,sum(experience+dedication) as expded
|
||||
from general GROUP BY nation'
|
||||
),
|
||||
'nation'
|
||||
);
|
||||
|
||||
$query = "select count(*) as cnt,round(sum(pop)/100) as pop,round(sum(pop2)/100) as pop2 from city where nation='{$nation['nation']}'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result2);
|
||||
$nationCityInfos = Util::convertArrayToDict(
|
||||
$db->query('SELECT nation, count(*) as cnt, sum(pop) as pop,sum(pop2) as pop2 from city GROUP BY nation'),
|
||||
'nation'
|
||||
);
|
||||
|
||||
foreach($nations as $nationNo=>&$nation) {
|
||||
$general = $nationGeneralInfos[$nationNo];
|
||||
$city = $nationCityInfos[$nationNo];
|
||||
|
||||
$nation['generalInfo'] = $general;
|
||||
$nation['cityInfo'] = $city;
|
||||
|
||||
$nationName .= $nation['name'].'('.getNationType($nation['type']).'), ';
|
||||
$power_hist .= "{$nation['name']}({$nation['power']}/{$nation['gennum']}/{$city['cnt']}/{$city['pop']}/{$city['pop2']}/{$nation['goldrice']}/{$general['goldrice']}/{$general['abil']}/{$general['dex']}/{$general['expded']}), ";
|
||||
$powerHist .= "{$nation['name']}({$nation['power']}/{$nation['gennum']}/{$city['cnt']}/{$city['pop']}/{$city['pop2']}/{$nation['goldrice']}/{$general['goldrice']}/{$general['abil']}/{$general['dex']}/{$general['expded']}), ";
|
||||
|
||||
if(!isset($nationHists[$nation['type']])){
|
||||
$nationHists[$nation['type']] = 0;
|
||||
@@ -997,26 +1023,21 @@ function checkStatistic() {
|
||||
$nationHists[$nation['type']]++;
|
||||
}
|
||||
|
||||
$auxData['nations']['all'] = $nations;
|
||||
|
||||
$nationHist = '';
|
||||
for($i=1; $i <= 13; $i++) {
|
||||
if(!Util::array_get($nationHists[$i])) { $nationHists[$i] = '-'; }
|
||||
$nationHist .= getNationType($i)."({$nationHists[$i]}), ";
|
||||
}
|
||||
|
||||
$query = "select no from general where npc <= 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$genCount = MYDB_num_rows($result);
|
||||
$generals = $db->query('SELECT `no`,npc,personal,special,special2,crewtype FROM general');
|
||||
|
||||
$query = "select no from general where npc > 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$npcCount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select personal,special,special2 from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$generalCount = MYDB_num_rows($result);
|
||||
for($i=0; $i < $generalCount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$genCount = 0;
|
||||
$npcCount = 0;
|
||||
$generalCount = count($generals);
|
||||
|
||||
foreach($generals as $general) {
|
||||
if(!isset($personalHists[$general['personal']])){
|
||||
$personalHists[$general['personal']] = 0;
|
||||
}
|
||||
@@ -1029,70 +1050,73 @@ function checkStatistic() {
|
||||
$specialHists2[$general['special2']] = 0;
|
||||
}
|
||||
|
||||
if($general['npc'] < 2){
|
||||
$genCount+=1;
|
||||
}
|
||||
else{
|
||||
$npcCount+=1;
|
||||
}
|
||||
|
||||
$personalHists[$general['personal']]++;
|
||||
$specialHists[$general['special']]++;
|
||||
$specialHists2[$general['special2']]++;
|
||||
}
|
||||
|
||||
foreach($db->queryAllLists(
|
||||
'SELECT crewtype, count(crewtype) AS cnt FROM general WHERE crew>=100 OR deathnum>0 GROUP BY crewtype'
|
||||
) as [$crewtype, $cnt]
|
||||
){
|
||||
$crewtypeHists[$crewtype] = $cnt;
|
||||
}
|
||||
|
||||
$auxData['generals']['hists'] = [
|
||||
'personal' => $personalHists,
|
||||
'special' => $specialHists,
|
||||
'special2' => $specialHists2,
|
||||
'crewtype' => $crewtypeHists,
|
||||
'userCnt' => $genCount,
|
||||
'npcCnt' => $npcCount,
|
||||
];
|
||||
|
||||
$generalCountStr = "{$generalCount}({$genCount}+{$npcCount})";
|
||||
|
||||
$personalHist = '';
|
||||
for($i=0; $i < 11; $i++) {
|
||||
if(!Util::array_get($personalHists[$i])) { $personalHists[$i] = '-'; }
|
||||
$personalHist .= getGenChar($i)."({$personalHists[$i]}), ";
|
||||
}
|
||||
$specialHist = '';
|
||||
for($i=0; $i < 40; $i++) {
|
||||
$call = getGenSpecial($i);
|
||||
if($call) {
|
||||
if(!Util::array_get($specialHists[$i])) { $specialHists[$i] = '-'; }
|
||||
$personalHistStr = join(', ', array_map(function($histPair){
|
||||
[$histKey, $cnt] = $histPair;
|
||||
return getGenChar($histKey).'('.$cnt.')';
|
||||
}, Util::convertDictToArray($personalHists)));
|
||||
|
||||
$specialHist .= $call."({$specialHists[$i]}), ";
|
||||
}
|
||||
}
|
||||
$specialHist .= '// ';
|
||||
$specialHist .= "-({$specialHists2[0]}), ";
|
||||
for($i=40; $i < 80; $i++) {
|
||||
$call = getGenSpecial($i);
|
||||
if($call) {
|
||||
if(!Util::array_get($specialHists2[$i])) { $specialHists2[$i] = '-'; }
|
||||
$specialHistsStr = join(', ', array_map(function($histPair){
|
||||
[$histKey, $cnt] = $histPair;
|
||||
return getGenSpecial($histKey).'('.$cnt.')';
|
||||
}, Util::convertDictToArray($specialHists)));
|
||||
|
||||
$specialHist .= $call."({$specialHists2[$i]}), ";
|
||||
}
|
||||
}
|
||||
$specialHists2Str = join(', ', array_map(function($histPair){
|
||||
[$histKey, $cnt] = $histPair;
|
||||
return getGenSpecial($histKey).'('.$cnt.')';
|
||||
}, Util::convertDictToArray($specialHists2)));
|
||||
|
||||
$crewtype = '';
|
||||
$types = array(0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43);
|
||||
$count = count($types);
|
||||
foreach(GameUnitConst::all() as $unit){
|
||||
$userCnt = DB::db()->queryFirstField(
|
||||
"SELECT count(*) as type from general where crewtype=%i and crew>=100",
|
||||
$unit->id
|
||||
);
|
||||
$crewtype .= "{$unit->name}({$userCnt}), ";
|
||||
}
|
||||
for($i=0; $i < $count; $i++) {
|
||||
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$specialHistsAllStr = "$specialHistsStr // $specialHists2Str";
|
||||
|
||||
|
||||
}
|
||||
$crewtypeHistsStr = join(', ', array_map(function($histPair){
|
||||
[$histKey, $cnt] = $histPair;
|
||||
return getGenSpecial($histKey).'('.$cnt.')';
|
||||
}, Util::convertDictToArray($crewtypeHists)));
|
||||
|
||||
$db->insert('statistic', [
|
||||
'year'=>$admin['year'],
|
||||
'month'=>$admin['month'],
|
||||
'nation_count'=>$nationCount,
|
||||
'nation_name'=>$nationName,
|
||||
'nation_hist'=>$nationHist,
|
||||
'gen_count'=>$generalCountStr,
|
||||
'personal_hist'=>$personalHistStr,
|
||||
'special_hist'=>$specialHistsAllStr,
|
||||
'power_hist'=>$powerHist,
|
||||
'crewtype'=>$crewtypeHistsStr,
|
||||
'etc'=>$etc,
|
||||
'aux'=>Json::encode($auxData)
|
||||
]);
|
||||
|
||||
|
||||
$query = "
|
||||
insert into statistic (
|
||||
year, month,
|
||||
nation_count, nation_name, nation_hist,
|
||||
gen_count, personal_hist, special_hist, power_hist,
|
||||
crewtype, etc
|
||||
) values (
|
||||
'{$admin['year']}', '{$admin['month']}',
|
||||
'$nationCount', '$nationName', '$nationHist',
|
||||
'$generalCountStr', '$personalHist', '$specialHist', '$power_hist',
|
||||
'$crewtype', '$etc'
|
||||
)";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
function checkEmperior() {
|
||||
@@ -1106,204 +1130,209 @@ function checkEmperior() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
|
||||
if($count == 1 && $admin['isunited'] == 0) {
|
||||
$nation = MYDB_fetch_array($result);
|
||||
if ($count != 1 || $admin['isunited'] != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query = "select city from city where nation='{$nation['nation']}'";
|
||||
checkStatistic();
|
||||
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select city from city where nation='{$nation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$allcount = MYDB_num_rows($result);
|
||||
|
||||
if($count == $allcount) {
|
||||
|
||||
$josaYi = JosaUtil::pick($nation['name'], '이');
|
||||
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일");
|
||||
|
||||
$gameStor->isunited = 2;
|
||||
$gameStor->conlimit = $gameStor->conlimit*100;
|
||||
|
||||
$query = "select no from general where npc<2 and age>=40";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
|
||||
$query = "select city from city";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$allcount = MYDB_num_rows($result);
|
||||
|
||||
if($count == $allcount) {
|
||||
|
||||
$josaYi = JosaUtil::pick($nation['name'], '이');
|
||||
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일");
|
||||
|
||||
$gameStor->isunited = 2;
|
||||
$gameStor->conlimit = $gameStor->conlimit*100;
|
||||
|
||||
$query = "select no from general where npc<2 and age>=40";
|
||||
$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);
|
||||
CheckHall($general['no']);
|
||||
}
|
||||
|
||||
$query = "select nation,name,type,color,gold,rice,power,gennum from nation where nation='{$nation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select SUM(pop) as totalpop,SUM(pop2) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
$pop = "{$city['totalpop']} / {$city['maxpop']}";
|
||||
$poprate = round($city['totalpop']/$city['maxpop']*100, 2);
|
||||
$poprate .= " %";
|
||||
|
||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='12'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$level12 = MYDB_fetch_array($genresult);
|
||||
|
||||
$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),"");
|
||||
$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']);
|
||||
$oldNationGenerals = $db->query('SELECT * FROM general WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['generals'] = $oldNationGenerals;
|
||||
|
||||
$query = "select name,picture,killnum from general where nation='{$nation['nation']}' order by killnum desc limit 5"; // 오호장군
|
||||
$tigerresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$tigernum = MYDB_num_rows($tigerresult);
|
||||
$tigerstr = '';
|
||||
for($i=0; $i < $tigernum; $i++) {
|
||||
$tiger = MYDB_fetch_array($tigerresult);
|
||||
if($tiger['killnum'] > 0) {
|
||||
$tigerstr .= "{$tiger['name']}【{$tiger['killnum']}】, ";
|
||||
}
|
||||
}
|
||||
|
||||
$query = "select name,picture,firenum from general where nation='{$nation['nation']}' order by firenum desc limit 7"; // 건안칠자
|
||||
$eagleresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$eaglenum = MYDB_num_rows($eagleresult);
|
||||
$eaglestr = '';
|
||||
for($i=0; $i < $eaglenum; $i++) {
|
||||
$eagle = MYDB_fetch_array($eagleresult);
|
||||
if($eagle['firenum'] > 0) {
|
||||
$eaglestr .= "{$eagle['name']}【{$eagle['firenum']}】, ";
|
||||
}
|
||||
}
|
||||
|
||||
$log = ["<C>●</>{$admin['year']}년 {$admin['month']}월: <D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다."];
|
||||
|
||||
$query = "select no,name from general where nation='{$nation['nation']}' order by dedication desc";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gen = '';
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$gen .= "{$general['name']}, ";
|
||||
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
$nation['type'] = getNationType($nation['type']);
|
||||
|
||||
$query = "select MAX(nation_count) as nc,MAX(gen_count) as gc from statistic";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$stat = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select count(*) as cnt from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_fetch_array($result);
|
||||
|
||||
$statNC = "1 / {$stat['nc']}";
|
||||
$statGC = "{$gencount['cnt']} / {$stat['gc']}";
|
||||
|
||||
$query = "select nation_count,nation_name,nation_hist from statistic where nation_count='{$stat['nc']}' limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$statNation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select gen_count,personal_hist,special_hist from statistic order by no desc limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$statGeneral = MYDB_fetch_array($result);
|
||||
|
||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['generals'] = $db->query('SELECT * FROM general WHERE nation=%i', $nation['nation']);
|
||||
|
||||
$db->insert('ng_old_nations', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation'=>$nation['nation'],
|
||||
'data'=>Json::encode($oldNation)
|
||||
]);
|
||||
|
||||
$noNationGeneral = $db->query('SELECT * FROM general WHERE nation=0');
|
||||
$db->insert('ng_old_nations', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation'=>0,
|
||||
'data'=>Json::encode($noNationGeneral)
|
||||
]);
|
||||
|
||||
$nationHistory = DB::db()->queryFirstField('SELECT `history` FROM `nation` WHERE `nation` = %i', $nation['nation']);
|
||||
|
||||
$db->insert('emperior', [
|
||||
'phase'=>'-',
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation_count'=>$statNC,
|
||||
'nation_name'=>$statNation['nation_name'],
|
||||
'nation_hist'=>$statNation['nation_hist'],
|
||||
'gen_count'=>$statGC,
|
||||
'personal_hist'=>$statGeneral['personal_hist'],
|
||||
'special_hist'=>$statGeneral['special_hist'],
|
||||
'name'=>$nation['name'],
|
||||
'type'=>$nation['type'],
|
||||
'color'=>$nation['color'],
|
||||
'year'=>$admin['year'],
|
||||
'month'=>$admin['month'],
|
||||
'power'=>$nation['power'],
|
||||
'gennum'=>$nation['gennum'],
|
||||
'citynum'=>$allcount,
|
||||
'pop'=>$pop,
|
||||
'poprate'=>$poprate,
|
||||
'gold'=>$nation['gold'],
|
||||
'rice'=>$nation['rice'],
|
||||
'l12name'=>$level12['name'],
|
||||
'l12pic'=>$level12['picture'],
|
||||
'l11name'=>$level11['name'],
|
||||
'l11pic'=>$level11['picture'],
|
||||
'l10name'=>$level10['name'],
|
||||
'l10pic'=>$level10['picture'],
|
||||
'l9name'=>$level9['name'],
|
||||
'l9pic'=>$level9['picture'],
|
||||
'l8name'=>$level8['name'],
|
||||
'l8pic'=>$level8['picture'],
|
||||
'l7name'=>$level7['name'],
|
||||
'l7pic'=>$level7['picture'],
|
||||
'l6name'=>$level6['name'],
|
||||
'l6pic'=>$level6['picture'],
|
||||
'l5name'=>$level5['name'],
|
||||
'l5pic'=>$level5['picture'],
|
||||
'tiger'=>$tigerstr,
|
||||
'eagle'=>$eaglestr,
|
||||
'gen'=>$gen,
|
||||
'history'=>$nationHistory
|
||||
]);
|
||||
|
||||
$history = ["<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다."];
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
//연감 월결산
|
||||
LogHistory();
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
CheckHall($general['no']);
|
||||
}
|
||||
|
||||
$query = "select nation,name,type,color,gold,rice,power,gennum from nation where nation='{$nation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select SUM(pop) as totalpop,SUM(pop2) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
$pop = "{$city['totalpop']} / {$city['maxpop']}";
|
||||
$poprate = round($city['totalpop']/$city['maxpop']*100, 2);
|
||||
$poprate .= " %";
|
||||
|
||||
$query = "select name,picture,belong from general where nation='{$nation['nation']}' and level='12'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$level12 = MYDB_fetch_array($genresult);
|
||||
|
||||
$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),"");
|
||||
$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']);
|
||||
$oldNationGenerals = $db->query('SELECT * FROM general WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['generals'] = $oldNationGenerals;
|
||||
|
||||
$query = "select name,picture,killnum from general where nation='{$nation['nation']}' order by killnum desc limit 5"; // 오호장군
|
||||
$tigerresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$tigernum = MYDB_num_rows($tigerresult);
|
||||
$tigerstr = '';
|
||||
for($i=0; $i < $tigernum; $i++) {
|
||||
$tiger = MYDB_fetch_array($tigerresult);
|
||||
if($tiger['killnum'] > 0) {
|
||||
$tigerstr .= "{$tiger['name']}【{$tiger['killnum']}】, ";
|
||||
}
|
||||
}
|
||||
|
||||
$query = "select name,picture,firenum from general where nation='{$nation['nation']}' order by firenum desc limit 7"; // 건안칠자
|
||||
$eagleresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$eaglenum = MYDB_num_rows($eagleresult);
|
||||
$eaglestr = '';
|
||||
for($i=0; $i < $eaglenum; $i++) {
|
||||
$eagle = MYDB_fetch_array($eagleresult);
|
||||
if($eagle['firenum'] > 0) {
|
||||
$eaglestr .= "{$eagle['name']}【{$eagle['firenum']}】, ";
|
||||
}
|
||||
}
|
||||
|
||||
$log = ["<C>●</>{$admin['year']}년 {$admin['month']}월: <D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다."];
|
||||
|
||||
$query = "select no,name from general where nation='{$nation['nation']}' order by dedication desc";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$gen = '';
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
$gen .= "{$general['name']}, ";
|
||||
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
$nation['type'] = getNationType($nation['type']);
|
||||
|
||||
$query = "select MAX(nation_count) as nc,MAX(gen_count) as gc from statistic";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$stat = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select count(*) as cnt from general";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_fetch_array($result);
|
||||
|
||||
$statNC = "1 / {$stat['nc']}";
|
||||
$statGC = "{$gencount['cnt']} / {$stat['gc']}";
|
||||
|
||||
$query = "select nation_count,nation_name,nation_hist from statistic where nation_count='{$stat['nc']}' limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$statNation = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select gen_count,personal_hist,special_hist,aux from statistic order by no desc limit 0,1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$statGeneral = MYDB_fetch_array($result);
|
||||
|
||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nation['nation']);
|
||||
$oldNation['generals'] = $db->query('SELECT * FROM general WHERE nation=%i', $nation['nation']);
|
||||
|
||||
$db->insert('ng_old_nations', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation'=>$nation['nation'],
|
||||
'data'=>Json::encode($oldNation)
|
||||
]);
|
||||
|
||||
$noNationGeneral = $db->query('SELECT * FROM general WHERE nation=0');
|
||||
$db->insert('ng_old_nations', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation'=>0,
|
||||
'data'=>Json::encode($noNationGeneral)
|
||||
]);
|
||||
|
||||
$nationHistory = DB::db()->queryFirstField('SELECT `history` FROM `nation` WHERE `nation` = %i', $nation['nation']);
|
||||
|
||||
$db->insert('emperior', [
|
||||
'phase'=>'-',
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation_count'=>$statNC,
|
||||
'nation_name'=>$statNation['nation_name'],
|
||||
'nation_hist'=>$statNation['nation_hist'],
|
||||
'gen_count'=>$statGC,
|
||||
'personal_hist'=>$statGeneral['personal_hist'],
|
||||
'special_hist'=>$statGeneral['special_hist'],
|
||||
'name'=>$nation['name'],
|
||||
'type'=>$nation['type'],
|
||||
'color'=>$nation['color'],
|
||||
'year'=>$admin['year'],
|
||||
'month'=>$admin['month'],
|
||||
'power'=>$nation['power'],
|
||||
'gennum'=>$nation['gennum'],
|
||||
'citynum'=>$allcount,
|
||||
'pop'=>$pop,
|
||||
'poprate'=>$poprate,
|
||||
'gold'=>$nation['gold'],
|
||||
'rice'=>$nation['rice'],
|
||||
'l12name'=>$level12['name'],
|
||||
'l12pic'=>$level12['picture'],
|
||||
'l11name'=>$level11['name'],
|
||||
'l11pic'=>$level11['picture'],
|
||||
'l10name'=>$level10['name'],
|
||||
'l10pic'=>$level10['picture'],
|
||||
'l9name'=>$level9['name'],
|
||||
'l9pic'=>$level9['picture'],
|
||||
'l8name'=>$level8['name'],
|
||||
'l8pic'=>$level8['picture'],
|
||||
'l7name'=>$level7['name'],
|
||||
'l7pic'=>$level7['picture'],
|
||||
'l6name'=>$level6['name'],
|
||||
'l6pic'=>$level6['picture'],
|
||||
'l5name'=>$level5['name'],
|
||||
'l5pic'=>$level5['picture'],
|
||||
'tiger'=>$tigerstr,
|
||||
'eagle'=>$eaglestr,
|
||||
'gen'=>$gen,
|
||||
'history'=>$nationHistory,
|
||||
'aux'=>$statGeneral['aux']
|
||||
]);
|
||||
|
||||
$history = ["<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다."];
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
//연감 월결산
|
||||
LogHistory();
|
||||
}
|
||||
}
|
||||
|
||||
+67
-57
@@ -363,7 +363,7 @@ ENGINE=InnoDB;
|
||||
## 명전 테이블
|
||||
###########################################################################
|
||||
|
||||
CREATE TABLE if not exists `ng_hall` (
|
||||
CREATE TABLE IF NOT EXISTS `ng_hall` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL,
|
||||
`scenario` INT(11) NOT NULL,
|
||||
@@ -385,7 +385,7 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED;
|
||||
## 왕조 테이블
|
||||
###########################################################################
|
||||
|
||||
CREATE TABLE if not exists `ng_games` (
|
||||
CREATE TABLE IF NOT EXISTS `ng_games` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL,
|
||||
`date` DATETIME NOT NULL,
|
||||
@@ -399,7 +399,7 @@ CREATE TABLE if not exists `ng_games` (
|
||||
)
|
||||
ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE if not exists `ng_old_nations` (
|
||||
CREATE TABLE IF NOT EXISTS `ng_old_nations` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL DEFAULT '0',
|
||||
`nation` INT(11) NOT NULL DEFAULT '0',
|
||||
@@ -410,42 +410,51 @@ CREATE TABLE if not exists `ng_old_nations` (
|
||||
)
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSED;
|
||||
|
||||
create table if not exists emperior (
|
||||
no int(6) not null auto_increment,
|
||||
phase char(255) default '',
|
||||
nation_count char(64) default '',
|
||||
nation_name text default '',
|
||||
nation_hist text default '',
|
||||
gen_count char(64) default '',
|
||||
personal_hist text default '',
|
||||
special_hist text default '',
|
||||
name char(64) default '',
|
||||
type char(64) default '',
|
||||
color char(7) default '',
|
||||
year int(4) default 0,
|
||||
month int(2) default 0,
|
||||
power int(8) default 0,
|
||||
gennum int(3) default 0,
|
||||
citynum int(3) default 0,
|
||||
pop char(255) default 0,
|
||||
poprate char(255) default '',
|
||||
gold int(9) default 0,
|
||||
rice int(9) default 0,
|
||||
l12name char(64) default '', l12pic char(32) default '',
|
||||
l11name char(64) default '', l11pic char(32) default '',
|
||||
l10name char(64) default '', l10pic char(32) default '',
|
||||
l9name char(64) default '', l9pic char(32) default '',
|
||||
l8name char(64) default '', l8pic char(32) default '',
|
||||
l7name char(64) default '', l7pic char(32) default '',
|
||||
l6name char(64) default '', l6pic char(32) default '',
|
||||
l5name char(64) default '', l5pic char(32) default '',
|
||||
tiger char(64) default '',
|
||||
eagle char(64) default '',
|
||||
gen text default '',
|
||||
history mediumtext default '',
|
||||
|
||||
PRIMARY KEY (no)
|
||||
) ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE IF NOT EXISTS `emperior` (
|
||||
`no` INT(6) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NULL DEFAULT '',
|
||||
`phase` CHAR(255) NULL DEFAULT '',
|
||||
`nation_count` CHAR(64) NULL DEFAULT '',
|
||||
`nation_name` TEXT NULL DEFAULT '',
|
||||
`nation_hist` TEXT NULL DEFAULT '',
|
||||
`gen_count` CHAR(64) NULL DEFAULT '',
|
||||
`personal_hist` TEXT NULL DEFAULT '',
|
||||
`special_hist` TEXT NULL DEFAULT '',
|
||||
`name` CHAR(64) NULL DEFAULT '',
|
||||
`type` CHAR(64) NULL DEFAULT '',
|
||||
`color` CHAR(7) NULL DEFAULT '',
|
||||
`year` INT(4) NULL DEFAULT '0',
|
||||
`month` INT(2) NULL DEFAULT '0',
|
||||
`power` INT(8) NULL DEFAULT '0',
|
||||
`gennum` INT(3) NULL DEFAULT '0',
|
||||
`citynum` INT(3) NULL DEFAULT '0',
|
||||
`pop` CHAR(255) NULL DEFAULT '0',
|
||||
`poprate` CHAR(255) NULL DEFAULT '',
|
||||
`gold` INT(9) NULL DEFAULT '0',
|
||||
`rice` INT(9) NULL DEFAULT '0',
|
||||
`l12name` CHAR(64) NULL DEFAULT '',
|
||||
`l12pic` CHAR(32) NULL DEFAULT '',
|
||||
`l11name` CHAR(64) NULL DEFAULT '',
|
||||
`l11pic` CHAR(32) NULL DEFAULT '',
|
||||
`l10name` CHAR(64) NULL DEFAULT '',
|
||||
`l10pic` CHAR(32) NULL DEFAULT '',
|
||||
`l9name` CHAR(64) NULL DEFAULT '',
|
||||
`l9pic` CHAR(32) NULL DEFAULT '',
|
||||
`l8name` CHAR(64) NULL DEFAULT '',
|
||||
`l8pic` CHAR(32) NULL DEFAULT '',
|
||||
`l7name` CHAR(64) NULL DEFAULT '',
|
||||
`l7pic` CHAR(32) NULL DEFAULT '',
|
||||
`l6name` CHAR(64) NULL DEFAULT '',
|
||||
`l6pic` CHAR(32) NULL DEFAULT '',
|
||||
`l5name` CHAR(64) NULL DEFAULT '',
|
||||
`l5pic` CHAR(32) NULL DEFAULT '',
|
||||
`tiger` CHAR(64) NULL DEFAULT '',
|
||||
`eagle` CHAR(64) NULL DEFAULT '',
|
||||
`gen` TEXT NULL DEFAULT '',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`aux` MEDIUMTEXT NULL DEFAULT '' COMMENT 'json',
|
||||
PRIMARY KEY (`no`)
|
||||
) ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
###########################################################################
|
||||
## 외교 테이블
|
||||
@@ -513,27 +522,28 @@ create table auction (
|
||||
###########################################################################
|
||||
## 통계 테이블
|
||||
###########################################################################
|
||||
create table statistic (
|
||||
no int(6) not null auto_increment,
|
||||
year int(4) default 0,
|
||||
month int(2) default 0,
|
||||
nation_count int(2) default 0,
|
||||
nation_name text default '',
|
||||
nation_hist text default '',
|
||||
gen_count varchar(32) default '',
|
||||
personal_hist text default '',
|
||||
special_hist text default '',
|
||||
power_hist text default '',
|
||||
crewtype text default '',
|
||||
etc text default '',
|
||||
|
||||
PRIMARY KEY (no)
|
||||
) ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE `statistic` (
|
||||
`no` INT(6) NOT NULL AUTO_INCREMENT,
|
||||
`year` INT(4) NULL DEFAULT '0',
|
||||
`month` INT(2) NULL DEFAULT '0',
|
||||
`nation_count` INT(2) NULL DEFAULT '0',
|
||||
`nation_name` TEXT NULL DEFAULT '',
|
||||
`nation_hist` TEXT NULL DEFAULT '',
|
||||
`gen_count` VARCHAR(32) NULL DEFAULT '',
|
||||
`personal_hist` TEXT NULL DEFAULT '',
|
||||
`special_hist` TEXT NULL DEFAULT '',
|
||||
`power_hist` TEXT NULL DEFAULT '',
|
||||
`crewtype` TEXT NULL DEFAULT '',
|
||||
`etc` TEXT NULL DEFAULT '',
|
||||
`aux` TEXT NULL DEFAULT '' COMMENT 'json',
|
||||
PRIMARY KEY (`no`)
|
||||
)
|
||||
ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
###########################################################################
|
||||
## 연감 테이블
|
||||
###########################################################################
|
||||
CREATE TABLE if not exists `history` (
|
||||
CREATE TABLE IF NOT EXISTS `history` (
|
||||
`no` INT(6) NOT NULL AUTO_INCREMENT,
|
||||
`server_id` CHAR(20) NOT NULL DEFAULT '',
|
||||
`year` INT(4) NULL DEFAULT '0',
|
||||
@@ -621,7 +631,7 @@ ENGINE=MyISAM;
|
||||
###################
|
||||
# KV storage
|
||||
###################
|
||||
CREATE TABLE if not exists `storage` (
|
||||
CREATE TABLE IF NOT EXISTS `storage` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`namespace` VARCHAR(40) NOT NULL,
|
||||
`key` VARCHAR(40) NOT NULL,
|
||||
|
||||
+11
-5
@@ -187,11 +187,11 @@ class Util extends \utilphp\util
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function mapWithDict($callback, $dict)
|
||||
public static function mapWithKey($callback, $dict)
|
||||
{
|
||||
$result = [];
|
||||
foreach (array_keys($dict) as $key) {
|
||||
$result[$key] = ($callback)($dict[$key]);
|
||||
$result[$key] = ($callback)($key, $dict[$key]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -208,13 +208,19 @@ class Util extends \utilphp\util
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function convertDictToArray($dict, $keys)
|
||||
public static function convertDictToArray($dict, bool $withKey=true)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$result[] = Util::array_get($dict[$key], null);
|
||||
foreach($dict as $key=>$value){
|
||||
if($withKey){
|
||||
$result[] = [$key, $value];
|
||||
}
|
||||
else{
|
||||
$result[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user