From 52eeff3466f50b9f845277b5fe0264dbdf4fe539 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 6 Jun 2020 13:45:31 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=98=EC=95=BD=20=EC=82=AC=EC=9A=A9=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=EA=B0=80=20=EC=95=88=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_myPage.php | 10 +- hwe/j_set_my_setting.php | 4 +- hwe/sammo/LazyVarUpdater.php | 294 +++++++++++++++++------------------ 3 files changed, 154 insertions(+), 154 deletions(-) diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index 6413b7ba..d2cbf0b4 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -78,11 +78,11 @@ var availableDieImmediately = ; ∞개막직전 남는자리가 있을경우 랜덤하게 참여합니다.

환약 사용 【
부상을 입었을 때 환약을 사용하는 기준입니다.

autorun_user['options']['chief'])??false) : ?> diff --git a/hwe/j_set_my_setting.php b/hwe/j_set_my_setting.php index 1bec80e1..a273720b 100644 --- a/hwe/j_set_my_setting.php +++ b/hwe/j_set_my_setting.php @@ -52,12 +52,12 @@ if($defence_train != $me->getVar('defence_train')){ } } +$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100)); + if($use_auto_nation_turn != $me->getAuxVar('use_auto_nation_turn')){ $me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn); } -$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100)); - if($me->getVar('tnmt') != $tnmt){ $me->setVar('tnmt', $tnmt); } diff --git a/hwe/sammo/LazyVarUpdater.php b/hwe/sammo/LazyVarUpdater.php index ec75f0eb..e4cfb283 100644 --- a/hwe/sammo/LazyVarUpdater.php +++ b/hwe/sammo/LazyVarUpdater.php @@ -1,148 +1,148 @@ -getAuxVar(''); - - } - return $this->raw; - } - - function getVar(string $key){ - return $this->raw[$key]; - } - - function getVars(string ...$keys){ - return array_map([$this, 'getVar'], $keys); - } - - function touchVar(string $key):bool{ - if(key_exists($key, $this->raw)){ - return false; - } - $this->raw[$key] = null; - - return true; - } - - function unpackAux(){ - if(($this->raw['auxVar']??null) === null){ - if(!key_exists('aux', $this->raw)){ - throw new \RuntimeException('aux is not set'); - } - $this->raw['auxVar'] = Json::decode($this->raw['aux']??'{}'); - } - } - - function setVar(string $key, $value){ - return $this->updateVar($key, $value); - } - - function getAuxVar(string $key){ - $this->unpackAux(); - return $this->raw['auxVar'][$key]??null; - } - - function setAuxVar(string $key, $var){ - $oldVar = $this->getAuxVar($key); - - if($oldVar === $var){ - return; - } - - if($var === null){ - unset($this->auxVar[$key]); - $this->auxUpdated = true; - return; - } - $this->raw['auxVar'][$key] = $var; - $this->auxUpdated = true; - } - - function updateVar(string $key, $value){ - if(($this->raw[$key]??null) === $value){ - return; - } - if(!key_exists($key, $this->updatedVar)){ - $this->updatedVar[$key] = true; - } - $this->raw[$key] = $value; - } - - function updateVarWithLimit(string $key, $value, $min = null, $max = null){ - if($min !== null && $value < $min){ - $value = $min; - } - if($max !== null && $value > $max){ - $value = $max; - } - $this->updateVar($key, $value); - } - - function increaseVar(string $key, $value) - { - if($value === 0){ - return; - } - $targetValue = $this->raw[$key] + $value; - $this->updateVar($key, $targetValue); - } - - function increaseVarWithLimit(string $key, $value, $min = null, $max = null){ - $targetValue = $this->raw[$key] + $value; - if($min !== null && $targetValue < $min){ - $targetValue = $min; - } - if($max !== null && $targetValue > $max){ - $targetValue = $max; - } - $this->updateVar($key, $targetValue); - } - - function multiplyVar(string $key, $value) - { - if($value === 1){ - return; - } - $targetValue = $this->raw[$key] * $value; - $this->updateVar($key, $targetValue); - } - - function multiplyVarWithLimit(string $key, $value, $min = null, $max = null){ - $targetValue = $this->raw[$key] * $value; - if($min !== null && $targetValue < $min){ - $targetValue = $min; - } - if($max !== null && $targetValue > $max){ - $targetValue = $max; - } - $this->updateVar($key, $targetValue); - } - - function getUpdatedValues():array { - if($this->auxUpdated){ - $this->setVar('aux', Json::encode($this->raw['auxVar'])); - $this->auxUpdated = false; - } - $updateVals = []; - foreach(array_keys($this->updatedVar) as $key){ - $updateVals[$key] = $this->raw[$key]; - } - return $updateVals; - } - - function flushUpdateValues():void { - $this->updatedVar = []; - if(key_exists('auxVar', $this->raw)){ - $this->auxUpdated = false; - unset($this->raw['auxVar']); - } - } +getAuxVar(''); + + } + return $this->raw; + } + + function getVar(string $key){ + return $this->raw[$key]; + } + + function getVars(string ...$keys){ + return array_map([$this, 'getVar'], $keys); + } + + function touchVar(string $key):bool{ + if(key_exists($key, $this->raw)){ + return false; + } + $this->raw[$key] = null; + + return true; + } + + function unpackAux(){ + if(!key_exists('auxVar', $this->raw)){ + if(!key_exists('aux', $this->raw)){ + throw new \RuntimeException('aux is not set'); + } + $this->raw['auxVar'] = Json::decode($this->raw['aux']??'{}'); + } + } + + function setVar(string $key, $value){ + return $this->updateVar($key, $value); + } + + function getAuxVar(string $key){ + $this->unpackAux(); + return $this->raw['auxVar'][$key]??null; + } + + function setAuxVar(string $key, $var){ + $oldVar = $this->getAuxVar($key); + + if($oldVar === $var){ + return; + } + + if($var === null){ + unset($this->auxVar[$key]); + $this->auxUpdated = true; + return; + } + $this->raw['auxVar'][$key] = $var; + $this->auxUpdated = true; + } + + function updateVar(string $key, $value){ + if(($this->raw[$key]??null) === $value){ + return; + } + if(!key_exists($key, $this->updatedVar)){ + $this->updatedVar[$key] = true; + } + $this->raw[$key] = $value; + } + + function updateVarWithLimit(string $key, $value, $min = null, $max = null){ + if($min !== null && $value < $min){ + $value = $min; + } + if($max !== null && $value > $max){ + $value = $max; + } + $this->updateVar($key, $value); + } + + function increaseVar(string $key, $value) + { + if($value === 0){ + return; + } + $targetValue = $this->raw[$key] + $value; + $this->updateVar($key, $targetValue); + } + + function increaseVarWithLimit(string $key, $value, $min = null, $max = null){ + $targetValue = $this->raw[$key] + $value; + if($min !== null && $targetValue < $min){ + $targetValue = $min; + } + if($max !== null && $targetValue > $max){ + $targetValue = $max; + } + $this->updateVar($key, $targetValue); + } + + function multiplyVar(string $key, $value) + { + if($value === 1){ + return; + } + $targetValue = $this->raw[$key] * $value; + $this->updateVar($key, $targetValue); + } + + function multiplyVarWithLimit(string $key, $value, $min = null, $max = null){ + $targetValue = $this->raw[$key] * $value; + if($min !== null && $targetValue < $min){ + $targetValue = $min; + } + if($max !== null && $targetValue > $max){ + $targetValue = $max; + } + $this->updateVar($key, $targetValue); + } + + function getUpdatedValues():array { + if($this->auxUpdated){ + $this->setVar('aux', Json::encode($this->raw['auxVar'])); + $this->auxUpdated = false; + } + $updateVals = []; + foreach(array_keys($this->updatedVar) as $key){ + $updateVals[$key] = $this->raw[$key]; + } + return $updateVals; + } + + function flushUpdateValues():void { + $this->updatedVar = []; + if(key_exists('auxVar', $this->raw)){ + $this->auxUpdated = false; + unset($this->raw['auxVar']); + } + } } \ No newline at end of file