외교부 추가
This commit is contained in:
@@ -16,9 +16,9 @@ $reason = Util::getReq('reason', 'string', '');
|
||||
|
||||
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
@@ -35,7 +35,6 @@ if($letterNo === null){
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 4) {
|
||||
Json::die([
|
||||
@@ -55,9 +54,21 @@ if(!$letter){
|
||||
}
|
||||
|
||||
$aux = Json::decode($letter['aux']);
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$srcNation = getNationStaticInfo($letter['src_nation_id']);
|
||||
$destNation = getNationStaticInfo($letter['dest_nation_id']);
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $destNation['nation'], $destNation['name'], $destNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $srcNation['nation'], $srcNation['name'], $srcNation['color']);
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
if($isAgree){
|
||||
$aux['dest']['generalName'] = $me['name'];
|
||||
$aux['dest']['generalIcon'] = $me['icon'];
|
||||
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'activated',
|
||||
'dest_signer'=>$me['no'],
|
||||
@@ -70,6 +81,7 @@ if($isAgree){
|
||||
'state'=>'replaced',
|
||||
], 'no=%i', $letter['prev_no']);
|
||||
}
|
||||
$msgText = "외교 서신 #{$letterNo}가 승인되었습니다.";
|
||||
}
|
||||
else{
|
||||
$aux['reason'] = [
|
||||
@@ -81,9 +93,23 @@ else{
|
||||
'state'=>'cancelled',
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
//TODO: 외교 서신에 대한 메시지를 양국에 발송해야함
|
||||
$msgText = "외교 서신 #{$letterNo}가 거부되었습니다.";
|
||||
if($reason){
|
||||
$msgText .= ' 이유 : '.$reason;
|
||||
}
|
||||
}
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
|
||||
Reference in New Issue
Block a user