등용 수락 변경, Aux 처리 추가

nations->aux.joinedNations
dummyGeneral에 exp,ded 추가
scheme에서 nations 제거
This commit is contained in:
2020-03-13 01:44:18 +09:00
parent 553e0fdbe3
commit 9e7b8bb6b2
20 changed files with 560 additions and 247 deletions
+17 -6
View File
@@ -16,14 +16,15 @@ class ReqGeneralValue extends Constraint{
protected $keyNick;
protected $reqVal;
protected $comp;
protected $errMsg;
public function checkInputValues(bool $throwExeception=true):bool{
if(!parent::checkInputValues($throwExeception) && !$throwExeception){
return false;
}
if(count($this->arg) == 4){
[$this->key, $this->keyNick, $comp, $this->reqVal] = $this->arg;
if(count($this->arg) == 5){
[$this->key, $this->keyNick, $comp, $this->reqVal, $this->errMsg] = $this->arg;
if(!in_array($comp, ['>', '>=', '==', '<=', '<', '!=', '===', '!=='])){
if(!$throwExeception){return false; }
@@ -32,7 +33,7 @@ class ReqGeneralValue extends Constraint{
}
else{
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("require key, keyNick, comp, reqVal");
throw new \InvalidArgumentException("require key, keyNick, comp, reqVal[, errMsg]");
}
$this->comp = $comp;
@@ -47,7 +48,7 @@ class ReqGeneralValue extends Constraint{
if(is_numeric($this->reqVal)){
$this->isPercent = false;
}
else if(is_str($this->reqVal)){
else if(is_string($this->reqVal)){
$this->reqVal = Util::convPercentStrToFloat($this->reqVal);
if($this->reqVal === null){
if(!$throwExeception){return false; }
@@ -61,6 +62,11 @@ class ReqGeneralValue extends Constraint{
$this->isPercent = true;
}
if($this->errMsg!==null && !is_string($this->errMsg)){
if(!$throwExeception){return false; }
throw new \InvalidArgumentException("{$this->errMsg} must be string or null");
}
return true;
}
@@ -120,8 +126,13 @@ class ReqGeneralValue extends Constraint{
return true;
}
$josaYi = JosaUtil::pick($keyNick, '이');
$this->reason = "{$keyNick}{$josaYi} {$result}";
if($this->errMsg){
$this->reason = $this->errMsg;
}
else{
$josaYi = JosaUtil::pick($keyNick, '이');
$this->reason = "{$keyNick}{$josaYi} {$result}";
}
return false;
}