From 98edc89fa09b1ed09836021b960afd986ccf270a Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 2 Sep 2018 19:51:17 +0900 Subject: [PATCH] =?UTF-8?q?LazyVarUpdater=EB=A5=BC=20=ED=99=9C=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EB=8A=94=20General=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/General.php | 88 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 hwe/sammo/General.php diff --git a/hwe/sammo/General.php b/hwe/sammo/General.php new file mode 100644 index 00000000..ac73b46d --- /dev/null +++ b/hwe/sammo/General.php @@ -0,0 +1,88 @@ +raw = $raw; + + $this->logger = new ActionLogger( + $this->getVar('no'), + $this->getVar('nation'), + $year, + $month, + false + ); + } + + protected function clearActivatedSkill(){ + foreach ($this->activatedSkill as $skillName=>$state) { + if (!$state) { + continue; + } + + if (!key_exists($skillName, $this->logActivatedSkill)) { + $this->logActivatedSkill[$skillName] = 1; + } else { + $this->logActivatedSkill[$skillName] += 1; + } + } + $this->activatedSkill = []; + } + + function getActivatedSkillLog():array{ + return $this->logActivatedSkill; + } + + function getName():string{ + return $this->raw['name']; + } + + function getCityID():int{ + return $this->raw['city']; + } + + function getNationID():int{ + return $this->raw['nation']; + } + + function getStaticNation():array{ + return getNationStaticInfo($this->raw['nation']); + } + + function getLogger():ActionLogger{ + return $this->logger; + } + + + /** + * @param \MeekroDB $db + */ + function applyDB($db):bool{ + $updateVals = $this->getUpdatedValues(); + + if(!$updateVals){ + return false; + } + + $db->update('general', $updateVals, 'no=%i', $this->raw['no']); + $this->getLogger()->flush(); + return $db->affectedRows() > 0; + } +} \ No newline at end of file