외교권자에게는 메시지를 보낼 수 없음
This commit is contained in:
+9
-6
@@ -395,7 +395,7 @@ function myNationInfo() {
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSecretPermission($me){
|
function checkSecretPermission($me, $checkSecretLimit=true){
|
||||||
if(!key_exists('penalty', $me) || !key_exists('permission', $me)){
|
if(!key_exists('penalty', $me) || !key_exists('permission', $me)){
|
||||||
trigger_error ('canAccessSecret() 함수에 필요한 인자가 부족');
|
trigger_error ('canAccessSecret() 함수에 필요한 인자가 부족');
|
||||||
}
|
}
|
||||||
@@ -409,15 +409,14 @@ function checkSecretPermission($me){
|
|||||||
if($me['level'] == 0){
|
if($me['level'] == 0){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$secretLimit = $db->queryFirstField('SELECT secretlimit FROM nation WHERE nation = %i', $me['nation']);
|
|
||||||
|
|
||||||
if($pernalty['noSecret']??false){
|
if($pernalty['noSecret']??false){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$secretMin = 0;
|
$secretMin = 0;
|
||||||
$secretMax = 3;
|
$secretMax = 4;
|
||||||
if($penalty['noTopSecret']??false){
|
if($penalty['noTopSecret']??false){
|
||||||
$secretMax = 1;
|
$secretMax = 1;
|
||||||
}
|
}
|
||||||
@@ -443,8 +442,12 @@ function checkSecretPermission($me){
|
|||||||
else if($me['level'] > 1){
|
else if($me['level'] > 1){
|
||||||
$secretMin = 1;
|
$secretMin = 1;
|
||||||
}
|
}
|
||||||
else if($me['belong'] >= $secretLimit){
|
else if($checkSecretLimit){
|
||||||
$secretMin = 1;
|
$db = DB::db();
|
||||||
|
$secretLimit = $db->queryFirstField('SELECT secretlimit FROM nation WHERE nation = %i', $me['nation']);
|
||||||
|
if ($me['belong'] >= $secretLimit) {
|
||||||
|
$secretMin = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return min($secretMin, $secretMax);
|
return min($secretMin, $secretMax);
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ function getMailboxList(){
|
|||||||
|
|
||||||
$generalNations = [];
|
$generalNations = [];
|
||||||
|
|
||||||
foreach(DB::db()->queryAllLists('select `no`, `name`, `nation`, `level`, `npc` from `general` where `npc` < 2') as $general)
|
foreach(DB::db()->query('select `no`, `name`, `nation`, `level`, `npc`, `permission`, `penalty` from `general` where `npc` < 2') as $general)
|
||||||
{
|
{
|
||||||
list($generalID, $generalName, $nationID, $level, $npc) = $general;
|
[$generalID, $generalName, $nationID, $level, $npc] = [$general['no'], $general['name'], $general['nation'], $general['level'], $general['npc']];
|
||||||
if(!isset($generalNations[$nationID])){
|
if(!isset($generalNations[$nationID])){
|
||||||
$generalNations[$nationID] = [];
|
$generalNations[$nationID] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = [$generalID, $generalName, 0];
|
$obj = [$generalID, $generalName, 0];
|
||||||
|
$permission = checkSecretPermission($general, false);
|
||||||
|
|
||||||
if($level == 12){
|
if($level == 12){
|
||||||
$obj[2] |= 1;
|
$obj[2] |= 1;
|
||||||
@@ -22,6 +23,10 @@ function getMailboxList(){
|
|||||||
$obj[2] |= 2;
|
$obj[2] |= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($permission == 4){
|
||||||
|
$obj[2] |= 4;
|
||||||
|
}
|
||||||
|
|
||||||
$generalNations[$nationID][] = $obj;
|
$generalNations[$nationID][] = $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +42,7 @@ function getMailboxList(){
|
|||||||
"mailbox"=>$mailbox,
|
"mailbox"=>$mailbox,
|
||||||
"name"=>$nationName,
|
"name"=>$nationName,
|
||||||
"color"=>$color,
|
"color"=>$color,
|
||||||
"general"=>$generals
|
"general"=>$generals,
|
||||||
];
|
];
|
||||||
}, array_merge([getNationStaticInfo(0)], getAllNationStaticInfo()));
|
}, array_merge([getNationStaticInfo(0)], getAllNationStaticInfo()));
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -150,8 +150,8 @@ if($mailbox > 0) {
|
|||||||
|
|
||||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||||
|
|
||||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`con`,`picture`,`imgsvr` FROM general WHERE `no`=%i',$mailbox);
|
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i',$mailbox);
|
||||||
|
|
||||||
if(!$destUser){
|
if(!$destUser){
|
||||||
Json::die([
|
Json::die([
|
||||||
'result' => false,
|
'result' => false,
|
||||||
@@ -160,6 +160,15 @@ if($mailbox > 0) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$destPermission = checkSecretPermission($destUser, false);
|
||||||
|
if($permission == 4 && $destPermission == 4){
|
||||||
|
Json::die([
|
||||||
|
'result' => false,
|
||||||
|
'reason' => '외교권자끼리는 메시지를 보낼 수 없습니다.',
|
||||||
|
'msgID' => null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$destNation = getNationStaticInfo($destUser['nation']);
|
$destNation = getNationStaticInfo($destUser['nation']);
|
||||||
|
|
||||||
$dest = new MessageTarget(
|
$dest = new MessageTarget(
|
||||||
|
|||||||
+9
-1
@@ -376,6 +376,7 @@ function refreshMailboxList(obj){
|
|||||||
var generalName = this[1];
|
var generalName = this[1];
|
||||||
var isNPC = !!(this[2] & 0x2);
|
var isNPC = !!(this[2] & 0x2);
|
||||||
var isRuler = !!(this[2] & 0x1);
|
var isRuler = !!(this[2] & 0x1);
|
||||||
|
var isAmbassador = !!(this[2] & 0x4);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -387,6 +388,9 @@ function refreshMailboxList(obj){
|
|||||||
if(isRuler){
|
if(isRuler){
|
||||||
textName = '*{0}*'.format(textName);
|
textName = '*{0}*'.format(textName);
|
||||||
}
|
}
|
||||||
|
else if(isAmbassador){
|
||||||
|
textName = '#{0}#'.format(textName);
|
||||||
|
}
|
||||||
|
|
||||||
generalList[generalID] = {
|
generalList[generalID] = {
|
||||||
id:generalID,
|
id:generalID,
|
||||||
@@ -398,6 +402,10 @@ function refreshMailboxList(obj){
|
|||||||
};
|
};
|
||||||
|
|
||||||
var $item = $('<option value="{0}">{1}</option>'.format(generalID, textName));
|
var $item = $('<option value="{0}">{1}</option>'.format(generalID, textName));
|
||||||
|
|
||||||
|
if(permissionLevel == 4 && isAmbassador){
|
||||||
|
$item.prop('disabled', true);
|
||||||
|
}
|
||||||
$optgroup.append($item);
|
$optgroup.append($item);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -460,7 +468,7 @@ function registerGlobal(basicInfo){
|
|||||||
window.myGeneralID = basicInfo.generalID;
|
window.myGeneralID = basicInfo.generalID;
|
||||||
window.isChief = basicInfo.isChief;
|
window.isChief = basicInfo.isChief;
|
||||||
window.myGeneralLevel = basicInfo.generalLevel;
|
window.myGeneralLevel = basicInfo.generalLevel;
|
||||||
window.permissionLevel = basicInfo.permissionLevel;
|
window.permissionLevel = basicInfo.permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
function activateMessageForm(){
|
function activateMessageForm(){
|
||||||
|
|||||||
Reference in New Issue
Block a user