메시지 관련 버그 우회

This commit is contained in:
2018-04-17 01:55:12 +09:00
parent 7ef3f0d5c5
commit 8c21eec168
6 changed files with 54 additions and 31 deletions
+2 -2
View File
@@ -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',
+3 -2
View File
@@ -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% 확률로 임관(엔장, 인재, 의병)
+14 -14
View File
@@ -1597,22 +1597,22 @@ function command_46($turn, $command) {
?>
</select>
성향 : <select name=third size=1>
<option value=1 style=background-color:black;color:white;>".getNationType(1)."</option>
<option value=2 style=background-color:black;color:white;>".getNationType(2)."</option>
<option value=10 style=background-color:black;color:white;>".getNationType(10)."</option>
<option value=3 style=background-color:black;color:white;>".getNationType(3)."</option>
<option value=4 style=background-color:black;color:white;>".getNationType(4)."</option>
<option value=5 style=background-color:black;color:white;>".getNationType(5)."</option>
<option value=6 style=background-color:black;color:white;>".getNationType(6)."</option>
<option value=7 style=background-color:black;color:white;>".getNationType(7)."</option>
<option value=8 style=background-color:black;color:white;>".getNationType(8)."</option>
<option selected value=9 style=background-color:black;color:white;>".getNationType(9)."</option>
<option value=11 style=background-color:black;color:white;>".getNationType(11)."</option>
<option value=12 style=background-color:black;color:white;>".getNationType(12)."</option>
<option value=13 style=background-color:black;color:white;>".getNationType(13)."</option>
<option value=1 style=background-color:black;color:white;><?=getNationType(1)?></option>
<option value=2 style=background-color:black;color:white;><?=getNationType(2)?></option>
<option value=10 style=background-color:black;color:white;><?=getNationType(10)?></option>
<option value=3 style=background-color:black;color:white;><?=getNationType(3)?></option>
<option value=4 style=background-color:black;color:white;><?=getNationType(4)?></option>
<option value=5 style=background-color:black;color:white;><?=getNationType(5)?></option>
<option value=6 style=background-color:black;color:white;><?=getNationType(6)?></option>
<option value=7 style=background-color:black;color:white;><?=getNationType(7)?></option>
<option value=8 style=background-color:black;color:white;><?=getNationType(8)?></option>
<option selected value=9 style=background-color:black;color:white;><?=getNationType(9)?></option>
<option value=11 style=background-color:black;color:white;><?=getNationType(11)?></option>
<option value=12 style=background-color:black;color:white;><?=getNationType(12)?></option>
<option value=13 style=background-color:black;color:white;><?=getNationType(13)?></option>
</select>
<input type=submit value=건국>
<input type=hidden name=command value=$command>
<input type=hidden name=command value=<?=$command?>>
<?php
for($i=0; $i < count($turn); $i++) {
echo "<input type=hidden name=turn[] value=$turn[$i]>";
+29 -8
View File
@@ -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], ["<C>●</>{$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], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
+3 -3
View File
@@ -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);
}
}
+3 -2
View File
@@ -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();
?>