From a4863dc8d74cf842a08c2bfa982bd766558b6d77 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 15 Sep 2018 02:37:11 +0900 Subject: [PATCH] =?UTF-8?q?totaltech,=20tech=EB=A5=BC=20float=20tech?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=BC=EC=9B=90=ED=99=94,=20NPC=EA=B0=80=20?= =?UTF-8?q?=EA=B8=B0=EC=88=A0=EB=A0=88=EB=B2=A8=2010=EC=9D=84=20=EB=84=98?= =?UTF-8?q?=EC=9C=BC=EB=A9=B4=20=EA=B8=B0=EC=97=B0=20=EC=95=88=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_myKingdomInfo.php | 2 +- hwe/c_myBossInfo.php | 9 +-- hwe/func.php | 17 ++--- hwe/func_gamerule.php | 61 +++++++++--------- hwe/func_npc.php | 8 +-- hwe/func_process.php | 2 +- hwe/func_process_chief.php | 8 ++- hwe/func_process_personnel.php | 111 +++++++++++++++++++-------------- hwe/j_simulate_battle.php | 5 +- hwe/js/battle_simulator.js | 3 - hwe/process_war.php | 19 ++---- hwe/sammo/Engine/Personnel.php | 26 +------- hwe/sammo/Scenario/Nation.php | 2 - hwe/sql/schema.sql | 3 +- 14 files changed, 126 insertions(+), 150 deletions(-) diff --git a/hwe/b_myKingdomInfo.php b/hwe/b_myKingdomInfo.php index d004ecc2..7874b252 100644 --- a/hwe/b_myKingdomInfo.php +++ b/hwe/b_myKingdomInfo.php @@ -139,7 +139,7 @@ echo " 병량 예산 {$budgetrice} ({$budgetricediff}) 기술력 - {$nation['tech']} + ".floor($nation['tech'])." 작 위 ".getNationLevel($nation['level'])." diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index 68f2490e..2ff08f52 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -209,10 +209,7 @@ if($btn == "추방") { $msg->send(); } - //국가 기술력 그대로 - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); + $gencount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $general['nation']); $gennum = $gencount; if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; @@ -224,11 +221,11 @@ if($btn == "추방") { $query = "update general set injury=injury+1 where no='{$ruler['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; + $query = "update nation set gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } else { //이번분기는 추방불가(초반 제외) - $query = "update nation set l{$meLevel}set=1,totaltech=tech*'$gencount',gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; + $query = "update nation set l{$meLevel}set=1,gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } diff --git a/hwe/func.php b/hwe/func.php index ded15450..78933fe3 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -266,7 +266,7 @@ function myNationInfo() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result); - $query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,sabotagelimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'"; + $query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,sabotagelimit,surlimit,tech,level,type from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nation = MYDB_fetch_array($result); @@ -340,8 +340,8 @@ function myNationInfo() { $techCall = getTechCall($nation['tech']); - if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $nation['tech'] = "{$nation['tech']}"; } - else { $nation['tech'] = "{$nation['tech']}"; } + if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $nation['tech'] = "".floor($nation['tech']).""; } + else { $nation['tech'] = "".floor($nation['tech']).""; } $nation['tech'] = "$techCall / {$nation['tech']}"; @@ -1978,15 +1978,10 @@ function updateTurntime($no) { // 장수 삭제 $query = "delete from general where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - //기존 국가 기술력 그대로 - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; - $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$db->sqleval('gennum - 1') + ], 'nation=%i', $general['nation']); // 병, 요절, 객사, 번개, 사채, 일확천금, 호랑이, 곰, 수영, 처형, 발견 $josaYi = JosaUtil::pick($general['name'], '이'); diff --git a/hwe/func_gamerule.php b/hwe/func_gamerule.php index f60cdc82..83c5d74b 100644 --- a/hwe/func_gamerule.php +++ b/hwe/func_gamerule.php @@ -706,11 +706,11 @@ function checkMerge() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $you = MYDB_fetch_array($result); // 모국 - $query = "select nation,name,surlimit,totaltech from nation where nation='{$you['nation']}'"; + $query = "select nation,name,surlimit,tech from nation where nation='{$you['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $younation = MYDB_fetch_array($result); // 아국 - $query = "select nation,name,gold,rice,surlimit,totaltech from nation where nation='{$me['nation']}'"; + $query = "select nation,name,gold,rice,surlimit,tech from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $mynation = MYDB_fetch_array($result); //양국 NPC수 @@ -755,8 +755,7 @@ function checkMerge() { $newGenCount = $gencount + $gencount2; if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; } - $newTotalTech = $younation['totaltech'] + $mynation['totaltech']; - $newTech = Util::round($newTotalTech / $newGenCount); + $newTech = ($younation['tech']*$gencount + $mynation['tech']*$gencount2)/$newGenCount; // 국가 백업 $oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $me['nation']); @@ -765,8 +764,14 @@ function checkMerge() { $oldNation['aux'] = Json::decode($oldNation['aux']); // 자금 통합, 외교제한 5년, 기술유지 - $query = "update nation set name='{$you['makenation']}',gold=gold+'{$mynation['gold']}',rice=rice+'{$mynation['rice']}',surlimit='24',totaltech='$newTotalTech',tech='$newTech',gennum='{$newGenCount}' where nation='{$younation['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'name'=>$you['makenation'], + 'gold'=>$db->sqleval('gold+%i',$mynation['gold']), + 'rice'=>$db->sqleval('rice+%i',$mynation['rice']), + 'surlimit'=>24, + 'tech'=>$newTech, + 'gennum'=>$newGenCount + ], 'nation=%i',$younation['nation']); //국가 삭제 $db->insert('ng_old_nations', [ 'server_id'=>UniqueConst::$serverID, @@ -845,11 +850,11 @@ function checkSurrender() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $you = MYDB_fetch_array($result); // 모국 - $query = "select nation,name,surlimit,totaltech from nation where nation='{$you['nation']}'"; + $query = "select nation,name,surlimit,tech from nation where nation='{$you['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $younation = MYDB_fetch_array($result); // 아국 - $query = "select nation,name,gold,rice,surlimit,totaltech from nation where nation='{$me['nation']}'"; + $query = "select nation,name,gold,rice,surlimit,tech from nation where nation='{$me['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $mynation = MYDB_fetch_array($result); //양국 NPC수 @@ -897,11 +902,16 @@ function checkSurrender() { $newGenCount = $gencount + $gencount2; if($newGenCount < GameConst::$initialNationGenLimit) { $newGenCount = GameConst::$initialNationGenLimit; } - $newTotalTech = $younation['totaltech'] + $mynation['totaltech']; - $newTech = Util::round($newTotalTech / $newGenCount); + $newTech = ($younation['tech'] * $gencount + $mynation['tech'] * $gencount2) / $newGenCount; // 자금 통합, 외교제한 5년, 기술유지 - $query = "update nation set gold=gold+'{$mynation['gold']}',rice=rice+'{$mynation['rice']}',surlimit='24',totaltech='$newTotalTech',tech='$newTech',gennum='{$newGenCount}' where nation='{$younation['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gold'=>$db->sqleval('gold+%i',$mynation['gold']), + 'rice'=>$db->sqleval('rice+%i',$mynation['rice']), + 'surlimit'=>24, + 'tech'=>$newTech, + 'gennum'=>$newGenCount + ], 'nation=%i', $younation['nation']); + //합병 당한국 모든 도시 10%감소 $query = "update city set pop=pop*0.9,agri=agri*0.9,comm=comm*0.9,secu=secu*0.9,trust=trust*0.9,def=def*0.9,wall=wall*0.9 where nation='{$me['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -965,20 +975,11 @@ function updateNationState() { $history = array(); $admin = $gameStor->getValues(['year', 'month']); - $query = "select nation,name,level from nation"; - $nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nationcount = MYDB_num_rows($nationresult); + foreach($db->query('SELECT nation,name,level FROM nation') as $nation) { + //TODO: level이 진관수이소중대특 체계를 벗어날 수 있음 + $citycount = $db->queryFirstField('SELECT count(*) FROM city WHERE nation=%i AND level>=4', $nation['nation']); - for($i=0; $i < $nationcount; $i++) { - $nation = MYDB_fetch_array($nationresult); - - $query = "select city,level,secu from city where nation='{$nation['nation']}' and level>=4"; - $cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $citycount = MYDB_num_rows($cityresult); - - $query = "select no from general where nation='{$nation['nation']}'"; - $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($genresult); + $gencount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $nation['nation']); if($citycount == 0) { $nationlevel = 0; // 방랑군 @@ -1029,11 +1030,9 @@ function updateNationState() { refreshNationStaticInfo(); } - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; - //기술 및 변경횟수 업데이트 - $query = "update nation set tech=totaltech/'$gencount',gennum='$gennum' where nation='{$nation['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$gencount + ], 'nation=%i', $nation['nation']); } pushWorldHistory($history, $admin['year'], $admin['month']); } @@ -1075,6 +1074,8 @@ function checkStatistic() { min(power) as minpower, max(power) as maxpower, avg(power) as avgpower from nation where level>0'); $auxData['nations']['avg'] = $avgNation; + $avgNation['mintech'] = floor($avgNation['mintech']); + $avgNation['maxtech'] = floor($avgNation['maxtech']); $avgNation['avgtech'] = Util::round($avgNation['avgtech']); $avgNation['avgpower'] = Util::round($avgNation['avgpower']); $etc .= "최저/평균/최고 기술({$avgNation['mintech']}/{$avgNation['avgtech']}/{$avgNation['maxtech']}), "; diff --git a/hwe/func_npc.php b/hwe/func_npc.php index 4119c8f4..b3769291 100644 --- a/hwe/func_npc.php +++ b/hwe/func_npc.php @@ -43,20 +43,20 @@ function SetDevelop($genType, $no, $city, $tech) { case 3: //지내정장 if($prob < 40) { if($city['ag'] < 99) { $command = EncodeCommand(0, 0, 0, 1); } //농업 - elseif($tech < 10000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 + elseif($tech < GameConst::$maxTechLevel * 1000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 elseif($city['po'] < 99) { $command = EncodeCommand(0, 0, 0, 7); } //정장 else { $command = EncodeCommand(0, 0, 0, 9); } //조달 } elseif($prob < 80) { if($city['co'] < 99) { $command = EncodeCommand(0, 0, 0, 2); } //상업 - elseif($tech < 10000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 + elseif($tech < GameConst::$maxTechLevel * 1000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 elseif($city['po'] < 99) { $command = EncodeCommand(0, 0, 0, 7); } //정장 else { $command = EncodeCommand(0, 0, 0, 9); } //조달 } elseif($prob < 90) { - if($tech < 10000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 + if($tech < GameConst::$maxTechLevel * 1000) { $command = EncodeCommand(0, 0, 0, 3); } //기술 elseif($city['po'] < 99) { $command = EncodeCommand(0, 0, 0, 7); } //정장 else { $command = EncodeCommand(0, 0, 0, 9); } //조달 } else { - if($tech < 10000) { $command = EncodeCommand(0, 0, 0, 3 + (rand() % 2) * 6); } //기술, 조달 + if($tech < GameConst::$maxTechLevel * 1000) { $command = EncodeCommand(0, 0, 0, 3 + (rand() % 2) * 6); } //기술, 조달 else { $command = EncodeCommand(0, 0, 0, 29); } } break; diff --git a/hwe/func_process.php b/hwe/func_process.php index db15425f..018f852a 100644 --- a/hwe/func_process.php +++ b/hwe/func_process.php @@ -1064,7 +1064,7 @@ function process_31(&$general) { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $myTech = MYDB_fetch_array($result); - $diff = $yourTech['tech'] - $myTech['tech']; // 차이 + $diff = floor($yourTech['tech']) - floor($myTech['tech']); // 차이 if($diff >= 1000) { $log[] = "【{$yourTech['name']}】아국대비기술:↑압도"; } elseif($diff >= 250) { $log[] = "【{$yourTech['name']}】아국대비기술:▲우위"; } elseif($diff >= -250) { $log[] = "【{$yourTech['name']}】아국대비기술:↕대등"; } diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index c425ff17..4a0acc74 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -2100,9 +2100,11 @@ function process_76(&$general) { if($nation['type'] == 11) { $term3 = Util::round($term3 / 2); } if($nation['type'] == 12) { $term3 = $term3 * 2; } - //전략기한, 국가 기술력 그대로 - $query = "update nation set sabotagelimit={$term3},totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + //전략기한 + $db->update('nation', [ + 'sabotagelimit'=>$term3, + 'gennum'=>$gennum + ], 'nation=%i', $general['nation']); //경험치, 공헌치 $query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; diff --git a/hwe/func_process_personnel.php b/hwe/func_process_personnel.php index edfe4221..cccfa326 100644 --- a/hwe/func_process_personnel.php +++ b/hwe/func_process_personnel.php @@ -221,15 +221,9 @@ function process_25(&$general) { 'belong'=>1 ], 'no=%i', $general['no']); - //국가 기술력 그대로 - $query = "select no from general where nation='{$nation['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; - - $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$nation['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$gencount + 1, + ], 'nation=%i', $nation['nation']); if($where < 99) { $log = uniqueItem($general, $log); @@ -441,40 +435,59 @@ function process_29(&$general) { // 10년 ~ 50년 $killturn = rand()%480 + 120; - @MYDB_query(" - insert into general ( - npcid,npc,npc_org,affinity,name,picture,nation, - city,leader,power,intel,experience,dedication, - level,gold,rice,crew,crewtype,train,atmos,tnmt, - weap,book,horse,turntime,killturn,age,belong,personal,special,specage,special2,specage2,npcmsg, - makelimit,bornyear,deadyear, - dex0, dex10, dex20, dex30, dex40 - ) values ( - '$npccount','$npc','$npc','$affinity','$name','$picture','$scoutNation', - '{$general['city']}','$leader','$power','$intel','{$avgGen['exp']}','{$avgGen['ded']}', - '$scoutLevel','100','100','0','".GameUnitConst::DEFAULT_CREWTYPE."','0','0','0', - '0','0','0','$turntime','$killturn','$age','1','$personal','0','$specage','0','$specage2','', - '0','$bornyear','$deadyear', - '{$avgGen['dex0']}','{$avgGen['dex10']}','{$avgGen['dex20']}','{$avgGen['dex30']}','{$avgGen['dex40']}' - )", - $connect - ) or Error(__LINE__.MYDB_error($connect),""); + $db->insert('general', [ + 'npcid'=>$npccount, + 'npc'=>$npc, + 'npc_org'=>$npc, + 'affinity'=>$affinity, + 'name'=>$name, + 'picture'=>$picture, + 'nation'=>$scoutNation, + 'city'=>$general['city'], + 'leader'=>$leader, + 'power'=>$power, + 'intel'=>$intel, + 'experience'=>$experience, + 'dedication'=>$dedication, + 'level'=>$scoutLevel, + 'gold'=>100, + 'rice'=>100, + 'crew'=>0, + 'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE, + 'train'=>0, + 'atmos'=>0, + 'tnmt'=>0, + 'weap'=>0, + 'book'=>0, + 'horse'=>0, + 'turntime'=>$turntime, + 'killturn'=>$killturn, + 'age'=>$age, + 'belong'=>1, + 'personal'=>$personal, + 'special'=>0, + 'specage'=>$specage, + 'special2'=>0, + 'specage2'=>$specage2, + 'npcmsg'=>'', + 'makelimit'=>0, + 'bornyear'=>$bornyear, + 'deadyear'=>$deadyear, + 'dex0'=>$avgGen['dex0'], + 'dex10'=>$avgGen['dex10'], + 'dex20'=>$avgGen['dex20'], + 'dex30'=>$avgGen['dex30'], + 'dex40'=>$avgGen['dex40'], + ]); $npcid++; //npccount $gameStor->npccount=$npcid; - //국가 기술력 그대로 - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; - - //국가 기술력 그대로 - $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$db->sqleval('gennum + 1'), + ], 'nation=%i', $general['nation']); } @@ -596,18 +609,16 @@ function process_45(&$general) { $query = "update general set troop='0' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - //국가 기술력 그대로 - $query = "select no from general where nation='{$general['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $gencount = MYDB_num_rows($result); - $gennum = $gencount; - if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit; $nation['chemi'] -= 1; if($nation['chemi'] < 0) { $nation['chemi'] = 0; } - $query = "update nation set totaltech=tech*'$gencount',gennum='$gennum',chemi='{$nation['chemi']}',gold=gold+'$gold',rice=rice+'$rice' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'gennum'=>$db->sqleval('gennum - 1'), + 'chemi'=>$nation['chemi'], + 'gold'=>$db->sqleval('gold + %i', $gold), + 'rice'=>$db->sqleval('rice + %i', $rice), + ], 'nation=%i', $general['nation']); } pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']); pushGenLog($general, $log); @@ -750,8 +761,14 @@ function process_47(&$general) { //분쟁기록 모두 지움 DeleteConflict($general['nation']); // 국명, 색깔 바꿈 국가 레벨 0, 성향리셋, 기술0 - $query = "update nation set name='{$general['name']}',color='#330000',level='0',type='0',tech='0',totaltech='0',capital='0' where nation='{$general['nation']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $db->update('nation', [ + 'name'=>$general['name'], + 'color'=>'#330000', //TODO: 기본 방랑군색 별도 지정 + 'level'=>0, + 'type'=>0, + 'tech'=>0, + 'capital'=>0 + ], 'nation=%i', $general['nation']); // 본인 빼고 건국/임관제한 $query = "update general set makelimit='12' where no!='{$general['no']}' and nation='{$general['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); diff --git a/hwe/j_simulate_battle.php b/hwe/j_simulate_battle.php index bf532bbe..98ed5da8 100644 --- a/hwe/j_simulate_battle.php +++ b/hwe/j_simulate_battle.php @@ -200,17 +200,16 @@ if(!$v->validate()){ $nationCheck = [ 'required'=>[ 'type', 'tech', 'level', 'capital', - 'nation', 'name', 'gold', 'rice', 'totaltech', 'gennum' + 'nation', 'name', 'gold', 'rice', 'gennum' ], 'integer'=>[ 'type', 'level', 'capital', 'nation', 'gennum', ], 'numeric'=>[ - 'tech', 'gold', 'rice', 'totaltech' + 'tech', 'gold', 'rice' ], 'min'=>[ ['tech', 0], - ['totaltech', 0], ['gold', 0], ['rice', 0], ['gennum', 1], diff --git a/hwe/js/battle_simulator.js b/hwe/js/battle_simulator.js index 51694041..c6b2f03c 100644 --- a/hwe/js/battle_simulator.js +++ b/hwe/js/battle_simulator.js @@ -580,7 +580,6 @@ jQuery(function($){ rice:2000, type:0, tech:0, - totaltech:0, gennum:200, }; @@ -618,7 +617,6 @@ jQuery(function($){ var attackerNation = $.extend({}, defaultNation, allData.attackerNation); attackerNation.nation = 1; attackerNation.name = '출병국'; - attackerNation.totaltech = attackerNation.tech * attackerNation.gennum; var attackerCity = $.extend({}, defaultCity, allData.attackerCity); attackerCity.nation = 1; @@ -638,7 +636,6 @@ jQuery(function($){ var defenderNation = $.extend({}, defaultNation, allData.defenderNation); defenderNation.nation = 2; defenderNation.name = '수비국'; - defenderNation.totaltech = defenderNation.tech * defenderNation.gennum; var defenderCity = $.extend({}, defaultCity, allData.defenderCity); defenderCity.nation = 2; diff --git a/hwe/process_war.php b/hwe/process_war.php index 781a2c7a..189866af 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -10,7 +10,7 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ $attackerNationID = $rawAttacker['nation']; $defenderNationID = $rawDefenderCity['nation']; - $rawAttackerNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,totaltech,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $attackerNationID); + $rawAttackerNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $attackerNationID); if($defenderNationID == 0){ $rawDefenderNation = [ @@ -22,12 +22,11 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ 'rice'=>2000, 'type'=>0, 'tech'=>0, - 'totaltech'=>0, 'gennum'=>1 ]; } else{ - $rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,totaltech,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID); + $rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID); } $gameStor = KVStorage::getStorage($db, 'game_env'); @@ -118,14 +117,8 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ $defenderIncTech /= 4; } - $attackerTotalTech = $rawAttackerNation['totaltech'] + $attackerIncTech; - $defenderTotalTech = $rawDefenderNation['totaltech'] + $defenderIncTech; - - $updateAttackerNation['totaltech'] = Util::round($attackerTotalTech); - $updateDefenderNation['totaltech'] = Util::round($defenderTotalTech); - - $updateAttackerNation['tech'] = Util::round($attackerTotalTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum'])); - $updateDefenderNation['tech'] = Util::round($defenderTotalTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum'])); + $updateAttackerNation['tech'] += $attackerIncTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum']); + $updateDefenderNation['tech'] += $defenderIncTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum']); $db->update('nation', $updateAttackerNation, 'nation=%i', $attackerNationID); $db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID); @@ -144,10 +137,10 @@ function processWar(array $rawAttacker, array $rawDefenderCity){ //XXX: 새 도시점령 코드 작성하기 전까지 유지 $rawAttackerCity = $db->queryFirstRow('SELECT * FROM city WHERE city = %i', $rawAttacker['city']); - $rawAttackerNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,totaltech,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $attackerNationID); + $rawAttackerNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $attackerNationID); if($defenderNationID !== 0){ - $rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,totaltech,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID); + $rawDefenderNation = $db->queryFirstRow('SELECT nation,`level`,`name`,capital,gennum,tech,`type`,gold,rice FROM nation WHERE nation = %i', $defenderNationID); } ConquerCity([ diff --git a/hwe/sammo/Engine/Personnel.php b/hwe/sammo/Engine/Personnel.php index d50f431e..b3e232d6 100644 --- a/hwe/sammo/Engine/Personnel.php +++ b/hwe/sammo/Engine/Personnel.php @@ -92,16 +92,6 @@ class Personnel{ return [$result, $reason]; } - $scoutNationGeneralCnt = $db->queryFirstField( - 'SELECT COUNT(`no`) FROM general WHERE nation = %i', - $this->nation['nation'] - ); - - $originalNationGeneralCnt = $db->queryFirstField( - 'SELECT COUNT(`no`) FROM general WHERE nation = %i', - $general['nation'] - ); - $isTroopLeader = false; if($general['troop']){ $troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop = %i', $general['troop']); @@ -110,16 +100,6 @@ class Personnel{ } } - $scoutNationGeneralCnt+=1; - if($scoutNationGeneralCnt < GameConst::$initialNationGenLimit){ - $scoutNationGeneralCnt = GameConst::$initialNationGenLimit; - } - - $originalNationGeneralCnt-=1; - if($originalNationGeneralCnt < GameConst::$initialNationGenLimit){ - $originalNationGeneralCnt = GameConst::$initialNationGenLimit; - } - $joinedNations = Json::decode($general['nations']); $joinedNations[] = $this->nation['nation']; @@ -139,13 +119,11 @@ class Personnel{ ]; $setOriginalNationValues = [ - 'totaltech'=>$db->sqleval('tech * %i', $originalNationGeneralCnt), - 'gennum'=>$originalNationGeneralCnt + 'gennum'=>$db->sqleval('gennum - 1') ]; $setScoutNationValues = [ - 'totaltech'=>$db->sqleval('tech * %i', $scoutNationGeneralCnt), - 'gennum'=>$scoutNationGeneralCnt + 'gennum'=>$db->sqleval('gennum + 1') ]; $setOriginalCityValues = []; diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php index 7ecad633..cf31fb01 100644 --- a/hwe/sammo/Scenario/Nation.php +++ b/hwe/sammo/Scenario/Nation.php @@ -97,7 +97,6 @@ class Nation{ 'surlimit'=>72, 'scoutmsg'=>$this->infoText, 'tech'=>$this->tech, - 'totaltech'=>0, 'level'=>$this->nationLevel, 'type'=>$type, ]); @@ -139,7 +138,6 @@ class Nation{ $db = DB::db(); $db->update('nation', [ 'gennum'=>$npc_cnt, - 'totaltech'=>$this->tech*$npc_cnt ], 'nation=%i', $this->id); //군주가 없는지 확인 diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 767a3f91..f2399f8d 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -197,8 +197,7 @@ CREATE TABLE `nation` ( `sabotagelimit` INT(4) NULL DEFAULT '36', `surlimit` INT(4) NULL DEFAULT '72', `scoutmsg` TEXT NULL DEFAULT '', - `tech` INT(8) NULL DEFAULT '0', - `totaltech` INT(8) NULL DEFAULT '0', + `tech` float NULL DEFAULT '0', `power` INT(8) NULL DEFAULT '0', `spy` CHAR(255) NOT NULL DEFAULT '{}', `level` INT(1) NULL DEFAULT '0',