round 문제 수정
This commit is contained in:
+1
-1
@@ -163,7 +163,7 @@ foreach($generalList as $general){
|
|||||||
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
$general['connect'] = Util::round($general['connect'], -1);
|
||||||
|
|
||||||
$imageTemp = GetImageURL($general['imgsvr']);
|
$imageTemp = GetImageURL($general['imgsvr']);
|
||||||
echo "
|
echo "
|
||||||
|
|||||||
+4
-4
@@ -46,10 +46,10 @@ $btCount = $tradeCount + $bidCount;
|
|||||||
|
|
||||||
$unit = $turnterm * 60;
|
$unit = $turnterm * 60;
|
||||||
|
|
||||||
$amount = Util::round($amount / 10) * 10;
|
$amount = Util::round($amount, -1);
|
||||||
$cost = Util::round($cost / 10) * 10;
|
$cost = Util::round($cost, -1);
|
||||||
$topv = Util::round($topv / 10) * 10;
|
$topv = Util::round($topv, -1);
|
||||||
$value = Util::round($value / 10) * 10;
|
$value = Util::round($value, -1);
|
||||||
if ($term > 24) {
|
if ($term > 24) {
|
||||||
$term = 24;
|
$term = 24;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ function registerAuction() {
|
|||||||
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
||||||
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
||||||
|
|
||||||
$amount = Util::round($amount / 10) * 10;
|
$amount = Util::round($amount, -1);
|
||||||
$cost = Util::round($cost / 10) * 10;
|
$cost = Util::round($cost, -1);
|
||||||
$topv = Util::round($topv / 10) * 10;
|
$topv = Util::round($topv, -1);
|
||||||
|
|
||||||
$term = 3 + rand() % 10;
|
$term = 3 + rand() % 10;
|
||||||
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
||||||
@@ -54,9 +54,9 @@ function registerAuction() {
|
|||||||
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
if($cost <= $amount*0.8) { $cost = $amount*0.8; }
|
||||||
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
if($cost >= $amount*1.2) { $cost = $amount*1.2; }
|
||||||
|
|
||||||
$amount = Util::round($amount / 10) * 10;
|
$amount = Util::round($amount, -1);
|
||||||
$cost = Util::round($cost / 10) * 10;
|
$cost = Util::round($cost, -1);
|
||||||
$topv = Util::round($topv / 10) * 10;
|
$topv = Util::round($topv, -1);
|
||||||
|
|
||||||
$term = 3 + rand() % 10;
|
$term = 3 + rand() % 10;
|
||||||
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
|
||||||
|
|||||||
@@ -740,7 +740,7 @@ class GeneralAI{
|
|||||||
|
|
||||||
if($targetGeneral){
|
if($targetGeneral){
|
||||||
if($targetGeneral === $compNpcCivil){
|
if($targetGeneral === $compNpcCivil){
|
||||||
$amount = round($targetGeneral->$resName - $minRes * 3, -2);
|
$amount = Util::round($targetGeneral->$resName - $minRes * 3, -2);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$amount = min(10000, intdiv($targetGeneral->$resName, 5000)*1000 + 1000);
|
$amount = min(10000, intdiv($targetGeneral->$resName, 5000)*1000 + 1000);
|
||||||
|
|||||||
+7
-4
@@ -7,17 +7,20 @@ class Util extends \utilphp\util
|
|||||||
/**
|
/**
|
||||||
* int 값 반환을 강제하는 부동소수점 반올림
|
* int 값 반환을 강제하는 부동소수점 반올림
|
||||||
* @param int|float $value
|
* @param int|float $value
|
||||||
|
* @param int $pos 반올림 자리수, 0 이하의 '음수만'
|
||||||
*/
|
*/
|
||||||
public static function round($value) : int{
|
public static function round($value, $pos=0) : int{
|
||||||
return intval(round($value));
|
assert($pos <= 0, 'Util::round는 음수만 입력 가능');
|
||||||
|
return intval(round($value, $pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* int 값으로 강제로 설정하는 부동소수점 반올림
|
* int 값으로 강제로 설정하는 부동소수점 반올림
|
||||||
* @param int|float $value
|
* @param int|float $value
|
||||||
|
* @param int $pos 반올림 자리수, 0 이하의 '음수만'
|
||||||
*/
|
*/
|
||||||
public static function setRound(&$value) : void{
|
public static function setRound(&$value, $pos=0) : void{
|
||||||
$value = static::round($value);
|
$value = static::round($value, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function _parseReq($value, string $type)
|
private static function _parseReq($value, string $type)
|
||||||
|
|||||||
Reference in New Issue
Block a user