징병 모병 추가, iAction 구조 일부 변경
This commit is contained in:
@@ -399,149 +399,6 @@ function process_11(&$general, $type) {
|
||||
$actLog->pushGeneralActionLog($log, ActionLogger::RAWTEXT);
|
||||
}
|
||||
|
||||
function process_31(&$general) {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
$msg = [];
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month', 'develcost']);
|
||||
|
||||
$dist = searchDistance($general['city'], 2, false);
|
||||
$command = DecodeCommand($general['turn0']);
|
||||
$destination = $command[1];
|
||||
|
||||
$query = "select * from city where city='$destination'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
|
||||
if(!$city) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 도시입니다. 첩보 실패. <1>$date</>";
|
||||
} elseif($general['gold'] < $admin['develcost']*3) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 모자랍니다. <G><b>{$city['name']}</b></>에 첩보 실패. <1>$date</>";
|
||||
} elseif($general['rice'] < $admin['develcost']*3) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:군량이 모자랍니다. <G><b>{$city['name']}</b></>에 첩보 실패. <1>$date</>";
|
||||
} elseif($general['nation'] == $city['nation']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:아국입니다. <G><b>{$city['name']}</b></>에 첩보 실패. <1>$date</>";
|
||||
// } elseif(!key_exists($destination, $dist)) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:너무 멉니다. <G><b>{$city['name']}</b></>에 첩보 실패. <1>$date</>";
|
||||
} else {
|
||||
$query = "select crew,crewtype from general where city='$destination' and nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$crew = 0;
|
||||
$typecount = [];
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
if($gen['crew'] != 0) {
|
||||
if(!key_exists($gen['crewtype'], $typecount)){
|
||||
$typecount[$gen['crewtype']] = 1;
|
||||
}
|
||||
else{
|
||||
$typecount[$gen['crewtype']]+=1;
|
||||
}
|
||||
|
||||
$crew += $gen['crew'];
|
||||
}
|
||||
}
|
||||
if(!key_exists($destination, $dist)) {
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:누군가가 <G><b>{$city['name']}</b></>{$josaUl} 살피는 것 같습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$city['name']}</b></>의 소문만 들을 수 있었습니다. <1>$date</>";
|
||||
$log[] = "【<G>{$city['name']}</>】주민:{$city['pop']}, 민심:".round($city['trust'], 1).", 장수:$gencount, 병력:$crew";
|
||||
} elseif($dist[$destination] == 2) {
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:누군가가 <G><b>{$city['name']}</b></>{$josaUl} 살피는 것 같습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$city['name']}</b></>의 어느정도 정보를 얻었습니다. <1>$date</>";
|
||||
$log[] = "【<M>첩보</>】농업:{$city['agri']}, 상업:{$city['comm']}, 치안:{$city['secu']}, 수비:{$city['def']}, 성벽:{$city['wall']}";
|
||||
$log[] = "【<G>{$city['name']}</>】주민:{$city['pop']}, 민심:".round($city['trust'], 1).", 장수:$gencount, 병력:$crew";
|
||||
} else {
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:누군가가 <G><b>{$city['name']}</b></>{$josaUl} 살피는 것 같습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$city['name']}</b></>의 많은 정보를 얻었습니다. <1>$date</>";
|
||||
$msg[] = "【<S>병종</>】";
|
||||
|
||||
foreach($typecount as $crewtype=>$cnt){
|
||||
$crewtypeText = mb_substr(GameUnitConst::byID($crewtype)->name, 0, 2);
|
||||
$msg[] = "{$crewtypeText}:{$cnt}";
|
||||
}
|
||||
|
||||
$log[] = join(' ', $msg);
|
||||
$msg = [];
|
||||
|
||||
$log[] = "【<M>첩보</>】농업:{$city['agri']}, 상업:{$city['comm']}, 치안:{$city['secu']}, 수비:{$city['def']}, 성벽:{$city['wall']}";
|
||||
$log[] = "【<G>{$city['name']}</>】주민:{$city['pop']}, 민심:".round($city['trust'], 1).", 장수:$gencount, 병력:$crew";
|
||||
|
||||
if($general['nation'] != 0 && $city['nation'] != 0) {
|
||||
$query = "select name,tech from nation where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$yourTech = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select tech from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$myTech = MYDB_fetch_array($result);
|
||||
|
||||
$diff = floor($yourTech['tech']) - floor($myTech['tech']); // 차이
|
||||
if($diff >= 1000) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<M>↑</>압도"; }
|
||||
elseif($diff >= 250) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<Y>▲</>우위"; }
|
||||
elseif($diff >= -250) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<W>↕</>대등"; }
|
||||
elseif($diff >= -1000) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<G>▼</>열위"; }
|
||||
else { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<C>↓</>미미"; }
|
||||
}
|
||||
}
|
||||
|
||||
// 자금 하락 // 경험치 상승 // 공헌도, 명성 상승
|
||||
$exp = rand() % 100 + 1;
|
||||
$ded = rand() % 70 + 1;
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
$general['leader2']++;
|
||||
$general['gold'] -= $admin['develcost']*3;
|
||||
$general['rice'] -= $admin['develcost']*3;
|
||||
$query = "update general set resturn='SUCCESS',gold='{$general['gold']}',rice='{$general['rice']}',leader2='{$general['leader2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
|
||||
|
||||
$rawSpy = $db->queryFirstField('SELECT spy FROM nation WHERE nation = %i', $general['nation']);
|
||||
|
||||
if($rawSpy == ''){
|
||||
$spyInfo = [];
|
||||
}
|
||||
else if(strpos($rawSpy, '|') !== false || is_numeric($rawSpy)){
|
||||
//TODO: 0.8 버전 이후에는 삭제할 것. 이후 버전은 json으로 변경됨.
|
||||
$spyInfo = [];
|
||||
foreach(explode('|', $rawSpy) as $value){
|
||||
$value = intval($value);
|
||||
$cityNo = intdiv($value, 10);
|
||||
$remainMonth = $value % 10;
|
||||
$spyInfo[$cityNo] = $remainMonth;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$spyInfo = Json::decode($rawSpy);
|
||||
}
|
||||
|
||||
$spyInfo[$destination] = 3;
|
||||
|
||||
$db->update('nation', [
|
||||
'spy'=>Json::encode($spyInfo, Json::EMPTY_ARRAY_IS_DICT)
|
||||
], 'nation=%i', $general['nation']);
|
||||
|
||||
$log = checkAbility($general, $log);
|
||||
}
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
|
||||
function process_48(&$general) {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
Reference in New Issue
Block a user