totaltech, tech를 float tech로 일원화, NPC가 기술레벨 10을 넘으면 기연 안하는 버그 수정

This commit is contained in:
2018-09-15 02:37:11 +09:00
parent af12a08e25
commit a4863dc8d7
14 changed files with 126 additions and 150 deletions
+1 -1
View File
@@ -139,7 +139,7 @@ echo "
<td align=center id=bg1>병량 예산</td>
<td align=center>{$budgetrice} ({$budgetricediff})</td>
<td align=center id=bg1>기술력</td>
<td align=center>{$nation['tech']}</td>
<td align=center>".floor($nation['tech'])."</td>
<td align=center id=bg1>작 위</td>
<td align=center>".getNationLevel($nation['level'])."</td>
</tr>
+3 -6
View File
@@ -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),"");
}
+6 -11
View File
@@ -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'] = "<font color=magenta>{$nation['tech']}</font>"; }
else { $nation['tech'] = "<font color=limegreen>{$nation['tech']}</font>"; }
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $nation['tech'] = "<font color=magenta>".floor($nation['tech'])."</font>"; }
else { $nation['tech'] = "<font color=limegreen>".floor($nation['tech'])."</font>"; }
$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'], '이');
+31 -30
View File
@@ -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']}), ";
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -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[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<M>↑</>압도"; }
elseif($diff >= 250) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<Y>▲</>우위"; }
elseif($diff >= -250) { $log[] = "【<span class='ev_notice'>{$yourTech['name']}</span>】아국대비기술:<W>↕</>대등"; }
+5 -3
View File
@@ -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']}'";
+64 -47
View File
@@ -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),"");
+2 -3
View File
@@ -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],
-3
View File
@@ -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;
+6 -13
View File
@@ -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([
+2 -24
View File
@@ -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 = [];
-2
View File
@@ -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);
//군주가 없는지 확인
+1 -2
View File
@@ -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',