메시지 관련 버그 우회
This commit is contained in:
+2
-2
@@ -12,7 +12,7 @@ function hexToRgb(hex) {
|
|||||||
|
|
||||||
function isBrightColor(color){
|
function isBrightColor(color){
|
||||||
color = hexToRgb(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;
|
return true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -31,7 +31,7 @@ var generalList = {};
|
|||||||
|
|
||||||
function responseMessage(msgID, response){
|
function responseMessage(msgID, response){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'j_decide_opt.php',
|
url: 'j_msg_decide_opt.php',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
|
|||||||
+3
-2
@@ -1775,13 +1775,14 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
|||||||
|| $nation['name'] == "왜족") {
|
|| $nation['name'] == "왜족") {
|
||||||
//등용장 미발부
|
//등용장 미발부
|
||||||
} elseif(Util::randBool(0.5)) {
|
} elseif(Util::randBool(0.5)) {
|
||||||
sendScoutMsg([
|
//TODO:등용장 보낼것
|
||||||
|
/*sendScoutMsg([
|
||||||
'id' => $ruler['no'],
|
'id' => $ruler['no'],
|
||||||
'nation_id' => $ruler['nation']
|
'nation_id' => $ruler['nation']
|
||||||
],[
|
],[
|
||||||
'id' => $gen['no'],
|
'id' => $gen['no'],
|
||||||
'nation_id' => $gen['nation']
|
'nation_id' => $gen['nation']
|
||||||
],$general['turntime']);
|
],$general['turntime']);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
||||||
|
|||||||
+14
-14
@@ -1597,22 +1597,22 @@ function command_46($turn, $command) {
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
성향 : <select name=third size=1>
|
성향 : <select name=third size=1>
|
||||||
<option value=1 style=background-color:black;color:white;>".getNationType(1)."</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=2 style=background-color:black;color:white;><?=getNationType(2)?></option>
|
||||||
<option value=10 style=background-color:black;color:white;>".getNationType(10)."</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=3 style=background-color:black;color:white;><?=getNationType(3)?></option>
|
||||||
<option value=4 style=background-color:black;color:white;>".getNationType(4)."</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=5 style=background-color:black;color:white;><?=getNationType(5)?></option>
|
||||||
<option value=6 style=background-color:black;color:white;>".getNationType(6)."</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=7 style=background-color:black;color:white;><?=getNationType(7)?></option>
|
||||||
<option value=8 style=background-color:black;color:white;>".getNationType(8)."</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 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=11 style=background-color:black;color:white;><?=getNationType(11)?></option>
|
||||||
<option value=12 style=background-color:black;color:white;>".getNationType(12)."</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=13 style=background-color:black;color:white;><?=getNationType(13)?></option>
|
||||||
</select>
|
</select>
|
||||||
<input type=submit value=건국>
|
<input type=submit value=건국>
|
||||||
<input type=hidden name=command value=$command>
|
<input type=hidden name=command value=<?=$command?>>
|
||||||
<?php
|
<?php
|
||||||
for($i=0; $i < count($turn); $i++) {
|
for($i=0; $i < count($turn); $i++) {
|
||||||
echo "<input type=hidden name=turn[] value=$turn[$i]>";
|
echo "<input type=hidden name=turn[] value=$turn[$i]>";
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class DiplomaticMessage extends Message{
|
|||||||
$this->validDiplomacy = false;
|
$this->validDiplomacy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->$validUntil < (new \DateTime())){
|
if($this->validUntil < (new \DateTime())){
|
||||||
$this->validDiplomacy = false;
|
$this->validDiplomacy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ class DiplomaticMessage extends Message{
|
|||||||
|
|
||||||
protected function cancelNA(){
|
protected function cancelNA(){
|
||||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||||
$chk = $helper->noAggression();
|
$chk = $helper->cancelNA();
|
||||||
if($chk[0] !== self::ACCEPTED){
|
if($chk[0] !== self::ACCEPTED){
|
||||||
return $chk;
|
return $chk;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ class DiplomaticMessage extends Message{
|
|||||||
|
|
||||||
protected function stopWar(){
|
protected function stopWar(){
|
||||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||||
$chk = $helper->noAggression();
|
$chk = $helper->stopWar();
|
||||||
if($chk[0] !== self::ACCEPTED){
|
if($chk[0] !== self::ACCEPTED){
|
||||||
return $chk;
|
return $chk;
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ class DiplomaticMessage extends Message{
|
|||||||
|
|
||||||
protected function acceptMerge(){
|
protected function acceptMerge(){
|
||||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||||
$chk = $helper->noAggression();
|
$chk = $helper->acceptMerge();
|
||||||
if($chk[0] !== self::ACCEPTED){
|
if($chk[0] !== self::ACCEPTED){
|
||||||
return $chk;
|
return $chk;
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ class DiplomaticMessage extends Message{
|
|||||||
|
|
||||||
protected function acceptSurrender(){
|
protected function acceptSurrender(){
|
||||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||||
$chk = $helper->noAggression();
|
$chk = $helper->acceptSurrender();
|
||||||
if($chk[0] !== self::ACCEPTED){
|
if($chk[0] !== self::ACCEPTED){
|
||||||
return $chk;
|
return $chk;
|
||||||
}
|
}
|
||||||
@@ -219,6 +219,8 @@ class DiplomaticMessage extends Message{
|
|||||||
throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중');
|
throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$general = $db->queryFirstRow(
|
$general = $db->queryFirstRow(
|
||||||
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
||||||
@@ -226,7 +228,20 @@ class DiplomaticMessage extends Message{
|
|||||||
$this->dest->nationID
|
$this->dest->nationID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(!$general){
|
||||||
|
$this->dest->generalID = $receiverID;
|
||||||
|
$this->dest->generalName = $general['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
list($result, $reason) = $this->checkDiplomaticMessageValidation($general);
|
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){
|
if($result !== self::ACCEPTED){
|
||||||
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||||
if($result === self::DECLINED){
|
if($result === self::DECLINED){
|
||||||
@@ -282,9 +297,9 @@ class DiplomaticMessage extends Message{
|
|||||||
"【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.",
|
"【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.",
|
||||||
new \DateTime(),
|
new \DateTime(),
|
||||||
new \DateTime('9999-12-31'),
|
new \DateTime('9999-12-31'),
|
||||||
Json::encode([
|
[
|
||||||
'delete'=>$this->id
|
'delete'=>$this->id
|
||||||
])
|
]
|
||||||
);
|
);
|
||||||
$newMsg->send();
|
$newMsg->send();
|
||||||
|
|
||||||
@@ -305,7 +320,13 @@ class DiplomaticMessage extends Message{
|
|||||||
throw \RuntimeException('전송되지 않은 메시지에 거절 진행 중');
|
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){
|
if($result === self::INVALID){
|
||||||
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ class Message
|
|||||||
{
|
{
|
||||||
$db = DB::db();
|
$db = DB::db();
|
||||||
$now = new \DateTime();
|
$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) {
|
if (!$row) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -344,8 +344,8 @@ class Message
|
|||||||
'text' => $this->msg,
|
'text' => $this->msg,
|
||||||
'option' => $this->msgOption
|
'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
@@ -7,6 +7,7 @@ include "func.php";
|
|||||||
$session = Session::requireLogin()->setReadOnly();
|
$session = Session::requireLogin()->setReadOnly();
|
||||||
$userID = Session::getUserID();
|
$userID = Session::getUserID();
|
||||||
$rootDB = RootDB::db();
|
$rootDB = RootDB::db();
|
||||||
|
$db = DB::db();
|
||||||
|
|
||||||
//회원 테이블에서 정보확인
|
//회원 테이블에서 정보확인
|
||||||
$member = $rootDB->queryFirstRow('select no,name,picture,grade from member where no=%i', $userID);
|
$member = $rootDB->queryFirstRow('select no,name,picture,grade from member where no=%i', $userID);
|
||||||
@@ -17,14 +18,14 @@ if(!$member) {
|
|||||||
exit(1);
|
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) {
|
if($admin['npcmode'] != 1) {
|
||||||
header('Location:join.php');
|
header('Location:join.php');
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = DB::db();
|
|
||||||
$connect=$db->get();
|
$connect=$db->get();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Reference in New Issue
Block a user