diff --git a/hwe/css/common.css b/hwe/css/common.css index 6bd98467..d96b6364 100644 --- a/hwe/css/common.css +++ b/hwe/css/common.css @@ -218,3 +218,25 @@ div.bar_out div.bar_in{ margin:0; padding:0; } + +.commandBasic{ + background-color:black; + color:white; +} + +.compensatePositive{ + color:skyblue; +} + +.compensateNegative{ + color:orange; +} + +.compensateNeutral{ + color:white; +} + +.commandBasic.commandImpossible{ + background-color:red; + color:white; +} diff --git a/hwe/func.php b/hwe/func.php index fe0e3589..e18ab353 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -427,246 +427,61 @@ function commandGroup($typename, $type=0) { } } -function commandTable() { +function printCommandTable() { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); $connect=$db->get(); $userID = Session::getUserID(); - $admin = $gameStor->getValues(['startyear', 'year', 'month', 'develcost', 'scenario', 'join_mode']); + $gameStor->cacheAll(); + $env = $gameStor->getAll(); + $admin = $gameStor->getAll(); - $query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$userID}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $me = MYDB_fetch_array($result); + $session = Session::getInstance(); + $generalID = $session->generalID; - $troop = getTroop($me['troop']); - $city = getCity($me['city']); + $generalObj = General::createGeneralObjFromDB($generalID); - $nationcount = count(getAllNationStaticInfo()); +?> + -"; +userGrade == 4){ - + ;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'>;color:white;width:160px;font-size:13px; value='로비로' onclick=location.replace('../')>
diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php index 1669547f..5a97d118 100644 --- a/hwe/sammo/Command/BaseCommand.php +++ b/hwe/sammo/Command/BaseCommand.php @@ -18,6 +18,10 @@ abstract class BaseCommand{ static protected $actionName = 'CommandName'; static public $reqArg = false; + public function getCommandDetailTitle():string{ + return $this->getName(); + } + protected $generalObj = null; protected $city = null; protected $nation = null; @@ -202,6 +206,15 @@ abstract class BaseCommand{ public function getBrief():string{ return static::getName(); } + + public function getCompensationStyle():?int{ + //1 : Positive + //0 : Neutral + //-1 : Negative + //null : can't calculate + //TODO: 구현 + return 0; + } static public function getName():string { return static::$actionName; @@ -212,7 +225,28 @@ abstract class BaseCommand{ } public function testReservable():?string{ + if($this->reservableConstraints === null){ + return true; + } + if($this->reasonNotReservable){ + return $this->reasonNotReservable; + } + + $constraintInput = [ + 'general'=>$this->generalObj->getRaw(), + 'city'=>$this->city, + 'nation'=>$this->nation, + 'arg'=>$this->arg, + + 'destGeneral'=>$this->destGeneralObj->getRaw(), + 'destCity'=>$this->destCity, + 'destNation'=>$this->destNation, + ]; + + $this->reasonNotReservable = Constraint::testAll($this->reservableConstraints, $constraintInput); + $this->reservable = $this->reasonNotReservable === null; + return $this->reasonNotReservable; } public function canDisplay():bool{ @@ -246,13 +280,9 @@ abstract class BaseCommand{ 'destNation'=>$this->destNation, ]; - if(!$fullCheck && $this->reservableConstraints){ - return Constraint::testAll($this->reservableConstraints, $constraintInput); - } - $this->reasonNotRunnable = Constraint::testAll($this->runnableConstraints, $constraintInput); - $this->runnable = $this->reason === null; - return $this->reason; + $this->runnable = $this->reasonNotRunnable === null; + return $this->reasonNotRunnable; } diff --git a/hwe/sammo/Command/General/che_상업투자.php b/hwe/sammo/Command/General/che_상업투자.php index 8bb4786d..d3c12f93 100644 --- a/hwe/sammo/Command/General/che_상업투자.php +++ b/hwe/sammo/Command/General/che_상업투자.php @@ -29,6 +29,27 @@ class che_상업투자 extends Command\GeneralCommand{ static protected $actionName = '상업 투자'; static protected $debuffFront = 0.5; + public function getCommandDetailTitle():string{ + $name = $this->getName(); + $statTypeBase = [ + 'leader'=>'통솔경험', + 'power'=>'무력경험', + 'intel'=>'지력경험', + ]; + $statType = $statType[static::$statKey]; + [$reqGold, $reqRice] = $this->getCost(); + + $title = "{$name}({$statType}"; + if($reqGold > 0){ + $title .= ", 자금{$reqGold}"; + } + if($reqRice > 0){ + $title .= ", 군량{$reqRice}"; + } + $title .= ')'; + return $title; + } + protected function argTest():bool{ $this->arg = null; return true; diff --git a/src/sammo/Util.php b/src/sammo/Util.php index b341314c..66bea4a2 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -572,9 +572,14 @@ class Util extends \utilphp\util /** * fqn 클래스 경로에서 클래스 이름을 받아옴 */ - function getClassName(string $classpath) + public static function getClassName(string $classpath) { if ($pos = strrpos($classpath, '\\')) return substr($classpath, $pos + 1); return $pos; } + + public static function getClassNameFromObj($object){ + $reflect = new ReflectionClass($object); + return $reflect->getShortName(); + } };