정적 분석기 결과 반영. 주로 배열 초기화. 변수 이름 실수 수정.
This commit is contained in:
+2
-1
@@ -11,7 +11,8 @@ return [
|
||||
// If this is set to null,
|
||||
// then Phan assumes the PHP version which is closest to the minor version
|
||||
// of the php executable used to execute phan.
|
||||
"target_php_version" => null,
|
||||
"target_php_version" => '7.0',
|
||||
'backward_compatibility_checks ' => false,
|
||||
|
||||
'file_list' => [
|
||||
'f_config/config.php',
|
||||
|
||||
+28
-39
@@ -163,7 +163,7 @@ function cityInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen1 = MYDB_fetch_array($result);
|
||||
} else {
|
||||
$gen1['name'] = '-';
|
||||
$gen1 = ['name'=>'-'];
|
||||
}
|
||||
|
||||
if($city['gen2'] > 0) {
|
||||
@@ -171,7 +171,7 @@ function cityInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen2 = MYDB_fetch_array($result);
|
||||
} else {
|
||||
$gen2['name'] = '-';
|
||||
$gen2 = ['name'=>'-'];
|
||||
}
|
||||
|
||||
if($city['gen3'] > 0) {
|
||||
@@ -179,7 +179,7 @@ function cityInfo() {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gen3 = MYDB_fetch_array($result);
|
||||
} else {
|
||||
$gen3['name'] = '-';
|
||||
$gen3 = ['name'=>'-'];
|
||||
}
|
||||
|
||||
echo "
|
||||
@@ -687,11 +687,7 @@ function CoreCommandTable() {
|
||||
addCommand("몰수", 24, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 외 교 ======");
|
||||
if($citycount <= 4) {
|
||||
addCommand("통합 제의", 53, $valid);
|
||||
} else {
|
||||
addCommand("통합 제의", 53, 0);
|
||||
}
|
||||
addCommand("통합 제의", 53, $valid);
|
||||
|
||||
addCommand("항복 권고", 51, $valid);
|
||||
if($nation['level'] >= 2) {
|
||||
@@ -705,11 +701,7 @@ function CoreCommandTable() {
|
||||
addCommand("파기 제의", 64, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 특 수 ======");
|
||||
if($citycount >= 5) {
|
||||
addCommand("초토화", 65, $valid);
|
||||
} else {
|
||||
addCommand("초토화", 65, 0);
|
||||
}
|
||||
addCommand("초토화", 65, $valid);
|
||||
addCommand("천도/3턴(금쌀{$admin['develcost']}0)", 66, $valid);
|
||||
$cost = $admin['develcost'] * 500 + 60000; // 7만~13만
|
||||
addCommand("증축/6턴(금쌀{$cost})", 67, $valid);
|
||||
@@ -1282,7 +1274,7 @@ function increaseRefresh($type="", $cnt=1) {
|
||||
file_put_contents(
|
||||
"logs/_{$date2}_refresh.txt",
|
||||
sprintf(
|
||||
"%s, %s, %s, %s, %d\n",
|
||||
"%s, %s, %s, %s, %s, %d\n",
|
||||
$date,
|
||||
$session->userName,
|
||||
$session->generalName,
|
||||
@@ -1455,6 +1447,7 @@ function checkDelay() {
|
||||
function updateOnline() {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$nationname = [];
|
||||
|
||||
//국가별 이름 매핑
|
||||
foreach(getAllNationStaticInfo() as $nation) {
|
||||
@@ -1504,6 +1497,8 @@ function checkTurn() {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$alllog = [];
|
||||
|
||||
// 잦은 갱신 금지 현재 5초당 1회
|
||||
if(!timeover()) { return; }
|
||||
// 현재 처리중이면 접근 불가
|
||||
@@ -1521,16 +1516,14 @@ function checkTurn() {
|
||||
|
||||
$session = Session::getInstance();
|
||||
|
||||
$locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName;
|
||||
pushLockLog($locklog);
|
||||
pushLockLog(["- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
// 파일락 해제
|
||||
if(!flock($fp, LOCK_UN)) { return; }
|
||||
// 세마포어 해제
|
||||
//if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); }
|
||||
|
||||
$locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName;
|
||||
pushLockLog($locklog);
|
||||
pushLockLog(["- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
//if(STEP_LOG) delStepLog();
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', 진입');
|
||||
@@ -1595,8 +1588,7 @@ function checkTurn() {
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly');
|
||||
$result = preUpdateMonthly();
|
||||
if($result == false) {
|
||||
$locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName;
|
||||
pushLockLog($locklog);
|
||||
pushLockLog(["-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
// 잡금 해제
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
|
||||
@@ -1608,8 +1600,7 @@ function checkTurn() {
|
||||
$dt = turnDate($nextTurn);
|
||||
$admin['year'] = $dt[0]; $admin['month'] = $dt[1];
|
||||
|
||||
$locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName;
|
||||
pushLockLog($locklog);
|
||||
pushLockLog(["-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
// 이벤트 핸들러 동작
|
||||
foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
|
||||
@@ -1734,8 +1725,7 @@ function checkTurn() {
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
|
||||
unlock();
|
||||
|
||||
$locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName;
|
||||
pushLockLog($locklog);
|
||||
pushLockLog(["- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
|
||||
|
||||
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish');
|
||||
|
||||
@@ -1765,9 +1755,8 @@ function addAge() {
|
||||
$query = "update general set special='$special' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special)."</></b>】(을)를 익혔습니다!";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>".getGenSpecial($special)."</></b>】(을)를 습득");
|
||||
pushGenLog($general, $log);
|
||||
pushGenLog($general, "<C>●</>특기 【<b><L>".getGenSpecial($special)."</></b>】(을)를 익혔습니다!");
|
||||
}
|
||||
|
||||
$query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'";
|
||||
@@ -1781,9 +1770,8 @@ function addAge() {
|
||||
$query = "update general set special2='$special2' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득");
|
||||
pushGenLog($general, $log);
|
||||
pushGenLog($general, "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1810,9 +1798,8 @@ function turnDate($curtime) {
|
||||
$query = "update game set year='$year',month='$month'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$value[0] = $year;
|
||||
$value[1] = $month;
|
||||
return $value;
|
||||
|
||||
return [$year, $month];
|
||||
}
|
||||
|
||||
|
||||
@@ -1836,6 +1823,7 @@ function triggerTournament() {
|
||||
function PreprocessCommand($no) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$log = [];
|
||||
|
||||
$query = "select no,name,city,injury,special2,item,turn0 from general where no='$no'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -1849,8 +1837,7 @@ function PreprocessCommand($no) {
|
||||
$query = "update general set injury=0 where no='$no'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</><C>의술</>을 펼쳐 스스로 치료합니다!";
|
||||
pushGenLog($general, $log);
|
||||
pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 스스로 치료합니다!");
|
||||
}
|
||||
|
||||
$query = "select no,name,injury from general where city='{$general['city']}' and injury>10 order by rand()";
|
||||
@@ -1869,8 +1856,7 @@ function PreprocessCommand($no) {
|
||||
$query = "update general set injury=0 where no='{$patient['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</><Y>{$general['name']}</>(이)가 <C>의술</>로써 치료해줍니다!";
|
||||
pushGenLog($patient, $log);
|
||||
pushGenLog($patient, "<C>●</><Y>{$general['name']}</>(이)가 <C>의술</>로써 치료해줍니다!");
|
||||
|
||||
if($patientName == "") {
|
||||
$patientName = $patient['name'];
|
||||
@@ -1878,12 +1864,11 @@ function PreprocessCommand($no) {
|
||||
}
|
||||
|
||||
if($patientCount == 1) {
|
||||
$log[0] = "<C>●</><C>의술</>을 펼쳐 도시의 장수 <Y>{$patientName}</>(을)를 치료합니다!";
|
||||
pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 도시의 장수 <Y>{$patientName}</>(을)를 치료합니다!");
|
||||
} else {
|
||||
$patientCount -= 1;
|
||||
$log[0] = "<C>●</><C>의술</>을 펼쳐 도시의 장수들 <Y>{$patientName}</> 외 <C>{$patientCount}</>명을 치료합니다!";
|
||||
pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 도시의 장수들 <Y>{$patientName}</> 외 <C>{$patientCount}</>명을 치료합니다!");
|
||||
}
|
||||
pushGenLog($general, $log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1918,6 +1903,7 @@ function PreprocessCommand($no) {
|
||||
function updateTurntime($no) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$alllog = [];
|
||||
|
||||
$query = "select year,month,isUnited,turnterm from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -2166,6 +2152,9 @@ function CheckHall($no) {
|
||||
function uniqueItem($general, $log, $vote=0) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; }
|
||||
if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; }
|
||||
@@ -2540,7 +2529,7 @@ function nextRuler($general) {
|
||||
* @param $distForm 리턴 타입. true일 경우 $result[$dist] = [...$city] 이며, false일 경우 $result[$city] = $dist 임
|
||||
*/
|
||||
function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
|
||||
$queue = new \SqlQueue();
|
||||
$queue = new \SplQueue();
|
||||
|
||||
$cities = [];
|
||||
$distanceList = [];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo;
|
||||
|
||||
function getTurn($general, $type, $font=1) {
|
||||
$str = [];
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
@@ -256,6 +257,7 @@ function getTurn($general, $type, $font=1) {
|
||||
function getCoreTurn($nation, $level) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
$str = [];
|
||||
|
||||
$turn[0] = $nation["l{$level}turn0"];
|
||||
$turn[1] = $nation["l{$level}turn1"];
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace sammo;
|
||||
|
||||
function process_32(&$general) {
|
||||
$db = DB::db();
|
||||
|
||||
+17
-16
@@ -597,6 +597,7 @@ function disaster() {
|
||||
}
|
||||
|
||||
$disastername = "<G><b>{$disastername}</b></>";
|
||||
$disaster = [];
|
||||
|
||||
//재해 처리
|
||||
if(count($disastercity)) {
|
||||
@@ -606,19 +607,19 @@ function disaster() {
|
||||
case 1:
|
||||
switch($disastertype) {
|
||||
case 0:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 역병이 발생하여 도시가 황폐해지고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 역병이 발생하여 도시가 황폐해지고 있습니다.";
|
||||
$state = 4;
|
||||
break;
|
||||
case 1:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$state = 5;
|
||||
break;
|
||||
case 2:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 추위가 풀리지 않아 얼어죽는 백성들이 늘어나고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 추위가 풀리지 않아 얼어죽는 백성들이 늘어나고 있습니다.";
|
||||
$state = 3;
|
||||
break;
|
||||
case 3:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다.";
|
||||
$state = 9;
|
||||
break;
|
||||
}
|
||||
@@ -627,19 +628,19 @@ function disaster() {
|
||||
case 4:
|
||||
switch($disastertype) {
|
||||
case 0:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 홍수로 인해 피해가 급증하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 홍수로 인해 피해가 급증하고 있습니다.";
|
||||
$state = 7;
|
||||
break;
|
||||
case 1:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$state = 5;
|
||||
break;
|
||||
case 2:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 태풍으로 인해 피해가 속출하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 태풍으로 인해 피해가 속출하고 있습니다.";
|
||||
$state = 6;
|
||||
break;
|
||||
case 3:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【호황】</b></>{$disastername}에 호황으로 도시가 번창하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【호황】</b></>{$disastername}에 호황으로 도시가 번창하고 있습니다.";
|
||||
$state = 2;
|
||||
$isGood = 1;
|
||||
break;
|
||||
@@ -649,19 +650,19 @@ function disaster() {
|
||||
case 7:
|
||||
switch($disastertype) {
|
||||
case 0:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 메뚜기 떼가 발생하여 도시가 황폐해지고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 메뚜기 떼가 발생하여 도시가 황폐해지고 있습니다.";
|
||||
$state = 8;
|
||||
break;
|
||||
case 1:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$state = 5;
|
||||
break;
|
||||
case 2:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 흉년이 들어 굶어죽는 백성들이 늘어나고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 흉년이 들어 굶어죽는 백성들이 늘어나고 있습니다.";
|
||||
$state = 8;
|
||||
break;
|
||||
case 3:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【풍작】</b></>{$disastername}에 풍작으로 도시가 번창하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<C><b>【풍작】</b></>{$disastername}에 풍작으로 도시가 번창하고 있습니다.";
|
||||
$state = 1;
|
||||
$isGood = 1;
|
||||
break;
|
||||
@@ -671,19 +672,19 @@ function disaster() {
|
||||
case 10:
|
||||
switch($disastertype) {
|
||||
case 0:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 혹한으로 도시가 황폐해지고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 혹한으로 도시가 황폐해지고 있습니다.";
|
||||
$state = 3;
|
||||
break;
|
||||
case 1:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 지진으로 피해가 속출하고 있습니다.";
|
||||
$state = 5;
|
||||
break;
|
||||
case 2:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 눈이 많이 쌓여 도시가 황폐해지고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 눈이 많이 쌓여 도시가 황폐해지고 있습니다.";
|
||||
$state = 3;
|
||||
break;
|
||||
case 3:
|
||||
$disaster[count($disaster)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다.";
|
||||
$disaster[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<M><b>【재난】</b></>{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다.";
|
||||
$state = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -261,11 +261,12 @@ function startTournament($auto, $type) {
|
||||
$query = "truncate tournament";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$history = [];
|
||||
switch($type) {
|
||||
case 0: $history[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>전력전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>영웅</span>들을 모집하고 있습니다!"; break;
|
||||
case 1: $history[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>통솔전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>명사</span>들을 모집하고 있습니다!"; break;
|
||||
case 2: $history[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>일기토</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>용사</span>들을 모집하고 있습니다!"; break;
|
||||
case 3: $history[0] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>설전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>책사</span>들을 모집하고 있습니다!"; break;
|
||||
case 0: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>전력전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>영웅</span>들을 모집하고 있습니다!"; break;
|
||||
case 1: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>통솔전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>명사</span>들을 모집하고 있습니다!"; break;
|
||||
case 2: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>일기토</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>용사</span>들을 모집하고 있습니다!"; break;
|
||||
case 3: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>설전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>책사</span>들을 모집하고 있습니다!"; break;
|
||||
}
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
}
|
||||
@@ -343,6 +344,7 @@ function fillLowGenAll() {
|
||||
//8 4강
|
||||
//9 결승
|
||||
function getTwo($tournament, $phase) {
|
||||
$cand = [];
|
||||
switch($tournament) {
|
||||
case 2:
|
||||
//예선
|
||||
@@ -746,6 +748,7 @@ function getLog($lvl1, $lvl2) {
|
||||
|
||||
//0 : 승무패, 1 : 승패
|
||||
function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
|
||||
$log = [];
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ class CityHelper{
|
||||
self::$listByNation = $listByNation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public static function getAllCities(){
|
||||
if(self::$list === null){
|
||||
self::generateCache();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
namespace sammo\Event\Action;
|
||||
use sammo\Util;
|
||||
use sammo\DB;
|
||||
|
||||
/**
|
||||
@@ -51,7 +50,7 @@ class RaiseInvader extends \sammo\Event\Action{
|
||||
private function moveCapital(){
|
||||
$cities = array_map(function ($value) {
|
||||
return $value;
|
||||
}, INVADER_LIST);
|
||||
}, static::INVADER_LIST);
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@ class RegNPC extends \sammo\Event\Action{
|
||||
int $intel,
|
||||
int $birth = 160,
|
||||
int $death = 300,
|
||||
string $ego = null,
|
||||
string $char = null,
|
||||
string $text = null
|
||||
$ego = null,
|
||||
string $char = '',
|
||||
string $text = ''
|
||||
){
|
||||
$this->npc = new \sammo\Scenario\NPC(
|
||||
$affinity,
|
||||
|
||||
@@ -36,7 +36,11 @@ abstract class Condition{
|
||||
}
|
||||
|
||||
//array의 첫번째 값이 Condition이 아닌 경우에는 그냥 배열로 처리함.
|
||||
return array_map(static::build, $conditionChain);
|
||||
$result = [];
|
||||
foreach($conditionChain as $condition){
|
||||
$result[] = static::build($condition);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected static function _eval($arg, $env=null){
|
||||
@@ -47,7 +51,7 @@ abstract class Condition{
|
||||
];
|
||||
}
|
||||
if($arg instanceof Condition){
|
||||
return $arg->checkCondition($env);
|
||||
return $arg->eval($env);
|
||||
}
|
||||
throw new \InvalidArgumentException('평가 인자는 boolean이거나 Condition 클래스여야 합니다.');
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace sammo\Event\Condition;
|
||||
|
||||
class Interval extends sammo\Event\Condition{
|
||||
class Interval extends \sammo\Event\Condition{
|
||||
//TODO:구현
|
||||
public function __construct(...$args){
|
||||
throw new \BadMethodCallException('Not Yet Implmented.');
|
||||
|
||||
@@ -3,6 +3,8 @@ namespace sammo\Event\Condition;
|
||||
|
||||
class Logic extends \sammo\Event\Condition{
|
||||
private $mode = 'and';
|
||||
|
||||
/** @var \sammo\Event\Condition[] */
|
||||
private $conditions = [];
|
||||
const AVAILABLE_LOGIC_NAME = [
|
||||
'not'=>false,
|
||||
@@ -26,7 +28,7 @@ class Logic extends \sammo\Event\Condition{
|
||||
}
|
||||
|
||||
public function eval($env=null){
|
||||
switch($this->$mode){
|
||||
switch($this->mode){
|
||||
case 'not':
|
||||
return $this->logicNot($env);
|
||||
case 'and':
|
||||
@@ -41,7 +43,7 @@ class Logic extends \sammo\Event\Condition{
|
||||
}
|
||||
|
||||
private function logicNot($env){
|
||||
$sub = self::_eval($this->conditions[0], $env);
|
||||
$result = self::_eval($this->conditions[0], $env);
|
||||
$result['value'] = !$result['value'];
|
||||
$result['chain'][] = 'not';
|
||||
return $result;
|
||||
@@ -55,7 +57,7 @@ class Logic extends \sammo\Event\Condition{
|
||||
$sub = self::_eval($cond, $env);
|
||||
$chain[] = $sub['chain'];
|
||||
if(!$sub['value']){
|
||||
$result['value'] = false;
|
||||
$value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +76,7 @@ class Logic extends \sammo\Event\Condition{
|
||||
$sub = self::_eval($cond, $env);
|
||||
$chain[] = $sub['chain'];
|
||||
if($sub['value']){
|
||||
$result['value'] = true;
|
||||
$value = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,22 +18,23 @@ class GameUnitConst{
|
||||
static::_generate();
|
||||
return static::$constID;
|
||||
}
|
||||
public static function byID($id): GameUnitDetail{
|
||||
|
||||
public static function byID(int $id): GameUnitDetail{
|
||||
static::_generate();
|
||||
return static::$constID[$id];
|
||||
}
|
||||
|
||||
public static function byName($name): GameUnitDetail{
|
||||
public static function byName(string $name): GameUnitDetail{
|
||||
static::_generate();
|
||||
return static::$constName[$name];
|
||||
}
|
||||
|
||||
public static function byCity($city): GameUnitDetail{
|
||||
public static function byCity(int $city): GameUnitDetail{
|
||||
static::_generate();
|
||||
return static::$constCity[$city];
|
||||
}
|
||||
|
||||
public static function byRegion($region): GameUnitDetail{
|
||||
public static function byRegion(int $region): GameUnitDetail{
|
||||
static::_generate();
|
||||
return static::$constRegion[$region];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class GameUnitDetail{
|
||||
public $recruitType;
|
||||
public $recruitCondition;
|
||||
public $recruitFirst;
|
||||
public $info;
|
||||
|
||||
public function __construct(
|
||||
int $id,
|
||||
@@ -62,7 +63,7 @@ class GameUnitDetail{
|
||||
}
|
||||
|
||||
if($this->recruitType == 2){
|
||||
$cityLevel = CityConst::byID($id)->level;
|
||||
$cityLevel = CityConst::byID($this->id)->level;
|
||||
$cityLevel = CityConst::$regionMap[$cityLevel];
|
||||
|
||||
if(!key_exists($this->recruitCondition, $ownCities)){
|
||||
|
||||
@@ -97,6 +97,7 @@ class NPC{
|
||||
|
||||
$name = 'ⓝ'.$this->name;
|
||||
|
||||
$pictureID = $this->pictureID;
|
||||
if($env['show_img_level'] == 3 && $pictureID > 0){
|
||||
$picture = "{$pictureID}.jpg";
|
||||
}
|
||||
@@ -107,11 +108,13 @@ class NPC{
|
||||
$city = $this->locatedCity;
|
||||
if($city === null){
|
||||
if($nationID == 0){
|
||||
$city = Util::choiceRandom(CityHelper::getAllCities())['id'];
|
||||
$cityObj = Util::choiceRandom(CityHelper::getAllCities());
|
||||
}
|
||||
else{
|
||||
$city = Util::choiceRandom(CityHelper::getAllNationCities($nationID))['id'];
|
||||
$cityObj = Util::choiceRandom(CityHelper::getAllNationCities($nationID));
|
||||
}
|
||||
'@phan-var array<string,string|int> $cityObj';
|
||||
$city = $cityObj['id'];
|
||||
}
|
||||
|
||||
$experience = $age * 100;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
namespace sammo\Scenario;
|
||||
use \sammo\DB;
|
||||
use \sammo\Util;
|
||||
|
||||
class Nation{
|
||||
private $id;
|
||||
@@ -14,7 +13,7 @@ class Nation{
|
||||
private $type;
|
||||
private $nationLevel;
|
||||
|
||||
private $capital;
|
||||
private $capital = null;
|
||||
|
||||
private $cities = [];
|
||||
|
||||
@@ -42,8 +41,10 @@ class Nation{
|
||||
$this->type = $type;
|
||||
$this->nationLevel = $nationLevel;
|
||||
$this->cities = $cities;
|
||||
|
||||
$this->capital = count($cities)>0?$cities[0]:null;
|
||||
|
||||
if(count($cities)){
|
||||
$this->capital = $this->cities[0];
|
||||
}
|
||||
}
|
||||
|
||||
public function setID(int $id){
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace kakao;
|
||||
|
||||
if (class_exists('\\kakao\\KakaoKey') === false) {
|
||||
/** @suppress PhanRedefineClass */
|
||||
class KakaoKey
|
||||
{
|
||||
const REST_KEY = '';
|
||||
@@ -106,12 +107,12 @@ class Kakao_REST_API_Helper
|
||||
if ($api_path != '/oauth/token') {
|
||||
if (in_array($api_path, self::$admin_apis)) {
|
||||
if (!$this->admin_key) {
|
||||
throw new Exception('admin key should not be null or empty.');
|
||||
throw new \Exception('admin key should not be null or empty.');
|
||||
}
|
||||
$headers = array('Authorization: KakaoAK ' . $this->admin_key);
|
||||
} else {
|
||||
if (!$this->access_token) {
|
||||
throw new Exception('access token should not be null or empty.');
|
||||
throw new \Exception('access token should not be null or empty.');
|
||||
}
|
||||
$headers = array('Authorization: Bearer ' . $this->access_token);
|
||||
}
|
||||
@@ -134,7 +135,7 @@ class Kakao_REST_API_Helper
|
||||
$return_data = curl_exec($curl_session);
|
||||
|
||||
if (curl_errno($curl_session)) {
|
||||
throw new Exception(curl_error($curl_session));
|
||||
throw new \Exception(curl_error($curl_session));
|
||||
} else {
|
||||
// 디버깅 시에 주석을 풀고 응답 내용 확인할 때
|
||||
//print_r(curl_getinfo($curl_session));
|
||||
|
||||
@@ -32,8 +32,10 @@ class AppConf
|
||||
public static function requireRootDB()
|
||||
{
|
||||
if (!class_exists('\\sammo\\RootDB')) {
|
||||
trigger_error('RootDB.php가 설정되지 않았습니다.', E_USER_ERROR);
|
||||
die();
|
||||
if(!trigger_error('RootDB.php가 설정되지 않았습니다.', E_USER_ERROR)){
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
return RootDB::db();
|
||||
}
|
||||
@@ -46,8 +48,10 @@ class AppConf
|
||||
public static function requireDB()
|
||||
{
|
||||
if (!class_exists('\\sammo\\DB')) {
|
||||
trigger_error('DB.php가 설정되지 않았습니다.', E_USER_ERROR);
|
||||
die();
|
||||
if(!trigger_error('DB.php가 설정되지 않았습니다.', E_USER_ERROR)){
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
return DB::db();
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class FileUtil
|
||||
|
||||
$filepath = sprintf('%s/%s', $dir, $FolderOrFile);
|
||||
if (is_dir($filepath)) {
|
||||
delExpiredInDir($filepath, $t);
|
||||
static::delExpiredInDir($filepath, $t);
|
||||
} // recursive
|
||||
else {
|
||||
$mt = filemtime($filepath);
|
||||
@@ -51,7 +51,6 @@ class FileUtil
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
return $success;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -282,7 +282,7 @@ class util
|
||||
* concisely access an index which may or may not exist without
|
||||
* raising a warning.
|
||||
*
|
||||
* @param array $var Array value to access
|
||||
* @param mixed $var Array value to access
|
||||
* @param mixed $default Default value to return if the key is not
|
||||
* present in the array
|
||||
* @return mixed
|
||||
|
||||
Reference in New Issue
Block a user