정적 분석기 결과 반영
This commit is contained in:
@@ -9,6 +9,9 @@ function MYDB_num_rows($result) {
|
||||
return mysqli_num_rows($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed[]
|
||||
*/
|
||||
function MYDB_fetch_array($result) {
|
||||
return mysqli_fetch_array($result);
|
||||
}
|
||||
|
||||
+10
-6
@@ -283,9 +283,9 @@ function myNationInfo() {
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=68 align=center id=bg1><b>".getLevel(12, $nation['level'])."</b></td>
|
||||
<td width=178 align=center>";echo $level12==''?"-":"{$level12['name']}"; echo "</td>
|
||||
<td width=178 align=center>";echo $level12?$level12['name']:"-"; echo "</td>
|
||||
<td width=68 align=center id=bg1><b>".getLevel(11, $nation['level'])."</b></td>
|
||||
<td width=178 align=center>";echo $level11==''?"-":"{$level11['name']}"; echo "</td>
|
||||
<td width=178 align=center>";echo $level11?$level11['name']:"-"; echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1><b>총주민</b></td>
|
||||
@@ -2154,6 +2154,8 @@ function uniqueItem($general, $log, $vote=0) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$occupied = [];
|
||||
$item = [];
|
||||
|
||||
if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; }
|
||||
if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; }
|
||||
@@ -2204,8 +2206,8 @@ function uniqueItem($general, $log, $vote=0) {
|
||||
|
||||
$nation = getNationStaticInfo($general['nation']);
|
||||
|
||||
if($nation == null) {
|
||||
$nation['name'] = "재야";
|
||||
if($nation === null) {
|
||||
$nation = ['name' => "재야"];
|
||||
}
|
||||
|
||||
switch($sel) {
|
||||
@@ -2422,6 +2424,7 @@ function deleteNation($general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
@@ -2514,7 +2517,7 @@ function nextRuler($general) {
|
||||
$query = "update city set gen3=0 where gen3='{$nextruler['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받았습니다";
|
||||
$history = ["<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받았습니다"];
|
||||
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
pushNationHistory($nation, "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받음.");
|
||||
@@ -2574,7 +2577,7 @@ function isClose($nation1, $nation2) {
|
||||
}
|
||||
|
||||
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i', $nation2) as $city){
|
||||
foreach(array_keys(CityConst::byID($city)->$path) as $adjCity){
|
||||
foreach(array_keys(CityConst::byID($city)->path) as $adjCity){
|
||||
if(key_exists($adjCity, $nation1Cities)){
|
||||
return true;
|
||||
}
|
||||
@@ -2651,6 +2654,7 @@ function CharCritical($rate, $personal) {
|
||||
function TrickInjury($city, $type=0) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$log = [];
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -254,6 +254,7 @@ function getCoreTurn($nation, $level) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$str = [];
|
||||
$turn = [];
|
||||
|
||||
$turn[0] = $nation["l{$level}turn0"];
|
||||
$turn[1] = $nation["l{$level}turn1"];
|
||||
|
||||
@@ -395,7 +395,7 @@ function getBill($dedication) {
|
||||
return ($level * 200 + 400);
|
||||
}
|
||||
|
||||
function getCost($armtype) {
|
||||
function getCost(int $armtype) {
|
||||
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
|
||||
//TODO: 병종 값이 column으로 들어있는건 전혀 옳지 않음. key->value 형태로 바꿔야함
|
||||
return DB::db()->queryFirstColumn('select %b from game limit 1', sprintf('cst%d', $armtype));
|
||||
|
||||
@@ -136,7 +136,7 @@ function acceptScout($messageInfo, $general, $msgResponse){
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($alllog, $year, $month);
|
||||
|
||||
return [true, 'success'];
|
||||
@@ -149,6 +149,12 @@ function declineScout($messageInfo, $reason=null){
|
||||
];
|
||||
$you = ['no'=>$messageInfo['src']['id']];
|
||||
|
||||
$nation = getNationStaticInfo($messageInfo['src']['nationID']);
|
||||
$generalID = $me['no'];
|
||||
$nationID = $nation['nation'];
|
||||
$nationName = $nation['name'];
|
||||
$myName = $me['name'];
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
|
||||
@@ -167,7 +173,7 @@ function declineScout($messageInfo, $reason=null){
|
||||
$db = DB::db();
|
||||
$db->query('UPDATE `message` SET `valid_until`=\'1234-11-22 11:22:33\' WHERE `id` = %i', $messageInfo['id']);
|
||||
|
||||
sendRawMessage('private', false, $general['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
|
||||
sendRawMessage('private', false, $you['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
|
||||
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
|
||||
+23
-12
@@ -109,7 +109,7 @@ function getSpecial($leader, $power, $intel) {
|
||||
$type = array(1, 2, 3, 31);
|
||||
$special = $type[array_rand($type)];
|
||||
// 거상, 귀모는 그중에 25% * 10% = 2.5%
|
||||
if($special == 31 && randBool(0.9)) {
|
||||
if($special == 31 && Util::randBool(0.9)) {
|
||||
$type = array(1, 2, 3);
|
||||
$special = $type[array_rand($type)];
|
||||
}
|
||||
@@ -399,8 +399,7 @@ function preUpdateMonthly() {
|
||||
$query = "update general set crew=0,rice=0 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</>군량이 모자라 병사들이 <R>소집해제</>되었습니다!";
|
||||
pushGenLog($general, $log);
|
||||
pushGenLog($general, ["<C>●</>군량이 모자라 병사들이 <R>소집해제</>되었습니다!"]);
|
||||
}
|
||||
|
||||
//접률감소
|
||||
@@ -472,11 +471,12 @@ function preUpdateMonthly() {
|
||||
$nationCount = MYDB_num_rows($result);
|
||||
for($i=0; $i < $nationCount; $i++) {
|
||||
$nation = MYDB_fetch_array($result);
|
||||
$spy = ""; $k = 0; unset($citys);
|
||||
if($nation['spy'] != "") { $citys = explode("|", $nation['spy']); }
|
||||
$spy = ""; $k = 0;
|
||||
$citys = [];
|
||||
if($nation['spy'] != "") { $citys = explode("|", (string)$nation['spy']); }
|
||||
while(count($citys)) {
|
||||
$citys[$k]--;
|
||||
if($citys[$k]%10 != 0) { $spy .= "$citys[$k]"; }
|
||||
if($citys[$k]%10 != 0) { $spy .= (string)$citys[$k]; }
|
||||
$k++;
|
||||
if($k >= count($citys)) { break; }
|
||||
if($citys[$k-1]%10 != 0) { $spy .= "|"; }
|
||||
@@ -676,6 +676,10 @@ function checkMerge() {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$history = [];
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
@@ -781,9 +785,10 @@ function checkMerge() {
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
unset($mylog);
|
||||
unset($youlog);
|
||||
unset($history);
|
||||
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$history = [];
|
||||
|
||||
refreshNationStaticInfo();
|
||||
}
|
||||
@@ -802,6 +807,10 @@ function checkSurrender() {
|
||||
$dipcount = MYDB_num_rows($dipresult);
|
||||
|
||||
for($i=0; $i < $dipcount; $i++) {
|
||||
$mylog = [];
|
||||
$youlog = [];
|
||||
$history = [];
|
||||
|
||||
$dip = MYDB_fetch_array($dipresult);
|
||||
|
||||
// 아국군주
|
||||
@@ -904,9 +913,6 @@ function checkSurrender() {
|
||||
pushGenLog($me, $mylog);
|
||||
pushGenLog($you, $youlog);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
unset($mylog);
|
||||
unset($youlog);
|
||||
unset($history);
|
||||
|
||||
refreshNationStaticInfo();
|
||||
}
|
||||
@@ -1001,6 +1007,9 @@ function checkStatistic() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$nationHists = [];
|
||||
$specialHists = [];
|
||||
|
||||
$etc = '';
|
||||
|
||||
$query = "select avg(gold) as avggold, avg(rice) as avgrice, avg(dex0+dex10+dex20+dex30) as avgdex, max(dex0+dex10+dex20+dex30) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded from general";
|
||||
@@ -1212,6 +1221,7 @@ function checkEmperior() {
|
||||
$query = "select name,picture,killnum from general where nation='{$nation['nation']}' order by killnum desc limit 5"; // 오호장군
|
||||
$tigerresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$tigernum = MYDB_num_rows($tigerresult);
|
||||
$tigerstr = '';
|
||||
for($i=0; $i < $tigernum; $i++) {
|
||||
$tiger = MYDB_fetch_array($tigerresult);
|
||||
if($tiger['killnum'] > 0) {
|
||||
@@ -1222,6 +1232,7 @@ function checkEmperior() {
|
||||
$query = "select name,picture,firenum from general where nation='{$nation['nation']}' order by firenum desc limit 7"; // 건안칠자
|
||||
$eagleresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$eaglenum = MYDB_num_rows($eagleresult);
|
||||
$eaglestr = '';
|
||||
for($i=0; $i < $eaglenum; $i++) {
|
||||
$eagle = MYDB_fetch_array($eagleresult);
|
||||
if($eagle['firenum'] > 0) {
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ function printCitysName(int $cityNo, int $maxDistance=1) {
|
||||
default: $color = "yellow"; break;
|
||||
}
|
||||
|
||||
echo "{$distance}칸 떨어진 도시 : <span style='color:{$color};font-weight:bold;'>{$cityStr}</span><br>";
|
||||
echo "{$dist}칸 떨어진 도시 : <span style='color:{$color};font-weight:bold;'>{$cityStr}</span><br>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ function getMailboxList(){
|
||||
$nationID = $nation['nation'];
|
||||
$mailbox = $nationID + 9000;
|
||||
$nation = $nation['name'];
|
||||
$color = ('#'.$nation['color']).replace('##','#');//xxx: #기호 없는 이전 코드 대비용
|
||||
$color = $nation['color'];
|
||||
$generals = Util::array_get($generalNations[$nationID], []);
|
||||
|
||||
return [
|
||||
|
||||
@@ -1857,6 +1857,7 @@ function process_76(&$general) {
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$tricklog = [];
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
|
||||
@@ -670,15 +670,16 @@ function setGift($tnmt_type, $tnmt, $phase) {
|
||||
|
||||
$cost = $admin['develcost'] * 20;
|
||||
$cost2 = $admin['develcost'] * 12;
|
||||
$history[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>{$tp}</> 대회에서 <Y>{$general['name']}</>(이)가 <C>우승</>, <Y>{$general2['name']}</>(이)가 <C>준우승</>을 차지하여 천하에 이름을 떨칩니다!";
|
||||
$history[1] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>{$tp}</> 대회의 <S>우승자</>에게는 <C>{$cost}</>, <S>준우승자</>에겐 <C>{$cost2}</>의 <S>상금</>과 약간의 <S>명성</>이 주어집니다!";
|
||||
$history = [
|
||||
"<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>{$tp}</> 대회에서 <Y>{$general['name']}</>(이)가 <C>우승</>, <Y>{$general2['name']}</>(이)가 <C>준우승</>을 차지하여 천하에 이름을 떨칩니다!",
|
||||
"<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>{$tp}</> 대회의 <S>우승자</>에게는 <C>{$cost}</>, <S>준우승자</>에겐 <C>{$cost2}</>의 <S>상금</>과 약간의 <S>명성</>이 주어집니다!"
|
||||
];
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
for($i=0; $i < count($genNo); $i++) {
|
||||
$general['no'] = $genNo[$i];
|
||||
$general['name'] = $genName[$i];
|
||||
$log[0] = "<S>◆</><C>{$tp}</> 대회의 {$genCall[$genNo[$i]]}로 <C>{$genGold[$genNo[$i]]}</>의 <S>상금</>, 약간의 <S>명성</> 획득!";
|
||||
pushGenLog($general, $log);
|
||||
pushGenLog($general, ["<S>◆</><C>{$tp}</> 대회의 {$genCall[$genNo[$i]]}로 <C>{$genGold[$genNo[$i]]}</>의 <S>상금</>, 약간의 <S>명성</> 획득!"]);
|
||||
}
|
||||
|
||||
//우승자 번호
|
||||
@@ -766,10 +767,11 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
if($type == 0) { $turn = 10; }
|
||||
else { $turn = 100; }
|
||||
|
||||
if($tnmt_type == 0) { $tp = "tot"; $tp2 = "tt"; }
|
||||
elseif($tnmt_type == 1) { $tp = "ldr"; $tp2 = "tl"; }
|
||||
|
||||
if($tnmt_type == 1) { $tp = "ldr"; $tp2 = "tl"; }
|
||||
elseif($tnmt_type == 2) { $tp = "pwr"; $tp2 = "tp"; }
|
||||
elseif($tnmt_type == 3) { $tp = "itl"; $tp2 = "ti"; }
|
||||
else /*$tnmt_type == 0*/{ $tp = "tot"; $tp2 = "tt"; }
|
||||
|
||||
$e1 = $energy1 = round($gen1[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
$e2 = $energy2 = round($gen2[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ function Error($message, $url="")
|
||||
ob_get_flush();
|
||||
|
||||
die($templates->render('error', [
|
||||
'message' => $msg
|
||||
'message' => $message
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
+108
-68
@@ -3,6 +3,8 @@ namespace sammo;
|
||||
|
||||
|
||||
function processWar($general, $city) {
|
||||
'@phan-var array<string,int|string|null> $general';
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
@@ -15,8 +17,24 @@ function processWar($general, $city) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$game = MYDB_fetch_array($result);
|
||||
|
||||
$deadAmount['att'] = 0;
|
||||
$deadAmount['def'] = 0;
|
||||
$year = $game['year'];
|
||||
$month = $game['month'];
|
||||
|
||||
$log = [];
|
||||
$batlog = [];
|
||||
$batres = [];
|
||||
|
||||
$opplog = [];
|
||||
$oppbatlog = [];
|
||||
$oppbatres = [];
|
||||
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
$deadAmount = [
|
||||
'att'=>0,
|
||||
'def'=>0
|
||||
];
|
||||
|
||||
$warphase = GameUnitConst::byID($general['crewtype'])->speed; //병종간 페이즈 수 얻기
|
||||
|
||||
@@ -92,8 +110,8 @@ function processWar($general, $city) {
|
||||
if($originCity['level'] == 2) { $genAtmosBonus += 5; } // 출병도시가 진이면 공격자 공격보정
|
||||
if($city['level'] == 3) { $oppTrainBonus += 5; } // 방어도시가 관이면 방어자 방어보정
|
||||
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></>(으)로 진격합니다.";
|
||||
$log[] = "<C>●</>{$game['month']}월:<G><b>{$city['name']}</b></>(으)로 <M>진격</>합니다. <1>$date</>";
|
||||
$alllog[] = "<C>●</>{$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></>(으)로 진격합니다.";
|
||||
$log[] = "<C>●</>{$month}월:<G><b>{$city['name']}</b></>(으)로 <M>진격</>합니다. <1>$date</>";
|
||||
|
||||
// 목표 도시내에 목표 국가 소속 장수 중, 병사가 있는 능력치합+병사수 순으로 훈,사 60, 80 이상
|
||||
$query = "select no,name,turntime,personal,special2,crew,crewtype,atmos,train,intel,intel2,book,power,power2,weap,injury,leader,leader2,horse,item,explevel,level,rice,leader+power+intel+weap+horse+book+crew/100 as sum,dex0,dex10,dex20,dex30,dex40 from general where city='{$city['city']}' and nation='{$city['nation']}' and nation!=0 and crew>'0' and rice>round(crew/100) and ((train>=60 and atmos>=60 and mode=1) or (train>=80 and atmos>=80 and mode=2)) order by sum desc";
|
||||
@@ -112,10 +130,10 @@ function processWar($general, $city) {
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$alllog[] = "<C>●</>{$game['month']}월:병량 부족으로 <G><b>{$city['name']}</b></>의 수비병들이 <R>패퇴</>합니다.";
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<M><b>【패퇴】</b></><D><b>{$destnation['name']}</b></>(이)가 병량 부족으로 <G><b>{$city['name']}</b></>(을)를 뺏기고 말았습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:병량 부족으로 <G><b>{$city['name']}</b></>의 수비병들이 <R>패퇴</>합니다.";
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<M><b>【패퇴】</b></><D><b>{$destnation['name']}</b></>(이)가 병량 부족으로 <G><b>{$city['name']}</b></>(을)를 뺏기고 말았습니다.";
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
unset($log);
|
||||
unset($alllog);
|
||||
@@ -135,7 +153,7 @@ function processWar($general, $city) {
|
||||
break;
|
||||
// 장수가 없어서 도시 공격
|
||||
} elseif($opposecount == 0) {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 ".GameUnitConst::byId($general['crewtype'])->name."(으)로 성벽을 공격합니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>(이)가 ".GameUnitConst::byId($general['crewtype'])->name."(으)로 성벽을 공격합니다.";
|
||||
$log[] = "<C>●</>".GameUnitConst::byId($general['crewtype'])->name."(으)로 성벽을 <M>공격</>합니다.";
|
||||
|
||||
$general['train'] += 1; //훈련 상승
|
||||
@@ -395,8 +413,8 @@ function processWar($general, $city) {
|
||||
];
|
||||
|
||||
$res = $templates->render('small_war_log',[
|
||||
'year'=>$game['year'],
|
||||
'month'=>$game['month'],
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'siege',
|
||||
'war_type_str'=>'성',
|
||||
'me' => $render_attacker,
|
||||
@@ -417,8 +435,7 @@ function processWar($general, $city) {
|
||||
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$adminLog[0] = "성벽 쌀 소모 : $rice";
|
||||
pushAdminLog($adminLog);
|
||||
pushAdminLog(["성벽 쌀 소모 : $rice"]);
|
||||
|
||||
//원래대로 스케일링
|
||||
$city['def'] = round($city['def'] / 10);
|
||||
@@ -443,7 +460,7 @@ function processWar($general, $city) {
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($game['startyear'], $game['year'], $nation['tech'])) { $num = floor($num/4); }
|
||||
if(TechLimit($game['startyear'], $year, $nation['tech'])) { $num = floor($num/4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 기술로 누적
|
||||
@@ -452,7 +469,7 @@ function processWar($general, $city) {
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($game['startyear'], $game['year'], $destnation['tech'])) { $num = floor($num/4); }
|
||||
if(TechLimit($game['startyear'], $year, $destnation['tech'])) { $num = floor($num/4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//양국 평균 기술가격
|
||||
@@ -484,26 +501,26 @@ function processWar($general, $city) {
|
||||
pushGenLog($general, $log);
|
||||
pushBatLog($general, $batlog);
|
||||
pushBatRes($general, $batres);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
unset($log);
|
||||
unset($batlog);
|
||||
unset($batres);
|
||||
unset($alllog);
|
||||
unset($history);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history, $year, $month);
|
||||
$log = [];
|
||||
$batlog = [];
|
||||
$batres = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
ConquerCity($game, $general, $city, $nation, $destnation);
|
||||
break;
|
||||
// 공격 장수 병사 소진시 실패 처리
|
||||
} elseif($general['crew'] <= 0) {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>퇴각했습니다.";
|
||||
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
} elseif($myRice <= round($general['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
@@ -513,7 +530,7 @@ function processWar($general, $city) {
|
||||
// 장수 대결
|
||||
} else {
|
||||
$oppose = MYDB_fetch_array($result);
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(와)과 <Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 대결합니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(와)과 <Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 대결합니다.";
|
||||
$log[] = "<C>●</>".GameUnitConst::byId($general['crewtype'])->name."(으)로 <Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(을)를 <M>공격</>합니다.";
|
||||
$opplog[] = "<C>●</>".GameUnitConst::byId($oppose['crewtype'])->name."(으)로 <Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(을)를 <M>수비</>합니다.";
|
||||
|
||||
@@ -1272,8 +1289,8 @@ function processWar($general, $city) {
|
||||
];
|
||||
|
||||
$res = $templates->render('small_war_log',[
|
||||
'year'=>$game['year'],
|
||||
'month'=>$game['month'],
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'attack',
|
||||
'war_type_str'=>'공',
|
||||
'me' => $render_attacker,
|
||||
@@ -1281,8 +1298,8 @@ function processWar($general, $city) {
|
||||
]);
|
||||
|
||||
$oppres = $templates->render('small_war_log',[
|
||||
'year'=>$game['year'],
|
||||
'month'=>$game['month'],
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'defense',
|
||||
'war_type_str'=>'수',
|
||||
'me' => $render_defender,
|
||||
@@ -1318,7 +1335,7 @@ function processWar($general, $city) {
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($game['startyear'], $game['year'], $nation['tech'])) { $num = floor($num/4); }
|
||||
if(TechLimit($game['startyear'], $year, $nation['tech'])) { $num = floor($num/4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -1341,7 +1358,7 @@ function processWar($general, $city) {
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($game['startyear'], $game['year'], $destnation['tech'])) { $num = floor($num/4); }
|
||||
if(TechLimit($game['startyear'], $year, $destnation['tech'])) { $num = floor($num/4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//양국 평균 기술가격
|
||||
@@ -1365,11 +1382,11 @@ function processWar($general, $city) {
|
||||
// 상대 병사 소진이나 쌀 소진시 다음 장수
|
||||
if($oppose['crew'] <= 0 || ($opRice <= round($oppose['crew']/100) && $general['crew'] > 0)) {
|
||||
if($opRice <= round($oppose['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 패퇴했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 패퇴했습니다.";
|
||||
$log[] = "<C>●</><Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 패퇴했습니다.";
|
||||
$opplog[] = "<C>●</>군량 부족으로 패퇴합니다.";
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 전멸했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 전멸했습니다.";
|
||||
$log[] = "<C>●</><Y>{$oppose['name']}</>의 ".GameUnitConst::byId($oppose['crewtype'])->name."(이)가 전멸했습니다.";
|
||||
$opplog[] = "<C>●</>전멸했습니다.";
|
||||
}
|
||||
@@ -1403,11 +1420,11 @@ function processWar($general, $city) {
|
||||
// 공격 장수 병사 소진이나 쌀 소진시 실패 처리
|
||||
} elseif($general['crew'] <= 0 || $myRice <= round($general['crew']/100)) {
|
||||
if($myRice <= round($general['crew']/100)) {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
$opplog[] = "<C>●</><Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
} else {
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
$log[] = "<C>●</>퇴각했습니다.";
|
||||
$opplog[] = "<C>●</><Y>{$general['name']}</>의 ".GameUnitConst::byId($general['crewtype'])->name."(이)가 퇴각했습니다.";
|
||||
}
|
||||
@@ -1445,7 +1462,7 @@ function processWar($general, $city) {
|
||||
unset($opplog);
|
||||
unset($oppbatlog);
|
||||
unset($oppbatres);
|
||||
// $alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 }<G>{$city['name']}</> 공략에 실패했습니다. <1>$date</>";
|
||||
// $alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>(이)가 }<G>{$city['name']}</> 공략에 실패했습니다. <1>$date</>";
|
||||
// $log[] = "<C>●</> <G>{$city['name']}</> 공략에 실패했습니다. <1>$date</>";
|
||||
break;
|
||||
} else {
|
||||
@@ -1497,7 +1514,7 @@ function processWar($general, $city) {
|
||||
pushGenLog($general, $log);
|
||||
pushBatLog($general, $batlog);
|
||||
pushBatRes($general, $batres);
|
||||
pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
|
||||
return $deadAmount;
|
||||
@@ -1593,16 +1610,16 @@ function addConflict($city, $nationnum, $mykillnum) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$nationlist = [];
|
||||
$killnum = [];
|
||||
|
||||
$query = "select year,month from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error("addConflict ".MYDB_error($connect),"");
|
||||
$game = MYDB_fetch_array($result);
|
||||
|
||||
if($city['conflict'] == "") {
|
||||
unset($nationlist);
|
||||
unset($killnum);
|
||||
} else {
|
||||
$nationlist = explode("|", $city['conflict']);
|
||||
$killnum = explode("|", $city['conflict2']);
|
||||
if($city['conflict']){
|
||||
$nationlist = array_map('intval', explode("|", $city['conflict']));
|
||||
$killnum = array_map('intval', explode("|", $city['conflict2']));
|
||||
}
|
||||
|
||||
for($i=0; $i < count($nationlist); $i++) {
|
||||
@@ -1611,8 +1628,7 @@ function addConflict($city, $nationnum, $mykillnum) {
|
||||
if($i != 0 && $i == count($nationlist)) { // 두번째 나라부터 분쟁 가담 메시지 출력
|
||||
$nation = getNationStaticInfo($nationnum);
|
||||
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<M><b>【분쟁】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다.";
|
||||
pushWorldHistory($history);
|
||||
pushWorldHistory(["<C>●</>{$game['year']}년 {$game['month']}월:<M><b>【분쟁】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다."]);
|
||||
}
|
||||
|
||||
$nationlist[$i] = $nationnum;
|
||||
@@ -1663,12 +1679,12 @@ function DeleteConflict($nation) {
|
||||
}
|
||||
}
|
||||
|
||||
function getConquerNation($city) {
|
||||
function getConquerNation($city) : int {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$nationlist = explode("|", (string)$city['conflict']);
|
||||
$killnum = explode("|", (string)$city['conflict2']);
|
||||
$nationlist = array_map('intval', explode("|", (string)$city['conflict']));
|
||||
$killnum = array_map('intval', explode("|", (string)$city['conflict2']));
|
||||
|
||||
$max = 0;
|
||||
for($i=0; $i < count($nationlist); $i++) {
|
||||
@@ -1681,23 +1697,31 @@ function getConquerNation($city) {
|
||||
}
|
||||
|
||||
function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
'@phan-var array<string,mixed> $city';
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
global $_maximumatmos;
|
||||
|
||||
$alllog = [];
|
||||
$log = [];
|
||||
$history = [];
|
||||
|
||||
if($destnation['nation'] > 0) {
|
||||
$destnationName = "<D><b>{$destnation['name']}</b></>의";
|
||||
} else {
|
||||
$destnationName = "공백지인";
|
||||
}
|
||||
|
||||
$alllog[] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
|
||||
$year = $game['year'];
|
||||
$month = $game['month'];
|
||||
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>(이)가 <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
|
||||
$log[] = "<C>●</><G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<S><b>【지배】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></>(을)를 지배했습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$game['year']}년 {$game['month']}월:<G><b>{$city['name']}</b></>(을)를 <S>함락</>시킴");
|
||||
pushNationHistory($nation, "<C>●</>{$game['year']}년 {$game['month']}월:<Y>{$general['name']}</>(이)가 {$destnationName} <G><b>{$city['name']}</b></>(을)를 <S>점령</>");
|
||||
pushNationHistory($destnation, "<C>●</>{$game['year']}년 {$game['month']}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>(이)가 <span class='ev_highlight'>함락</span>");
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<S><b>【지배】</b></><D><b>{$nation['name']}</b></>(이)가 <G><b>{$city['name']}</b></>(을)를 지배했습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>(을)를 <S>함락</>시킴");
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<Y>{$general['name']}</>(이)가 {$destnationName} <G><b>{$city['name']}</b></>(을)를 <S>점령</>");
|
||||
pushNationHistory($destnation, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>(이)가 <span class='ev_highlight'>함락</span>");
|
||||
|
||||
$query = "select city from city where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1710,8 +1734,8 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losenation = MYDB_fetch_array($result);
|
||||
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>(이)가 멸망하였습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$game['year']}년 {$game['month']}월:<D><b>{$losenation['name']}</b></>(을)를 정복");
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>(이)가 멸망하였습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>(을)를 정복");
|
||||
|
||||
$query = "select no from general where nation='{$general['nation']}' and level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1728,7 +1752,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$query = "select no,name,nation,npc,gold,rice from general where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog[0] = "<C>●</><D><b>{$losenation['name']}</b></>(이)가 <R>멸망</>했습니다.";
|
||||
$genlog = ["<C>●</><D><b>{$losenation['name']}</b></>(이)가 <R>멸망</>했습니다."];
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
|
||||
@@ -1741,7 +1765,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
|
||||
pushGenLog($gen, $genlog);
|
||||
|
||||
pushGeneralHistory($gen, "<C>●</>{$game['year']}년 {$game['month']}월:<D><b>{$losenation['name']}</b></>(이)가 <R>멸망</>");
|
||||
pushGeneralHistory($gen, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>(이)가 <R>멸망</>");
|
||||
|
||||
$loseGeneralGold += $loseGold;
|
||||
$loseGeneralRice += $loseRice;
|
||||
@@ -1751,7 +1775,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
|| $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족"
|
||||
|| $nation['name'] == "왜족") {
|
||||
//등용장 미발부
|
||||
} elseif(randBool(0.5)) {
|
||||
} elseif(Util::randBool(0.5)) {
|
||||
sendScoutMsg([
|
||||
'id' => $ruler['no'],
|
||||
'nation_id' => $ruler['nation']
|
||||
@@ -1857,6 +1881,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
|
||||
foreach($distList[$dist] as $cityID){
|
||||
$city = $cities[$cityID];
|
||||
'@phan-var array<string,mixed> $city';
|
||||
if($city['nation'] != $destnation['nation']){
|
||||
continue;
|
||||
}
|
||||
@@ -1877,13 +1902,13 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
|
||||
$minCityName = CityConst::byID($minCity)->name;
|
||||
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<M><b>【긴급천도】</b></><D><b>{$destnation['name']}</b></>(이)가 수도가 함락되어 <G><b>$minCityName</b></>으로 긴급천도하였습니다.";
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<M><b>【긴급천도】</b></><D><b>{$destnation['name']}</b></>(이)가 수도가 함락되어 <G><b>$minCityName</b></>으로 긴급천도하였습니다.";
|
||||
|
||||
//아국 수뇌부에게 로그 전달
|
||||
$query = "select no,name,nation from general where nation='{$destnation['nation']}' and level>='5'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog[0] = "<C>●</>수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다.";
|
||||
$genlog = ["<C>●</>수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다."];
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
pushGenLog($gen, $genlog);
|
||||
@@ -1930,29 +1955,44 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
$query = "select name,nation from nation where nation='$conquerNation'";
|
||||
$conquerResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$conquerNationArray = MYDB_fetch_array($conquerResult);
|
||||
|
||||
|
||||
$history[] = "<C>●</>{$game['year']}년 {$game['month']}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationArray['name']}</b></>(이)가 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>(을)를 양도받았습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$game['year']}년 {$game['month']}월:<G><b>{$city['name']}</b></>(을)를 <D><b>{$conquerNationArray['name']}</b></>에 <Y>양도</>");
|
||||
pushNationHistory($conquerNationArray, "<C>●</>{$game['year']}년 {$game['month']}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>(을)를 <S>양도</> 받음");
|
||||
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationArray['name']}</b></>(이)가 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>(을)를 양도받았습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>(을)를 <D><b>{$conquerNationArray['name']}</b></>에 <Y>양도</>");
|
||||
pushNationHistory($conquerNationArray, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>(을)를 <S>양도</> 받음");
|
||||
// 이동X 및 사기 변경
|
||||
$query = "update general set atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = [
|
||||
'supply'=>1,
|
||||
'term'=>0,
|
||||
'conflict2'=>'',
|
||||
'agri'=>$db->sqleval('agri*0.7'),
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'gen1'=>0,
|
||||
'gen2'=>0,
|
||||
'gen3'=>0
|
||||
];
|
||||
if($city['level'] > 3) {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='',term=0,conflict2='',agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=1000,wall=1000,nation='$conquerNation',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query['def'] = 1000;
|
||||
$query['wall'] = 1000;
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='',term=0,conflict2='',agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=def2/2,wall=wall2/2,nation='$conquerNation',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query['def'] = $db->sqleval('def2/2');
|
||||
$query['wall'] = $db->sqleval('wall2/2');
|
||||
}
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
//전방설정
|
||||
SetNationFront($destnation['nation']);
|
||||
SetNationFront($conquerNation);
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $game['year'], $game['month']);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ class CityHelper{
|
||||
$list = [];
|
||||
$listInv = [];
|
||||
$listByNation = [];
|
||||
|
||||
'@phan-var array<int,mixed>|null $list';
|
||||
'@phan-var array<string,mixed>|null $listInv';
|
||||
'@phan-var array<int,mixed>|null $listByNation';
|
||||
|
||||
foreach (DB::db()->query('SELECT `city` as `id`, `name`, `level`, `nation` from city') as $city) {
|
||||
$id = $city['id'];
|
||||
|
||||
@@ -20,7 +20,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
private $queries;
|
||||
private $targetType = 'all';
|
||||
private $targetArgs = [];
|
||||
public function __construct($target = null, array $actions){
|
||||
public function __construct($target, array $actions){
|
||||
|
||||
//values 포맷은 key, value로
|
||||
|
||||
@@ -74,7 +74,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
|
||||
$matches = null;
|
||||
if(preg_match(self::REGEXP_PERCENT, $value, $matches)){
|
||||
$value = round($matches[1], 0);
|
||||
$value = (int)round((float)$matches[1], 0);
|
||||
return DB::db()->sqleval('%i', Util::valueFit($value, 0, 100));
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class ChangeCity extends \sammo\Event\Action{
|
||||
|
||||
$matches = null;
|
||||
if(preg_match(self::REGEXP_PERCENT, $value, $matches)){
|
||||
$value = round($matches[1], 0);
|
||||
$value = (int)round((float)$matches[1], 0);
|
||||
return DB::db()->sqleval('ROUND(%b * %d, 0)', $keyMax, $value/100);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user