From b28ac27fba356226d860440efae8b69383454d41 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 5 Mar 2020 06:48:15 +0900 Subject: [PATCH] =?UTF-8?q?=EB=82=B4=ED=8A=B9=20=EC=A0=84=ED=8A=B9=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func.php | 2 ++ hwe/func_command.php | 14 ++++++++-- hwe/func_process.php | 49 +++++++++++++++++++++++++++++++++ hwe/j_preprocessing.php | 3 ++ hwe/processing.php | 3 ++ hwe/sammo/GameUnitConstBase.php | 4 ++- 6 files changed, 72 insertions(+), 3 deletions(-) diff --git a/hwe/func.php b/hwe/func.php index 77d81ad2..3ab0564e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -663,6 +663,8 @@ function commandTable() { } commandGroup("", 1); commandGroup("======= 개 인 ========"); + addCommand("내정 특기 초기화(3턴, 1회만)", 38); + addCommand("전투 특기 초기화(3턴, 1회만)", 39); if($me['level'] >= 1) { addCommand("단련(자금$develcost, 군량$develcost)", 41); addCommand("숙련전환(통솔경험, 자금$develcost, 군량$develcost)", 58); diff --git a/hwe/func_command.php b/hwe/func_command.php index 9984f68c..10348cab 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -170,6 +170,13 @@ function getTurn(array $general, $type, $font=1) { $str[$i] = "【{$city['name']}】에 선동 실행"; break; + case 38: //내특 초기화 + $str[$i] = "내정 특기를 초기화"; + break; + case 39: //전특 초기화 + $str[$i] = "전투 특기를 초기화"; + break; + case 41: //단련 $str[$i] = "숙련도를 단련"; break; @@ -489,7 +496,7 @@ function processCommand($no, $reduceTurn) { $gameStor = KVStorage::getStorage($db, 'game_env'); $connect=$db->get(); - $general = $db->queryFirstRow('SELECT npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset from general where no = %i', $no); + $general = $db->queryFirstRow('SELECT npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset,aux from general where no = %i', $no); list($month, $killturn) = $gameStor->getValuesAsArray(['month', 'killturn']); $log = []; @@ -549,7 +556,7 @@ function processCommand($no, $reduceTurn) { } //장수정보 재로드 - $query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset from general where no='$no'"; + $query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset,aux from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $general = MYDB_fetch_array($result); } @@ -621,6 +628,9 @@ function processCommand($no, $reduceTurn) { case 34: process_34($general); break; //파괴 case 35: process_35($general); break; //선동 + case 38: process_38($general, '내정 특기', 'special', 'specage'); break; //내특 초기화 + case 39: process_38($general, '전투 특기', 'special2', 'specage2'); break; //내특 초기화 + case 41: process_41($general); break; //단련 case 42: process_42($general); break; //견문 case 43: process_43($general); break; //증여 diff --git a/hwe/func_process.php b/hwe/func_process.php index d3a37b34..6d5231e7 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -1858,6 +1858,55 @@ function process_31(&$general) { pushGenLog($general, $log); } +function process_38(&$general, string $specName, string $specTypeKey, string $specAgeKey) { + $db = DB::db(); + $gameStor = KVStorage::getStorage($db, 'game_env'); + $connect=$db->get(); + + $log = []; + $date = substr($general['turntime'],11,5); + + $admin = $gameStor->getValues(['year', 'month']); + + $genAux = Json::decode($general['aux']); + + + if($general['term']%100 == 38) { + $term = intdiv($general['term'], 100) + 1; + $code = $term * 100 + 38; + } else { + $term = 1; + $code = 100 + 38; + } + + if($genAux['used_38_'.$specTypeKey]??0){ + $log[] = "●{$admin['month']}월:이미 {$specName}을 초기화했습니다. {$specName} 초기화 실패. <1>$date"; + } + else if(!$general[$specTypeKey]) { + $log[] = "●{$admin['month']}월:{$specName}를 갖고 있지 않습니다. {$specName} 초기화 실패. <1>$date"; + } elseif($term < 3) { + $log[] = "●{$admin['month']}월:새로운 적성을 찾는 중... ({$term}/3) <1>$date"; + + $query = "update general set resturn='ONGOING',term={$code} where no='{$general['no']}'"; + MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + } else { + + $genAux['used_38_'.$specTypeKey] = 1; + $general[$specAgeKey]=20; + $db->update('general', [ + 'resturn'=>'SUCCESS', + 'term'=>0, + $specTypeKey=>0, + $specAgeKey=>$db->sqleval('age+1'), + 'aux'=>Json::encode($genAux) + ], 'no = %i', $general['no']); + + $log[] = "●{$admin['month']}월:새로운 {$specName}를 가질 준비가 되었습니다. <1>$date"; + } + + pushGenLog($general, $log); +} + function process_41(&$general) { $db = DB::db(); $gameStor = KVStorage::getStorage($db, 'game_env'); diff --git a/hwe/j_preprocessing.php b/hwe/j_preprocessing.php index 31926d8f..246490b1 100644 --- a/hwe/j_preprocessing.php +++ b/hwe/j_preprocessing.php @@ -82,6 +82,9 @@ switch($commandtype) { // case 34: command_34($turn, 34); break; //파괴 // case 35: command_35($turn, 35); break; //선동 + case 38: command_Single($turn, 38); break; //내특 초기화 + case 39: command_Single($turn, 39); break; //전특 초기화 + case 41: command_Single($turn, 41); break; //단련 case 42: command_Single($turn, 42); break; //견문 // case 43: command_43( $turn, 43); break; //증여 diff --git a/hwe/processing.php b/hwe/processing.php index 56908e67..dedab31f 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -77,6 +77,9 @@ switch($commandtype) { case 34: command_34($turn, 34); break; //파괴 case 35: command_35($turn, 35); break; //선동 + case 38: command_Single($turn, 38); break; //내특 초기화 + case 39: command_Single($turn, 39); break; //전특 초기화 + case 41: command_Single($turn, 41); break; //단련 case 42: command_Single($turn, 42); break; //견문 case 43: command_43( $turn, 43); break; //증여 diff --git a/hwe/sammo/GameUnitConstBase.php b/hwe/sammo/GameUnitConstBase.php index 6fa55735..fe664452 100644 --- a/hwe/sammo/GameUnitConstBase.php +++ b/hwe/sammo/GameUnitConstBase.php @@ -336,7 +336,9 @@ class GameUnitConstBase{ } - + /** + * @return \sammo\GameUnitDetail[] + */ public static function byType(int $type): array{ static::_generate(); if(!key_exists($type, static::$constType)){