CityConst에서 참고 가능한 자료들은 CityConst를 이용하도록 수정
Scenario에서 __construct에서 꼭 다 할 필요는 없는 코드들을 뒤로 미룸.
This commit is contained in:
@@ -163,7 +163,7 @@ if($city['trade'] == 0) {
|
||||
echo "
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr>
|
||||
<td colspan=12 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 ".getRegion($city['region'])." | ".getCityLevel($city['level'])." 】 {$city['name']}</td>
|
||||
<td colspan=12 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=48 id=bg1>주민</td>
|
||||
|
||||
+1
-3
@@ -71,8 +71,6 @@ for($i=0; $i < $troopCount; $i++) {
|
||||
$troopName[$troop['troop']] = $troop['name'];
|
||||
}
|
||||
|
||||
$cityname = CityNameArray();
|
||||
|
||||
switch($type) {
|
||||
case 1: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by gold desc"; break;
|
||||
case 2: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by rice desc"; break;
|
||||
@@ -106,7 +104,7 @@ echo"
|
||||
</tr>";
|
||||
for($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
$city = $cityname[$general['city']];
|
||||
$city = CityConst::byID($general['city'])->name;
|
||||
$troop = $troopName[$general['troop']] == "" ? "-" : $troopName[$general['troop']];
|
||||
|
||||
if($general['level'] == 12) {
|
||||
|
||||
+25
-26
@@ -43,7 +43,6 @@ function out() {
|
||||
<br>
|
||||
|
||||
<?php
|
||||
$cityNames = CityNameArray();
|
||||
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -167,7 +166,7 @@ echo "
|
||||
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right id=bg1>".getLevel(12, $nation['level'])."</td>
|
||||
<td width=398>{$general['name']} 【{$cityNames[$general['city']]}】</td>
|
||||
<td width=398>{$general['name']} 【".CityConst::byID($general['city'])->name."】</td>
|
||||
<td width=98 align=right id=bg1>".getLevel(11, $nation['level'])."</td>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<td width=398>
|
||||
@@ -184,11 +183,11 @@ if($meLevel >= 5 && $nation['l11set'] == 0) {
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 11) {
|
||||
echo "<option style=color:red; selected value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:red; selected value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +199,7 @@ if($meLevel >= 5 && $nation['l11set'] == 0) {
|
||||
$query = "select name,city from general where nation='{$me['nation']}' and level='11'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
echo "{$general['name']} 【{$cityNames[$general['city']]}】";
|
||||
echo "{$general['name']} 【".CityConst::byID($general['city'])->name."】";
|
||||
}
|
||||
echo "
|
||||
</td>
|
||||
@@ -235,11 +234,11 @@ 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 value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:red; selected value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ for($i=10; $i >= $lv; $i--) {
|
||||
$query = "select name,city from general where nation='{$me['nation']}' and level={$i}";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
echo "{$general['name']} 【{$cityNames[$general['city']]}】";
|
||||
echo "{$general['name']} 【".CityConst::byID($general['city'])->name."】";
|
||||
}
|
||||
echo "</td></form>";
|
||||
if($i % 2 == 1) { echo "</tr>"; }
|
||||
@@ -284,7 +283,7 @@ if($meLevel >= 5) {
|
||||
if($region != 0) {
|
||||
echo "</optgroup>";
|
||||
}
|
||||
echo "<optgroup label=' 【 ".getRegion($city['region'])." 】 ' style=color:skyblue;>";
|
||||
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
|
||||
$region = $city['region'];
|
||||
}
|
||||
|
||||
@@ -304,11 +303,11 @@ if($meLevel >= 5) {
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 4) {
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +337,7 @@ if($meLevel >= 5) {
|
||||
if($region != 0) {
|
||||
echo "</optgroup>";
|
||||
}
|
||||
echo "<optgroup label=' 【 ".getRegion($city['region'])." 】 ' style=color:skyblue;>";
|
||||
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
|
||||
$region = $city['region'];
|
||||
}
|
||||
|
||||
@@ -358,11 +357,11 @@ if($meLevel >= 5) {
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 3) {
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,7 +391,7 @@ if($meLevel >= 5) {
|
||||
if($region != 0) {
|
||||
echo "</optgroup>";
|
||||
}
|
||||
echo "<optgroup label=' 【 ".getRegion($city['region'])." 】 ' style=color:skyblue;>";
|
||||
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
|
||||
$region = $city['region'];
|
||||
}
|
||||
|
||||
@@ -412,11 +411,11 @@ if($meLevel >= 5) {
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['level'] == 2) {
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:red; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} elseif($general['level'] > 1) {
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option style=color:orange; value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
} else {
|
||||
echo "<option value={$general['no']}>{$general['name']} 【{$cityNames[$general['city']]}】</option>";
|
||||
echo "<option value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,13 +468,13 @@ for($j=0; $j < $citycount; $j++) {
|
||||
if($region != $city['region']) {
|
||||
echo "
|
||||
<tr><td colspan=5 height=3 id=bg1></td></tr>
|
||||
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 ".getRegion($city['region'])." 】 </font></td></tr>";
|
||||
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 ".CityConst::$regionMap[$city['region']]." 】 </font></td></tr>";
|
||||
$region = $city['region'];
|
||||
}
|
||||
|
||||
$gen1['name'] = $gen1['name']==""?"-":$gen1['name']." ({$gen1['belong']}년) 【{$cityNames[$gen1['city']]}】";
|
||||
$gen2['name'] = $gen2['name']==""?"-":$gen2['name']." ({$gen2['belong']}년) 【{$cityNames[$gen2['city']]}】";
|
||||
$gen3['name'] = $gen3['name']==""?"-":$gen3['name']." ({$gen3['belong']}년) 【{$cityNames[$gen3['city']]}】";
|
||||
$gen1['name'] = $gen1['name']==""?"-":$gen1['name']." ({$gen1['belong']}년) 【".CityConst::byID($gen1['city'])->name."】";
|
||||
$gen2['name'] = $gen2['name']==""?"-":$gen2['name']." ({$gen2['belong']}년) 【".CityConst::byID($gen2['city'])->name."】";
|
||||
$gen3['name'] = $gen3['name']==""?"-":$gen3['name']." ({$gen3['belong']}년) 【".CityConst::byID($gen3['city'])->name."】";
|
||||
if($city['gen1set'] == 1) { $gen1['name'] = "<font color=orange>".$gen1['name']."</font>"; }
|
||||
if($city['gen2set'] == 1) { $gen2['name'] = "<font color=orange>".$gen2['name']."</font>"; }
|
||||
if($city['gen3set'] == 1) { $gen3['name'] = "<font color=orange>".$gen3['name']."</font>"; }
|
||||
|
||||
@@ -108,7 +108,7 @@ for($j=0; $j < $citycount; $j++) {
|
||||
echo "
|
||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr>
|
||||
<td colspan=12 style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=2>【 ".getRegion($city['region'])." | ".getCityLevel($city['level'])." 】 {$city['name']}</font></td>
|
||||
<td colspan=12 style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=2>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</font></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center width=48 id=bg1>주민</td>
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ function cityInfo($connect) {
|
||||
|
||||
if($nation['color'] == "" ) { $nation['color'] = "000000"; }
|
||||
echo "<table width=640 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
|
||||
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".getRegion($city['region'])." | ".getCityLevel($city['level'])." 】 {$city['name']}</td></tr>
|
||||
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</td></tr>
|
||||
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']}><b>";
|
||||
|
||||
if($city['nation'] == 0) {
|
||||
|
||||
@@ -63,129 +63,6 @@ function NationCharCall($call) {
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
function CityNameArray() {
|
||||
$cityNames = array(
|
||||
'','업','허창','낙양','장안','성도','양양','건업','북평','남피','완','수춘','서주','강릉','장사',
|
||||
'시상','위례','계','복양','진류','여남','하비','서량','하내','한중','상용','덕양','강주','건녕',
|
||||
'남해','계양','오','평양','사비','계림','진양','평원','북해','초','패','천수','안정','홍농',
|
||||
'하변','자동','영안','귀양','주시','운남','남영','교지','신야','강하','무릉','영릉','상동','여강',
|
||||
'회계','고창','대','안평','졸본','이도','강','저','흉노','남만','산월','오환','왜','호관',
|
||||
'호로','사곡','함곡','사수','양평','가맹','역경','계교','동황','관도','정도','합비','광릉','적도',
|
||||
'가정','기산','면죽','이릉','장판','백랑','적벽','파양','탐라','유구'
|
||||
);
|
||||
return $cityNames;
|
||||
}
|
||||
|
||||
|
||||
function CityCall($call) {
|
||||
switch($call) {
|
||||
case '업': $type = 1; break; case '허창': $type = 2; break;
|
||||
case '낙양': $type = 3; break; case '장안': $type = 4; break;
|
||||
case '성도': $type = 5; break; case '양양': $type = 6; break;
|
||||
case '건업': $type = 7; break; case '북평': $type = 8; break;
|
||||
case '남피': $type = 9; break; case '완': $type = 10; break;
|
||||
case '수춘': $type = 11; break; case '서주': $type = 12; break;
|
||||
case '강릉': $type = 13; break; case '장사': $type = 14; break;
|
||||
case '시상': $type = 15; break; case '위례': $type = 16; break;
|
||||
case '계': $type = 17; break; case '복양': $type = 18; break;
|
||||
case '진류': $type = 19; break; case '여남': $type = 20; break;
|
||||
case '하비': $type = 21; break; case '서량': $type = 22; break;
|
||||
case '하내': $type = 23; break; case '한중': $type = 24; break;
|
||||
case '상용': $type = 25; break; case '덕양': $type = 26; break;
|
||||
case '강주': $type = 27; break; case '건녕': $type = 28; break;
|
||||
case '남해': $type = 29; break; case '계양': $type = 30; break;
|
||||
case '오': $type = 31; break; case '평양': $type = 32; break;
|
||||
case '사비': $type = 33; break; case '계림': $type = 34; break;
|
||||
case '진양': $type = 35; break; case '평원': $type = 36; break;
|
||||
case '북해': $type = 37; break; case '초': $type = 38; break;
|
||||
case '패': $type = 39; break; case '천수': $type = 40; break;
|
||||
case '안정': $type = 41; break; case '홍농': $type = 42; break;
|
||||
case '하변': $type = 43; break; case '자동': $type = 44; break;
|
||||
case '영안': $type = 45; break; case '귀양': $type = 46; break;
|
||||
case '주시': $type = 47; break; case '운남': $type = 48; break;
|
||||
case '남영': $type = 49; break; case '교지': $type = 50; break;
|
||||
case '신야': $type = 51; break; case '강하': $type = 52; break;
|
||||
case '무릉': $type = 53; break; case '영릉': $type = 54; break;
|
||||
case '상동': $type = 55; break; case '여강': $type = 56; break;
|
||||
case '회계': $type = 57; break; case '고창': $type = 58; break;
|
||||
case '대': $type = 59; break; case '안평': $type = 60; break;
|
||||
case '졸본': $type = 61; break; case '이도': $type = 62; break;
|
||||
case '강': $type = 63; break; case '저': $type = 64; break;
|
||||
case '흉노': $type = 65; break; case '남만': $type = 66; break;
|
||||
case '산월': $type = 67; break; case '오환': $type = 68; break;
|
||||
case '왜': $type = 69; break; case '호관': $type = 70; break;
|
||||
case '호로': $type = 71; break; case '사곡': $type = 72; break;
|
||||
case '함곡': $type = 73; break; case '사수': $type = 74; break;
|
||||
case '양평': $type = 75; break; case '가맹': $type = 76; break;
|
||||
case '역경': $type = 77; break; case '계교': $type = 78; break;
|
||||
case '동황': $type = 79; break; case '관도': $type = 80; break;
|
||||
case '정도': $type = 81; break; case '합비': $type = 82; break;
|
||||
case '광릉': $type = 83; break; case '적도': $type = 84; break;
|
||||
case '가정': $type = 85; break; case '기산': $type = 86; break;
|
||||
case '면죽': $type = 87; break; case '이릉': $type = 88; break;
|
||||
case '장판': $type = 89; break; case '백랑': $type = 90; break;
|
||||
case '적벽': $type = 91; break; case '파양': $type = 92; break;
|
||||
case '탐라': $type = 93; break; case '유구': $type = 94; break;
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
function CityNum($num) {
|
||||
switch($num) {
|
||||
case 1: $call = '업' ; break; case 2: $call = '허창'; break;
|
||||
case 3: $call = '낙양'; break; case 4: $call = '장안'; break;
|
||||
case 5: $call = '성도'; break; case 6: $call = '양양'; break;
|
||||
case 7: $call = '건업'; break; case 8: $call = '북평'; break;
|
||||
case 9: $call = '남피'; break; case 10: $call = '완' ; break;
|
||||
case 11: $call = '수춘'; break; case 12: $call = '서주'; break;
|
||||
case 13: $call = '강릉'; break; case 14: $call = '장사'; break;
|
||||
case 15: $call = '시상'; break; case 16: $call = '위례'; break;
|
||||
case 17: $call = '계' ; break; case 18: $call = '복양'; break;
|
||||
case 19: $call = '진류'; break; case 20: $call = '여남'; break;
|
||||
case 21: $call = '하비'; break; case 22: $call = '서량'; break;
|
||||
case 23: $call = '하내'; break; case 24: $call = '한중'; break;
|
||||
case 25: $call = '상용'; break; case 26: $call = '덕양'; break;
|
||||
case 27: $call = '강주'; break; case 28: $call = '건녕'; break;
|
||||
case 29: $call = '남해'; break; case 30: $call = '계양'; break;
|
||||
case 31: $call = '오' ; break; case 32: $call = '평양'; break;
|
||||
case 33: $call = '사비'; break; case 34: $call = '계림'; break;
|
||||
case 35: $call = '진양'; break; case 36: $call = '평원'; break;
|
||||
case 37: $call = '북해'; break; case 38: $call = '초' ; break;
|
||||
case 39: $call = '패' ; break; case 40: $call = '천수'; break;
|
||||
case 41: $call = '안정'; break; case 42: $call = '홍농'; break;
|
||||
case 43: $call = '하변'; break; case 44: $call = '자동'; break;
|
||||
case 45: $call = '영안'; break; case 46: $call = '귀양'; break;
|
||||
case 47: $call = '주시'; break; case 48: $call = '운남'; break;
|
||||
case 49: $call = '남영'; break; case 50: $call = '교지'; break;
|
||||
case 51: $call = '신야'; break; case 52: $call = '강하'; break;
|
||||
case 53: $call = '무릉'; break; case 54: $call = '영릉'; break;
|
||||
case 55: $call = '상동'; break; case 56: $call = '여강'; break;
|
||||
case 57: $call = '회계'; break; case 58: $call = '고창'; break;
|
||||
case 59: $call = '대' ; break; case 60: $call = '안평'; break;
|
||||
case 61: $call = '졸본'; break; case 62: $call = '이도'; break;
|
||||
case 63: $call = '강' ; break; case 64: $call = '저' ; break;
|
||||
case 65: $call = '흉노'; break; case 66: $call = '남만'; break;
|
||||
case 67: $call = '산월'; break; case 68: $call = '오환'; break;
|
||||
case 69: $call = '왜' ; break; case 70: $call = '호관'; break;
|
||||
case 71: $call = '호로'; break; case 72: $call = '사곡'; break;
|
||||
case 73: $call = '함곡'; break; case 74: $call = '사수'; break;
|
||||
case 75: $call = '양평'; break; case 76: $call = '가맹'; break;
|
||||
case 77: $call = '역경'; break; case 78: $call = '계교'; break;
|
||||
case 79: $call = '동황'; break; case 80: $call = '관도'; break;
|
||||
case 81: $call = '정도'; break; case 82: $call = '합비'; break;
|
||||
case 83: $call = '광릉'; break; case 84: $call = '적도'; break;
|
||||
case 85: $call = '가정'; break; case 86: $call = '기산'; break;
|
||||
case 87: $call = '면죽'; break; case 88: $call = '이릉'; break;
|
||||
case 89: $call = '장판'; break; case 90: $call = '백랑'; break;
|
||||
case 91: $call = '적벽'; break; case 92: $call = '파양'; break;
|
||||
case 93: $call = '탐라'; break; case 94: $call = '유구'; break;
|
||||
}
|
||||
return $call;
|
||||
}
|
||||
|
||||
|
||||
function CharCall($call) {
|
||||
switch($call) {
|
||||
case '은둔': $type =10; break;
|
||||
@@ -247,37 +124,6 @@ function SpecCall($call) {
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
||||
function getCityLevel($level) {
|
||||
switch($level) {
|
||||
case 8: $call = '특'; break;
|
||||
case 7: $call = '대'; break;
|
||||
case 6: $call = '중'; break;
|
||||
case 5: $call = '소'; break;
|
||||
case 4: $call = '이'; break;
|
||||
case 3: $call = '관'; break;
|
||||
case 2: $call = '진'; break;
|
||||
case 1: $call = '수'; break;
|
||||
default:$call = '?'; break;
|
||||
}
|
||||
return $call;
|
||||
}
|
||||
|
||||
function getRegion($region) {
|
||||
switch($region) {
|
||||
case 8: $call = '동이'; break;
|
||||
case 7: $call = '오월'; break;
|
||||
case 6: $call = '초'; break;
|
||||
case 5: $call = '남중'; break;
|
||||
case 4: $call = '서촉'; break;
|
||||
case 3: $call = '서북'; break;
|
||||
case 2: $call = '중원'; break;
|
||||
case 1: $call = '하북'; break;
|
||||
default:$call = '?'; break;
|
||||
}
|
||||
return $call;
|
||||
}
|
||||
|
||||
function getNationChiefLevel($level) {
|
||||
switch($level) {
|
||||
case 7: $lv = 5; break;
|
||||
|
||||
+9
-13
@@ -57,11 +57,9 @@ function bar($per, $h=7) {
|
||||
|
||||
|
||||
function OptionsForCitys() {
|
||||
$citynames = CityNameArray();
|
||||
|
||||
for($i=1; $i <= 94; $i++) {
|
||||
foreach(CityConst::all() as $city){
|
||||
echo "
|
||||
<option value={$i}>{$citynames[$i]}</option>";
|
||||
<option value={$city->id}>{$city->name}</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,23 +106,21 @@ function closeButton() {
|
||||
function printCitysName($connect, $cityNo, $distance=1) {
|
||||
$dist = distance($connect, $cityNo, $distance);
|
||||
|
||||
$citynames = CityNameArray();
|
||||
$citynum = 94;
|
||||
|
||||
$citystr = "";
|
||||
for($i=1; $i <= $citynum; $i++) {
|
||||
|
||||
if($dist[$i] == $distance) {
|
||||
$citystr = $citystr.$citynames[$i].", ";
|
||||
$cityList = [];
|
||||
foreach(CityConst::all() as $city){
|
||||
if($dist[$city->id] == $distance){
|
||||
$cityList[] = $city->name;
|
||||
}
|
||||
}
|
||||
|
||||
$cityStr = join(', ', $cityList);
|
||||
|
||||
switch($distance) {
|
||||
case 1: $color = "magenta"; break;
|
||||
case 2: $color = "orange"; break;
|
||||
default: $color = "yellow"; break;
|
||||
}
|
||||
echo "{$distance}칸 떨어진 도시 : <font color={$color}><b>{$citystr}</b></font><br>";
|
||||
echo "{$distance}칸 떨어진 도시 : <font color={$color}><b>{$cityStr}</b></font><br>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-5
@@ -35,9 +35,9 @@ function RegGeneral($init,$life,$fiction,$turnterm,$startyear,$year,$gencount,$a
|
||||
//$name = "ⓝ".$name;
|
||||
$npc = 2;
|
||||
if($city == "-") {
|
||||
$city = rand() % 94 + 1;
|
||||
$city = rand(1, count(CityConst::all()));
|
||||
} else {
|
||||
$city = CityCall($city);
|
||||
$city = CityConst::byName($city)->id;
|
||||
}
|
||||
if($affinity == 0 || $fiction == 1) { $affinity = rand() % 150 + 1; }
|
||||
if($life == 1) { $bornyear = 160; $deadyear = 300; }
|
||||
@@ -1069,6 +1069,7 @@ function processAI($connect, $no) {
|
||||
//$command = $fourth * 100000000 + $type * 100000 + $crew * 100 + 11;
|
||||
|
||||
function RegNation($name, $color, $gold, $rice, $scoutmsg, $tech, $gencount, $type, $level) {
|
||||
//TODO: 삭제
|
||||
$type = NationCharCall($type);
|
||||
$totaltech = $tech * $gencount;
|
||||
|
||||
@@ -1093,11 +1094,11 @@ function RegNation($name, $color, $gold, $rice, $scoutmsg, $tech, $gencount, $ty
|
||||
}
|
||||
|
||||
function RegCity($nation, $name, $cap=0) {
|
||||
$city = CityCall($name);
|
||||
//TODO: 삭제
|
||||
$city = CityConst::byName($name)->id;
|
||||
DB::db()->update('city', [
|
||||
'nation'=>$nation,
|
||||
'city'=>$city
|
||||
]);
|
||||
], 'city=%i',$city);
|
||||
|
||||
if($cap > 0){
|
||||
DB::db()->update('nation', ['capital'=>city], 'nation = %i', $nation);
|
||||
|
||||
+35
-70
@@ -25,19 +25,12 @@ class Scenario{
|
||||
private $initialEvents;
|
||||
private $events;
|
||||
|
||||
public function __construct(int $scenarioIdx){
|
||||
$scenarioPath = self::SCENARIO_PATH."/scenario_{$scenarioIdx}.json";
|
||||
private $initOK = false;
|
||||
|
||||
$this->scenarioIdx = $scenarioIdx;
|
||||
$this->scenarioPath = $scenarioPath;
|
||||
|
||||
$data = Json::decode(file_get_contents($scenarioPath));
|
||||
$this->data = $data;
|
||||
|
||||
$this->year = Util::array_get($data['startYear']);
|
||||
$this->title = Util::array_get($data['title'] , '');
|
||||
|
||||
$this->history = Util::array_get($data['history'], []);
|
||||
private function initFull(){
|
||||
if($this->initOK){
|
||||
return;
|
||||
}
|
||||
|
||||
$this->nations = [];
|
||||
$this->nations[0] = new Scenario\Nation(0, '재야', '#ffffff', 0, 0);
|
||||
@@ -149,6 +142,25 @@ class Scenario{
|
||||
'action' => $action
|
||||
];
|
||||
}, Util::array_get($data['events'], []));
|
||||
}
|
||||
|
||||
public function __construct(int $scenarioIdx, bool $lazyInit = true){
|
||||
$scenarioPath = self::SCENARIO_PATH."/scenario_{$scenarioIdx}.json";
|
||||
|
||||
$this->scenarioIdx = $scenarioIdx;
|
||||
$this->scenarioPath = $scenarioPath;
|
||||
|
||||
$data = Json::decode(file_get_contents($scenarioPath));
|
||||
$this->data = $data;
|
||||
|
||||
$this->year = Util::array_get($data['startYear']);
|
||||
$this->title = Util::array_get($data['title'] , '');
|
||||
|
||||
$this->history = Util::array_get($data['history'], []);
|
||||
|
||||
if(!$lazyInit){
|
||||
$this->initFull();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -165,76 +177,23 @@ class Scenario{
|
||||
}
|
||||
|
||||
public function getNPC(){
|
||||
$this->initFull();
|
||||
return $this->generals;
|
||||
}
|
||||
|
||||
public function getNPCex(){
|
||||
$this->initFull();
|
||||
return $this->generalsEx;
|
||||
}
|
||||
|
||||
public function getNation(){
|
||||
$this->initFull();
|
||||
return $this->nations;
|
||||
|
||||
$nationsRaw = Util::array_get($this->data['nation']);
|
||||
if(!$nationsRaw){
|
||||
return [];
|
||||
}
|
||||
|
||||
$nations = [];
|
||||
foreach($nationsRaw as $idx=>$nation){
|
||||
list($name, $color, $gold, $rice, $infoText, $tech, $type, $nationLevel, $cities) = $nation;
|
||||
$nationID = $idx+1;
|
||||
|
||||
$nation['id'] = $nationID;
|
||||
|
||||
$nations[$nationID] = [
|
||||
'id'=>$nationID,
|
||||
'name'=>$name,
|
||||
'color'=>$color,
|
||||
'gold'=>$gold,
|
||||
'rice'=>$rice,
|
||||
'infoText'=>$infoText,
|
||||
'tech'=>$tech,
|
||||
'type'=>$type,
|
||||
'nationLevel'=>$nationLevel,
|
||||
'cities'=>$cities,
|
||||
'generals'=>0
|
||||
];
|
||||
}
|
||||
|
||||
$nations[0] = [
|
||||
'id'=>0,
|
||||
'name'=>'재야',
|
||||
'color'=>'#ffffff',
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
'infoText'=>'재야',
|
||||
'tech'=>0,
|
||||
'type'=>'재야',
|
||||
'nationLevel'=>0,
|
||||
'cities'=>[],
|
||||
'generals'=>0
|
||||
];
|
||||
|
||||
foreach(Util::array_get($this->data['general'], []) as $idx=>$general){
|
||||
while(count($general) < 14){
|
||||
$general[] = null;
|
||||
}
|
||||
list(
|
||||
$a, $name, $npcname, $nationID, $specifiedCity,
|
||||
$leadership, $power, $intel, $birth, $death,
|
||||
$charDom, $charWar, $text
|
||||
) = $general;
|
||||
|
||||
if(array_key_exists($nationID, $nations)){
|
||||
$nations[$nationID]['generals']++;
|
||||
};
|
||||
}
|
||||
|
||||
return $nations;
|
||||
}
|
||||
|
||||
public function getScenarioBrief(){
|
||||
$this->initFull();
|
||||
|
||||
$nations = [];
|
||||
$nationGeneralCnt = [];
|
||||
$nationGeneralExCnt = [];
|
||||
@@ -275,6 +234,8 @@ class Scenario{
|
||||
}
|
||||
|
||||
private function buildGenerals($env){
|
||||
$this->initFull();
|
||||
|
||||
$remainGenerals = [];
|
||||
foreach($this->generals as $general){
|
||||
if($general->build($env)){
|
||||
@@ -307,6 +268,8 @@ class Scenario{
|
||||
}
|
||||
|
||||
private function buildDiplomacy($env){
|
||||
$this->initFull();
|
||||
|
||||
$db = DB::db();
|
||||
foreach($this->diplomacy as $diplomacy){
|
||||
list($me, $you, $state, $remain) = $diplomacy;
|
||||
@@ -318,6 +281,8 @@ class Scenario{
|
||||
}
|
||||
|
||||
public function build($env=[]){
|
||||
$this->initFull();
|
||||
|
||||
//NOTE: 초기화가 되어있다고 가정함.
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user