name2 -> owner_name (or orderName)
This commit is contained in:
@@ -75,7 +75,7 @@ $types = [
|
|||||||
$v['nationName'] = '???';
|
$v['nationName'] = '???';
|
||||||
$v['pictureFullPath'] = GetImageURL(0)."/default.jpg";
|
$v['pictureFullPath'] = GetImageURL(0)."/default.jpg";
|
||||||
$v['name'] = '???';
|
$v['name'] = '???';
|
||||||
$v['owner_name'] = null;
|
$v['ownerName'] = null;
|
||||||
$v['bgColor'] = GameConst::$basecolor4;
|
$v['bgColor'] = GameConst::$basecolor4;
|
||||||
$v['fgColor'] = newColor($v['bgColor']);
|
$v['fgColor'] = newColor($v['bgColor']);
|
||||||
return $v;
|
return $v;
|
||||||
@@ -163,7 +163,7 @@ $types = [
|
|||||||
|
|
||||||
$generals = [];
|
$generals = [];
|
||||||
foreach($db->query(
|
foreach($db->query(
|
||||||
"SELECT nation,no,name,name2 as owner_name, owner, picture, imgsvr,
|
"SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr,
|
||||||
experience, dedication,
|
experience, dedication,
|
||||||
dex1, dex2, dex3, dex4, dex5,
|
dex1, dex2, dex3, dex4, dex5,
|
||||||
horse, weapon, book, item
|
horse, weapon, book, item
|
||||||
@@ -194,7 +194,7 @@ $templates = new \League\Plates\Engine('templates');
|
|||||||
foreach($types as $idx=>[$typeName, $typeValue, $typeFunc]){
|
foreach($types as $idx=>[$typeName, $typeValue, $typeFunc]){
|
||||||
$validCnt = 0;
|
$validCnt = 0;
|
||||||
$typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt, $ownerNameList){
|
$typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt, $ownerNameList){
|
||||||
$general['owner_name'] = $ownerNameList[$general['owner']]??null;
|
$general['ownerName'] = $ownerNameList[$general['owner']]??null;
|
||||||
$general = ($typeFunc)($general);
|
$general = ($typeFunc)($general);
|
||||||
$value = $general['value'];
|
$value = $general['value'];
|
||||||
|
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ foreach($types as $idx=>[$typeName, $typeValue]) {
|
|||||||
$general += $aux;
|
$general += $aux;
|
||||||
|
|
||||||
if(key_exists($general['owner'], $ownerNameList)){
|
if(key_exists($general['owner'], $ownerNameList)){
|
||||||
$general['owner_name'] = $ownerNameList[$general['owner']];
|
$general['ownerName'] = $ownerNameList[$general['owner']];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!key_exists('bgColor', $general)){
|
if(!key_exists('bgColor', $general)){
|
||||||
|
|||||||
+37
-19
@@ -54,27 +54,44 @@ $sel[$type] = "selected";
|
|||||||
</td></tr>
|
</td></tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
$nationname = [];
|
$nationName = [];
|
||||||
$nationname[0] = "-";
|
$nationName[0] = "-";
|
||||||
foreach (getAllNationStaticInfo() as $nation) {
|
foreach (getAllNationStaticInfo() as $nation) {
|
||||||
$nationname[$nation['nation']] = $nation['name'];
|
$nationName[$nation['nation']] = $nation['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($type) {//FIXME: $query 처리 부실
|
|
||||||
default:
|
|
||||||
case 1: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by binary(name)"; break;
|
|
||||||
case 2: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by nation"; break;
|
|
||||||
case 3: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by sum desc"; break;
|
|
||||||
case 4: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by leadership"; break;
|
|
||||||
case 5: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by strength"; break;
|
|
||||||
case 6: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by intel"; break;
|
|
||||||
case 7: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by experience"; break;
|
|
||||||
case 8: $query = "select npc,nation,name,name2,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1 order by dedication"; break;
|
|
||||||
}
|
|
||||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
|
||||||
$gencount = MYDB_num_rows($genresult);
|
|
||||||
|
|
||||||
echo"
|
$generalList = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1');
|
||||||
|
$sortType = [
|
||||||
|
1 => ['name', true],
|
||||||
|
2 => ['nation', true],
|
||||||
|
3 => ['sum', false],
|
||||||
|
4 => ['leadership', false],
|
||||||
|
5 => ['strength', false],
|
||||||
|
6 => ['intel', false],
|
||||||
|
7 => ['experience', false],
|
||||||
|
8 => ['dedication', false],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($generalList as &$general){
|
||||||
|
$general['nationName'] = $nationName[$general['nation']];
|
||||||
|
$general['coloredName'] = getColoredName($general['name'], $general['npc']);
|
||||||
|
}
|
||||||
|
|
||||||
|
[$sortKey, $isAsc] = $sortType[$type];
|
||||||
|
|
||||||
|
if($isAsc){
|
||||||
|
usort($generalList, function($lhs, $rhs)use($sortKey){
|
||||||
|
return $lhs[$sortKey] <=> $rhs[$sortKey];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
usort($generalList, function($lhs, $rhs)use($sortKey){
|
||||||
|
return $rhs[$sortKey] <=> $lhs[$sortKey];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
<table align=center width=1000 class='tb_layout bg0'>
|
<table align=center width=1000 class='tb_layout bg0'>
|
||||||
<tr>
|
<tr>
|
||||||
<td width=102 align=center id=bg1>희생된 장수</td>
|
<td width=102 align=center id=bg1>희생된 장수</td>
|
||||||
@@ -89,7 +106,8 @@ echo"
|
|||||||
<td width=68 align=center id=bg1>지력</td>
|
<td width=68 align=center id=bg1>지력</td>
|
||||||
<td width=78 align=center id=bg1>명성</td>
|
<td width=78 align=center id=bg1>명성</td>
|
||||||
<td width=78 align=center id=bg1>계급</td>
|
<td width=78 align=center id=bg1>계급</td>
|
||||||
</tr>";
|
</tr>
|
||||||
|
<?php foreach($generalList as $general): ?>
|
||||||
for ($j=0; $j < $gencount; $j++) {
|
for ($j=0; $j < $gencount; $j++) {
|
||||||
$general = MYDB_fetch_array($genresult);
|
$general = MYDB_fetch_array($genresult);
|
||||||
$nation = $nationname[$general['nation']];
|
$nation = $nationname[$general['nation']];
|
||||||
@@ -105,7 +123,7 @@ for ($j=0; $j < $gencount; $j++) {
|
|||||||
echo "
|
echo "
|
||||||
<tr>
|
<tr>
|
||||||
<td align=center>{$name}</td>
|
<td align=center>{$name}</td>
|
||||||
<td align=center>{$general['name2']}</td>
|
<td align=center>{$general['owner_name']}</td>
|
||||||
<td align=center>Lv {$general['explevel']}</td>
|
<td align=center>Lv {$general['explevel']}</td>
|
||||||
<td align=center>{$nation}</td>
|
<td align=center>{$nation}</td>
|
||||||
<td align=center>".displayCharInfo($general['personal'])."</td>
|
<td align=center>".displayCharInfo($general['personal'])."</td>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ $userID = Session::getUserID();
|
|||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|
||||||
$general = $db->queryFirstRow('SELECT no,name,name2,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
|
$general = $db->queryFirstRow('SELECT no,name,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
|
||||||
|
|
||||||
if(!$general){
|
if(!$general){
|
||||||
header('location:b_myPage.php');
|
header('location:b_myPage.php');
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace sammo;
|
|
||||||
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
// $btn, $name, $troop
|
|
||||||
$btn = Util::getReq('btn');
|
|
||||||
$name = Util::getReq('name');
|
|
||||||
$gen = Util::getReq('gen', 'int');
|
|
||||||
$troop = Util::getReq('troop', 'int');
|
|
||||||
|
|
||||||
//로그인 검사
|
|
||||||
$session = Session::requireGameLogin()->setReadOnly();
|
|
||||||
$userID = $session::getUserID();
|
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
|
|
||||||
$me = $db->queryFirstRow('SELECT `no`, nation, troop FROM general WHERE `owner`=%i', $userID);
|
|
||||||
|
|
||||||
|
|
||||||
if($name && mb_strwidth($name) > 18){
|
|
||||||
$name = mb_strimwidth($name, 0, 18);
|
|
||||||
}
|
|
||||||
|
|
||||||
$name = trim($name);
|
|
||||||
if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
|
|
||||||
$db->insertIgnore('troop',[
|
|
||||||
'troop_leader'=>$me['no'],
|
|
||||||
'name'=>$name,
|
|
||||||
'nation'=>$me['nation'],
|
|
||||||
]);
|
|
||||||
|
|
||||||
$db->update('general', [
|
|
||||||
'troop'=>$me['no'],
|
|
||||||
], 'no=%i',$me['no']);
|
|
||||||
} elseif($btn == "부 대 변 경" && $name != "") {
|
|
||||||
$db->update('troop', [
|
|
||||||
'name'=>$name
|
|
||||||
], 'troop_leader=%i',$me['no']);
|
|
||||||
} elseif($btn == "부 대 추 방" && $gen != 0) {
|
|
||||||
$db->update('general', [
|
|
||||||
'troop'=>0
|
|
||||||
], 'no=%i AND troop= %i', $gen, $me['no']);
|
|
||||||
} elseif($btn == "부 대 가 입" && $troop != 0) {
|
|
||||||
$troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `troop`=%i AND `nation`=%i', $troop, $troop, $me['nation']);
|
|
||||||
if($troopLeaderNation){
|
|
||||||
$db->update('general', [
|
|
||||||
'troop'=>$troop
|
|
||||||
], 'no=%i', $me['no']);
|
|
||||||
}
|
|
||||||
} elseif($btn == "부 대 탈 퇴") {
|
|
||||||
//부대장일 경우
|
|
||||||
if($me['troop'] == $me['no']) {
|
|
||||||
// 모두 탈퇴
|
|
||||||
$db->update('general', [
|
|
||||||
'troop'=>0
|
|
||||||
], 'troop=%i',$me['troop']);
|
|
||||||
// 부대 삭제
|
|
||||||
$db->delete('troop', 'troop_leader=%i', $me['troop']);
|
|
||||||
} else {
|
|
||||||
$db->update('general', [
|
|
||||||
'troop'=>0
|
|
||||||
], 'no=%i', $me['no']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location:b_troop.php', true, 303);
|
|
||||||
+2
-2
@@ -1427,7 +1427,7 @@ function CheckHall($no) {
|
|||||||
|
|
||||||
[$scenarioIdx, $scenarioName, $startTime] = $gameStor->getValuesAsArray(['scenario', 'scenario_text', 'starttime']);
|
[$scenarioIdx, $scenarioName, $startTime] = $gameStor->getValuesAsArray(['scenario', 'scenario_text', 'starttime']);
|
||||||
|
|
||||||
$ownerName = $generalObj->getVar('name2');
|
$ownerName = $generalObj->getVar('owner_name');
|
||||||
if($generalObj->getVar('owner')){
|
if($generalObj->getVar('owner')){
|
||||||
$ownerName = RootDB::db()->queryFirstField('SELECT name FROM member WHERE no = %i', $generalObj->getVar('owner'));
|
$ownerName = RootDB::db()->queryFirstField('SELECT name FROM member WHERE no = %i', $generalObj->getVar('owner'));
|
||||||
}
|
}
|
||||||
@@ -1470,7 +1470,7 @@ function CheckHall($no) {
|
|||||||
'imgsvr'=>$generalObj->getVar('imgsvr'),
|
'imgsvr'=>$generalObj->getVar('imgsvr'),
|
||||||
'startTime'=>$startTime,
|
'startTime'=>$startTime,
|
||||||
'unitedTime'=>$unitedDate,
|
'unitedTime'=>$unitedDate,
|
||||||
'owner_name'=>$ownerName,
|
'ownerName'=>$ownerName,
|
||||||
'serverID'=>UniqueConst::$serverID,
|
'serverID'=>UniqueConst::$serverID,
|
||||||
'serverIdx'=>$serverCnt,
|
'serverIdx'=>$serverCnt,
|
||||||
'serverName'=>UniqueConst::$serverName,
|
'serverName'=>UniqueConst::$serverName,
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ function updateYearly() {
|
|||||||
//관직 변경 해제
|
//관직 변경 해제
|
||||||
function updateQuaterly() {
|
function updateQuaterly() {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
//천도 제한 해제, 관직 변경 제한 해제
|
//천도 제한 해제, 관직 변경 제한 해제
|
||||||
$db->update('nation', [
|
$db->update('nation', [
|
||||||
|
|||||||
@@ -74,118 +74,6 @@ function process_51(&$general) {
|
|||||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>"]);
|
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_52(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name,level,gold,rice,surlimit,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$mynation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($mynation["l{$general['level']}turn0"]);
|
|
||||||
$rice = $command[3];
|
|
||||||
$gold = $command[2];
|
|
||||||
$which = $command[1];
|
|
||||||
$rice *= 1000;
|
|
||||||
$gold *= 1000;
|
|
||||||
$limit = $mynation['level'] * 10000;
|
|
||||||
|
|
||||||
if($gold < 0) { $gold = 0; }
|
|
||||||
if($rice < 0) { $rice = 0; }
|
|
||||||
|
|
||||||
$query = "select nation,name,gold,rice,surlimit from nation where nation='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$younation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
if($gold > $mynation['gold']-GameConst::$basegold) { $gold = $mynation['gold'] - GameConst::$basegold; }
|
|
||||||
if($rice > $mynation['rice']-GameConst::$baserice) { $rice = $mynation['rice'] - GameConst::$baserice; }
|
|
||||||
|
|
||||||
if($younation['nation'] == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($gold == 0 && $rice == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:보낼 물자가 부족합니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($gold < 0 || $rice < 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:보낼 물자가 부족합니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($gold > $limit || $rice > $limit) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:작위 제한량 이상은 보낼 수 없습니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($mynation['surlimit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:외교제한중입니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($younation['surlimit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:상대국이 외교제한중입니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 원조 실패. <1>$date</>";
|
|
||||||
} elseif($city['supply'] == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 원조 실패. <1>$date</>";
|
|
||||||
} else {
|
|
||||||
// 본국 자원 감소
|
|
||||||
$query = "update nation set gold=gold-'$gold',rice=rice-'$rice',surlimit=surlimit+12 where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 상대국 자원 증가
|
|
||||||
$query = "update nation set gold=gold+'$gold',rice=rice+'$rice' where nation='$which'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//아국 수뇌부에게 로그 전달
|
|
||||||
$query = "select no,name,nation from general where nation='{$general['nation']}' and level>='9'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$gencount = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
$josaRo = JosaUtil::pick($younation['name'], '로');
|
|
||||||
$genlog = ["<C>●</><D><b>{$younation['name']}</b></>{$josaRo} 금<C>$gold</> 쌀<C>$rice</>을 지원했습니다."];
|
|
||||||
for($i=0; $i < $gencount; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $genlog);
|
|
||||||
}
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>{$josaRo} 금<C>$gold</> 쌀<C>$rice</>을 지원");
|
|
||||||
pushNationHistory($mynation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$younation['name']}</b></>{$josaRo} 금<C>$gold</> 쌀<C>$rice</>을 지원");
|
|
||||||
pushNationHistory($younation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$mynation['name']}</b></>{$josaRo}부터 금<C>$gold</> 쌀<C>$rice</>을 지원 받음");
|
|
||||||
|
|
||||||
//상대국 수뇌부에게 로그 전달
|
|
||||||
$query = "select no,name,nation from general where nation='$which' and level>='9'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$gencount = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
for($i=0; $i < $gencount; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
$genlog[0] = "<C>●</><D><b>{$mynation['name']}</b></>에서 금<C>$gold</> 쌀<C>$rice</>을 원조 했습니다.";
|
|
||||||
pushGenLog($gen, $genlog);
|
|
||||||
}
|
|
||||||
|
|
||||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【원조】</b></><D><b>{$mynation['name']}</b></>에서 <D><b>{$younation['name']}</b></>{$josaRo} 물자를 지원합니다.";
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>{$josaRo} 물자를 지원합니다. <1>$date</>";
|
|
||||||
|
|
||||||
$exp = 5;
|
|
||||||
$ded = 5;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
// 경험치 상승 // 공헌도, 명성 상승
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// $log = checkAbility($general, $log);
|
|
||||||
}
|
|
||||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_53(&$general) {
|
function process_53(&$general) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
@@ -491,1159 +379,6 @@ function process_65(&$general) {
|
|||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
}
|
}
|
||||||
|
|
||||||
function process_66(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$nearCities = searchDistance($nation['capital'], 1, false);
|
|
||||||
$amount = $admin['develcost'] * 10;
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 66) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 66;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 66;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($city['supply'] == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국 영토가 아닙니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['city'] == $nation['capital'] || !key_exists($destcity['city'], $nearCities)){
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:인접도시가 아닙니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($nation['capset'] == 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:다음 분기에 가능합니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$baserice < $amount) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:물자가 부족합니다. 천도 실패. <1>$date</>";
|
|
||||||
} elseif($term < 3) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:천도중... ({$term}/3) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$josaRo = JosaUtil::pick($destcity['name'], '로');
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaRo} 천도했습니다. <1>$date</>";
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaRo} <R>천도</>를 명령하였습니다.";
|
|
||||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<S><b>【천도】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>{$josaRo} 천도하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaRo} 천도 명령");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaRo} 천도 명령");
|
|
||||||
|
|
||||||
//수도 변경
|
|
||||||
$query = "update nation set l{$general['level']}term='0',capital='{$destcity['city']}',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
refreshNationStaticInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_67(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation,level from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$amount = $admin['develcost'] * GameConst::$expandCityCostCoef + GameConst::$expandCityDefaultCost; // 7만~13만
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 67) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 67;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 67;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($nation['capital'] != $general['city']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수도에서 실행해야 합니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($nation['capital'] != $destcity['city']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수도만 가능합니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['level'] <= 3) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수진, 진, 관문은 불가능합니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['level'] >= 8) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:더이상 증축할 수 없습니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($nation['capset'] == 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:다음 분기에 가능합니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($nation['gold']-GameConst::$basegold < $amount || $nation['rice']-GameConst::$baserice < $amount) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:물자가 부족합니다. 증축 실패. <1>$date</>";
|
|
||||||
} elseif($term < 6) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:증축중... ({$term}/6) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$josaUl = JosaUtil::pick($destcity['name'], '을');
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaUl} 증축했습니다. <1>$date</>";
|
|
||||||
$exp = 5 * 6;
|
|
||||||
$ded = 5 * 6;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaUl} <C>증축</>하였습니다.";
|
|
||||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【증축】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>{$josaUl} 증축하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaUl} 증축");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaUl} 증축");
|
|
||||||
|
|
||||||
//물자 감소
|
|
||||||
$query = "update nation set l{$general['level']}term='0',capset='1',gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//수도 증축
|
|
||||||
$db->update('city', [
|
|
||||||
'upgrading'=>$db->sqleval('upgrading+1'),
|
|
||||||
'level'=>$db->sqleval('level+1'),
|
|
||||||
'pop_max'=>$db->sqleval('pop_max + %i', GameConst::$expandCityPopIncreaseAmount),
|
|
||||||
'agri_max'=>$db->sqleval('agri_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'comm_max'=>$db->sqleval('comm_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'secu_max'=>$db->sqleval('secu_max + %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'def_max'=>$db->sqleval('def_max + %i', GameConst::$expandCityWallIncreaseAmount),
|
|
||||||
'wall_max'=>$db->sqleval('wall_max + %i', GameConst::$expandCityWallIncreaseAmount),
|
|
||||||
], 'city=%i', $destcity['city']);
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_68(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name,gold,rice,surlimit,l{$general['level']}term,l{$general['level']}turn0,capital,capset from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation,level,pop,agri,comm,def,wall,secu,upgrading from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$amount = $admin['develcost'] * GameConst::$expandCityCostCoef + GameConst::$expandCityDefaultCost / 2; // 4만~10만
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 68) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 68;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 68;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($nation['capital'] != $general['city']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수도에서 실행해야 합니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($nation['capital'] != $destcity['city']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수도만 가능합니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['level'] <= 3) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수진, 진, 관문은 불가능합니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['level'] <= 6) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:더이상 감축할 수 없습니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['upgrading'] <= 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:증축된 도시가 아닙니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($nation['capset'] == 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:다음 분기에 가능합니다. 감축 실패. <1>$date</>";
|
|
||||||
} elseif($term < 6) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:감축중... ({$term}/6) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$josaUl = JosaUtil::pick($destcity['name'], '을');
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaUl} 감축했습니다. <1>$date</>";
|
|
||||||
$exp = 5 * 6;
|
|
||||||
$ded = 5 * 6;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaUl} <M>감축</>하였습니다.";
|
|
||||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【감축】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>{$josaUl} 감축하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>{$josaUl} 감축");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>{$josaUl} 감축");
|
|
||||||
|
|
||||||
//물자 증가
|
|
||||||
$query = "update nation set l{$general['level']}term='0',capset='1',gold=gold+'$amount',rice=rice+'$amount' where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
$pop = $destcity['pop'] - GameConst::$expandCityPopIncreaseAmount;
|
|
||||||
$agri = $destcity['agri'] - GameConst::$expandCityDevelIncreaseAmount;
|
|
||||||
$comm = $destcity['comm'] - GameConst::$expandCityDevelIncreaseAmount;
|
|
||||||
$def = $destcity['def'] - GameConst::$expandCityWallIncreaseAmount;
|
|
||||||
$wall = $destcity['wall'] - GameConst::$expandCityWallIncreaseAmount;
|
|
||||||
$secu = $destcity['secu'] - GameConst::$expandCityDevelIncreaseAmount;
|
|
||||||
if($pop < 30000) { $pop = 30000; }
|
|
||||||
if($agri < 0) { $agri = 0; }
|
|
||||||
if($comm < 0) { $comm = 0; }
|
|
||||||
if($def < 0) { $def = 0; }
|
|
||||||
if($wall < 0) { $wall = 0; }
|
|
||||||
if($secu < 0) { $secu = 0; }
|
|
||||||
//수도 감축
|
|
||||||
$db->update('city', [
|
|
||||||
'upgrading'=>$db->sqleval('upgrading-1'),
|
|
||||||
'level'=>$db->sqleval('level-1'),
|
|
||||||
'pop_max'=>$db->sqleval('pop_max - %i', GameConst::$expandCityPopIncreaseAmount),
|
|
||||||
'agri_max'=>$db->sqleval('agri_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'comm_max'=>$db->sqleval('comm_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'secu_max'=>$db->sqleval('secu_max - %i', GameConst::$expandCityDevelIncreaseAmount),
|
|
||||||
'def_max'=>$db->sqleval('def_max - %i', GameConst::$expandCityWallIncreaseAmount),
|
|
||||||
'wall_max'=>$db->sqleval('wall_max - %i', GameConst::$expandCityWallIncreaseAmount),
|
|
||||||
'pop'=>$pop,
|
|
||||||
'agri'=>$agri,
|
|
||||||
'comm'=>$comm,
|
|
||||||
'secu'=>$secu,
|
|
||||||
'def'=>$def,
|
|
||||||
'wall'=>$wall
|
|
||||||
], 'city=%i', $destcity['city']);
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_71(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select no from diplomacy where me='{$general['nation']}' and state=0";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dipCount = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 10);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 3;
|
|
||||||
$term3 = Util::round(sqrt($genCount*8)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 71) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 71;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 71;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 필사즉생 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 필사즉생 실패. <1>$date</>";
|
|
||||||
} elseif($dipCount == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중이 아닙니다. 필사즉생 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 필사즉생 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:필사즉생 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:필사즉생 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <M>필사즉생</>을 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <M>필사즉생</>을 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <M>필사즉생</>을 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <M>필사즉생</>을 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<M>필사즉생</>을 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <M>필사즉생</>을 발동");
|
|
||||||
|
|
||||||
//전장수 훈사100
|
|
||||||
$query = "update general set atmos=100,train=100 where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한
|
|
||||||
$query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_72(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select no from diplomacy where me='{$general['nation']}' and state=0";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dipCount = MYDB_num_rows($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 20);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 1;
|
|
||||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 72) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 72;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 72;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 백성동원 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 백성동원 실패. <1>$date</>";
|
|
||||||
} elseif($dipCount == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중이 아닙니다. 백성동원 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 백성동원 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국 도시만 가능합니다. 백성동원 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:백성동원 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:백성동원 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>백성동원</>을 발동");
|
|
||||||
|
|
||||||
//도시 성수 80%
|
|
||||||
$query = "update city set def=def_max*0.8,wall=wall_max*0.8 where city='{$destcity['city']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한
|
|
||||||
$query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_73(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name from nation where nation='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destnation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select state from diplomacy where me='{$general['nation']}' and you='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dip = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 20);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 3;
|
|
||||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 73) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 73;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 73;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:공백지입니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] == $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:대상도시가 아국입니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($dip['state'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전쟁중인 상대국에만 가능합니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 수몰 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수몰 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수몰 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><G><b>{$destcity['name']}</b></>에 <M>수몰</>이 발동되었습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>의 <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동");
|
|
||||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>{$josaYi} 아국의 <G><b>{$destcity['name']}</b></>에 <M>수몰</>을 발동");
|
|
||||||
|
|
||||||
//도시 성수 80% 감소
|
|
||||||
$query = "update city set def=def*0.2,wall=wall*0.2 where city='{$destcity['city']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한
|
|
||||||
$query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_74(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select city,name,nation from city where city='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destcity = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,name from nation where nation='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destnation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select state from diplomacy where me='{$general['nation']}' and you='{$destcity['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dip = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 20);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 2;
|
|
||||||
$term3 = Util::round(sqrt($genCount*4)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 74) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 74;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 74;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] == 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:공백지입니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($destcity['nation'] == $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:대상도시가 아국입니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($dip['state'] > 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 허보 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:허보 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:허보 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>의 <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동");
|
|
||||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>{$josaYi} 아국의 <G><b>{$destcity['name']}</b></>에 <M>허보</>를 발동");
|
|
||||||
|
|
||||||
//상대국 도시 전부 검색
|
|
||||||
$query = "select city from city where nation='{$destcity['nation']}' and supply=1";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cityCount = MYDB_num_rows($result);
|
|
||||||
$cities = [];
|
|
||||||
for($i=0; $i < $cityCount; $i++) {
|
|
||||||
$dCity = MYDB_fetch_array($result);
|
|
||||||
$cities[$i] = $dCity['city'];
|
|
||||||
}
|
|
||||||
//상대국 유저 랜덤 배치
|
|
||||||
$query = "select no,name from general where nation='{$destcity['nation']}' and city='{$destcity['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$count = MYDB_num_rows($result);
|
|
||||||
$opplog = ["<C>●</>상대국의 허보에 당했다! <1>$date</>"];
|
|
||||||
for($i=0; $i < $count; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
$selCity = $cities[rand() % $cityCount];
|
|
||||||
//현재도시이면 한번 다시 랜덤추첨
|
|
||||||
if($selCity == $destcity['city']) { $selCity = $cities[rand() % $cityCount]; }
|
|
||||||
|
|
||||||
$query = "update general set city={$selCity} where no='{$gen['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
pushGenLog($gen, $opplog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한
|
|
||||||
$query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_75(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['year','month','develcost']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
|
|
||||||
$which = $command[1];
|
|
||||||
|
|
||||||
$query = "select nation,name from nation where nation='$which'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$destnation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select state from diplomacy where me='{$general['nation']}' and you='{$destnation['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dip = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 40);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 3;
|
|
||||||
$term3 = Util::round(sqrt($genCount*2)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 75) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 75;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 75;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$destnation) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:없는 국가입니다. 피장파장 실패. <1>$date</>";
|
|
||||||
} elseif($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 피장파장 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 피장파장 실패. <1>$date</>";
|
|
||||||
} elseif($dip['state'] > 1) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:선포,전쟁중인 상대국에만 가능합니다. 피장파장 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 피장파장 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:피장파장 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:피장파장 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$destnation['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</>아국에 <M>피장파장</>이 발동되었습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <D><b>{$destnation['name']}</b></>에 <M>피장파장</>을 발동");
|
|
||||||
pushNationHistory($destnation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>{$josaYi} 아국에 <M>피장파장</>을 발동");
|
|
||||||
|
|
||||||
//전략기한+60
|
|
||||||
$query = "update nation set strategic_cmd_limit=strategic_cmd_limit+60 where nation='{$destnation['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한, 최소72
|
|
||||||
if($term3 < 72) { $term3 = 72; }
|
|
||||||
$query = "update nation set strategic_cmd_limit={$term3} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_76(&$general) {
|
|
||||||
$db = DB::db();
|
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
|
||||||
$connect=$db->get();
|
|
||||||
|
|
||||||
$log = [];
|
|
||||||
$alllog = [];
|
|
||||||
$history = [];
|
|
||||||
$sabotagelog = [];
|
|
||||||
|
|
||||||
$date = substr($general['turntime'],11,5);
|
|
||||||
|
|
||||||
$admin = $gameStor->getValues(['startyear','year','month','develcost','npccount', 'turnterm', 'turntime']);
|
|
||||||
|
|
||||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$city = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select nation,gennum,name,type,strategic_cmd_limit,l{$general['level']}term,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$genCount = Util::valueFit($nation['gennum'], GameConst::$initialNationGenLimit);
|
|
||||||
|
|
||||||
//$term2 = Util::round($genCount / 10);
|
|
||||||
//if($term2 == 0) { $term2 = 1; }
|
|
||||||
$term2 = 3;
|
|
||||||
$term3 = Util::round(sqrt($genCount*10)*10);
|
|
||||||
|
|
||||||
$code = $nation["l{$general['level']}term"];
|
|
||||||
if($code%100 == 76) {
|
|
||||||
$term = intdiv($code, 100) + 1;
|
|
||||||
$code = $term * 100 + 76;
|
|
||||||
} else {
|
|
||||||
$term = 1;
|
|
||||||
$code = 100 + 76;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($admin['year'] < $admin['startyear']+3) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:현재 초반 제한중입니다. 의병모집 실패. <1>$date</>";
|
|
||||||
} elseif($city['nation'] != $general['nation']) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 의병모집 실패. <1>$date</>";
|
|
||||||
} elseif($general['level'] < 5) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 의병모집 실패. <1>$date</>";
|
|
||||||
} elseif($nation['strategic_cmd_limit'] > 0) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:전략기한이 남았습니다. 의병모집 실패. <1>$date</>";
|
|
||||||
} elseif($term < $term2) {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:의병모집 수행중... ({$term}/{$term2}) <1>$date</>";
|
|
||||||
|
|
||||||
$query = "update nation set l{$general['level']}term={$code} where nation='{$general['nation']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
$log[] = "<C>●</>{$admin['month']}월:의병모집 발동! <1>$date</>";
|
|
||||||
$exp = 5 * $term2;
|
|
||||||
$ded = 5 * $term2;
|
|
||||||
|
|
||||||
// 성격 보정
|
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
|
||||||
|
|
||||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
|
||||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
|
||||||
|
|
||||||
$query = "select no,name from general where nation='{$general['nation']}' and no!='{$general['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$cnt = MYDB_num_rows($result);
|
|
||||||
$alllog[0] = "<C>●</><Y>{$general['name']}</>{$josaYi} <M>의병모집</>을 발동하였습니다.";
|
|
||||||
for($i=0; $i < $cnt; $i++) {
|
|
||||||
$gen = MYDB_fetch_array($result);
|
|
||||||
pushGenLog($gen, $alllog);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <M>의병모집</>을 발동하였습니다.";
|
|
||||||
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <M>의병모집</>을 발동하였습니다.";
|
|
||||||
$sabotagelog[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【전략】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <M>의병모집</>을 발동하였습니다.";
|
|
||||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<M>의병모집</>을 발동");
|
|
||||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <M>의병모집</>을 발동");
|
|
||||||
|
|
||||||
$avgGenNum = $db->queryFirstField('SELECT avg(gennum) FROM nation');
|
|
||||||
$addGenCount = 5 + Util::round($avgGenNum / 10);
|
|
||||||
|
|
||||||
$avgGen = $db->queryFirstRow('SELECT max(leadership+strength+intel) as stat_sum, avg(dedication) as ded,avg(experience) as exp, avg(dex1+dex2+dex3+dex4) as dex_t, avg(age) as age, avg(dex5) as dex5 from general where npc < 5 and nation = %i', $general['nation']);
|
|
||||||
|
|
||||||
$dexTotal = $avgGen['dex_t'];
|
|
||||||
|
|
||||||
//의병추가
|
|
||||||
$npc = 4;
|
|
||||||
$npcid = Util::randRangeInt(0, 9999999);
|
|
||||||
for($i=0; $i < $addGenCount; $i++) {
|
|
||||||
//무장 50%, 지장 50%, 무지장 0%
|
|
||||||
$stat_tier1 = GameConst::$defaultStatMax - 10 + rand()%11;
|
|
||||||
$stat_tier3 = GameConst::$defaultStatMin + rand()%6;
|
|
||||||
$stat_tier2 = GameConst::$defaultStatTotal - $stat_tier1 - $stat_tier3;
|
|
||||||
$type = Util::choiceRandomUsingWeight([
|
|
||||||
'strength0'=>1,
|
|
||||||
'strength1'=>1,
|
|
||||||
'strength_exp'=>1,
|
|
||||||
'intel'=>3,
|
|
||||||
'neutral'=>0
|
|
||||||
]);
|
|
||||||
switch($type){
|
|
||||||
case 'strength0':
|
|
||||||
$leadership = $stat_tier1;
|
|
||||||
$strength = $stat_tier2;
|
|
||||||
$intel = $stat_tier3;
|
|
||||||
$dexVal = [$dexTotal*5/8, $dexTotal/8, $dexTotal/8, $dexTotal/8];
|
|
||||||
break;
|
|
||||||
case 'strength1':
|
|
||||||
$leadership = $stat_tier1;
|
|
||||||
$strength = $stat_tier2;
|
|
||||||
$intel = $stat_tier3;
|
|
||||||
$dexVal = [$dexTotal/8, $dexTotal*5/8, $dexTotal/8, $dexTotal/8];
|
|
||||||
break;
|
|
||||||
case 'strength_exp':
|
|
||||||
$leadership = $stat_tier1;
|
|
||||||
$strength = $stat_tier2;
|
|
||||||
$intel = $stat_tier3;
|
|
||||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal*5/8, $dexTotal/8];
|
|
||||||
break;
|
|
||||||
case 'intel':
|
|
||||||
$leadership = $stat_tier1;
|
|
||||||
$strength = $stat_tier3;
|
|
||||||
$intel = $stat_tier2;
|
|
||||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal/8, $dexTotal*5/8];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$leadership = $stat_tier3;
|
|
||||||
$strength = $stat_tier1;
|
|
||||||
$intel = $stat_tier2;
|
|
||||||
$dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
|
||||||
if($avgGen['stat_sum'] > 210) {
|
|
||||||
$leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100);
|
|
||||||
$strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100);
|
|
||||||
$intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (60+rand()%31)/100);
|
|
||||||
} elseif($avgGen['stat_sum'] > 180) {
|
|
||||||
$leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100);
|
|
||||||
$strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100);
|
|
||||||
$intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (75+rand()%21)/100);
|
|
||||||
} else {
|
|
||||||
$leadership = Util::round($leadership * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100);
|
|
||||||
$strength = Util::round($strength * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100);
|
|
||||||
$intel = Util::round($intel * $avgGen['stat_sum'] / GameConst::$defaultStatTotal * (90+rand()%11)/100);
|
|
||||||
}
|
|
||||||
$over1 = 0;
|
|
||||||
$over2 = 0;
|
|
||||||
$over3 = 0;
|
|
||||||
// 너무 높은 능치는 다른 능치로 분산
|
|
||||||
if($leadership > 90) {
|
|
||||||
$over1 = rand() % ($leadership - 90) + 5;
|
|
||||||
$leadership -= $over1;
|
|
||||||
}
|
|
||||||
if($strength > 90) {
|
|
||||||
$over2 = rand() % ($strength - 90) + 5;
|
|
||||||
$strength -= $over2;
|
|
||||||
}
|
|
||||||
if($intel > 90) {
|
|
||||||
$over3 = rand() % ($intel - 90) + 5;
|
|
||||||
$intel -= $over3;
|
|
||||||
}
|
|
||||||
// 낮은 능치쪽으로 합산
|
|
||||||
if($type == 'strength') {
|
|
||||||
$intel = $intel + $over1 + $over2 + $over3;
|
|
||||||
} else {
|
|
||||||
$strength = $strength + $over1 + $over2 + $over3;
|
|
||||||
}
|
|
||||||
// 너무 높은 능치는 제한
|
|
||||||
if($leadership > GameConst::$defaultStatNPCMax) {
|
|
||||||
$leadership = GameConst::$defaultStatNPCMax;
|
|
||||||
}
|
|
||||||
if($strength > GameConst::$defaultStatNPCMax) {
|
|
||||||
$strength = GameConst::$defaultStatNPCMax;
|
|
||||||
}
|
|
||||||
if($intel > GameConst::$defaultStatNPCMax) {
|
|
||||||
$intel = GameConst::$defaultStatNPCMax;
|
|
||||||
}
|
|
||||||
|
|
||||||
$affinity = rand() % 150 + 1;
|
|
||||||
$name = "ⓖ의병장{$npcid}";
|
|
||||||
$picture = 'default.jpg';
|
|
||||||
$turntime = getRandTurn($admin['turnterm'], new \DateTimeImmutable($admin['turntime']));
|
|
||||||
$personal = rand() % 10;
|
|
||||||
$bornyear = $admin['year'];
|
|
||||||
$deadyear = $admin['year'] + 3;
|
|
||||||
$killturn = 64 + rand()%7;
|
|
||||||
|
|
||||||
@MYDB_query("
|
|
||||||
insert into general (
|
|
||||||
npc,npc_org,affinity,name,picture,nation,
|
|
||||||
city,leadership,strength,intel,experience,dedication,
|
|
||||||
level,gold,rice,crew,crewtype,train,atmos,tnmt,
|
|
||||||
weapon,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg,
|
|
||||||
makelimit,bornyear,deadyear,
|
|
||||||
dex1, dex2, dex3, dex4, dex5
|
|
||||||
) values (
|
|
||||||
'$npc','$npc','$affinity','$name','$picture','{$nation['nation']}',
|
|
||||||
'{$general['city']}','$leadership','$strength','$intel','{$avgGen['exp']}','{$avgGen['ded']}',
|
|
||||||
'1','100','100','0','".GameUnitConst::DEFAULT_CREWTYPE."','0','0','0',
|
|
||||||
'0','0','0','$turntime','$killturn','{$avgGen['age']}','1','$personal','0','0','0','0','',
|
|
||||||
'0','$bornyear','$deadyear',
|
|
||||||
'{$dexVal[0]}','{$dexVal[1]}','{$dexVal[2]}','{$dexVal[3]}','{$avgGen['dex5']}'
|
|
||||||
)",
|
|
||||||
$connect
|
|
||||||
) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
$npcid++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 국가보정
|
|
||||||
if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); }
|
|
||||||
if($nation['type'] == 12) { $term3 = $term3 * 2; }
|
|
||||||
|
|
||||||
//전략기한
|
|
||||||
$db->update('nation', [
|
|
||||||
'strategic_cmd_limit'=>$term3,
|
|
||||||
'gennum'=>$db->sqleval('gennum + %i', $addGenCount),
|
|
||||||
], 'nation=%i', $general['nation']);
|
|
||||||
|
|
||||||
//경험치, 공헌치
|
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pushWorldHistory($history, $admin['year'], $admin['month']);
|
|
||||||
// pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
|
||||||
pushSabotageLog($sabotagelog);
|
|
||||||
pushGenLog($general, $log);
|
|
||||||
}
|
|
||||||
|
|
||||||
function process_77(&$general) {
|
function process_77(&$general) {
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ else{
|
|||||||
|
|
||||||
$session->setReadOnly();
|
$session->setReadOnly();
|
||||||
|
|
||||||
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,name2,injury,leadership,strength,intel,experience,dedication,level,killturn,connect from general');
|
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,level,killturn,connect from general');
|
||||||
|
|
||||||
$ownerNameList = [];
|
$ownerNameList = [];
|
||||||
if($gameStor->isunited){
|
if($gameStor->isunited){
|
||||||
@@ -53,10 +53,10 @@ if($gameStor->isunited){
|
|||||||
|
|
||||||
$generalList = [];
|
$generalList = [];
|
||||||
foreach($rawGeneralList as $rawGeneral){
|
foreach($rawGeneralList as $rawGeneral){
|
||||||
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$name2,$injury,$leadership,$strength,$intel,$experience,$dedication,$level,$killturn,$connect] = $rawGeneral;
|
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$level,$killturn,$connect] = $rawGeneral;
|
||||||
|
|
||||||
if(key_exists($owner, $ownerNameList)){
|
if(key_exists($owner, $ownerNameList)){
|
||||||
$name2 = $ownerNameList[$owner];
|
$ownerName = $ownerNameList[$owner];
|
||||||
}
|
}
|
||||||
|
|
||||||
$nationArr = getNationStaticInfo($nation);
|
$nationArr = getNationStaticInfo($nation);
|
||||||
@@ -73,7 +73,7 @@ foreach($rawGeneralList as $rawGeneral){
|
|||||||
getGeneralSpecialWarName($special2),
|
getGeneralSpecialWarName($special2),
|
||||||
getGenChar($personal),
|
getGenChar($personal),
|
||||||
$name,
|
$name,
|
||||||
$npc==1?$name2:null,
|
$npc==1?$ownerName:null,
|
||||||
$injury,
|
$injury,
|
||||||
$leadership,
|
$leadership,
|
||||||
$lbonus,
|
$lbonus,
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ if ($gencount >= $maxgeneral) {
|
|||||||
|
|
||||||
//등록 시작
|
//등록 시작
|
||||||
$db->update('general', [
|
$db->update('general', [
|
||||||
'name2'=>$userNick,
|
'owner_name'=>$userNick,
|
||||||
'npc'=>1,
|
'npc'=>1,
|
||||||
'killturn'=>6,
|
'killturn'=>6,
|
||||||
'defence_train'=>80,
|
'defence_train'=>80,
|
||||||
|
|||||||
+1
-1
@@ -221,7 +221,7 @@ $affinity = rand()%150 + 1;
|
|||||||
$db->insert('general', [
|
$db->insert('general', [
|
||||||
'owner' => $userID,
|
'owner' => $userID,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'name2' => $member['name'],
|
'owner_name' => $member['name'],
|
||||||
'picture' => $face,
|
'picture' => $face,
|
||||||
'imgsvr' => $imgsvr,
|
'imgsvr' => $imgsvr,
|
||||||
'nation' => 0,
|
'nation' => 0,
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ function printGeneralList(value){
|
|||||||
special2:general[7],
|
special2:general[7],
|
||||||
personal:general[8],
|
personal:general[8],
|
||||||
name:general[9],
|
name:general[9],
|
||||||
name2:general[10],
|
ownerName:general[10],
|
||||||
injury:general[11],
|
injury:general[11],
|
||||||
leadership:general[12],
|
leadership:general[12],
|
||||||
lbonus:general[13],
|
lbonus:general[13],
|
||||||
@@ -213,8 +213,8 @@ function printGeneralList(value){
|
|||||||
general.userCSS = 'color:skyblue';
|
general.userCSS = 'color:skyblue';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(general.name2){
|
if(general.ownerName){
|
||||||
general.nameAux += '<br><small>({0})</small>'.format(general.name2);
|
general.nameAux += '<br><small>({0})</small>'.format(general.ownerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(general.reserved == 1){
|
if(general.reserved == 1){
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ class GameConstBase
|
|||||||
//'che_급습',
|
//'che_급습',
|
||||||
],
|
],
|
||||||
'기타'=>[
|
'기타'=>[
|
||||||
//'che_국기변경'
|
//'che_국기변경',
|
||||||
|
//'che_국호변경',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
public static $retirementYear = 80;
|
public static $retirementYear = 80;
|
||||||
|
|||||||
@@ -833,7 +833,7 @@ class General implements iAction{
|
|||||||
'horse', 'weapon', 'book', 'item', 'last_turn'
|
'horse', 'weapon', 'book', 'item', 'last_turn'
|
||||||
];
|
];
|
||||||
$fullColumn = [
|
$fullColumn = [
|
||||||
'no', 'name', 'name2', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity',
|
'no', 'name', 'owner_name', 'picture', 'imgsvr', 'nation', 'city', 'troop', 'injury', 'affinity',
|
||||||
'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item',
|
'leadership', 'leadership_exp', 'strength', 'strength_exp', 'intel', 'intel_exp', 'weapon', 'book', 'horse', 'item',
|
||||||
'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
'experience', 'dedication', 'level', 'gold', 'rice', 'crew', 'crewtype', 'train', 'atmos', 'turntime',
|
||||||
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
|
'makelimit', 'killturn', 'block', 'dedlevel', 'explevel', 'age', 'startage', 'belong',
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class DyingMessage{
|
|||||||
$this->name = $general->getName();
|
$this->name = $general->getName();
|
||||||
$this->npc = $general->getVar('npc');
|
$this->npc = $general->getVar('npc');
|
||||||
if($general->getVar('owner') > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
if($general->getVar('owner') > 0 && $general->getVar('startage') - $general->getVar('age') > 1){
|
||||||
$this->realName = $general->getVar('name2');
|
$this->realName = $general->getVar('owner_name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class TurnExecutionHelper
|
|||||||
// npc유저 삭턴시 npc로 전환
|
// npc유저 삭턴시 npc로 전환
|
||||||
if($general->getVar('npc') == 1 && $general->getVar('deadyear') > $gameStor->year){
|
if($general->getVar('npc') == 1 && $general->getVar('deadyear') > $gameStor->year){
|
||||||
|
|
||||||
$ownerName = $general->getVar('name2');
|
$ownerName = $general->getVar('owner_name');
|
||||||
$josaYi = JosaUtil::pick($ownerName, '이');
|
$josaYi = JosaUtil::pick($ownerName, '이');
|
||||||
|
|
||||||
$logger->pushGlobalActionLog("{$ownerName}</>{$josaYi} <Y>{$generalName}</>의 육체에서 <S>유체이탈</>합니다!");
|
$logger->pushGlobalActionLog("{$ownerName}</>{$josaYi} <Y>{$generalName}</>의 육체에서 <S>유체이탈</>합니다!");
|
||||||
@@ -185,7 +185,7 @@ class TurnExecutionHelper
|
|||||||
$general->setVar('npc', $general->getVar('npc_org'));
|
$general->setVar('npc', $general->getVar('npc_org'));
|
||||||
$general->setVar('owner', 1);
|
$general->setVar('owner', 1);
|
||||||
$general->setVar('defence_train', 80);
|
$general->setVar('defence_train', 80);
|
||||||
$general->setVar('name2', null);
|
$general->setVar('owner_name', null);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$general->applyDB($db);
|
$general->applyDB($db);
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ CREATE TABLE `general` (
|
|||||||
`picture` VARCHAR(40) NOT NULL,
|
`picture` VARCHAR(40) NOT NULL,
|
||||||
`imgsvr` INT(1) NOT NULL DEFAULT '0',
|
`imgsvr` INT(1) NOT NULL DEFAULT '0',
|
||||||
`name` CHAR(32) NOT NULL COLLATE 'utf8mb4_bin',
|
`name` CHAR(32) NOT NULL COLLATE 'utf8mb4_bin',
|
||||||
`name2` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
|
`owner_name` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
|
||||||
`nation` INT(6) NOT NULL DEFAULT '0',
|
`nation` INT(6) NOT NULL DEFAULT '0',
|
||||||
`city` INT(6) NOT NULL DEFAULT '3',
|
`city` INT(6) NOT NULL DEFAULT '3',
|
||||||
`troop` INT(6) NOT NULL DEFAULT '0',
|
`troop` INT(6) NOT NULL DEFAULT '0',
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
<div class="hall_nation" style="background-color:<?=$general['bgColor']?>;color:<?=$general['fgColor']?>;"><?=$general['nationName']??'-'?></div>
|
<div class="hall_nation" style="background-color:<?=$general['bgColor']?>;color:<?=$general['fgColor']?>;"><?=$general['nationName']??'-'?></div>
|
||||||
<div class="hall_name" style="background-color:<?=$general['bgColor']?>;color:<?=$general['fgColor']?>;"><p><?=$general['name']??'-'?>
|
<div class="hall_name" style="background-color:<?=$general['bgColor']?>;color:<?=$general['fgColor']?>;"><p><?=$general['name']??'-'?>
|
||||||
<?php if($general["owner_name"]??null): ?>
|
<?php if($general["ownerName"]??null): ?>
|
||||||
<div class="hall_owner">(<?=$general['owner_name']?>)</div>
|
<div class="hall_owner">(<?=$general['ownerName']?>)</div>
|
||||||
<?php endif;?>
|
<?php endif;?>
|
||||||
</p></div>
|
</p></div>
|
||||||
<div class="hall_value"><?=$general['printValue']??$general['value']?></div>
|
<div class="hall_value"><?=$general['printValue']??$general['value']?></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user