diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php
index 70906b49..9db7c2a9 100644
--- a/f_install/j_setup_db.php
+++ b/f_install/j_setup_db.php
@@ -180,6 +180,10 @@ $rootDB->insert('system', array(
$globalSalt = bin2hex(random_bytes(16));
+'@phan-var-force string $servHost';
+'@phan-var-force string $sharedIconPath';
+'@phan-var-force string $gameImagePath';
+
$sharedIconPath = WebUtil::resolveRelativePath($sharedIconPath, $servHost);
$gameImagePath = WebUtil::resolveRelativePath($gameImagePath, $servHost);
diff --git a/hwe/_admin1_submit.php b/hwe/_admin1_submit.php
index 53e60438..ff24e6eb 100644
--- a/hwe/_admin1_submit.php
+++ b/hwe/_admin1_submit.php
@@ -6,7 +6,7 @@ include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
-if($session->userGrade < 5) {
+if ($session->userGrade < 5) {
//echo "";
echo '_admin1.php';//TODO:debug all and replace
}
@@ -18,7 +18,7 @@ $v->rule('integer', [
])->rule('dateFormat', [
'starttime'
]);
-if(!$v->validate()){
+if (!$v->validate()) {
Error($v->errorStr());
}
@@ -33,33 +33,35 @@ $connect=$db->get();
$admin = getAdmin();
-switch($btn) {
+switch ($btn) {
case "변경":
$msg = addslashes(SQ2DQ($msg));
$query = "update game set msg='$msg'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "로그쓰기":
$lognum = $admin['historyindex'] + 1;
- if($lognum >= 29) { $lognum = 0; }
+ if ($lognum >= 29) {
+ $lognum = 0;
+ }
$history[0] = "★>{$log}>";
pushWorldHistory($history);
break;
case "변경1":
$query = "update game set starttime='$starttime'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "변경2":
$query = "update game set maxgeneral='$maxgeneral'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "변경3":
$query = "update game set maxnation='$maxnation'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "변경4":
$query = "update game set startyear='$startyear'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "1분턴":
case "2분턴":
@@ -69,7 +71,7 @@ switch($btn) {
case "30분턴":
case "60분턴":
case "120분턴":
- switch($btn) {
+ switch ($btn) {
case "1분턴": $turnterm = 1; break;
case "2분턴": $turnterm = 2; break;
case "5분턴": $turnterm = 5; break;
@@ -84,30 +86,30 @@ switch($btn) {
$starttime = date("Y-m-d H:i:s", strtotime($admin['turntime']) - $turn * $unit);
$starttime = cutTurn($starttime, $turnterm);
$query = "update game set turnterm='$turnterm',starttime='$starttime'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
// 턴시간이 길어지는 경우 랜덤턴 배정
- if($turnterm < $admin['turnterm']) {
+ if ($turnterm < $admin['turnterm']) {
$query = "select no from general";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result);
- for($i=0; $i < $count; $i++) {
+ for ($i=0; $i < $count; $i++) {
$gen = MYDB_fetch_array($result);
$turntime = getRandTurn($turnterm);
$query = "update general set turntime='$turntime' where no='{$gen['no']}'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
}
- // 턴시간이 너무 멀리 떨어진 선수 제대로 보정
+ // 턴시간이 너무 멀리 떨어진 선수 제대로 보정
} else {
$query = "select no,turntime from general";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result);
- for($i=0; $i < $count; $i++) {
+ for ($i=0; $i < $count; $i++) {
$gen = MYDB_fetch_array($result);
- $num = floor((strtotime($gen['turntime']) - strtotime($admin['turntime'])) / $unit);
- if($num > 0) {
+ $num = intdiv((strtotime($gen['turntime']) - strtotime($admin['turntime'])), $unit);
+ if ($num > 0) {
$gen['turntime'] = date("Y-m-d H:i:s", strtotime($gen['turntime']) - $unit * $num);
$query = "update general set turntime='{$gen['turntime']}' where no='{$gen['no']}'";
- MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
}
}
}
@@ -118,4 +120,3 @@ switch($btn) {
//echo "";
echo '_admin1.php';//TODO:debug all and replace
-
diff --git a/hwe/_simul.php b/hwe/_simul.php
index a6842bcd..8264c184 100644
--- a/hwe/_simul.php
+++ b/hwe/_simul.php
@@ -204,7 +204,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$avoid = 1;
// 병종간 특성
- if(floor($general['crewtype']/10) == 3) { // 귀병
+ if(intdiv($general['crewtype'], 10) == 3) { // 귀병
$int = $general['intel'] + getBookEff($general['book']);
if($general['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50%
@@ -394,7 +394,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$myAvoid = 1;
$opAvoid = 1;
// 병종간 특성
- if(floor($general['crewtype']/10) == 3) { // 귀병
+ if(intdiv($general['crewtype'], 10) == 3) { // 귀병
$int = $general['intel'] + getBookEff($general['book']);
if($general['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50%
@@ -476,7 +476,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
}
// 상대 장수 병종간 특성
- if(floor($oppose['crewtype']/10) == 3) { // 귀병
+ if(intdiv($oppose['crewtype'], 10) == 3) { // 귀병
$int = $oppose['intel'] + getBookEff($oppose['book']);
if($oppose['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50%
@@ -571,44 +571,44 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
// my 입장 상성
// 보병계열 > 궁병계열
- if(floor($general['crewtype']/10) == 0 && floor($oppose['crewtype']/10) == 1) {
+ if(intdiv($general['crewtype'], 10) == 0 && intdiv($oppose['crewtype'], 10) == 1) {
$myCrew *= 0.8;
$opCrew *= 1.2;
}
// 궁병계열 > 기병계열
- if(floor($general['crewtype']/10) == 1 && floor($oppose['crewtype']/10) == 2) {
+ if(intdiv($general['crewtype'], 10) == 1 && intdiv($oppose['crewtype'], 10) == 2) {
$myCrew *= 0.8;
$opCrew *= 1.2;
}
// 기병계열 > 보병계열
- if(floor($general['crewtype']/10) == 2 && floor($oppose['crewtype']/10) == 0) {
+ if(intdiv($general['crewtype'], 10) == 2 && intdiv($oppose['crewtype'], 10) == 0) {
$myCrew *= 0.8;
$opCrew *= 1.2;
}
// 차병계열
- if(floor($general['crewtype']/10) == 4) {
+ if(intdiv($general['crewtype'], 10) == 4) {
$myCrew *= 1.2;
$opCrew *= 0.8;
}
// op 입장 상성
// 보병계열 > 궁병계열
- if(floor($oppose['crewtype']/10) == 0 && floor($general['crewtype']/10) == 1) {
+ if(intdiv($oppose['crewtype'], 10) == 0 && intdiv($general['crewtype'], 10) == 1) {
$opCrew *= 0.8;
$myCrew *= 1.2;
}
// 궁병계열 > 기병계열
- if(floor($oppose['crewtype']/10) == 1 && floor($general['crewtype']/10) == 2) {
+ if(intdiv($oppose['crewtype'], 10) == 1 && intdiv($general['crewtype'], 10) == 2) {
$opCrew *= 0.8;
$myCrew *= 1.2;
}
// 기병계열 > 보병계열
- if(floor($oppose['crewtype']/10) == 2 && floor($general['crewtype']/10) == 0) {
+ if(intdiv($oppose['crewtype'], 10) == 2 && intdiv($general['crewtype'], 10) == 0) {
$opCrew *= 0.8;
$myCrew *= 1.2;
}
// 차병계열
- if(floor($oppose['crewtype']/10) == 4) {
+ if(intdiv($oppose['crewtype'], 10) == 4) {
$opCrew *= 1.2;
$myCrew *= 0.8;
}
diff --git a/hwe/a_bestGeneral.php b/hwe/a_bestGeneral.php
index 9f4253be..f6d9f637 100644
--- a/hwe/a_bestGeneral.php
+++ b/hwe/a_bestGeneral.php
@@ -171,10 +171,10 @@ for ($i=0; $i < 21; $i++) {
for ($k=0; $k < 10; $k++) {
if ($i == 5 || $i == 7 || $i == 20) {
- $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %";
+ $data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
if ($i >= 13 && $i <= 16) {
- $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %";
+ $data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
echo "| {$data[$k]} | ";
}
diff --git a/hwe/a_genList.php b/hwe/a_genList.php
index e91e61a1..ef6bd4b6 100644
--- a/hwe/a_genList.php
+++ b/hwe/a_genList.php
@@ -128,9 +128,9 @@ for($j=0; $j < $gencount; $j++) {
}
if($general['injury'] > 0) {
- $leader = floor($general['leader'] * (100 - $general['injury'])/100);
- $power = floor($general['power'] * (100 - $general['injury'])/100);
- $intel = floor($general['intel'] * (100 - $general['injury'])/100);
+ $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
+ $power = intdiv($general['power'] * (100 - $general['injury']), 100);
+ $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "{$leader}{$lbonus}";
$power = "{$power}";
$intel = "{$intel}";
diff --git a/hwe/a_hallOfFame.php b/hwe/a_hallOfFame.php
index 15e9d8a1..91c87827 100644
--- a/hwe/a_hallOfFame.php
+++ b/hwe/a_hallOfFame.php
@@ -49,51 +49,59 @@ $type = array(
"베 팅 수 익 금",
"베 팅 수 익 률"
);
-for($i=0; $i < 21; $i++) {
+for ($i=0; $i < 21; $i++) {
$query = "select * from hall where type={$i} order by rank";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
echo "
| $type[$i] |
| 1위 | 2위 | 3위 | 4위 | 5위 | 6위 | 7위 | 8위 | 9위 | 10위 |
";
- for($k=0; $k < 10; $k++) {
+ for ($k=0; $k < 10; $k++) {
$gen = MYDB_fetch_array($result);
$name[$k] = $gen['name'];
$nation[$k] = $gen['nation'];
$data[$k] = $gen['data'];
$color[$k] = $gen['color'];
$pic[$k] = $gen['picture'];
- if($color[$k] == "") $color[$k] = GameConst::$basecolor4;
- if($nation[$k] == "") $nation[$k] = " ";
-/*
- if($pic[$k] == "") {
- echo "| | ";
- } else {
- $imageTemp = GetImageURL($gen['imgsvr']);
- echo " | ";
+ if ($color[$k] == "") {
+ $color[$k] = GameConst::$basecolor4;
}
-*/
+ if ($nation[$k] == "") {
+ $nation[$k] = " ";
+ }
+ /*
+ if($pic[$k] == "") {
+ echo " | ";
+ } else {
+ $imageTemp = GetImageURL($gen['imgsvr']);
+ echo " | ";
+ }
+ */
}
// echo "
";
- for($k=0; $k < 10; $k++) {
+ for ($k=0; $k < 10; $k++) {
echo "| {$nation[$k]} | ";
}
echo "
";
- for($k=0; $k < 10; $k++) {
+ for ($k=0; $k < 10; $k++) {
echo "| {$name[$k]} | ";
}
echo "
";
- for($k=0; $k < 10; $k++) {
- if($i == 5 || $i == 7 || $i == 20) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; }
- if($i >= 13 && $i <= 16) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; }
+ for ($k=0; $k < 10; $k++) {
+ if ($i == 5 || $i == 7 || $i == 20) {
+ $data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
+ }
+ if ($i >= 13 && $i <= 16) {
+ $data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
+ }
echo "| {$data[$k]} | ";
}
echo "
|
";
diff --git a/hwe/a_history.php b/hwe/a_history.php
index f313a614..b98abc30 100644
--- a/hwe/a_history.php
+++ b/hwe/a_history.php
@@ -15,47 +15,54 @@ $connect=$db->get();
increaseRefresh("연감", 5);
$query = "select startyear,year,month,conlimit from game limit 1";
-$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result);
$query = "select map,con,turntime from general where owner='{$userID}'";
-$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']);
-if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
+if ($con >= 2) {
+ printLimitMsg($me['turntime']);
+ exit();
+}
$query = "select year,month from history order by no limit 1";
-$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$history = MYDB_fetch_array($result);
$s = ($history['year']*12) + $history['month'];
$query = "select year,month from history order by no desc limit 1";
-$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$history = MYDB_fetch_array($result);
$e = ($history['year']*12) + $history['month'];
-if(!$yearmonth) {
+if (!$yearmonth) {
$year = $admin['year'];
$month = $admin['month'] - 1;
} else {
$year = substr($yearmonth, 0, 3) - 0;
$month = substr($yearmonth, 3, 2) - 0;
- if($btn == "◀◀ 이전달") {
+ if ($btn == "◀◀ 이전달") {
$month -= 1;
- } elseif($btn == "다음달 ▶▶") {
+ } elseif ($btn == "다음달 ▶▶") {
$month += 1;
}
}
$now = ($year*12) + $month;
-if($now < $s) { $now = $s; }
-if($now > $e) { $now = $e; }
+if ($now < $s) {
+ $now = $s;
+}
+if ($now > $e) {
+ $now = $e;
+}
-$year = floor($now / 12);
+$year = intdiv($now, 12);
$month = $now % 12;
-if($month <= 0) {
+if ($month <= 0) {
$year -= 1;
$month += 12;
}
@@ -82,12 +89,12 @@ if($month <= 0) {
diff --git a/hwe/a_traffic.php b/hwe/a_traffic.php
index b8c1bf3f..8800b43a 100644
--- a/hwe/a_traffic.php
+++ b/hwe/a_traffic.php
@@ -272,8 +272,8 @@ function getTrafficColor($per)
function getHex($dec)
{
- $hex = floor($dec * 255 / 100);
- $code = getHexCode(floor($hex / 16));
+ $hex = intdiv($dec * 255, 100);
+ $code = getHexCode(intdiv($hex, 16));
$code .= getHexCode($hex % 16);
return $code;
}
diff --git a/hwe/b_auction.php b/hwe/b_auction.php
index 53b107de..8f584be9 100644
--- a/hwe/b_auction.php
+++ b/hwe/b_auction.php
@@ -208,7 +208,7 @@ for ($i=0; $i < $count; $i++) {
$chk = 1;
}
$pv = round($auction['value'] * 100 / $auction['amount']) / 100 + 0.001;
- $pv = substr($pv, 0, 4);
+ $pv = substr((string)$pv, 0, 4);
if ($auction['stuff'] != 0) {
$pv = '-';
}
diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php
index 5a973e08..32736fa5 100644
--- a/hwe/b_battleCenter.php
+++ b/hwe/b_battleCenter.php
@@ -3,6 +3,12 @@ namespace sammo;
include "lib.php";
include "func.php";
+
+$v = new Validator($_POST + $_GET);
+$v->rule('required', 'gen')
+->rule('integer', 'gen');
+
+$gen = Util::getReq('gen', 'int');
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
diff --git a/hwe/b_betting.php b/hwe/b_betting.php
index 16a97a0d..caa4ec8f 100644
--- a/hwe/b_betting.php
+++ b/hwe/b_betting.php
@@ -109,7 +109,7 @@ for ($i=0; $i < 2; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -150,7 +150,7 @@ for ($i=0; $i < 4; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -191,7 +191,7 @@ for ($i=0; $i < 8; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -232,7 +232,7 @@ for ($i=0; $i < 16; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php
index 49ff2f66..539ab1d0 100644
--- a/hwe/b_currentCity.php
+++ b/hwe/b_currentCity.php
@@ -99,7 +99,7 @@ if($myNation['level'] > 0) {
$where = 'city=0';
$cities = explode("|", $myNation['spy']);
for($i=0; $i < count($cities); $i++) {
- $city = floor($cities[$i]/10);
+ $city = intdiv($cities[$i], 10);
$where .= " or city='{$city}'";
}
@@ -259,9 +259,9 @@ for($j=0; $j < $gencount; $j++) {
}
if($general['injury'] > 0) {
- $leader = floor($general['leader'] * (100 - $general['injury'])/100);
- $power = floor($general['power'] * (100 - $general['injury'])/100);
- $intel = floor($general['intel'] * (100 - $general['injury'])/100);
+ $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
+ $power = intdiv($general['power'] * (100 - $general['injury']), 100);
+ $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "{$leader}{$lbonus}";
$power = "{$power}";
$intel = "{$intel}";
diff --git a/hwe/b_dipcenter.php b/hwe/b_dipcenter.php
index 6fffd3ab..368746fa 100644
--- a/hwe/b_dipcenter.php
+++ b/hwe/b_dipcenter.php
@@ -125,7 +125,7 @@ for ($i=0; $i < $nationcount; $i++) {
}
$term = $admin['year'] * 12 + $admin['month'] + $dip['term'];
- $year = floor($term / 12);
+ $year = intdiv($term, 12);
$month = $term % 12;
if ($month == 0) {
diff --git a/hwe/b_diplomacy.php b/hwe/b_diplomacy.php
index d6225262..3570f95d 100644
--- a/hwe/b_diplomacy.php
+++ b/hwe/b_diplomacy.php
@@ -89,7 +89,7 @@ echo "
| ";
if($nationcount != 0) {
- $width = floor(888 / $nationcount);
+ $width = intdiv(888, $nationcount);
}
for($i=0; $i < $nationcount; $i++) {
diff --git a/hwe/b_genList.php b/hwe/b_genList.php
index 2115f5b1..08c2d98b 100644
--- a/hwe/b_genList.php
+++ b/hwe/b_genList.php
@@ -131,9 +131,9 @@ for ($j=0; $j < $gencount; $j++) {
}
if ($general['injury'] > 0) {
- $leader = floor($general['leader'] * (100 - $general['injury'])/100);
- $power = floor($general['power'] * (100 - $general['injury'])/100);
- $intel = floor($general['intel'] * (100 - $general['injury'])/100);
+ $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
+ $power = intdiv($general['power'] * (100 - $general['injury']), 100);
+ $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "{$leader}{$lbonus}";
$power = "{$power}";
$intel = "{$intel}";
diff --git a/hwe/b_myGenInfo.php b/hwe/b_myGenInfo.php
index 08c998bc..9b940696 100644
--- a/hwe/b_myGenInfo.php
+++ b/hwe/b_myGenInfo.php
@@ -122,9 +122,9 @@ for($j=0; $j < $gencount; $j++) {
}
if($general['injury'] > 0) {
- $leader = floor($general['leader'] * (100 - $general['injury'])/100);
- $power = floor($general['power'] * (100 - $general['injury'])/100);
- $intel = floor($general['intel'] * (100 - $general['injury'])/100);
+ $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
+ $power = intdiv($general['power'] * (100 - $general['injury']), 100);
+ $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "{$leader}{$lbonus}";
$power = "{$power}";
$intel = "{$intel}";
diff --git a/hwe/b_tournament.php b/hwe/b_tournament.php
index 49088183..93efbf8a 100644
--- a/hwe/b_tournament.php
+++ b/hwe/b_tournament.php
@@ -223,7 +223,7 @@ for ($i=0; $i < 2; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -264,7 +264,7 @@ for ($i=0; $i < 4; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -305,7 +305,7 @@ for ($i=0; $i < 8; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
@@ -346,7 +346,7 @@ for ($i=0; $i < 16; $i++) {
}
if ($general['win'] > 0) {
$line[$i] = "";
- $cent[floor($i/2)] = "";
+ $cent[intdiv($i, 2)] = "";
} else {
$line[$i] = "";
}
diff --git a/hwe/c_tournament.php b/hwe/c_tournament.php
index 3fa6f992..b40b268e 100644
--- a/hwe/c_tournament.php
+++ b/hwe/c_tournament.php
@@ -177,7 +177,7 @@ if($btn == "자동개최설정" && $session->userGrade >= 5) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
- $grp = floor($code[$i] / 10);
+ $grp = intdiv($code[$i], 10);
$grp_no = $code[$i] % 10;
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['leader']}', '{$general['power']}', '{$general['intel']}', '{$general['explevel']}', '$grp', '$grp_no', '{$general['horse']}', '{$general['weap']}', '{$general['book']}')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
diff --git a/hwe/func.php b/hwe/func.php
index a694196b..71459110 100644
--- a/hwe/func.php
+++ b/hwe/func.php
@@ -796,9 +796,9 @@ function generalInfo($no) {
$horsename = getHorseName($general['horse']);
$itemname = getItemName($general['item']);
if($general['injury'] > 0) {
- $leader = floor($general['leader'] * (100 - $general['injury'])/100);
- $power = floor($general['power'] * (100 - $general['injury'])/100);
- $intel = floor($general['intel'] * (100 - $general['injury'])/100);
+ $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
+ $power = intdiv($general['power'] * (100 - $general['injury']), 100);
+ $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
} else {
$leader = $general['leader'];
$power = $general['power'];
@@ -1426,7 +1426,7 @@ function checkDelay() {
$threshold = 3;
}
//지연 해야할 밀린 턴 횟수
- $iter = floor($admin['offset'] / $term);
+ $iter = intdiv($admin['offset'], $term);
if($iter > $threshold) {
$minute = $iter * $term;
$query = "update game set turntime=DATE_ADD(turntime, INTERVAL $minute MINUTE),starttime=DATE_ADD(starttime, INTERVAL $minute MINUTE),tnmt_time=DATE_ADD(tnmt_time, INTERVAL $minute MINUTE)";
@@ -1780,9 +1780,9 @@ function turnDate($curtime) {
$curturn = cutTurn($curtime, $admin['turnterm']);
$num = 0;
$term = $admin['turnterm']*60;
- $num = floor((strtotime($curturn) - strtotime($turn)) / $term);
+ $num = intdiv((strtotime($curturn) - strtotime($turn)), $term);
- $year = $admin['startyear'] + floor($num / 12);
+ $year = $admin['startyear'] + intdiv($num, 12);
$month = 1 + (12+$num) % 12;
// 바뀐 경우만 업데이트
@@ -2667,7 +2667,7 @@ function TrickInjury($city, $type=0) {
$injury = rand() % 100;
if($injury < 30) { // 부상률 30%
- $injury = floor($injury / 2) + 1; // 부상 1~16
+ $injury = intdiv($injury, 2) + 1; // 부상 1~16
$query = "update general set crew=crew*0.98,atmos=atmos*0.98,train=train*0.98,injury=injury+'$injury' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
diff --git a/hwe/func_auction.php b/hwe/func_auction.php
index df21fd7c..4de0810a 100644
--- a/hwe/func_auction.php
+++ b/hwe/func_auction.php
@@ -3,7 +3,7 @@ namespace sammo;
function GetStuffName($stuff) {
$type1 = $stuff % 10;
- $type2 = floor($stuff / 10);
+ $type2 = intdiv($stuff, 10);
switch($type1) {
case 0: $str = "쌀"; break;
@@ -180,7 +180,7 @@ function processAuction() {
$bidder = MYDB_fetch_array($result);
$sel1 = $auction['stuff'] % 10;
- $sel2 = floor($auction['stuff'] / 10);
+ $sel2 = intdiv($auction['stuff'], 10);
switch($sel1) {
case 1: $type = "weap"; break;
case 2: $type = "book"; break;
diff --git a/hwe/func_command.php b/hwe/func_command.php
index 3b53c6b2..0bc1e641 100644
--- a/hwe/func_command.php
+++ b/hwe/func_command.php
@@ -532,7 +532,7 @@ function processCommand($no) {
if($general['npc'] >= 2 || $general['killturn'] > $admin['killturn']) {
$query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
- } elseif(floor($command[0]) == 0 && $session->userGrade < 5) {
+ } elseif(intval($command[0]) == 0 && $session->userGrade < 5) {
$query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
diff --git a/hwe/func_converter.php b/hwe/func_converter.php
index aad5052c..6286082d 100644
--- a/hwe/func_converter.php
+++ b/hwe/func_converter.php
@@ -361,7 +361,7 @@ function getHonor($experience) {
function getExpLevel($experience) {
if($experience < 1000) {
- $level = floor($experience / 100);
+ $level = intdiv($experience, 100);
} else {
for($level = 0; $experience > (($level+1)*($level+1)*10); $level++) {
}
diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php
index f3eb03a2..7eadec51 100644
--- a/hwe/func_gamerule.php
+++ b/hwe/func_gamerule.php
@@ -12,9 +12,9 @@ function abilityRand() {
$power = (rand()%100 + 1) / 100.0 + 1.0;
$intel = (rand()%100 + 1) / 100.0 + 1.0;
$rate = $leader + $power + $intel;
- $leader = floor($leader / $rate * $total);
- $power = floor($power / $rate * $total);
- $intel = floor($intel / $rate * $total);
+ $leader = intdiv($leader * $total, $rate);
+ $power = intdiv($power * $total, $rate);
+ $intel = intdiv($intel * $total, $rate);
while($leader+$power+$intel < 150) {
$leader++;
@@ -30,9 +30,9 @@ function abilityLeadpow() {
$power = (rand()%100 + 1) / 100.0 + 6.0;
$intel = (rand()%100 + 1) / 100.0 + 1.0;
$rate = $leader + $power + $intel;
- $leader = floor($leader / $rate * $total);
- $power = floor($power / $rate * $total);
- $intel = floor($intel / $rate * $total);
+ $leader = intdiv($leader * $total, $rate);
+ $power = intdiv($power * $total, $rate);
+ $intel = intdiv($intel * $total, $rate);
while($leader+$power+$intel < 150) {
$leader++;
@@ -47,9 +47,9 @@ function abilityLeadint() {
$power = (rand()%100 + 1) / 100.0 + 1.0;
$intel = (rand()%100 + 1) / 100.0 + 6.0;
$rate = $leader + $power + $intel;
- $leader = floor($leader / $rate * $total);
- $power = floor($power / $rate * $total);
- $intel = floor($intel / $rate * $total);
+ $leader = intdiv($leader * $total, $rate);
+ $power = intdiv($power * $total, $rate);
+ $intel = intdiv($intel * $total, $rate);
while($leader+$power+$intel < 150) {
$leader++;
@@ -64,9 +64,9 @@ function abilityPowint() {
$power = (rand()%100 + 1) / 100.0 + 6.0;
$intel = (rand()%100 + 1) / 100.0 + 6.0;
$rate = $leader + $power + $intel;
- $leader = floor($leader / $rate * $total);
- $power = floor($power / $rate * $total);
- $intel = floor($intel / $rate * $total);
+ $leader = intdiv($leader * $total, $rate);
+ $power = intdiv($power * $total, $rate);
+ $intel = intdiv($intel * $total, $rate);
while($leader+$power+$intel < 150) {
$leader++;
@@ -184,7 +184,7 @@ function getSpecial2($leader, $power, $intel, $nodex=1, $dex0=0, $dex10=0, $dex2
}
function getGenDex($general, $type) {
- $type = floor($type / 10) * 10;
+ $type = intdiv($type, 10) * 10;
return $general["dex{$type}"];
}
@@ -192,7 +192,7 @@ function addGenDex($no, $type, $exp) {
$db = DB::db();
$connect=$db->get();
- $type = floor($type / 10) * 10;
+ $type = intdiv($type, 10) * 10;
$dexType = "dex{$type}";
if($type == 30) { $exp = round($exp * 0.90); } //귀병은 90%효율
elseif($type == 40) { $exp = round($exp * 0.90); } //차병은 90%효율
diff --git a/hwe/func_message.php b/hwe/func_message.php
index d62b9f79..7fe1fb9a 100644
--- a/hwe/func_message.php
+++ b/hwe/func_message.php
@@ -299,8 +299,8 @@ function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
// 4 : 합병, 5 : 통합, 6 : 불가침, 7 : 종전, 8 : 파기
// 9 : 자신->타인, 10 : 타인 -> 자신, 11 : 등용
$category = $type % 100;
- $term = floor($type / 100);
- $from = floor($who / 10000);
+ $term = intdiv($type, 100);
+ $from = intdiv($who, 10000);
$to = $who % 10000;
$query = "select name,picture,imgsvr,nation from general where no='$from'";
diff --git a/hwe/func_npc.php b/hwe/func_npc.php
index 87a4fd0e..bcf2f343 100644
--- a/hwe/func_npc.php
+++ b/hwe/func_npc.php
@@ -154,7 +154,7 @@ function SetCrew($no, $personal, $gold, $leader, $genType, $tech, $region, $city
$cost = getCost($type) * getTechCost($tech);
$cost = CharCost($cost, $personal);
- $crew = floor($gold / $cost);
+ $crew = intdiv($gold, $cost);
if($leader < $crew) { $crew = $leader; }
$command = EncodeCommand(0, $type, $crew, 11);
@@ -577,7 +577,7 @@ function processAI($no) {
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
$SelGen = MYDB_fetch_array($result);
if($SelGen['no'] != 0) {
- $amount = floor($SelGen[$type] / 5000)*10 + 10;
+ $amount = intdiv($SelGen[$type], 5000)*10 + 10;
if($amount > 100) $amount = 100;
// 몰수
$command = EncodeCommand($type2, $SelGen['no'], $amount, 24); // 금,쌀 1000단위 몰수
@@ -588,7 +588,7 @@ function processAI($no) {
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
$SelGen = MYDB_fetch_array($result);
if($SelGen['no'] != 0) {
- $amount = floor(($nation[$type]-GameConst::$baserice) / 5000)*10 + 10;
+ $amount = intdiv(($nation[$type]-GameConst::$baserice), 5000)*10 + 10;
if($amount > 100) $amount = 100;
// 포상
$command = EncodeCommand($type2, $SelGen['no'], $amount, 23); // 금 1000단위 포상
@@ -637,7 +637,7 @@ function processAI($no) {
}
//국가 병량이 없을때 바로 헌납
if($nation['rice'] < 2000 && $general['rice'] > 200) {
- $amount = floor(($general['rice'] - 200)/100) + 1;
+ $amount = intdiv($general['rice'] - 200, 100) + 1;
if($amount > 20) { $amount = 20; }
$command = EncodeCommand(0, 2, $amount, 44); //헌납
$query = "update general set turn0='$command' where no='{$general['no']}'";
@@ -663,11 +663,11 @@ function processAI($no) {
if($general['gold'] + $general['rice'] < 200) { $command = EncodeCommand(0, 0, 0, 9); } //금쌀없으면 조달9
elseif($general['rice'] > 100 && $city['rate'] < 95) { $command = EncodeCommand(0, 0, 0, 4); } //우선 선정
elseif($general['gold'] < 100) { //금없으면 쌀팜
- $amount = floor(($general['rice'] - $general['gold']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['rice'] - $general['gold']), 100 / 2); // 100단위
$command = EncodeCommand(0, 1, $amount, 49); //팜
} elseif($general['gold'] < 700 && $general['rice'] < 700) { $command = EncodeCommand(0, 0, 0, 1); } //금쌀되면 내정
elseif($general['rice'] < 100) { //쌀없으면 쌀삼
- $amount = floor(($general['gold'] - $general['rice']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['gold'] - $general['rice']), 100 / 2); // 100단위
$command = EncodeCommand(0, 2, $amount, 49); //삼
} elseif($genType >= 2) { $command = EncodeCommand(0, 0, 0, 1); } //내정장일때 내정
else {
@@ -743,12 +743,12 @@ function processAI($no) {
else { $command = EncodeCommand(0, 0, 0, 1); }
} elseif($general['rice'] < $resrc && $general['rice'] <= $general['gold']) {
//금이 더 많으면 매매
- $amount = floor(($general['gold'] - $general['rice']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['gold'] - $general['rice']), 100 / 2); // 100단위
if($amount > 0) { $command = EncodeCommand(0, 2, $amount, 49); }//삼
else { $command = EncodeCommand(0, 0, 0, (rand()%2)*8 + 1); } // 내정, 조달
} elseif($general['gold'] < $resrc && $general['rice'] > $general['gold']) {
//쌀이 더 많으면 매매
- $amount = floor(($general['rice'] - $general['gold']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['rice'] - $general['gold']), 100 / 2); // 100단위
if($amount > 0) { $command = EncodeCommand(0, 1, $amount, 49); }//팜
else { $command = EncodeCommand(0, 0, 0, (rand()%2)*8 + 1); } // 내정, 조달
//자원, 병사 모두 충족
@@ -777,11 +777,11 @@ function processAI($no) {
elseif($general['rice'] > $resrc && $city['rate'] < 95 && $city['front'] == 0) { $command = EncodeCommand(0, 0, 0, 4); } // 우선 선정
elseif($general['rice'] > $resrc && $city['rate'] < 50 && $city['front'] == 1) { $command = EncodeCommand(0, 0, 0, 4); } // 우선 선정
elseif($general['gold'] < $resrc) { // 금없으면 쌀팜
- $amount = floor(($general['rice'] - $general['gold']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['rice'] - $general['gold']), 100 / 2); // 100단위
if($amount > 0) { $command = EncodeCommand(0, 1, $amount, 49); }// 팜
else { $command = EncodeCommand(0, 0, 0, 9); } // 조달
} elseif($general['rice'] < $resrc) { // 쌀없으면 쌀삼
- $amount = floor(($general['gold'] - $general['rice']) / 100 / 2); // 100단위
+ $amount = intdiv(($general['gold'] - $general['rice']), 100 / 2); // 100단위
if($amount > 0) { $command = EncodeCommand(0, 2, $amount, 49); }// 팜
else { $command = EncodeCommand(0, 0, 0, 9); } // 조달
} elseif($genType >= 2) { $command = EncodeCommand(0, 0, 0, 1); } //내정장일때 내정
@@ -1041,7 +1041,7 @@ function GoldBillRate($nation, $rate, $gold_rate, $type, $gold) {
$incomeList = getGoldIncome($nation, $rate, $gold_rate, $type);
$income = $gold + $incomeList[0] + $incomeList[1];
$outcome = getGoldOutcome($nation, 100); // 100%의 지급량
- $bill = floor($income / $outcome * 90); // 수입의 90% 만 지급
+ $bill = intval($income / $outcome * 90); // 수입의 90% 만 지급
if($bill < 20) { $bill = 20; }
if($bill > 200) { $bill = 200; }
@@ -1057,7 +1057,7 @@ function RiceBillRate($nation, $rate, $rice_rate, $type, $rice) {
$incomeList = getRiceIncome($nation, $rate, $rice_rate, $type);
$income = $rice + $incomeList[0] + $incomeList[1];
$outcome = getRiceOutcome($nation, 100); // 100%의 지급량
- $bill = floor($income / $outcome * 90); // 수입의 90% 만 지급
+ $bill = intval($income / $outcome * 90); // 수입의 90% 만 지급
if($bill < 20) { $bill = 20; }
if($bill > 200) { $bill = 200; }
diff --git a/hwe/func_process.php b/hwe/func_process.php
index b76024d7..230e71c3 100644
--- a/hwe/func_process.php
+++ b/hwe/func_process.php
@@ -30,7 +30,7 @@ function getGeneralLeadership(&$general, $withInjury, $withItem, $withStatAdjust
//$withStatAdjust는 통솔에서 미사용
if($useFloor){
- return floor($leadership);
+ return intval($leadership);
}
return $leadership;
@@ -62,7 +62,7 @@ function getGeneralPower(&$general, $withInjury, $withItem, $withStatAdjust, $us
}
if($useFloor){
- return floor($power);
+ return intval($power);
}
return $power;
}
@@ -93,7 +93,7 @@ function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $us
}
if($useFloor){
- return floor($intel);
+ return intval($intel);
}
return $intel;
}
@@ -350,7 +350,7 @@ function process_3(&$general) {
$ded = CharDedication($ded, $general['personal']);
// 부드러운 기술 제한
- if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score = floor($score/4); }
+ if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score = intdiv($score, 4); }
//장수수 구함
$query = "select no from general where nation='{$general['nation']}'";
@@ -887,11 +887,11 @@ function process_11(&$general, $type) {
$cost = round($cost);
//특기 보정 : 보병, 궁병, 기병, 귀병, 공성, 징병
- if(floor($armtype/10) == 0 && $general['special2'] == 50) { $cost *= 0.9; }
- if(floor($armtype/10) == 1 && $general['special2'] == 51) { $cost *= 0.9; }
- if(floor($armtype/10) == 2 && $general['special2'] == 52) { $cost *= 0.9; }
- if(floor($armtype/10) == 3 && $general['special2'] == 40) { $cost *= 0.9; }
- if(floor($armtype/10) == 4 && $general['special2'] == 43) { $cost *= 0.9; }
+ if(intdiv($armtype, 10) == 0 && $general['special2'] == 50) { $cost *= 0.9; }
+ if(intdiv($armtype, 10) == 1 && $general['special2'] == 51) { $cost *= 0.9; }
+ if(intdiv($armtype, 10) == 2 && $general['special2'] == 52) { $cost *= 0.9; }
+ if(intdiv($armtype, 10) == 3 && $general['special2'] == 40) { $cost *= 0.9; }
+ if(intdiv($armtype, 10) == 4 && $general['special2'] == 43) { $cost *= 0.9; }
if($general['special2'] == 72) { $cost *= 0.5; }
if($type == 1) { $dtype = "징병"; }
@@ -974,7 +974,7 @@ function process_11(&$general, $type) {
else { $valid = 0; }
// 초반 제한중 차병 불가
- if($admin['year'] < $admin['startyear']+3 && floor($armtype/10) == 4) {
+ if($admin['year'] < $admin['startyear']+3 && intdiv($armtype, 10) == 4) {
$valid = 0;
}
@@ -1061,7 +1061,7 @@ function process_13(&$general) {
$log[] = "●>{$admin['month']}월:병사가 없습니다. 훈련 실패. <1>$date>";
} elseif($general['train'] >= $_maxtrain) {
$log[] = "●>{$admin['month']}월:병사들은 이미 정예병사들입니다. <1>$date>";
-// } elseif(floor($general['crewtype']/10) == 4) {
+// } elseif(intdiv($general['crewtype'], 10) == 4) {
// $log[] = "●>{$admin['month']}월:병기는 훈련이 불가능합니다. <1>$date>";
} else {
// 훈련시
@@ -1082,7 +1082,7 @@ function process_13(&$general) {
$query = "update general set train='$score' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 사기 약간 감소
- $score = floor($general['atmos'] * $_atmosing);
+ $score = intval($general['atmos'] * $_atmosing);
if($score < 0 ) { $score = 0; }
$query = "update general set atmos='$score' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1133,7 +1133,7 @@ function process_14(&$general) {
$log[] = "●>{$admin['month']}월:자금이 모자랍니다. 사기진작 실패. <1>$date>";
} elseif($general['atmos'] >= $_maxatmos) {
$log[] = "●>{$admin['month']}월:이미 사기는 하늘을 찌를듯 합니다. <1>$date>";
-// } elseif(floor($general['crewtype']/10) == 4) {
+// } elseif(intdiv($general['crewtype'], 10) == 4) {
// $log[] = "●>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date>";
} else {
$score = round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * $_training);
@@ -1185,7 +1185,7 @@ function process_15(&$general) {
$city = MYDB_fetch_array($result);
if($general['term']%100 == 15) {
- $term = floor($general['term']/100) + 1;
+ $term = intdiv($general['term'], 100) + 1;
$code = $term * 100 + 15;
} else {
$term = 1;
@@ -1738,7 +1738,7 @@ function process_31(&$general) {
if($nation['spy'] != "") { $cities = explode("|", $nation['spy']); }
$exist = 0;
for($i=0; $i < count($cities); $i++) {
- if(floor($cities[$i]/10) == $destination) {
+ if(intdiv($cities[$i], 10) == $destination) {
$exist = 1;
break;
}
@@ -1796,7 +1796,7 @@ function process_41(&$general) {
} elseif($crewexp == 0) {
$log[] = "●>{$admin['month']}월:병사가 모자랍니다. 단련 실패. <1>$date>";
} else {
- $type = floor($general['crewtype'] / 10) * 10;
+ $type = intdiv($general['crewtype'], 10) * 10;
switch($type) {
case 0: $crewstr = '보병'; break;
case 1: $crewstr = '궁병'; break;
diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php
index 63340123..df96680b 100644
--- a/hwe/func_process_chief.php
+++ b/hwe/func_process_chief.php
@@ -986,7 +986,7 @@ function process_66(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 66) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 66;
} else {
$term = 1;
@@ -1075,7 +1075,7 @@ function process_67(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 67) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 67;
} else {
$term = 1;
@@ -1166,7 +1166,7 @@ function process_68(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 68) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 68;
} else {
$term = 1;
@@ -1275,7 +1275,7 @@ function process_71(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 71) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 71;
} else {
$term = 1;
@@ -1388,7 +1388,7 @@ function process_72(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 72) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 72;
} else {
$term = 1;
@@ -1507,7 +1507,7 @@ function process_73(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 73) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 73;
} else {
$term = 1;
@@ -1638,7 +1638,7 @@ function process_74(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 74) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 74;
} else {
$term = 1;
@@ -1778,7 +1778,7 @@ function process_75(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 75) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 75;
} else {
$term = 1;
@@ -1893,7 +1893,7 @@ function process_76(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 76) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 76;
} else {
$term = 1;
@@ -2121,7 +2121,7 @@ function process_77(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 77) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 77;
} else {
$term = 1;
@@ -2249,7 +2249,7 @@ function process_78(&$general) {
$code = $nation["l{$general['level']}term"];
if($code%100 == 78) {
- $term = floor($code/100) + 1;
+ $term = intdiv($code, 100) + 1;
$code = $term * 100 + 78;
} else {
$term = 1;
diff --git a/hwe/func_time_event.php b/hwe/func_time_event.php
index 2b826f0c..6c31cc6b 100644
--- a/hwe/func_time_event.php
+++ b/hwe/func_time_event.php
@@ -155,18 +155,18 @@ function popIncrease() {
$cityrate = 50;
$ratio = 0.99; // 공백지는 수비 빼고 약간씩 감소
- $agri = floor($city['agri'] * $ratio);
- $comm = floor($city['comm'] * $ratio);
- $secu = floor($city['secu'] * $ratio);
+ $agri = intval($city['agri'] * $ratio);
+ $comm = intval($city['comm'] * $ratio);
+ $secu = intval($city['secu'] * $ratio);
$def = $city['def'];
$wall = $city['wall'];
} else {
$ratio = (20 - $rate[$city['nation']])/200; // 20일때 0% 0일때 10% 100일때 -40%
- $agri = $city['agri'] + floor($city['agri'] * $ratio); //내정도 증감
- $comm = $city['comm'] + floor($city['comm'] * $ratio);
- $secu = $city['secu'] + floor($city['secu'] * $ratio);
- $def = $city['def'] + floor($city['def'] * $ratio);
- $wall = $city['wall'] + floor($city['wall'] * $ratio);
+ $agri = $city['agri'] + intval($city['agri'] * $ratio); //내정도 증감
+ $comm = $city['comm'] + intval($city['comm'] * $ratio);
+ $secu = $city['secu'] + intval($city['secu'] * $ratio);
+ $def = $city['def'] + intval($city['def'] * $ratio);
+ $wall = $city['wall'] + intval($city['wall'] * $ratio);
$ratio = (30 - $rate[$city['nation']])/200; // 20일때 5% 5일때 12.5% 50일때 -10%
if($ratio >= 0) {
// 국가보정
@@ -180,7 +180,7 @@ function popIncrease() {
$ratio *= (1 - $city['secu']/$city['secu2']/10); //치안에 따라 최대 10% 경감
}
- $pop = $city['pop'] + floor($city['pop'] * $ratio) + 5000; // 기본 5000명은 증가
+ $pop = $city['pop'] + (int)($city['pop'] * $ratio) + 5000; // 기본 5000명은 증가
$ratio = round($ratio*100, 2);
$cityrate = $city['rate'];
diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php
index 442b15f4..ae37e410 100644
--- a/hwe/func_tournament.php
+++ b/hwe/func_tournament.php
@@ -30,7 +30,7 @@ function processTournament() {
}
//업데이트 횟수
- $iter = floor($admin['offset'] / $unit) + 1;
+ $iter = intdiv($admin['offset'], $unit) + 1;
for($i=0; $i < $iter; $i++) {
switch($tnmt) {
@@ -519,7 +519,7 @@ function final16set() {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
//16강에 추가
- $newGrp = 20 + floor($i / 2);
+ $newGrp = 20 + intdiv($i, 2);
$newGrp_no = $i % 2;
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['ldr']}', '{$general['pwr']}', '{$general['itl']}', '{$general['lvl']}', '$newGrp', '$newGrp_no', '{$general['h']}', '{$general['w']}', '{$general['b']}')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -552,7 +552,7 @@ function finalFight($tnmt_type, $tnmt, $phase, $type) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
//x강에 추가
- $newGrp = floor($phase / 2) + $offset + 10;
+ $newGrp = intdiv($phase, 2) + $offset + 10;
$newGrp_no = $phase % 2;
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['ldr']}', '{$general['pwr']}', '{$general['itl']}', '{$general['lvl']}', '$newGrp', '$newGrp_no', '{$general['h']}', '{$general['w']}', '{$general['b']}')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
diff --git a/hwe/j_install.php b/hwe/j_install.php
index d231ac33..2bf1294a 100644
--- a/hwe/j_install.php
+++ b/hwe/j_install.php
@@ -162,7 +162,7 @@ if($sync == 0) {
}
$killturn = 4800 / $turnterm;
-if($npcmode == 1) { $killturn = floor($killturn / 3); }
+if($npcmode == 1) { $killturn = intdiv($killturn, 3); }
$env = [
'scenario'=>$scenario,
diff --git a/hwe/join_post.php b/hwe/join_post.php
index 31d3aa9e..b51b26be 100644
--- a/hwe/join_post.php
+++ b/hwe/join_post.php
@@ -4,7 +4,7 @@ namespace sammo;
include "lib.php";
include "func.php";
-$v = new Validator($_GET + $_POST);
+$v = new Validator($_POST + $_GET);
$v
->rule('required', [
'name',
@@ -34,7 +34,7 @@ $v
->rule('min', 'character', 0)
->rule('max', 'character', 11);
-if(!$v->validate()){
+if (!$v->validate()) {
MessageBox($v->errorStr());
echo "";
exit(1);
@@ -59,7 +59,7 @@ $rootDB = RootDB::db();
//회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM MEMBER WHERE no=%i', $userID);
-if(!$member) {
+if (!$member) {
MessageBox("잘못된 접근입니다!!!");
echo "";
exit(1);
@@ -73,42 +73,42 @@ $gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE noc<2');
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%i', $name);
-if($oldGeneral) {
+if ($oldGeneral) {
echo("");
exit;
}
-if($oldName) {
+if ($oldName) {
echo("");
exit;
}
-if($admin['maxgeneral'] <= $gencount) {
+if ($admin['maxgeneral'] <= $gencount) {
echo("");
exit;
}
-if(mb_strlen($name) < 1) {
+if (mb_strlen($name) < 1) {
echo("");
exit;
}
-if(mb_strlen($name) > 6) {
+if (mb_strlen($name) > 6) {
echo("");
exit;
}
-if($leader + $power + $intel > 150) {
+if ($leader + $power + $intel > 150) {
echo("