From f9f59bd7c269b1a113f1521c62764db571cc6e15 Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 6 Mar 2019 01:09:34 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=A0=EB=84=88=EB=A8=BC=ED=8A=B8=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=9D=B4=20=EB=B3=80=EA=B2=BD=20=ED=9A=9F?= =?UTF-8?q?=EC=88=98=EB=A5=BC=20=EA=B9=8E=EC=A7=80=20=EC=95=8A=EC=9D=8C.?= =?UTF-8?q?=20=EC=88=98=EB=B9=84=20=EB=81=94=20=EC=8B=9C=20=ED=9B=88?= =?UTF-8?q?=EC=82=AC=203=20=EA=B0=90=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/b_myPage.php | 31 ++++++++++++++++++++++++------- hwe/func_command.php | 23 ++++++++++++++--------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/hwe/b_myPage.php b/hwe/b_myPage.php index b5170e04..e72171e4 100644 --- a/hwe/b_myPage.php +++ b/hwe/b_myPage.php @@ -28,7 +28,7 @@ $connect=$db->get(); increaseRefresh("내정보", 1); -$query = "select no,npc,mode,tnmt,myset from general where owner='{$userID}'"; +$query = "select no,npc,mode,tnmt,myset,train,atmos from general where owner='{$userID}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), ""); $me = MYDB_fetch_array($result); @@ -46,13 +46,30 @@ if (($btn == "설정저장" || $detachNPC) && $me['myset'] > 0) { $submit = 'hidden'; } - $me['myset'] -= 1; + if($mode == 0){ + $db->update('general', [ + 'myset'=>$db->sqleval('myset-1'), + 'mode'=>$mode, + 'train'=>max(0, $me['train'] - 3), + 'atmos'=>max(0, $me['atmos'] - 3), + ], 'owner=%i AND mode!=%i', $userID, $mode); + } + else{ + $db->update('general', [ + 'myset'=>$db->sqleval('myset-1'), + 'mode'=>$mode + ], 'owner=%i AND mode!=%i', $userID, $mode); + } - $db->update('general', [ - 'myset'=>$db->sqleval('myset-1'), - 'mode'=>$mode, - 'tnmt'=>$tnmt - ], 'owner=%i', $userID); + if($db->affectedRows()){ + $me['myset'] -= 1; + } + + if($me['tnmt'] != $tnmt){ + $db->update('general', [ + 'tnmt'=>$tnmt + ], 'owner=%i', $userID); + } $me['mode'] = $mode; $me['tnmt'] = $tnmt; diff --git a/hwe/func_command.php b/hwe/func_command.php index 0064cf43..7c7d3a16 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -478,9 +478,7 @@ function processCommand($no) { $gameStor = KVStorage::getStorage($db, 'game_env'); $connect=$db->get(); - $query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar from general where no='$no'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $general = MYDB_fetch_array($result); + $general = $db->queryFirstRow('SELECT npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset from general where no = %i', $no); list($month, $killturn) = $gameStor->getValuesAsArray(['month', 'killturn']); $log = []; @@ -546,17 +544,24 @@ function processCommand($no) { } $command = DecodeCommand($general['turn0']); + $newKillturn = $killturn; //삭턴 처리 if($general['npc'] >= 2 || $general['killturn'] > $killturn) { - $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $newKillturn = $general['killturn'] - 1; } elseif($command[0] == 0) { - $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $newKillturn = $general['killturn'] - 1; } else { - $query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn='{$killturn}' where no='{$general['no']}'"; - MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $newKillturn = $killturn; } + + $newMySet = min($general['myset'] + 1, 3); + $db->update('general', [ + 'recturn'=>$db->sqleval('turn0'), + 'resturn'=>'FAIL', + 'con'=>0, + 'killturn'=>$newKillturn, + 'myset'=>$newMySet + ], 'no = %i', $general['no']); //FIXME: 운영자 같이 사망하면 안되는 인물에 대한 처리가 필요 //연속턴 아닌경우 텀 리셋