$leader, 'power' => $power, 'intel' => $intel);
}
// 14 ~ 75
function abilityLeadpow() {
$total = 150;
$leader = (rand()%100 + 1) / 100.0 + 6.0;
$power = (rand()%100 + 1) / 100.0 + 6.0;
$intel = (rand()%100 + 1) / 100.0 + 1.0;
$rate = $leader + $power + $intel;
$leader = floor($leader / $rate * $total);
$power = floor($power / $rate * $total);
$intel = floor($intel / $rate * $total);
while($leader+$power+$intel < 150) {
$leader++;
}
return array('leader' => $leader, 'power' => $power, 'intel' => $intel);
}
function abilityLeadint() {
$total = 150;
$leader = (rand()%100 + 1) / 100.0 + 6.0;
$power = (rand()%100 + 1) / 100.0 + 1.0;
$intel = (rand()%100 + 1) / 100.0 + 6.0;
$rate = $leader + $power + $intel;
$leader = floor($leader / $rate * $total);
$power = floor($power / $rate * $total);
$intel = floor($intel / $rate * $total);
while($leader+$power+$intel < 150) {
$leader++;
}
return array('leader' => $leader, 'power' => $power, 'intel' => $intel);
}
function abilityPowint() {
$total = 150;
$leader = (rand()%100 + 1) / 100.0 + 1.0;
$power = (rand()%100 + 1) / 100.0 + 6.0;
$intel = (rand()%100 + 1) / 100.0 + 6.0;
$rate = $leader + $power + $intel;
$leader = floor($leader / $rate * $total);
$power = floor($power / $rate * $total);
$intel = floor($intel / $rate * $total);
while($leader+$power+$intel < 150) {
$leader++;
}
return array('leader' => $leader, 'power' => $power, 'intel' => $intel);
}
function GetImageURL($imgsvr) {
global $image, $image1;
if($imgsvr == 0) {
return $image;
} else {
return $image1;
}
}
function CheckLoginEx(){
//TODO: 서버 별로 p_id를 다르게 설정할 수 있어야함.
if(!isset($_SESSION['p_id'])) {
return false;
}
return true;
}
function checkLimit($userlevel, $con, $conlimit) {
//운영자
if($userlevel >= 5) { return 0; }
//특회이면 3배
if($userlevel >= 3) { $conlimit *= 3; }
//접속률 이상이면 제한
if($con > $conlimit) {
return 2;
//접속제한 90%이면 경고문구
} elseif($con > $conlimit * 0.9) {
return 1;
} else {
return 0;
}
}
function bar($per, $skin=1, $h=7) {
global $images;
if($h == 7) { $bd = 0; $h = 7; $h2 = 5; }
else { $bd = 1; $h = 12; $h2 = 8; }
$per = round($per, 1);
if($per < 1 || $per > 99) { $per = round($per); }
$str1 = "
| 【 ".getRegion($city['region'])." | ".getCityLevel($city['level'])." 】 {$city['name']} |
| ";
if($city['nation'] == 0) {
echo "공 백 지";
} else {
echo "지배 국가 【 {$nation['name']} 】";
}
if($city['gen1'] > 0) {
$query = "select name from general where no='{$city['gen1']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen1 = MYDB_fetch_array($result);
} else {
$gen1['name'] = '-';
}
if($city['gen2'] > 0) {
$query = "select name from general where no='{$city['gen2']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen2 = MYDB_fetch_array($result);
} else {
$gen2['name'] = '-';
}
if($city['gen3'] > 0) {
$query = "select name from general where no='{$city['gen3']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen3 = MYDB_fetch_array($result);
} else {
$gen3['name'] = '-';
}
echo "
|
| 주민 |
".bar($pop, $me['skin'])." |
민심 |
".bar($rate, $me['skin'])." |
태수 |
{$gen1['name']} |
| {$city['pop']}/{$city['pop2']} |
{$city['rate']} |
| 농업 |
".bar($agri, $me['skin'])." |
상업 |
".bar($comm, $me['skin'])." |
치안 |
".bar($secu, $me['skin'])." |
군사 |
{$gen2['name']} |
| {$city['agri']}/{$city['agri2']} |
{$city['comm']}/{$city['comm2']} |
{$city['secu']}/{$city['secu2']} |
| 수비 |
".bar($def, $me['skin'])." |
성벽 |
".bar($wall, $me['skin'])." |
시세 |
".bar($trade, $me['skin'])." |
시중 |
{$gen3['name']} |
| {$city['def']}/{$city['def2']} |
{$city['wall']}/{$city['wall2']} |
{$tradeStr} |
";
}
function myNationInfo($connect) {
global $_basecolor, $_basecolor2, $images;
$query = "select startyear,year from game where no='1'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select skin,no,nation from general where user_id='{$_SESSION['p_id']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,tricklimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$query = "select COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop2) as maxpop from city where nation='{$nation['nation']}'"; // 도시 이름 목록
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
$query = "select COUNT(*) as cnt, SUM(crew) as totcrew,SUM(leader)*100 as maxcrew from general where nation='{$nation['nation']}'"; // 장수 목록
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
$query = "select name from general where nation='{$nation['nation']}' and level='12'";
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$level12 = MYDB_fetch_array($genresult);
$query = "select name from general where nation='{$nation['nation']}' and level='11'";
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$level11 = MYDB_fetch_array($genresult);
echo "
| 【재 야】"; }
else { echo "style=font-weight:bold;font-size:13;>국가【 {$nation['name']} 】"; }
} else {
if($me['nation'] == 0) { echo "style=color:white;background-color:000000;font-weight:bold;font-size:13;>【재 야】"; }
else { echo "style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13;>국가【 {$nation['name']} 】"; }
}
echo "
|
| 성 향 |
".getNationType($nation['type'])." (".getNationType2($nation['type'], $me['skin']).") |
| ".getLevel(12, $nation['level'])." |
";echo $level12==''?"-":"{$level12['name']}"; echo " |
".getLevel(11, $nation['level'])." |
";echo $level11==''?"-":"{$level11['name']}"; echo " |
| 총주민 |
";echo $me['nation']==0?"해당 없음":"{$city['totpop']}/{$city['maxpop']}";echo " |
총병사 |
";echo $me['nation']==0?"해당 없음":"{$general['totcrew']}/{$general['maxcrew']}"; echo " |
| 국 고 |
";echo $me['nation']==0?"해당 없음":"{$nation['gold']}";echo " |
병 량 |
";echo $me['nation']==0?"해당 없음":"{$nation['rice']}";echo " |
| 지급율 |
";
if($me['nation'] == 0) {
echo "해당 없음";
} else {
echo $nation['bill']==0?"0 %":"{$nation['bill']} %";
}
echo "
|
세 율 |
";
if($me['nation'] == 0) {
echo "해당 없음";
} else {
echo $nation['rate']==0?"0 %":"{$nation['rate']} %";
}
$techCall = getTechCall($nation['tech']);
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $nation['tech'] = "{$nation['tech']}"; }
else { $nation['tech'] = "{$nation['tech']}"; }
$nation['tech'] = "$techCall / {$nation['tech']}";
if($me['nation']==0){
$nation['tricklimit'] = "해당 없음";
$nation['surlimit'] = "해당 없음";
$nation['scout'] = "해당 없음";
$nation['war'] = "해당 없음";
$nation['power'] = "해당 없음";
} else {
if($nation['tricklimit'] != 0) { $nation['tricklimit'] = "{$nation['tricklimit']}턴"; }
else { $nation['tricklimit'] = "가 능"; }
if($nation['surlimit'] != 0) { $nation['surlimit'] = "{$nation['surlimit']}턴"; }
else { $nation['surlimit'] = "가 능"; }
if($nation['scout'] != 0) { $nation['scout'] = "금 지"; }
else { $nation['scout'] = "허 가"; }
if($nation['war'] != 0) { $nation['war'] = "금 지"; }
else { $nation['war'] = "허 가"; }
}
if($me['skin'] == 0) {
$nation['tech'] = unfont($nation['tech']);
$nation['tricklimit'] = unfont($nation['tricklimit']);
$nation['surlimit'] = unfont($nation['surlimit']);
$nation['scout'] = unfont($nation['scout']);
$nation['war'] = unfont($nation['war']);
}
echo "
|
| 속 령 |
";echo $me['nation']==0?"-":"{$city['cnt']}"; echo " |
장 수 |
";echo $me['nation']==0?"-":"{$general['cnt']}"; echo " |
| 국 력 |
{$nation['power']} |
기술력 |
";echo $me['nation']==0?"-":"{$nation['tech']}"; echo " |
| 전 략 |
{$nation['tricklimit']} |
외 교 |
{$nation['surlimit']} |
| 임 관 |
{$nation['scout']} |
전 쟁 |
{$nation['war']} |
";
}
function addCommand($typename, $value, $valid = 1, $color=0) {
if($valid == 1) {
switch($color) {
case 0:
echo "