diff --git a/hwe/_admin7.php b/hwe/_admin7.php index b7589e2a..e9f76046 100644 --- a/hwe/_admin7.php +++ b/hwe/_admin7.php @@ -56,7 +56,6 @@ if($session->userGrade < 5) { } $db = DB::db(); -$connect=$db->get(); if($btn == '정렬하기') { $gen = 0; @@ -112,7 +111,7 @@ $generalObj = General::createGeneralObjFromDB($gen);
정렬순서 : - [$queryTypeText,]): ?> diff --git a/hwe/b_battleCenter.php b/hwe/b_battleCenter.php index ada1463d..644a7497 100644 --- a/hwe/b_battleCenter.php +++ b/hwe/b_battleCenter.php @@ -36,11 +36,6 @@ if($reqQueryType === null || !key_exists($reqQueryType, $queryMap)){ } -if($reqQueryType === null || !key_exists($reqQueryType, $queryMap)){ - $reqQueryType = Util::array_first_key($queryMap); -} - - //로그인 검사 $session = Session::requireGameLogin()->setReadOnly(); $userID = Session::getUserID(); diff --git a/hwe/b_currentCity.php b/hwe/b_currentCity.php index 1b757fbd..f992f591 100644 --- a/hwe/b_currentCity.php +++ b/hwe/b_currentCity.php @@ -187,10 +187,6 @@ if($city['trade'] === null) { $city['trade'] = "- "; } -$query = "select npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,officer_level,nation,crewtype,crew,train,atmos from general where city='{$city['city']}' order by dedication desc"; // 장수 목록 -$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$gencount = MYDB_num_rows($genresult); - $generals = $db->query( 'SELECT npc,defence_train,no,picture,imgsvr,name,injury,leadership,strength,intel,officer_level,nation,crewtype,crew,train,atmos from general where city=%i order by name', $city['city'] @@ -198,17 +194,20 @@ $generals = $db->query( $generalTurnList = []; -foreach($db->queryAllLists( - 'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC', - array_column($generals, 'no') - ) as [$generalID, $turnIdx, $brief] -){ - if(!key_exists($generalID, $generalTurnList)){ - $generalTurnList[$generalID] = []; +if($generals){ + foreach($db->queryAllLists( + 'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC', + array_column($generals, 'no') + ) as [$generalID, $turnIdx, $brief] + ){ + if(!key_exists($generalID, $generalTurnList)){ + $generalTurnList[$generalID] = []; + } + $generalTurnList[$generalID][$turnIdx] = $brief; } - $generalTurnList[$generalID][$turnIdx] = $brief; } + $nationname = []; $nationlevel = []; foreach(getAllNationStaticInfo() as $nation){ @@ -220,9 +219,7 @@ foreach(getAllNationStaticInfo() as $nation){ $generalsFormat = []; -for($j=0; $j < $gencount; $j++) { - $general = MYDB_fetch_array($genresult); - +foreach($generals as $general){ $nationInfo = getNationStaticInfo($general['nation']); if($general['nation'] != 0 && $general['nation'] == $myNation['nation']){ diff --git a/hwe/b_myBossInfo.php b/hwe/b_myBossInfo.php index 1e08f01a..2e3ecb50 100644 --- a/hwe/b_myBossInfo.php +++ b/hwe/b_myBossInfo.php @@ -193,7 +193,7 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) { continue; } echo " - "; + "; } echo " @@ -230,11 +230,11 @@ if($meLevel >= 5 && $nation['l11set'] == 0) { for($i=0; $i < $gencount; $i++) { $general = MYDB_fetch_array($result); if($general['officer_level'] == 11) { - echo ""; + echo ""; } elseif($general['officer_level'] > 1) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } } @@ -284,11 +284,11 @@ for($i=10; $i >= $lv; $i--) { for($k=0; $k < $gencount; $k++) { $general = MYDB_fetch_array($result); if($general['officer_level'] == $i) { - echo ""; + echo ""; } elseif($general['officer_level'] > 1) { - echo ""; + echo ""; } else { - echo ""; + echo ""; } } @@ -371,7 +371,7 @@ if($meLevel >= 5) { echo " - + "; $officerLevelText = getOfficerLevelText(3, $nation['level']); @@ -423,7 +423,7 @@ if($meLevel >= 5) { echo " - + "; $officerLevelText = getOfficerLevelText(2, $nation['level']); @@ -475,7 +475,7 @@ if($meLevel >= 5) { echo " - + 빨간색은 현재 임명중인 장수, 노란색은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다. @@ -534,20 +534,21 @@ foreach($db->query('SELECT city,name,level,region,officer4set,officer3set,office $cityID = $city['city']; $cityOfficerList = $officerList[$cityID]??[]; ?> + + + +   - - - "; - + -(년) 【name?>】 +(년) 【name?>】 -- +- diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index ff321313..d02b07fa 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -10,6 +10,9 @@ $tnmt = Util::getReq('tnmt', 'int', 1); //$detachNPC = Util::getReq('detachNPC', 'bool'); $detachNPC = false; +$showDieImmediatelyBtn = false; +$availableDieImmediately = false; + if ($defence_train <= 60) { $defence_train = 60; } @@ -82,6 +85,17 @@ if (($btn == "설정저장" || $detachNPC) && $myset > 0) { } $me->applyDB($db); +if($gameStor->turntime <= $gameStor->opentime){ + //서버 가오픈시 할 수 있는 행동 + + if($me['npc'] == 0){ + $showDieImmediatelyBtn = true; + if(addTurn($me['lastrefresh'], $gameStor->turnterm, 2) <= TimeUtil::DatetimeNow()){ + $availableDieImmediately = true; + } + } +} + ?> diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index 247c3dfa..95de7bfd 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -1089,6 +1089,7 @@ function checkStatistic() { } $nationHists[$nation['type']]++; } + unset($nation); $auxData['nations']['all'] = $nations; diff --git a/hwe/j_myBossInfo.php b/hwe/j_myBossInfo.php index 4c638b8b..e500f8cc 100644 --- a/hwe/j_myBossInfo.php +++ b/hwe/j_myBossInfo.php @@ -19,7 +19,7 @@ $gameStor->cacheValues(['startyear','year','month','scenario']); $me = $db->queryFirstRow('SELECT no,nation,officer_level from general where owner=%i', $userID); $myOfficerLevel = $me['officer_level']; -$nationID = $nationID; +$nationID = $me['nation']; //수뇌가 아니면 아무것도 할 수 없음 if($myOfficerLevel < 5){ @@ -113,6 +113,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{ $db->update('nation', [ "l{$targetOfficerLevel}set"=>1, ], 'nation=%i', $nationID); + $general->applyDB($db); return null; } @@ -152,6 +153,7 @@ function do도시임명(General $general, int $cityID, int $targetOfficerLevel): ], 'city=%i AND nation=%i', $cityID, $nationID); $general->setVar('officer_level', $targetOfficerLevel); $general->setVar('officer_city', $cityID); + $general->applyDB($db); return null; } @@ -299,6 +301,7 @@ function do추방(General $general, int $myOfficerLevel):?string{ } $logger->pushGeneralHistoryLog("{$nation['name']}에서 추방됨"); + $general->applyDB($db); return null; } diff --git a/hwe/js/bossInfo.js b/hwe/js/bossInfo.js index d97a8a9d..d793301d 100644 --- a/hwe/js/bossInfo.js +++ b/hwe/js/bossInfo.js @@ -118,8 +118,8 @@ $(function(){ var officerLevelText = $btn.data('officer_level_text'); var cityID = 0; var cityName = '_'; - var $generalSelect = $('.genlist_{0} option:selected'.format(officerLevel)); - var $citySelect = $('.citylist_{0} option:selected'.format(officerLevel)); + var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel)); + var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel)); var generalID = $generalSelect.val(); var generalName = $generalSelect.data('name'); @@ -133,12 +133,12 @@ $(function(){ } } else if(generalOfficerLevel >= 5){ - if(!confirm('이미 수뇌인 {0}를 {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){ + if(!confirm('이미 수뇌인 {0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){ return false; } } else{ - if(!confirm('{0}를 {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){ + if(!confirm('{0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))){ return false; } } @@ -157,12 +157,12 @@ $(function(){ } } else if(generalOfficerLevel >= 5){ - if(!confirm('수뇌인 {0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){ + if(!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){ return false; } } else{ - if(!confirm('{0}를 {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){ + if(!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))){ return false; } } @@ -187,8 +187,8 @@ $(function(){ return false; } - if(destGeneralID){ - alert('{0}를 임명했습니다.'.format(generalName)); + if(generalID){ + alert('{0}을(를) 임명했습니다.'.format(generalName)); } else{ alert('관직을 비웠습니다.'); diff --git a/hwe/process_war.php b/hwe/process_war.php index e72cd299..5fd56e0a 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -16,7 +16,7 @@ function processWar(General $attackerGeneral, array $rawAttackerNation, array $r 'capital'=>0, 'level'=>0, 'gold'=>0, - 'rice'=>2000, + 'rice'=>10000, 'type'=>GameConst::$neutralNationType, 'tech'=>0, 'gennum'=>1 @@ -714,6 +714,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) { foreach($nearNationsID as $nationNationID){ SetNationFront($nationNationID); } + SetNationFront($conquerNation); pushGenLog($general['no'], $log); pushGeneralPublicRecord($alllog, $year, $month); diff --git a/hwe/sammo/AutorunNationPolicy.php b/hwe/sammo/AutorunNationPolicy.php index ea40431f..a76a5e58 100644 --- a/hwe/sammo/AutorunNationPolicy.php +++ b/hwe/sammo/AutorunNationPolicy.php @@ -27,14 +27,14 @@ class AutorunNationPolicy { static $NPC몰수 = 'NPC몰수'; // 군주 행동 - static $선포 = '선포'; + static $선전포고 = '선전포고'; static $천도 = '천도'; //실제 행동 static public $defaultPriority = [ - '선포', + '선전포고', '천도', '유저장긴급포상', @@ -103,8 +103,8 @@ class AutorunNationPolicy { public $canNPC포상 = true; public $canNPC몰수 = true; - public $can선포 = false; - public $can천도 = false; + public $can선전포고 = true; + public $can천도 = true; //Policy Variables public $reqNationGold = 10000; diff --git a/hwe/sammo/Command/General/che_출병.php b/hwe/sammo/Command/General/che_출병.php index a7d66b2b..1f3e369a 100644 --- a/hwe/sammo/Command/General/che_출병.php +++ b/hwe/sammo/Command/General/che_출병.php @@ -47,7 +47,7 @@ class che_출병 extends Command\GeneralCommand{ $general = $this->generalObj; $this->setCity(); - $this->setNation(['war', 'gennum', 'tech', 'gold', 'rice']); + $this->setNation(['war', 'gennum', 'tech', 'gold', 'rice', 'color', 'type', 'level', 'capital']); $this->setDestCity($this->arg['destCityID'], null); [$reqGold, $reqRice] = $this->getCost(); @@ -196,9 +196,7 @@ class che_출병 extends Command\GeneralCommand{ $general->setResultTurn(new LastTurn(static::getName(), $this->arg)); $general->applyDB($db); - //TODO: 장기적으로 통합해야함 - $attackerNation = $db->queryFirstRow('SELECT nation, name, color, type, level, capital, tech, gennum from nation WHERE nation = %i', $attackerNationID); - processWar($general, $attackerNation, $this->destCity); + processWar($general, $this->nation, $this->destCity); tryUniqueItemLottery($general); $general->applyDB($db); diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 6d4592e3..bf7f9541 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -1068,9 +1068,6 @@ class GeneralAI } //국고와 '충분한 금액'의 기하평균 $payAmount = sqrt(($enoughMoney - $targetUserGeneral->getVar($resName)) * $resVal); - if($payAmount < $this->nationPolicy->minimumResourceActionAmount){ - continue; - } if ($resVal < $payAmount / 2) { continue; @@ -1513,7 +1510,7 @@ class GeneralAI // 군주 행동 - protected function do선포(LastTurn $lastTurn): ?NationCommand + protected function do선전포고(LastTurn $lastTurn): ?NationCommand { $general = $this->general; @@ -2843,6 +2840,7 @@ class GeneralAI } $nationCities[$cityID] = &$nationCity; + unset($nationCity); } $this->nationCities = $nationCities; diff --git a/hwe/sammo/WarUnit.php b/hwe/sammo/WarUnit.php index 4e23b054..74927f72 100644 --- a/hwe/sammo/WarUnit.php +++ b/hwe/sammo/WarUnit.php @@ -369,4 +369,9 @@ class WarUnit{ //전특, 병종에 따라 필살 데미지가 달라질지도 모르므로 static 함수는 아닌 것으로 return Util::randRange(1.3, 2.0); } + + function applyDB(\MeekroDB $db):bool{ + throw new MustNotBeReachedException('Must be WarUnitCity or WarUnitGeneral'); + return false; + } } \ No newline at end of file diff --git a/hwe/sammo/WarUnitCity.php b/hwe/sammo/WarUnitCity.php index 2b5416e6..172223ff 100644 --- a/hwe/sammo/WarUnitCity.php +++ b/hwe/sammo/WarUnitCity.php @@ -23,7 +23,7 @@ class WarUnitCity extends WarUnit{ $this->logger = $general->getLogger(); $this->crewType = GameUnitConst::byID(GameUnitConst::CREWTYPE_CASTLE); - $this->hp = $this->getVar('def') * 10; + $this->hp = $this->getCityVar('def') * 10; //수비자 보정 if($this->getCityVar('level') == 1){