From a72452454ceecc53b1672e9c5676668732d23483 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 1 Mar 2018 20:18:54 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1=20=EA=B3=BC=EC=A0=95=EC=97=90=EC=84=9C=20=EC=A0=84?= =?UTF-8?q?=EC=86=A1=EC=9E=90=EC=97=90=20id,=20nation=5Fid=EB=A7=8C=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/func_message.php | 16 ++++++++++++++-- twe/func_process.php | 14 +++----------- twe/j_msgsubmit.php | 43 +++++++++++-------------------------------- twe/process_war.php | 18 +++++++++++------- twe/turn.php | 2 +- 5 files changed, 40 insertions(+), 53 deletions(-) diff --git a/twe/func_message.php b/twe/func_message.php index 7f8f8c51..d9ddf040 100644 --- a/twe/func_message.php +++ b/twe/func_message.php @@ -105,6 +105,15 @@ function getMessage($msgType, $nationID=null, $limit=30, $fromSeq=NULL){ function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption){ + $srcNation = getNationStaticInfo($src['nation_id']); + $destNation = getNationStaticInfo($dest['nation_id']); + + $src['nation'] = util::array_get($srcNation['name'], '재야'); + $src['color'] = util::array_get($srcNation['color'], '#ffffff'); + + $dest['nation'] = util::array_get($destNation['name'], '재야'); + $dest['color'] = util::array_get($destNation['color'], '#ffffff'); + if(!$isSender && $mailBox < 9000){ //TODO:newmsg보단 lastmsg로 datetime을 넣는게 더 나아보임 getDB()->update('general', array( @@ -181,10 +190,13 @@ function sendScoutMsg($src, $dest, $date) { //$msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption - if(!$src || !$src['id'] || !$src['nation_id'] || !$src['nation']){ + if(!$src || !$src['id'] || !$src['nation_id']){ return false; } + $nation = getNationStaticInfo($src['nation_id']); + $nationName = util::array_get($nation['name'], '재야'); + if(!$dest || !$dest['id']){ return false; } @@ -195,7 +207,7 @@ function sendScoutMsg($src, $dest, $date) { ]; $msg = "{$src['nation']}(으)로 망명 권유 서신"; - $validUntil = "9999-12-31 23:59:59";//등용장의 시간 제한 없음 + $validUntil = "9999-12-31 12:59:59";//등용장의 시간 제한 없음 sendRawMessage('private', false, $dest['id'], $src, $dest, $msg, $date, $validUntil, $option); diff --git a/twe/func_process.php b/twe/func_process.php index 2a7e71e5..00eba11c 100644 --- a/twe/func_process.php +++ b/twe/func_process.php @@ -1406,22 +1406,14 @@ function process_22($connect, &$general) { // 성격 보정 $exp = CharExperience($exp, $general['personal']); $ded = CharDedication($ded, $general['personal']); - - $myNation = getNationStaticInfo($general['nation']); - $youNation = getNationStaticInfo($you['nation']); - + sendScoutMsg([ 'id' => $general['no'], - 'nation_id' => util::array_get($myNation['nation'], 0), - 'nation' => util::array_get($myNation['name'], '재야'), - 'color' => util::array_get($myNation['color'], '#ffffff') + 'nation_id' => util::array_get($general['nation'], 0) ],[ 'id' => $you['no'], - 'nation_id' => util::array_get($youNation['nation'], 0), - 'nation' => util::array_get($youNation['name'], '재야'), - 'color' => util::array_get($youNation['color'], '#ffffff') + 'nation_id' => util::array_get($you['nation'], 0) ],$date); - //sendScoutMsg($connect, $general['no'], $nation['name'], $who, $you['msgindex']); $general['intel2']++; $query = "update general set resturn='SUCCESS',gold=gold-'$cost',intel2='{$general['intel2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'"; diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index 9f610f92..34af8391 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -54,7 +54,7 @@ if(getBlockLevel() == 1 || getBlockLevel() == 3) { $conlimit = $db->queryFirstField('select conlimit from game where no=1'); -$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`msgindex`,`userlevel`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', getUserID()); +$me = $db->queryFirstRow('select `no`,`name`,`nation`,`level`,`userlevel`,`con`,`picture`,`imgsvr` from `general` where `owner` = %i', getUserID()); if(!$me){ resetSessionGeneralValues(); @@ -91,14 +91,7 @@ $src = [ 'name' => $me['name'], 'icon' => $me['picture'], 'nation_id' => $me['nation'], - 'nation' => null ]; -if($src['nation_id'] != 0) { - $nation = getNationStaticInfo($src_nation_id); - $src['nation'] = $nation['name']; - $src['color'] = '#'.$nation['color']; - $src['color'] = str_replace('##', '#', $src['color']); //FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비 -} // 전체 메세지 if($destMailbox == 9999) { @@ -112,21 +105,15 @@ if($destMailbox == 9999) { else{ $real_nation = $dest - 9000; } - $nation = getNationStaticInfo($real_nation); - - if($nation === null || empty($nation)){ - $dest = ['nation_id' => 0]; - } - else{ - $color = '#'.$nation['color']; - $color = str_replace('##', '#', $color); - //FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비 - $dest = [ - 'nation_id' => $nation['nation'], - 'color' => $color - ]; + + if(!getNationStaticInfo($real_nation)){ + $real_nation = $me['nation_id']; } + $dest = [ + 'nation_id' => $real_nation + ]; + sendMessage('national', $src, $dest, $msg, $date); // 개인 메세지 @@ -142,7 +129,6 @@ if($destMailbox == 9999) { 'newSeq' => false ]); } - $destUser = $db->queryFirstRow('select `no`,`name`,`nation` from `general` where `no` = %s',$destMailbox); @@ -158,17 +144,10 @@ if($destMailbox == 9999) { $dest = [ 'id' => $destMailbox, - 'name' => $dest_user['name'] + 'name' => $dest_user['name'], + 'nation_id' => $dest_user['nation'] ]; - $destNation = getNationStaticInfo($dest_user['nation']); - if($destNation){ - $color = $destNation['color']; - $color = str_replace('##', '#', $color); - //FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비 - $dest['color'] = $color; - $dest['nation'] = $destNation['name']; - $dest['nation_id'] = $destNation['nation']; - } + sendMessage('private', $src, $dest, $msg, $date); } else{ diff --git a/twe/process_war.php b/twe/process_war.php index 8b464d17..6fb66879 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -1688,11 +1688,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $citycount = MYDB_num_rows($result); // 국가 멸망시 + //TODO: 국가 멸망 코드를 별도로 작성 if($citycount == 1 && $city['nation'] != 0) { - $query = "select nation,name,history,tech,type from nation where nation='{$nation['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); - $query = "select nation,name,gold,rice from nation where nation='{$city['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $losenation = MYDB_fetch_array($result); @@ -1712,7 +1709,7 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $loseGeneralGold = 0; $loseGeneralRice = 0; //멸망국 장수들 역사 기록 및 로그 전달 - $query = "select no,name,nation,npc,gold,rice,history,msgindex from general where nation='{$city['nation']}'"; + $query = "select no,name,nation,npc,gold,rice,history from general where nation='{$city['nation']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gencount = MYDB_num_rows($result); $genlog[0] = "{$losenation['name']}(이)가 멸망했습니다."; @@ -1738,8 +1735,15 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { || $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족" || $nation['name'] == "왜족") { //등용장 미발부 - } elseif(rand() % 100 < 50) { - sendScoutMsg($connect, $ruler['no'], $nation['name'], $gen['no'], $gen['msgindex']); + } elseif(randBool(0.5)) { + sendScoutMsg([ + 'id' => $ruler['no'], + 'nation_id' => $ruler['nation'] + ],[ + 'id' => $gen['no'], + 'nation_id' => $gen['nation'] + ],$general['turntime']); + //TODO: msgindex 사용하는 코드 모두 제거 } //NPC인 경우 10% 확률로 임관(엔장, 인재, 의병) diff --git a/twe/turn.php b/twe/turn.php index 0f1e8f04..909c1ad1 100644 --- a/twe/turn.php +++ b/twe/turn.php @@ -12,7 +12,7 @@ $query = "select conlimit from game where no=1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $admin = MYDB_fetch_array($result); -$query = "select no,name,nation,msgindex,userlevel,con from general where owner='{$_SESSION['noMember']}'"; +$query = "select no,name,nation,userlevel,con from general where owner='{$_SESSION['noMember']}'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $me = MYDB_fetch_array($result);