diff --git a/hwe/js/defaultSelectCityByMap.js b/hwe/js/defaultSelectCityByMap.js
new file mode 100644
index 00000000..f1781ccf
--- /dev/null
+++ b/hwe/js/defaultSelectCityByMap.js
@@ -0,0 +1,13 @@
+$(function(){
+ var $target = $("#destCityID");
+ reloadWorldMap({
+ isDetailMap:false,
+ clickableAll:true,
+ neutralView:true,
+ useCachedMap:true,
+ selectCallback:function(city){
+ $target.val(city.id);
+ return false;
+ }
+ });
+});
\ No newline at end of file
diff --git a/hwe/processing.old.php b/hwe/processing.old.php
new file mode 100644
index 00000000..dd2cb2bb
--- /dev/null
+++ b/hwe/processing.old.php
@@ -0,0 +1,2522 @@
+setReadOnly();
+
+$db = DB::db();
+$connect=$db->get();
+
+$count = count($turn);
+for($i=0; $i < $count; $i++) {
+ if($turn[$i] == 100 || $turn[$i] == 99 || $turn[$i] == 98) {
+ } elseif($turn[$i] >= 0 || $turn[$i] <= 23) {
+ } else {
+ unset($turn);
+ $turn[0] = 100;
+ break;
+ }
+}
+
+if($turn[0] == 100) {
+ unset($turn);
+ for($i=0; $i < 24; $i++) $turn[$i] = $i;
+} elseif($turn[0] == 99) {
+ unset($turn);
+ for($i=0, $j=0; $i < 24; $i+=2, $j++) $turn[$j] = $i;
+} elseif($turn[0] == 98) {
+ unset($turn);
+ for($i=1, $j=0; $i < 24; $i+=2, $j++) $turn[$j] = $i;
+}
+
+switch($commandtype) {
+ case 0: command_Single($turn, 0); break; //휴식
+ case 1: command_Single($turn, 1); break; //농업
+ case 2: command_Single($turn, 2); break; //상업
+ case 3: command_Single($turn, 3); break; //기술
+ case 4: command_Single($turn, 4); break; //선정
+ case 5: command_Single($turn, 5); break; //수비
+ case 6: command_Single($turn, 6); break; //성벽
+ case 7: command_Single($turn, 7); break; //정착 장려
+ case 8: command_Single($turn, 8); break; //치안 강화
+ case 9: command_Single($turn, 9); break; //자금 조달
+
+ case 11: command_11( $turn, 11, false); break; //징병
+ case 12: command_11( $turn, 12, true); break; //모병
+ case 13: command_Single($turn, 13); break; //훈련
+ case 14: command_Single($turn, 14); break; //사기진작
+ //case 15: command_Single($turn, 0); break; //전투태세
+ case 16: command_16( $turn, 16); break; //전쟁
+ case 17: command_Single($turn, 17); break; //소집해제
+
+ case 21: command_21( $turn, 21); break; //이동
+ case 22: command_22( $turn, 22); break; //등용 //TODO:등용장 재 디자인
+ case 23: command_23( $turn, 23); break; //포상
+ case 24: command_24( $turn, 24); break; //몰수
+ case 25: command_25( $turn, 25); break; //임관
+ case 26: command_Single($turn, 26); break; //집합
+ case 27: command_27( $turn, 27); break; //발령
+ case 28: command_Single($turn, 28); break; //귀환
+ case 29: command_Single($turn, 29); break; //인재탐색
+ case 30: command_30( $turn, 30); break; //강행
+
+ case 31: command_31($turn, 31); break; //첩보
+ case 32: command_32($turn, 32); break; //화계
+ case 33: command_33($turn, 33); break; //탈취
+ case 34: command_34($turn, 34); break; //파괴
+ case 35: command_35($turn, 35); break; //선동
+
+ case 41: command_Single($turn, 41); break; //단련
+ case 42: command_Single($turn, 42); break; //견문
+ case 43: command_43( $turn, 43); break; //증여
+ case 44: command_44( $turn, 44); break; //헌납
+ case 45: command_Single($turn, 45); break; //하야
+ case 46: command_46( $turn, 46); break; //건국
+ case 47: command_Single($turn, 47); break; //방랑
+ case 48: command_48( $turn, 48); break; //장비구입
+ case 49: command_49( $turn, 49); break; //군량매매
+ case 50: command_Single($turn, 50); break; //요양
+
+ case 51: command_51($turn, 51); break; //항복권고
+ case 52: command_52($turn, 52); break; //원조
+ case 53: command_53($turn, 53); break; //통합제의
+ case 54: command_54($turn, 54); break; //선양
+ case 55: command_Single($turn, 55); break; //거병
+ case 56: command_Single($turn, 56); break; //해산
+ case 57: command_Single($turn, 57); break; //모반 시도
+
+ case 61: command_61($turn, 61); break; //불가침
+ case 62: command_62($turn, 62); break; //선포
+ case 63: command_63($turn, 63); break; //종전
+ case 64: command_64($turn, 64); break; //파기
+ case 65: command_65($turn, 65); break; //초토화
+ case 66: command_66($turn, 66); break; //천도
+ case 67: command_67($turn, 67); break; //증축
+ case 68: command_68($turn, 68); break; //감축
+ case 71: command_Chief($turn, 71); break; //필사즉생
+ case 72: command_72($turn, 72); break; //백성동원
+ case 73: command_73($turn, 73); break; //수몰
+ case 74: command_74($turn, 74); break; //허보
+ case 75: command_75($turn, 75); break; //피장파장
+ case 76: command_Chief($turn, 76); break; //의병모집
+ case 77: command_77($turn, 77); break; //이호경식
+ case 78: command_78($turn, 78); break; //급습
+ case 81: command_81($turn, 81); break; //국기변경
+ case 99: command_99($turn); break; //수뇌부 휴식
+
+ default:command_Single($turn, 0); break; //휴식
+}
+
+function starter($name, $type=0) {
+?>
+
+
+
+=$name?>
+
+
+
+=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
+=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
+=WebUtil::printJS('../d_shared/common_path.js')?>
+=WebUtil::printJS('js/common.js')?>
+=WebUtil::printJS('d_shared/base_map.js')?>
+=WebUtil::printJS('js/map.js')?>
+
+=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
+=WebUtil::printCSS('../d_shared/common.css')?>
+=WebUtil::printCSS('css/common.css')?>
+=WebUtil::printCSS('css/main.css')?>
+=WebUtil::printCSS('css/map.css')?>
+
+
+
+
+
+";
+}
+
+function command_99($turn) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ $query = "select nation,level from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ if($me['level'] >= 5) {
+ _setNationCommand($me['nation'], $me['level'], range(0, $turn - 1), 'che_휴식');
+ }
+
+ header('location:b_chiefcenter.php', true, 303);
+}
+
+function command_11($turn, $command, bool $is모병 = false) {
+ $db = DB::db();
+ $gameStor = KVStorage::getStorage($db, 'game_env');
+ $userID = Session::getUserID();
+
+ $me = $db->queryFirstRow(
+ 'SELECT no,nation,level,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold
+ from general where owner=%i',
+ $userID
+ );
+
+ [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $me['nation']);
+ if(!$nationLevel){
+ $nationLevel = 0;
+ }
+
+ if(!$tech){
+ $tech = 0;
+ }
+
+ $lbonus = setLeadershipBonus($me, $nationLevel);
+
+ $ownCities = [];
+ $ownRegions = [];
+ [$year, $startyear] = $gameStor->getValuesAsArray(['year','startyear']);
+
+ $relativeYear = $year - $startyear;
+
+ foreach(DB::db()->query('SELECT city, region from city where nation = %i', $me['nation']) as $city){
+ $ownCities[$city['city']] = 1;
+ $ownRegions[$city['region']] = 1;
+ }
+
+ $leader = getGeneralLeadership($me, true, true, true);
+ $fullLeader = getGeneralLeadership($me, false, true, true);
+ $abil = getTechAbil($tech);
+
+ $armTypes = [];
+
+ foreach(GameUnitConst::allType() as $armType => $armName){
+ $armTypeCrews = [];
+
+ foreach(GameUnitConst::byType($armType) as $unit){
+ $crewObj = new \stdClass;
+ if(!$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech)){
+ continue; //TODO: 불가능한 병종도 보여줄 필요가 있음.
+ }
+
+ $crewObj->id = $unit->id;
+
+ if($unit->reqTech == 0){
+ $crewObj->bgcolor = 'green';
+ }
+ else{
+ $crewObj->bgcolor = 'limegreen';
+ }
+
+ $crewObj->baseRice = $unit->rice * getTechCost($tech);
+ $crewObj->baseCost = CharCost($unit->costWithTech($tech), $me['personal']);
+
+ $armType = $unit->armType;
+ if($me['special2'] == 50 && $armType == GameUnitConst::T_FOOTMAN){
+ $crewObj->baseCost *= 0.9;
+ }
+ else if($me['special2'] == 51 && $armType == GameUnitConst::T_ARCHER){
+ $crewObj->baseCost *= 0.9;
+ }
+ else if($me['special2'] == 52 && $armType == GameUnitConst::T_CAVALRY){
+ $crewObj->baseCost *= 0.9;
+ }
+ else if($me['special2'] == 53 && $armType == GameUnitConst::T_WIZARD){
+ $crewObj->baseCost *= 0.9;
+ }
+ else if($me['special2'] == 54 && $armType == GameUnitConst::T_SIEGE){
+ $crewObj->baseCost *= 0.9;
+ }
+ else if($me['special2'] == 72) {
+ $crewObj->baseCost *= 0.5;
+ }
+
+ $crewObj->name = $unit->name;
+ $crewObj->attack = $unit->attack + $abil;
+ $crewObj->defence = $unit->defence + $abil;
+ $crewObj->speed = $unit->speed;
+ $crewObj->avoid = $unit->avoid;
+ if($gameStor->show_img_level < 2) {
+ $crewObj->img = ServConfig::$sharedIconPath."/default.jpg";
+ }
+ else{
+ $crewObj->img = ServConfig::$gameImagePath."/weap".$unit->id.".png";
+ }
+
+ $crewObj->baseRiceShort = round($crewObj->baseRice, 1);
+ $crewObj->baseCostShort = round($crewObj->baseCost, 1);
+
+ $crewObj->info = join('
', $unit->info);
+
+
+ $armTypeCrews[] = $crewObj;
+ }
+ $armTypes[] = [$armName, $armTypeCrews];
+ }
+ if($is모병){
+ $commandName = '모병';
+ starter("모병");
+ }
+ else{
+ $commandName = '징병';
+ starter("징병");
+ }
+
+ $templates = new \League\Plates\Engine('templates');
+ echo $templates->render('recruitCrewForm', [
+ 'command'=>$command,
+ 'commandName'=>$commandName,
+ 'techLevelText'=>getTechCall($tech),
+ 'tech'=>$tech,
+ 'leader'=>$leader,
+ 'fullLeader'=>$fullLeader,
+ 'crewType'=>GameUnitConst::byId($me['crewtype'])->id,
+ 'crewTypeName'=>GameUnitConst::byId($me['crewtype'])->name,
+ 'crew'=>$me['crew'],
+ 'gold'=>$me['gold'],
+ 'turn'=>$turn,
+ 'armTypes'=>$armTypes,
+ ]);
+
+
+ ender();
+}
+
+function command_15($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("재편성");
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+ $me = $general['no'];
+
+ $query = "select no,name from general where nation='{$general['nation']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo "
+자신의 병사를 다른 장수에게 보냅니다.
+
+";
+
+ ender();
+}
+
+function command_16($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("출병");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시로 침공을 합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 1);
+
+ ender();
+}
+
+function command_21($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("이동");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시로 이동합니다.
+인접 도시로만 이동이 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 1);
+
+ ender();
+}
+
+function command_22($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("등용");
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+재야나 타국의 장수를 등용합니다.
+서신은 개인 메세지로 전달됩니다.
+등용할 장수를 목록에서 선택하세요.
+
+";
+ ender();
+}
+
+function command_23($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("포상", 1);
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo "
+국고로 장수에게 자금이나 군량을 지급합니다.
+
+";
+
+ ender(1);
+}
+
+function command_24($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("몰수", 1);
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo "
+장수의 자금이나 군량을 몰수합니다.
+몰수한것은 국가재산으로 귀속됩니다.
+
+";
+
+ ender(1);
+}
+
+function command_25($turn, $command) {
+ $db = DB::db();
+ $gameStor = KVStorage::getStorage($db, 'game_env');
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ $gameStor->cacheValues(['year','startyear','month','join_mode']);
+
+ $onlyRandom = $gameStor->join_mode == 'onlyRandom';
+ starter("임관");
+
+ $query = "select no,nations from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $joinedNations = Json::decode($me['nations']);
+
+ $query = "select nation,name,color,scout,scoutmsg,strategic_cmd_limit,gennum from nation order by gennum";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $count = MYDB_num_rows($result);
+
+ $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation ORDER BY rand()');
+
+ foreach($nationList as &$nation){
+ if ($onlyRandom && TimeUtil::IsRangeMonth($gameStor->init_year, $gameStor->init_month, 1, $gameStor->year, $gameStor->month) && $nation['gennum'] >= GameConst::$initialNationGenLimitForRandInit) {
+ $nation['availableJoin'] = false;
+ }
+ else if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
+ $nation['availableJoin'] = false;
+ }
+ else if($nation['scout'] == 1) {
+ $nation['availableJoin'] = false;
+ }
+ else{
+ $nation['availableJoin'] = true;
+ }
+ }
+ unset($nation);
+?>
+
+국가에 임관합니다.
+이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.
+바로 군주의 위치로 이동합니다.
+
+랜덤 임관 대상 국가는 아래에서 확인할 수 있습니다.
+
+임관할 국가를 목록에서 선택하세요.
+
+!!!는 방랑군을 포함한 랜덤임관입니다. 유니크를 기대하신다면!
+???는 방랑군을 제외한 랜덤임관입니다. 유니크 혜택은 없습니다.
+임관 금지이거나 초기 제한중인 국가는 붉은색 배경으로 표시됩니다.
+870px x 200px를 넘어서는 내용은 표시되지 않습니다.
+
+get();
+ $userID = Session::getUserID();
+
+ starter("발령", 1);
+
+ $query = "select no,nation,level from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $query = "select no,name,level,npc from general where nation='{$me['nation']}' and no!='{$me['no']}' order by npc,binary(name)";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시로 아국 장수를 발령합니다.
+아국 도시로만 발령이 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender(1);
+}
+
+function command_30($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("강행");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시로 강행합니다.
+최대 3칸내 도시로만 강행이 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+printCitiesBasedOnDistance($currentcity['city'], 3);
+
+ender();
+}
+
+function command_31($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("첩보");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 첩보를 실행합니다.
+인접도시일 경우 많은 정보를 얻을 수 있습니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ echo "
+모든 도시가 가능하지만 많은 정보를 얻을 수 있는
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_32($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("화계");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 화계를 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_33($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("탈취");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 탈취를 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_34($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("파괴");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 파괴를 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_35($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("선동");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 선동을 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_36($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("기습");
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select city,name from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+ echo "
+선택된 도시에 기습을 실행합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ printCitiesBasedOnDistance($currentcity['city'], 2);
+
+ ender();
+}
+
+function command_43($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("증여");
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo "
+자신의 자금이나 군량을 다른 장수에게 증여합니다.
+장수를 선택하세요.
+
+";
+
+ ender();
+}
+
+function command_44($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+
+ starter("헌납");
+
+ echo "
+자신의 자금이나 군량을 국가 재산으로 헌납합니다.
+
+";
+
+ ender();
+}
+
+function command_46($turn, $command) {
+ $db = DB::db();
+ $gameStor = KVStorage::getStorage($db, 'game_env');
+ $connect=$db->get();
+
+ starter("건국");
+
+ $maxnation = $gameStor->maxnation;
+
+ $colorUsed = [];
+
+ foreach(GetNationColors() as $color){
+ $colorUsed[$color] = 0;
+ }
+
+ $nationCount = count(getAllNationStaticInfo());
+ foreach(getAllNationStaticInfo() as $nation){
+ if($nation['level'] <= 0){
+ continue;
+ }
+
+ if(!isset($nationcolor[$nation['color']])){
+ $nationcolor[$nation['color']] = 1;
+ }
+ else{
+ $nationcolor[$nation['color']]++;
+ }
+
+ }
+
+ $colorUsedCnt = 0;
+ foreach($colorUsed as $color=>$used){
+ if($used){
+ continue;
+ }
+ $colorUsedCnt += 1;
+ }
+
+ //색깔이 다 쓰였으면 그냥 모두 허용
+ if($colorUsedCnt === count($colorUsed)){
+ foreach(array_keys($colorUsed) as $color){
+ $colorUsed[$color] = 0;
+ }
+ }
+
+
+ if($nationCount < $maxnation) {
+?>
+현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.
+
+- 법 가 : 금수입↑ 치안↑ 인구↓ 민심↓
+- 유 가 : 내정↑ 민심↑ 쌀수입↓
+- 병 가 : 기술↑ 수성↑ 인구↓ 민심↓
+- 덕 가 : 치안↑인구↑ 민심↑ 쌀수입↓ 수성↓
+- 묵 가 : 수성↑ 기술↓
+- 도 가 : 인구↑ 기술↓ 치안↓
+- 태 평 도 : 인구↑ 민심↑ 기술↓ 수성↓
+- 오 두 미 도 : 쌀수입↑ 인구↑ 기술↓ 수성↓ 내정↓
+- 도 적 : 계략↑ 금수입↓ 치안↓ 민심↓
+- 불 가 : 민심↑ 수성↑ 금수입↓
+- 종 횡 가 : 전략↑ 수성↑ 금수입↓ 내정↓
+- 음 양 가 : 내정↑ 인구↑ 기술↓ 전략↓
+- 명 가 : 기술↑ 인구↑ 쌀수입↓ 수성↓
+
+";
+ } else {
+ echo "더 이상 건국은 불가능합니다.
";
+ }
+ ender();
+}
+
+function command_48($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("장비 매매");
+
+ $query = "select no,city,gold from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("command_48 ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+ $city = getCity($me['city'], "secu");
+
+ $color = [];
+
+ for($i=1; $i <= 6; $i++) {
+ if($city['secu'] >= $i*1000) {
+ $color[$i] = "white";
+ } else {
+ $color[$i] = "red";
+ }
+ }
+
+ echo "
+장비를 구입하거나 매각합니다.
+현재 구입 불가능한 것은 붉은색으로 표시됩니다.
+현재 도시 치안 : {$city['secu']} 현재 자금 : {$me['gold']}
+
+";
+
+ ender();
+}
+
+function command_49($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+
+ starter("군량매매");
+
+ echo "
+자신의 군량을 사거나 팝니다.
+
+";
+
+ ender();
+}
+
+function command_51($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("항복 권고", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $query = "select nation,power from nation where nation='{$me['nation']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $myNation = MYDB_fetch_array($result);
+
+ echo "
+타국에게 항복을 권고합니다.
+서신은 개인 메세지로 전달됩니다.
+권고할 국가를 목록에서 선택하세요.
+합병이 불가능한 국가는 붉은 배경으로 표시됩니다.
+
+제한 조건
+- 인접 국가
+- 양국 모두 외교제한 기간 없음
+- 제의한 국가가 항복하는 국가보다 국력 3배 초과
+";
+ ender(1);
+}
+
+function command_52($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("원조", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $mynation = getNationStaticInfo($me['nation']);
+
+ echo "
+타국에게 원조합니다.
+작위별로 금액 제한이 있습니다.
+ 호족: 1만
+ 군벌: 2만
+주자사: 3만
+ 주목: 4만
+ 공: 5만
+ 왕: 6만
+ 황제: 7만
+원조할 국가를 목록에서 선택하세요.
+
+";
+ ender(1);
+}
+
+function command_53($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("통합제의", 1);
+
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("command_53 ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ $query = "select avg(power) as power,avg(gennum) as gennum from nation where level>=1";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $avgNation = MYDB_fetch_array($result);
+
+ $query = "select std(power) as power,std(gennum) as gennum from nation where level>=1";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $stdNation = MYDB_fetch_array($result);
+
+ $query = "select nation,power,gennum from nation where nation='{$me['nation']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $myNation = MYDB_fetch_array($result);
+
+ echo "
+세력이 비슷한 국가에 통합 제의를 합니다. 제의한 국가 위주로 통합됩니다.
+서신은 개인 메세지로 전달됩니다.
+제의할 국가를 목록에서 선택하세요.
+통합이 불가능한 국가는 붉은 배경으로 표시됩니다.
+
+제한 조건
+- 인접 국가
+- 양국 모두 외교제한 없음
+- 두 국가의 국력 평균이 상위 60%(현재 ".round($cond1,2).") 이하.
+- 두 국가의 장수수 평균이 상위 75%(현재 ".round($cond2,1).") 이하.
+";
+ ender(1);
+}
+
+function command_54($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("선양");
+ $query = "select no,nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select no,name,level from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $gencount = MYDB_num_rows($result);
+
+ echo "
+군주의 자리를 다른 장수에게 물려줍니다.
+장수를 선택하세요.
+
+";
+
+ ender();
+}
+
+function command_61($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("불가침", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+타국에게 불가침을 제의합니다.
+제의할 국가를 목록에서 선택하세요.
+배경색은 현재 제의가 불가능한 국가는 붉은색, 현재 불가침중인 국가는 푸른색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_62($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("선전포고", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+타국에게 선전 포고합니다.
+선전 포고할 국가를 목록에서 선택하세요.
+고립되지 않은 아국 도시에서 인접한 국가에 선포 가능합니다.
+초반제한 해제 2년전부터 선포가 가능합니다. (체섭기준 181년 1월부터 가능)
+배경색은 현재 선포가 불가능한 국가는 붉은색, 현재 불가침중(역시 불가)인 국가는 푸른색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_63($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("종전", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+전쟁중인 국가에 종전을 제의합니다.
+제의할 국가를 목록에서 선택하세요.
+배경색은 현재 제의가 불가능한 국가는 붉은색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_64($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("파기", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+불가침중인 국가에 조약 파기를 제의합니다.
+제의할 국가를 목록에서 선택하세요.
+배경색은 현재 제의가 불가능한 국가는 붉은색, 현재 불가침중(제의 가능)인 국가는 푸른색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_65($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("초토화", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시를 초토화 시킵니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_66($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("천도", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시로 천도합니다.
+현재 수도에서 인접한 도시만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_67($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("증축", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시를 증축합니다.
+현재 수도만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_68($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("감축", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시를 감축합니다.
+현재 수도만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_72($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("백성동원", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시에 백성동원을 발동합니다.
+아국 도시만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_73($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("수몰", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시에 수몰을 발동합니다.
+전쟁중인 상대국 도시만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_74($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("허보", 1);
+ $query = "select city from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $general = MYDB_fetch_array($result);
+
+ $query = "select name,path from city where city='{$general['city']}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $currentcity = MYDB_fetch_array($result);
+
+ echo getMapHtml();
+echo "
+선택된 도시에 허보를 발동합니다.
+선포, 전쟁중인 상대국 도시만 가능합니다.
+목록을 선택하거나 도시를 클릭하세요.
+
+";
+
+ ender();
+}
+
+function command_75($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("피장파장", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+선택된 국가에 피장파장을 발동합니다.
+선포, 전쟁중인 상대국에만 가능합니다.
+상대 국가를 목록에서 선택하세요.
+배경색은 현재 피장파장 불가능 국가는 붉은색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_77($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("이호경식", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+선택된 국가에 이호경식을 발동합니다.
+선포, 전쟁중인 상대국에만 가능합니다.
+상대 국가를 목록에서 선택하세요.
+배경색은 현재 이호경식 불가능 국가는 붉은색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_78($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+ $userID = Session::getUserID();
+
+ starter("급습", 1);
+
+ $query = "select nation from general where owner='{$userID}'";
+ $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
+ $me = MYDB_fetch_array($result);
+
+ echo "
+선택된 국가에 급습을 발동합니다.
+선포, 전쟁중인 상대국에만 가능합니다.
+상대 국가를 목록에서 선택하세요.
+배경색은 현재 급습 불가능 국가는 붉은색으로 표시됩니다.
+
+";
+ ender(1);
+}
+
+function command_81($turn, $command) {
+ $db = DB::db();
+ $connect=$db->get();
+
+ starter("국기변경", 1);
+
+ $colorUsed = [];
+
+ foreach(GetNationColors() as $color){
+ $colorUsed[$color] = 0;
+ }
+
+ foreach(getAllNationStaticInfo() as $nation){
+ if($nation['level'] <= 0){
+ continue;
+ }
+
+ $colorUsed[$nation['color']]+=1;
+ }
+
+ $colorUsedCnt = 0;
+ foreach($colorUsed as $color=>$used){
+ if($used){
+ continue;
+ }
+ $colorUsedCnt += 1;
+ }
+
+ //색깔이 다 쓰였으면 그냥 모두 허용
+ if($colorUsedCnt === count($colorUsed)){
+ foreach(array_keys($colorUsed) as $color){
+ $colorUsed[$color] = 0;
+ }
+ }
+
+ echo "
+국기를 변경합니다. 단 1회 가능합니다.
+
+";
+ ender(1);
+}
diff --git a/hwe/processing.php b/hwe/processing.php
index b18d2a5c..6fb52e6e 100644
--- a/hwe/processing.php
+++ b/hwe/processing.php
@@ -5,121 +5,37 @@ include "lib.php";
include "func.php";
//로그인 검사
-$commandtype = Util::getReq('commandtype', 'int');
+$commandType = Util::getReq('commandtype', 'string');
$turn = Util::getReq('turn', 'array_int');
if(!$turn || $commandtype === null){
- header('location:commandlist.php', true, 303);
+ header('location:index.php', true, 303);
die();
}
$session = Session::requireGameLogin()->setReadOnly();
$db = DB::db();
-$connect=$db->get();
-$count = count($turn);
-for($i=0; $i < $count; $i++) {
- if($turn[$i] == 100 || $turn[$i] == 99 || $turn[$i] == 98) {
- } elseif($turn[$i] >= 0 || $turn[$i] <= 23) {
- } else {
- unset($turn);
- $turn[0] = 100;
- break;
- }
+$gameStor = KVStorage::getStorage($db, 'game_env')->turnOnCache();
+$env = $gameStor->getValues(['init_year','init_month','startyear','year','month','show_img_level','join_mode','maxnation']);
+$general = General::createGeneralObjFromDB($session->generalID);
+$commandObj = buildGeneralCommandClass($commandType, $general, $env);
+
+if($general->getVar('level') < 5 && ($commandObj instanceof Command\NationCommand)){
+ header('location:index.php', true, 303);
+ die();
}
-if($turn[0] == 100) {
- unset($turn);
- for($i=0; $i < 24; $i++) $turn[$i] = $i;
-} elseif($turn[0] == 99) {
- unset($turn);
- for($i=0, $j=0; $i < 24; $i+=2, $j++) $turn[$j] = $i;
-} elseif($turn[0] == 98) {
- unset($turn);
- for($i=1, $j=0; $i < 24; $i+=2, $j++) $turn[$j] = $i;
+if($commandObj->isArgValid()){
+ //인자가 필요없는 타입의 경우 processing에서 '전혀' 처리하지 않음!
+ header('location:index.php', true, 303);
+ die();
}
-switch($commandtype) {
- case 0: command_Single($turn, 0); break; //휴식
- case 1: command_Single($turn, 1); break; //농업
- case 2: command_Single($turn, 2); break; //상업
- case 3: command_Single($turn, 3); break; //기술
- case 4: command_Single($turn, 4); break; //선정
- case 5: command_Single($turn, 5); break; //수비
- case 6: command_Single($turn, 6); break; //성벽
- case 7: command_Single($turn, 7); break; //정착 장려
- case 8: command_Single($turn, 8); break; //치안 강화
- case 9: command_Single($turn, 9); break; //자금 조달
-
- case 11: command_11( $turn, 11, false); break; //징병
- case 12: command_11( $turn, 12, true); break; //모병
- case 13: command_Single($turn, 13); break; //훈련
- case 14: command_Single($turn, 14); break; //사기진작
- //case 15: command_Single($turn, 0); break; //전투태세
- case 16: command_16( $turn, 16); break; //전쟁
- case 17: command_Single($turn, 17); break; //소집해제
-
- case 21: command_21( $turn, 21); break; //이동
- case 22: command_22( $turn, 22); break; //등용 //TODO:등용장 재 디자인
- case 23: command_23( $turn, 23); break; //포상
- case 24: command_24( $turn, 24); break; //몰수
- case 25: command_25( $turn, 25); break; //임관
- case 26: command_Single($turn, 26); break; //집합
- case 27: command_27( $turn, 27); break; //발령
- case 28: command_Single($turn, 28); break; //귀환
- case 29: command_Single($turn, 29); break; //인재탐색
- case 30: command_30( $turn, 30); break; //강행
-
- case 31: command_31($turn, 31); break; //첩보
- case 32: command_32($turn, 32); break; //화계
- case 33: command_33($turn, 33); break; //탈취
- case 34: command_34($turn, 34); break; //파괴
- case 35: command_35($turn, 35); break; //선동
-
- case 41: command_Single($turn, 41); break; //단련
- case 42: command_Single($turn, 42); break; //견문
- case 43: command_43( $turn, 43); break; //증여
- case 44: command_44( $turn, 44); break; //헌납
- case 45: command_Single($turn, 45); break; //하야
- case 46: command_46( $turn, 46); break; //건국
- case 47: command_Single($turn, 47); break; //방랑
- case 48: command_48( $turn, 48); break; //장비구입
- case 49: command_49( $turn, 49); break; //군량매매
- case 50: command_Single($turn, 50); break; //요양
-
- case 51: command_51($turn, 51); break; //항복권고
- case 52: command_52($turn, 52); break; //원조
- case 53: command_53($turn, 53); break; //통합제의
- case 54: command_54($turn, 54); break; //선양
- case 55: command_Single($turn, 55); break; //거병
- case 56: command_Single($turn, 56); break; //해산
- case 57: command_Single($turn, 57); break; //모반 시도
-
- case 61: command_61($turn, 61); break; //불가침
- case 62: command_62($turn, 62); break; //선포
- case 63: command_63($turn, 63); break; //종전
- case 64: command_64($turn, 64); break; //파기
- case 65: command_65($turn, 65); break; //초토화
- case 66: command_66($turn, 66); break; //천도
- case 67: command_67($turn, 67); break; //증축
- case 68: command_68($turn, 68); break; //감축
- case 71: command_Chief($turn, 71); break; //필사즉생
- case 72: command_72($turn, 72); break; //백성동원
- case 73: command_73($turn, 73); break; //수몰
- case 74: command_74($turn, 74); break; //허보
- case 75: command_75($turn, 75); break; //피장파장
- case 76: command_Chief($turn, 76); break; //의병모집
- case 77: command_77($turn, 77); break; //이호경식
- case 78: command_78($turn, 78); break; //급습
- case 81: command_81($turn, 81); break; //국기변경
- case 99: command_99($turn); break; //수뇌부 휴식
-
- default:command_Single($turn, 0); break; //휴식
-}
-
-function starter($name, $type=0) {
+[$jsList, $cssList] = $commandObj->getResourceFiles();
?>
+
@@ -136,2383 +52,39 @@ function starter($name, $type=0) {
+
=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
=WebUtil::printCSS('../d_shared/common.css')?>
=WebUtil::printCSS('css/common.css')?>
=WebUtil::printCSS('css/main.css')?>
=WebUtil::printCSS('css/map.css')?>
+
- | =$name?> |
+ | =$commandObj->getName()?> |
-
+ |
+
+
+=$commandObj->getForm()?>
+
+
+
+
-function ender($type=0) {
- if($type == 1) echo CoreBackButton();
- else echo backButton();
- echo banner();
- echo "
-
-
-";
-}
-
-function command_99($turn) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- $query = "select nation,level from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- if($me['level'] >= 5) {
- _setNationCommand($me['nation'], $me['level'], range(0, $turn - 1), 'che_휴식');
- }
-
- header('location:b_chiefcenter.php', true, 303);
-}
-
-function command_11($turn, $command, bool $is모병 = false) {
- $db = DB::db();
- $gameStor = KVStorage::getStorage($db, 'game_env');
- $userID = Session::getUserID();
-
- $me = $db->queryFirstRow(
- 'SELECT no,nation,level,personal,special2,level,city,crew,horse,injury,leader,crewtype,gold
- from general where owner=%i',
- $userID
- );
-
- [$nationLevel, $tech] = $db->queryFirstList('SELECT level,tech FROM nation WHERE nation=%i', $me['nation']);
- if(!$nationLevel){
- $nationLevel = 0;
- }
-
- if(!$tech){
- $tech = 0;
- }
-
- $lbonus = setLeadershipBonus($me, $nationLevel);
-
- $ownCities = [];
- $ownRegions = [];
- [$year, $startyear] = $gameStor->getValuesAsArray(['year','startyear']);
-
- $relativeYear = $year - $startyear;
-
- foreach(DB::db()->query('SELECT city, region from city where nation = %i', $me['nation']) as $city){
- $ownCities[$city['city']] = 1;
- $ownRegions[$city['region']] = 1;
- }
-
- $leader = getGeneralLeadership($me, true, true, true);
- $fullLeader = getGeneralLeadership($me, false, true, true);
- $abil = getTechAbil($tech);
-
- $armTypes = [];
-
- foreach(GameUnitConst::allType() as $armType => $armName){
- $armTypeCrews = [];
-
- foreach(GameUnitConst::byType($armType) as $unit){
- $crewObj = new \stdClass;
- if(!$unit->isValid($ownCities, $ownRegions, $relativeYear, $tech)){
- continue; //TODO: 불가능한 병종도 보여줄 필요가 있음.
- }
-
- $crewObj->id = $unit->id;
-
- if($unit->reqTech == 0){
- $crewObj->bgcolor = 'green';
- }
- else{
- $crewObj->bgcolor = 'limegreen';
- }
-
- $crewObj->baseRice = $unit->rice * getTechCost($tech);
- $crewObj->baseCost = CharCost($unit->costWithTech($tech), $me['personal']);
-
- $armType = $unit->armType;
- if($me['special2'] == 50 && $armType == GameUnitConst::T_FOOTMAN){
- $crewObj->baseCost *= 0.9;
- }
- else if($me['special2'] == 51 && $armType == GameUnitConst::T_ARCHER){
- $crewObj->baseCost *= 0.9;
- }
- else if($me['special2'] == 52 && $armType == GameUnitConst::T_CAVALRY){
- $crewObj->baseCost *= 0.9;
- }
- else if($me['special2'] == 53 && $armType == GameUnitConst::T_WIZARD){
- $crewObj->baseCost *= 0.9;
- }
- else if($me['special2'] == 54 && $armType == GameUnitConst::T_SIEGE){
- $crewObj->baseCost *= 0.9;
- }
- else if($me['special2'] == 72) {
- $crewObj->baseCost *= 0.5;
- }
-
- $crewObj->name = $unit->name;
- $crewObj->attack = $unit->attack + $abil;
- $crewObj->defence = $unit->defence + $abil;
- $crewObj->speed = $unit->speed;
- $crewObj->avoid = $unit->avoid;
- if($gameStor->show_img_level < 2) {
- $crewObj->img = ServConfig::$sharedIconPath."/default.jpg";
- }
- else{
- $crewObj->img = ServConfig::$gameImagePath."/weap".$unit->id.".png";
- }
-
- $crewObj->baseRiceShort = round($crewObj->baseRice, 1);
- $crewObj->baseCostShort = round($crewObj->baseCost, 1);
-
- $crewObj->info = join('
', $unit->info);
-
-
- $armTypeCrews[] = $crewObj;
- }
- $armTypes[] = [$armName, $armTypeCrews];
- }
- if($is모병){
- $commandName = '모병';
- starter("모병");
- }
- else{
- $commandName = '징병';
- starter("징병");
- }
-
- $templates = new \League\Plates\Engine('templates');
- echo $templates->render('recruitCrewForm', [
- 'command'=>$command,
- 'commandName'=>$commandName,
- 'techLevelText'=>getTechCall($tech),
- 'tech'=>$tech,
- 'leader'=>$leader,
- 'fullLeader'=>$fullLeader,
- 'crewType'=>GameUnitConst::byId($me['crewtype'])->id,
- 'crewTypeName'=>GameUnitConst::byId($me['crewtype'])->name,
- 'crew'=>$me['crew'],
- 'gold'=>$me['gold'],
- 'turn'=>$turn,
- 'armTypes'=>$armTypes,
- ]);
-
-
- ender();
-}
-
-function command_15($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("재편성");
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
- $me = $general['no'];
-
- $query = "select no,name from general where nation='{$general['nation']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo "
-자신의 병사를 다른 장수에게 보냅니다.
-
-";
-
- ender();
-}
-
-function command_16($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("출병");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시로 침공을 합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 1);
-
- ender();
-}
-
-function command_21($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("이동");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시로 이동합니다.
-인접 도시로만 이동이 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 1);
-
- ender();
-}
-
-function command_22($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("등용");
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-재야나 타국의 장수를 등용합니다.
-서신은 개인 메세지로 전달됩니다.
-등용할 장수를 목록에서 선택하세요.
-
-";
- ender();
-}
-
-function command_23($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("포상", 1);
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo "
-국고로 장수에게 자금이나 군량을 지급합니다.
-
-";
-
- ender(1);
-}
-
-function command_24($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("몰수", 1);
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo "
-장수의 자금이나 군량을 몰수합니다.
-몰수한것은 국가재산으로 귀속됩니다.
-
-";
-
- ender(1);
-}
-
-function command_25($turn, $command) {
- $db = DB::db();
- $gameStor = KVStorage::getStorage($db, 'game_env');
- $connect=$db->get();
- $userID = Session::getUserID();
-
- $gameStor->cacheValues(['year','startyear','month','join_mode']);
-
- $onlyRandom = $gameStor->join_mode == 'onlyRandom';
- starter("임관");
-
- $query = "select no,nations from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- $joinedNations = Json::decode($me['nations']);
-
- $query = "select nation,name,color,scout,scoutmsg,strategic_cmd_limit,gennum from nation order by gennum";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $count = MYDB_num_rows($result);
-
- $nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation ORDER BY rand()');
-
- foreach($nationList as &$nation){
- if ($onlyRandom && TimeUtil::IsRangeMonth($gameStor->init_year, $gameStor->init_month, 1, $gameStor->year, $gameStor->month) && $nation['gennum'] >= GameConst::$initialNationGenLimitForRandInit) {
- $nation['availableJoin'] = false;
- }
- else if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
- $nation['availableJoin'] = false;
- }
- else if($nation['scout'] == 1) {
- $nation['availableJoin'] = false;
- }
- else{
- $nation['availableJoin'] = true;
- }
- }
- unset($nation);
-?>
-
-국가에 임관합니다.
-이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.
-바로 군주의 위치로 이동합니다.
-
-랜덤 임관 대상 국가는 아래에서 확인할 수 있습니다.
-
-임관할 국가를 목록에서 선택하세요.
-
-!!!는 방랑군을 포함한 랜덤임관입니다. 유니크를 기대하신다면!
-???는 방랑군을 제외한 랜덤임관입니다. 유니크 혜택은 없습니다.
-임관 금지이거나 초기 제한중인 국가는 붉은색 배경으로 표시됩니다.
-870px x 200px를 넘어서는 내용은 표시되지 않습니다.
-
-get();
- $userID = Session::getUserID();
-
- starter("발령", 1);
-
- $query = "select no,nation,level from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("command_27 ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- $query = "select no,name,level,npc from general where nation='{$me['nation']}' and no!='{$me['no']}' order by npc,binary(name)";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo getMapHtml();
- echo "
-선택된 도시로 아국 장수를 발령합니다.
-아국 도시로만 발령이 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender(1);
-}
-
-function command_30($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("강행");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시로 강행합니다.
-최대 3칸내 도시로만 강행이 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
-printCitiesBasedOnDistance($currentcity['city'], 3);
-
-ender();
-}
-
-function command_31($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("첩보");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 첩보를 실행합니다.
-인접도시일 경우 많은 정보를 얻을 수 있습니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- echo "
-모든 도시가 가능하지만 많은 정보를 얻을 수 있는
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_32($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("화계");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 화계를 실행합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_33($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("탈취");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 탈취를 실행합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_34($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("파괴");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 파괴를 실행합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_35($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("선동");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 선동을 실행합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_36($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("기습");
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select city,name from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
- echo "
-선택된 도시에 기습을 실행합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- printCitiesBasedOnDistance($currentcity['city'], 2);
-
- ender();
-}
-
-function command_43($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("증여");
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select no,name,level,npc from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo "
-자신의 자금이나 군량을 다른 장수에게 증여합니다.
-장수를 선택하세요.
-
-";
-
- ender();
-}
-
-function command_44($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
-
- starter("헌납");
-
- echo "
-자신의 자금이나 군량을 국가 재산으로 헌납합니다.
-
-";
-
- ender();
-}
-
-function command_46($turn, $command) {
- $db = DB::db();
- $gameStor = KVStorage::getStorage($db, 'game_env');
- $connect=$db->get();
-
- starter("건국");
-
- $maxnation = $gameStor->maxnation;
-
- $colorUsed = [];
-
- foreach(GetNationColors() as $color){
- $colorUsed[$color] = 0;
- }
-
- $nationCount = count(getAllNationStaticInfo());
- foreach(getAllNationStaticInfo() as $nation){
- if($nation['level'] <= 0){
- continue;
- }
-
- if(!isset($nationcolor[$nation['color']])){
- $nationcolor[$nation['color']] = 1;
- }
- else{
- $nationcolor[$nation['color']]++;
- }
-
- }
-
- $colorUsedCnt = 0;
- foreach($colorUsed as $color=>$used){
- if($used){
- continue;
- }
- $colorUsedCnt += 1;
- }
-
- //색깔이 다 쓰였으면 그냥 모두 허용
- if($colorUsedCnt === count($colorUsed)){
- foreach(array_keys($colorUsed) as $color){
- $colorUsed[$color] = 0;
- }
- }
-
-
- if($nationCount < $maxnation) {
-?>
-현재 도시에서 나라를 세웁니다. 중, 소도시에서만 가능합니다.
-
-- 법 가 : 금수입↑ 치안↑ 인구↓ 민심↓
-- 유 가 : 내정↑ 민심↑ 쌀수입↓
-- 병 가 : 기술↑ 수성↑ 인구↓ 민심↓
-- 덕 가 : 치안↑인구↑ 민심↑ 쌀수입↓ 수성↓
-- 묵 가 : 수성↑ 기술↓
-- 도 가 : 인구↑ 기술↓ 치안↓
-- 태 평 도 : 인구↑ 민심↑ 기술↓ 수성↓
-- 오 두 미 도 : 쌀수입↑ 인구↑ 기술↓ 수성↓ 내정↓
-- 도 적 : 계략↑ 금수입↓ 치안↓ 민심↓
-- 불 가 : 민심↑ 수성↑ 금수입↓
-- 종 횡 가 : 전략↑ 수성↑ 금수입↓ 내정↓
-- 음 양 가 : 내정↑ 인구↑ 기술↓ 전략↓
-- 명 가 : 기술↑ 인구↑ 쌀수입↓ 수성↓
-
-";
- } else {
- echo "더 이상 건국은 불가능합니다.
";
- }
- ender();
-}
-
-function command_48($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("장비 매매");
-
- $query = "select no,city,gold from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("command_48 ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
- $city = getCity($me['city'], "secu");
-
- $color = [];
-
- for($i=1; $i <= 6; $i++) {
- if($city['secu'] >= $i*1000) {
- $color[$i] = "white";
- } else {
- $color[$i] = "red";
- }
- }
-
- echo "
-장비를 구입하거나 매각합니다.
-현재 구입 불가능한 것은 붉은색으로 표시됩니다.
-현재 도시 치안 : {$city['secu']} 현재 자금 : {$me['gold']}
-
-";
-
- ender();
-}
-
-function command_49($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
-
- starter("군량매매");
-
- echo "
-자신의 군량을 사거나 팝니다.
-
-";
-
- ender();
-}
-
-function command_51($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("항복 권고", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- $query = "select nation,power from nation where nation='{$me['nation']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $myNation = MYDB_fetch_array($result);
-
- echo "
-타국에게 항복을 권고합니다.
-서신은 개인 메세지로 전달됩니다.
-권고할 국가를 목록에서 선택하세요.
-합병이 불가능한 국가는 붉은 배경으로 표시됩니다.
-
-제한 조건
-- 인접 국가
-- 양국 모두 외교제한 기간 없음
-- 제의한 국가가 항복하는 국가보다 국력 3배 초과
-";
- ender(1);
-}
-
-function command_52($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("원조", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- $mynation = getNationStaticInfo($me['nation']);
-
- echo "
-타국에게 원조합니다.
-작위별로 금액 제한이 있습니다.
- 호족: 1만
- 군벌: 2만
-주자사: 3만
- 주목: 4만
- 공: 5만
- 왕: 6만
- 황제: 7만
-원조할 국가를 목록에서 선택하세요.
-
-";
- ender(1);
-}
-
-function command_53($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("통합제의", 1);
-
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("command_53 ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- $query = "select avg(power) as power,avg(gennum) as gennum from nation where level>=1";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $avgNation = MYDB_fetch_array($result);
-
- $query = "select std(power) as power,std(gennum) as gennum from nation where level>=1";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $stdNation = MYDB_fetch_array($result);
-
- $query = "select nation,power,gennum from nation where nation='{$me['nation']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $myNation = MYDB_fetch_array($result);
-
- echo "
-세력이 비슷한 국가에 통합 제의를 합니다. 제의한 국가 위주로 통합됩니다.
-서신은 개인 메세지로 전달됩니다.
-제의할 국가를 목록에서 선택하세요.
-통합이 불가능한 국가는 붉은 배경으로 표시됩니다.
-
-제한 조건
-- 인접 국가
-- 양국 모두 외교제한 없음
-- 두 국가의 국력 평균이 상위 60%(현재 ".round($cond1,2).") 이하.
-- 두 국가의 장수수 평균이 상위 75%(현재 ".round($cond2,1).") 이하.
-";
- ender(1);
-}
-
-function command_54($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("선양");
- $query = "select no,nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select no,name,level from general where nation='{$general['nation']}' and no!='{$general['no']}' order by npc,binary(name)";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $gencount = MYDB_num_rows($result);
-
- echo "
-군주의 자리를 다른 장수에게 물려줍니다.
-장수를 선택하세요.
-
-";
-
- ender();
-}
-
-function command_61($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("불가침", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-타국에게 불가침을 제의합니다.
-제의할 국가를 목록에서 선택하세요.
-배경색은 현재 제의가 불가능한 국가는 붉은색, 현재 불가침중인 국가는 푸른색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_62($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("선전포고", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-타국에게 선전 포고합니다.
-선전 포고할 국가를 목록에서 선택하세요.
-고립되지 않은 아국 도시에서 인접한 국가에 선포 가능합니다.
-초반제한 해제 2년전부터 선포가 가능합니다. (체섭기준 181년 1월부터 가능)
-배경색은 현재 선포가 불가능한 국가는 붉은색, 현재 불가침중(역시 불가)인 국가는 푸른색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_63($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("종전", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-전쟁중인 국가에 종전을 제의합니다.
-제의할 국가를 목록에서 선택하세요.
-배경색은 현재 제의가 불가능한 국가는 붉은색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_64($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("파기", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-불가침중인 국가에 조약 파기를 제의합니다.
-제의할 국가를 목록에서 선택하세요.
-배경색은 현재 제의가 불가능한 국가는 붉은색, 현재 불가침중(제의 가능)인 국가는 푸른색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_65($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("초토화", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시를 초토화 시킵니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_66($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("천도", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시로 천도합니다.
-현재 수도에서 인접한 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_67($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("증축", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시를 증축합니다.
-현재 수도만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_68($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("감축", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시를 감축합니다.
-현재 수도만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_72($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("백성동원", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시에 백성동원을 발동합니다.
-아국 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_73($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("수몰", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시에 수몰을 발동합니다.
-전쟁중인 상대국 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_74($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("허보", 1);
- $query = "select city from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $general = MYDB_fetch_array($result);
-
- $query = "select name,path from city where city='{$general['city']}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $currentcity = MYDB_fetch_array($result);
-
- echo getMapHtml();
-echo "
-선택된 도시에 허보를 발동합니다.
-선포, 전쟁중인 상대국 도시만 가능합니다.
-목록을 선택하거나 도시를 클릭하세요.
-
-";
-
- ender();
-}
-
-function command_75($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("피장파장", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-선택된 국가에 피장파장을 발동합니다.
-선포, 전쟁중인 상대국에만 가능합니다.
-상대 국가를 목록에서 선택하세요.
-배경색은 현재 피장파장 불가능 국가는 붉은색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_77($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("이호경식", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-선택된 국가에 이호경식을 발동합니다.
-선포, 전쟁중인 상대국에만 가능합니다.
-상대 국가를 목록에서 선택하세요.
-배경색은 현재 이호경식 불가능 국가는 붉은색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_78($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
- $userID = Session::getUserID();
-
- starter("급습", 1);
-
- $query = "select nation from general where owner='{$userID}'";
- $result = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
- $me = MYDB_fetch_array($result);
-
- echo "
-선택된 국가에 급습을 발동합니다.
-선포, 전쟁중인 상대국에만 가능합니다.
-상대 국가를 목록에서 선택하세요.
-배경색은 현재 급습 불가능 국가는 붉은색으로 표시됩니다.
-
-";
- ender(1);
-}
-
-function command_81($turn, $command) {
- $db = DB::db();
- $connect=$db->get();
-
- starter("국기변경", 1);
-
- $colorUsed = [];
-
- foreach(GetNationColors() as $color){
- $colorUsed[$color] = 0;
- }
-
- foreach(getAllNationStaticInfo() as $nation){
- if($nation['level'] <= 0){
- continue;
- }
-
- $colorUsed[$nation['color']]+=1;
- }
-
- $colorUsedCnt = 0;
- foreach($colorUsed as $color=>$used){
- if($used){
- continue;
- }
- $colorUsedCnt += 1;
- }
-
- //색깔이 다 쓰였으면 그냥 모두 허용
- if($colorUsedCnt === count($colorUsed)){
- foreach(array_keys($colorUsed) as $color){
- $colorUsed[$color] = 0;
- }
- }
-
- echo "
-국기를 변경합니다. 단 1회 가능합니다.
-
-";
- ender(1);
-}
diff --git a/hwe/sammo/Command/BaseCommand.php b/hwe/sammo/Command/BaseCommand.php
index f9655289..89a50868 100644
--- a/hwe/sammo/Command/BaseCommand.php
+++ b/hwe/sammo/Command/BaseCommand.php
@@ -335,5 +335,14 @@ abstract class BaseCommand{
abstract public function run():bool;
-
+ public function getJSFiles():array {
+ return [];
+ }
+ public function getCSSFiles():array {
+ return [];
+ }
+ public function getForm():string{
+ throw new \sammo\MustNotBeReachedException();
+ return '';
+ }
}
\ No newline at end of file
diff --git a/hwe/sammo/Command/General/che_등용.php b/hwe/sammo/Command/General/che_등용.php
index d8c7dda6..3729ca7b 100644
--- a/hwe/sammo/Command/General/che_등용.php
+++ b/hwe/sammo/Command/General/che_등용.php
@@ -143,7 +143,7 @@ class che_등용 extends Command\GeneralCommand{
$general->setResultTurn(new LastTurn(static::getName(), $this->arg));
$general->checkStatChange();
$general->applyDB($db);
- $destGeneral->applyDB($db);
+ $this->destGeneralObj->applyDB($db);
return true;
}
diff --git a/hwe/sammo/Command/General/che_모반시도.php b/hwe/sammo/Command/General/che_모반시도.php
index 96175262..be8c35e3 100644
--- a/hwe/sammo/Command/General/che_모반시도.php
+++ b/hwe/sammo/Command/General/che_모반시도.php
@@ -79,7 +79,7 @@ class che_모반시도 extends Command\GeneralCommand{
$nationName = $this->nation['name'];
$logger = $general->getLogger();
- $lordLogger = $destGeneral->getLogger();
+ $lordLogger = $this->destGeneralObj->getLogger();
$general->setVar('level', 12);
$lordGeneral->setVar('level', 1);
diff --git a/hwe/sammo/Command/General/che_선동.php b/hwe/sammo/Command/General/che_선동.php
index a154355e..0295e9f2 100644
--- a/hwe/sammo/Command/General/che_선동.php
+++ b/hwe/sammo/Command/General/che_선동.php
@@ -38,7 +38,7 @@ class che_선동 extends che_화계{
$destCity['secu'] -= $secuAmount;
$destCity['trust'] -= $trustAmount;
- $db->update('city', [
+ DB::db()->update('city', [
'state'=>32,
'secu'=>$destCity['secu'],
'trust'=>$destCity['trust']
diff --git a/hwe/sammo/Command/General/che_탈취.php b/hwe/sammo/Command/General/che_탈취.php
index f4cacc91..741d6910 100644
--- a/hwe/sammo/Command/General/che_탈취.php
+++ b/hwe/sammo/Command/General/che_탈취.php
@@ -26,8 +26,10 @@ class che_탈취 extends che_화계{
$destCityName = $destCity['name'];
$destCityID = $destCity['city'];
+ $destNationID = $destCity['nation'];
$commandName = $this->getName();
+ $db = DB::db();
// 탈취 최대 400 * 8
$gold = Util::randRangeInt(GameConst::$sabotageDamageMin, GameConst::$sabotageDamageMax) * $destCity['level'];
diff --git a/hwe/sammo/Command/General/che_파괴.php b/hwe/sammo/Command/General/che_파괴.php
index 4fb35150..889b545b 100644
--- a/hwe/sammo/Command/General/che_파괴.php
+++ b/hwe/sammo/Command/General/che_파괴.php
@@ -37,7 +37,7 @@ class che_파괴 extends che_화계{
$destCity['def'] -= $defAmount;
$destCity['wall'] -= $wallAmount;
- $db->update('city', [
+ DB::db()->update('city', [
'state'=>32,
'def'=>$destCity['def'],
'wall'=>$destCity['wall']
diff --git a/hwe/sammo/Command/General/che_화계.php b/hwe/sammo/Command/General/che_화계.php
index cb2a969e..602a0445 100644
--- a/hwe/sammo/Command/General/che_화계.php
+++ b/hwe/sammo/Command/General/che_화계.php
@@ -97,8 +97,8 @@ class che_화계 extends Command\GeneralCommand{
$prob = $maxGenScore / GameConst::$sabotageProbCoefByStat;
- $prob += $city['secu'] / $city['secu2'] / 5; //최대 20%p
- $prob += $city['supply'] ? 0.1 : 0;
+ $prob += $destCity['secu'] / $destCity['secu2'] / 5; //최대 20%p
+ $prob += $destCity['supply'] ? 0.1 : 0;
return $prob;
}
@@ -169,7 +169,7 @@ class che_화계 extends Command\GeneralCommand{
$destCity['agri'] -= $agriAmount;
$destCity['comm'] -= $commAmount;
- $db->update('city', [
+ DB::db()->update('city', [
'state'=>32,
'agri'=>$destCity['agri'],
'comm'=>$destCity['comm']
@@ -222,7 +222,7 @@ class che_화계 extends Command\GeneralCommand{
$destCityID,
$destNationID
) as $rawDestCityGeneral){
- $destCityGeneralList[] = new General($rawDestGeneral, $destCity, $year, $month, true);
+ $destCityGeneralList[] = new General($rawDestCityGeneral, $destCity, $year, $month, true);
//계략에 성공할 경우 logger를 사용해야 하므로 해야하므로, 미리 초기화한다.
//실패하면 날리는거지 뭐~
};
@@ -264,7 +264,7 @@ class che_화계 extends Command\GeneralCommand{
$itemObj = $general->getItem();
if($itemObj->isValidTurnItem('GeneralCommand', '계략') && $itemObj::$consumable){
- $itemName = $itemObj->$name;
+ $itemName = $itemObj->name;
$josaUl = JosaUtil::pick($itemName, '을');
$logger->pushGeneralActionLog("{$itemName}>{$josaUl} 사용!", ActionLogger::PLAIN);
$general->deleteItem();