From 8c21eec168a6bf8c004101b2e5b1462129e1e4d5 Mon Sep 17 00:00:00 2001 From: hide_d Date: Tue, 17 Apr 2018 01:55:12 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EB=B2=84=EA=B7=B8=20=EC=9A=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/js/msg.js | 4 ++-- hwe/process_war.php | 5 +++-- hwe/processing.php | 28 ++++++++++++------------- hwe/sammo/DiplomaticMessage.php | 37 ++++++++++++++++++++++++++------- hwe/sammo/Message.php | 6 +++--- hwe/select_npc.php | 5 +++-- 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/hwe/js/msg.js b/hwe/js/msg.js index cf7e689a..93bd0c00 100644 --- a/hwe/js/msg.js +++ b/hwe/js/msg.js @@ -12,7 +12,7 @@ function hexToRgb(hex) { function isBrightColor(color){ color = hexToRgb(color); - if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 186){ + if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){ return true; } else{ @@ -31,7 +31,7 @@ var generalList = {}; function responseMessage(msgID, response){ $.ajax({ - url: 'j_decide_opt.php', + url: 'j_msg_decide_opt.php', type: 'post', dataType:'json', contentType: 'application/json', diff --git a/hwe/process_war.php b/hwe/process_war.php index 761315a2..364b9555 100644 --- a/hwe/process_war.php +++ b/hwe/process_war.php @@ -1775,13 +1775,14 @@ function ConquerCity($game, $general, $city, $nation, $destnation) { || $nation['name'] == "왜족") { //등용장 미발부 } elseif(Util::randBool(0.5)) { - sendScoutMsg([ + //TODO:등용장 보낼것 + /*sendScoutMsg([ 'id' => $ruler['no'], 'nation_id' => $ruler['nation'] ],[ 'id' => $gen['no'], 'nation_id' => $gen['nation'] - ],$general['turntime']); + ],$general['turntime']);*/ } //NPC인 경우 10% 확률로 임관(엔장, 인재, 의병) diff --git a/hwe/processing.php b/hwe/processing.php index 844a4f39..8533a760 100644 --- a/hwe/processing.php +++ b/hwe/processing.php @@ -1597,22 +1597,22 @@ function command_46($turn, $command) { ?> 성향 : - +> "; diff --git a/hwe/sammo/DiplomaticMessage.php b/hwe/sammo/DiplomaticMessage.php index 3bce0a74..b4c59701 100644 --- a/hwe/sammo/DiplomaticMessage.php +++ b/hwe/sammo/DiplomaticMessage.php @@ -49,7 +49,7 @@ class DiplomaticMessage extends Message{ $this->validDiplomacy = false; } - if($this->$validUntil < (new \DateTime())){ + if($this->validUntil < (new \DateTime())){ $this->validDiplomacy = false; } } @@ -95,7 +95,7 @@ class DiplomaticMessage extends Message{ protected function cancelNA(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->cancelNA(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -117,7 +117,7 @@ class DiplomaticMessage extends Message{ protected function stopWar(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->stopWar(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -139,7 +139,7 @@ class DiplomaticMessage extends Message{ protected function acceptMerge(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->acceptMerge(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -175,7 +175,7 @@ class DiplomaticMessage extends Message{ protected function acceptSurrender(){ $helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID); - $chk = $helper->noAggression(); + $chk = $helper->acceptSurrender(); if($chk[0] !== self::ACCEPTED){ return $chk; } @@ -219,6 +219,8 @@ class DiplomaticMessage extends Message{ throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중'); } + + $db = DB::db(); $general = $db->queryFirstRow( 'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i', @@ -226,7 +228,20 @@ class DiplomaticMessage extends Message{ $this->dest->nationID ); + if(!$general){ + $this->dest->generalID = $receiverID; + $this->dest->generalName = $general['name']; + } + + list($result, $reason) = $this->checkDiplomaticMessageValidation($general); + $db->update('diplomacy', [ + 'reserved'=>'', + 'showing'=>null + ], '(me=%s AND you=%s) OR (you=%s AND me=%s)', + $this->src->nationID, $this->dest->nationID, + $this->src->nationID, $this->dest->nationID + ); if($result !== self::ACCEPTED){ pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 실패."]); if($result === self::DECLINED){ @@ -282,9 +297,9 @@ class DiplomaticMessage extends Message{ "【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.", new \DateTime(), new \DateTime('9999-12-31'), - Json::encode([ + [ 'delete'=>$this->id - ]) + ] ); $newMsg->send(); @@ -305,7 +320,13 @@ class DiplomaticMessage extends Message{ throw \RuntimeException('전송되지 않은 메시지에 거절 진행 중'); } - list($result, $reason) = $this->checkScoutMessageValidation($receiverID); + $db = DB::db(); + $general = $db->queryFirstRow( + 'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i', + $receiverID, + $this->dest->nationID + ); + list($result, $reason) = $this->checkDiplomaticMessageValidation($general); if($result === self::INVALID){ pushGenLog(['no'=>$receiverID], ["●{$reason} {$this->diplomacyName} 거절 불가."]); diff --git a/hwe/sammo/Message.php b/hwe/sammo/Message.php index 819dc8c0..793bb918 100644 --- a/hwe/sammo/Message.php +++ b/hwe/sammo/Message.php @@ -188,7 +188,7 @@ class Message { $db = DB::db(); $now = new \DateTime(); - $row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i AND ValidUntil', $messageID); + $row = $db->queryFirstRow('SELECT * FROM `message` WHERE `id` = %i AND valid_until', $messageID); if (!$row) { return null; } @@ -344,8 +344,8 @@ class Message 'text' => $this->msg, 'option' => $this->msgOption ]), - 'validUntil'=>$this->validUntil->format('Y-m-d H:i:s'), - ]); + 'valid_until'=>$this->validUntil->format('Y-m-d H:i:s'), + ], 'id=%i', $this->id); } } diff --git a/hwe/select_npc.php b/hwe/select_npc.php index d3a28d97..9fca674a 100644 --- a/hwe/select_npc.php +++ b/hwe/select_npc.php @@ -7,6 +7,7 @@ include "func.php"; $session = Session::requireLogin()->setReadOnly(); $userID = Session::getUserID(); $rootDB = RootDB::db(); +$db = DB::db(); //회원 테이블에서 정보확인 $member = $rootDB->queryFirstRow('select no,name,picture,grade from member where no=%i', $userID); @@ -17,14 +18,14 @@ if(!$member) { exit(1); } -$admin = $rootDB->queryFirstRow('select npcmode,maxgeneral,show_img_level from game limit 1'); +$admin = $db->queryFirstRow('select npcmode,maxgeneral,show_img_level from game limit 1'); if($admin['npcmode'] != 1) { header('Location:join.php'); die(); } -$db = DB::db(); + $connect=$db->get(); ?>