이전 외교 메시지를 불러 올 수 있음

This commit is contained in:
2019-01-25 01:39:45 +09:00
parent bc31b49b99
commit 89fad9ada7
3 changed files with 15 additions and 3 deletions
+11 -3
View File
@@ -16,7 +16,7 @@ if($reqTo === null){
'reason'=>'올바르지 않은 범위 입니다.'
]);
}
if($reqType === null || !in_array($reqType, ['private', 'public', 'national'])){
if($reqType === null || !in_array($reqType, ['private', 'public', 'national', 'diplomacy'])){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 타입입니다.'
@@ -95,13 +95,21 @@ else if($reqType == 'public'){
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, $reqTo, 20));
}
else{
else if($reqType == 'national'){
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 40));
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 20));
}
else{
$result['diplomacy'] = array_map(function(Message $msg)use (&$nextSequence){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, $reqTo, 20));
}
Json::die($result);
+1
View File
@@ -29,6 +29,7 @@ var minMsgSeq = {
'private':0x7fffffff,
'public':0x7fffffff,
'national':0x7fffffff,
'diplomacy':0x7fffffff,
}
var generalList = {};
+3
View File
@@ -366,6 +366,9 @@ class Message
if($this->msgType === self::MSGTYPE_NATIONAL && $this->src->nationID !== $this->dest->nationID){
return $this->sendRaw($this->src->nationID + self::MAILBOX_NATIONAL);
}
if($this->msgType === self::MSGTYPE_DIPLOMACY && !key_exists('action', $this->msgOption)){
return $this->sendRaw($this->src->nationID + self::MAILBOX_NATIONAL);
}
return [0, 0];
}