메시지 전송 시스템을 새 시스템에 맞게 수정
국가의 기본 정보를 중복 쿼리 없이 받아오는 함수 추가 - 해당 함수를 위해 국가색, 건국 등의 국가 정보가 바뀌는 경우 refresh 새 메시지 시스템 적용을 위해 메인 페이지 틀 변경
This commit is contained in:
@@ -234,6 +234,7 @@ switch($btn) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "메세지 전달":
|
case "메세지 전달":
|
||||||
|
//TODO:새 갠메 시스템으로 변경
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
for($i=0; $i < sizeof($genlist); $i++) {
|
for($i=0; $i < sizeof($genlist); $i++) {
|
||||||
$query = "select msgindex from general where no='$genlist[$i]'";
|
$query = "select msgindex from general where no='$genlist[$i]'";
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ switch($btn) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "메세지 전달":
|
case "메세지 전달":
|
||||||
|
//TODO:새 갠메 시스템으로 변경
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
for($i=0; $i < sizeof($genlist); $i++) {
|
for($i=0; $i < sizeof($genlist); $i++) {
|
||||||
$query = "select msgindex from general where no='$genlist[$i]'";
|
$query = "select msgindex from general where no='$genlist[$i]'";
|
||||||
|
|||||||
@@ -50,16 +50,10 @@ switch($btn) {
|
|||||||
getDB()->query('update general set turn0=0,killturn=0,turntime=%s where no IN %li',$date, $genlist);
|
getDB()->query('update general set turn0=0,killturn=0,turntime=%s where no IN %li',$date, $genlist);
|
||||||
break;
|
break;
|
||||||
case "메세지 전달":
|
case "메세지 전달":
|
||||||
|
//TODO:새 갠메 시스템으로 변경
|
||||||
$date = date('Y-m-d H:i:s');
|
$date = date('Y-m-d H:i:s');
|
||||||
|
$msg;
|
||||||
for($i=0; $i < sizeof($genlist); $i++) {
|
for($i=0; $i < sizeof($genlist); $i++) {
|
||||||
$query = "select msgindex from general where no='$genlist[$i]'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$you = MYDB_fetch_array($result);
|
|
||||||
// 상대에게 발송
|
|
||||||
$you['msgindex']++;
|
|
||||||
if($you['msgindex'] >= 10) { $you['msgindex'] = 0; }
|
|
||||||
$query = "update general set msgindex='{$you['msgindex']}',msg{$you['msgindex']}_type=10,msg{$you['msgindex']}='$msg',msg{$you['msgindex']}_who='$genlist[$i]'+10000,msg{$you['msgindex']}_when='$date',newmsg=1 where no='$genlist[$i]'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,139 +0,0 @@
|
|||||||
<?php
|
|
||||||
include "lib.php";
|
|
||||||
include "func.php";
|
|
||||||
// $msg, $genlist
|
|
||||||
|
|
||||||
//로그인 검사
|
|
||||||
CheckLogin(1);
|
|
||||||
$connect = dbConn();
|
|
||||||
increaseRefresh($connect, "서신전달", 1);
|
|
||||||
|
|
||||||
if(getBlockLevel() == 1 || getBlockLevel() == 3) {
|
|
||||||
$msg = "";
|
|
||||||
$genlist = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = "select conlimit from game where no=1";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$admin = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$query = "select no,name,nation,level,msgindex,userlevel,con,picture,imgsvr from general where owner='{$_SESSION['noMember']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$me = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$con = checkLimit($me['userlevel'], $me['con'], $admin['conlimit']);
|
|
||||||
if($con >= 2) {
|
|
||||||
//echo "<script>window.top.main.location.replace('index.php');</script>"; exit();
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode([
|
|
||||||
'result' => false,
|
|
||||||
'reason' => '권한이 충분하지 않습니다.',
|
|
||||||
'redirect' => 'index.php',
|
|
||||||
'page_target' => 'top'
|
|
||||||
]);
|
|
||||||
echo 'index.php';//TODO:debug all and replace
|
|
||||||
}
|
|
||||||
|
|
||||||
$msg = str_replace("|", "", $msg);
|
|
||||||
$msg = trim($msg);
|
|
||||||
|
|
||||||
//TODO : 몰라서 임시로 값 세팅해봄. 추후에 용도를 확인하고 수정 필요
|
|
||||||
$s = 50;
|
|
||||||
$msg = _String::SubStrForWidth($msg, $s, 198);
|
|
||||||
|
|
||||||
$date = date('Y-m-d H:i:s');
|
|
||||||
|
|
||||||
// 전체 메세지
|
|
||||||
if($genlist == 9999 && str_replace(" ", "", $msg) != "") {
|
|
||||||
echo '<script>console.log('.$me['nation'].')</script>';
|
|
||||||
if($me['nation'] == 0) {
|
|
||||||
$nation['name'] = '재야';
|
|
||||||
$nation['color'] = 'FFFFFF';
|
|
||||||
} else {
|
|
||||||
$query = "select nation,name,color from nation where nation='{$me['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
}
|
|
||||||
PushMsg(1, 0, $me['picture'], $me['imgsvr'], "{$me['name']}:", $nation['color'], $nation['name'], $nation['color'], $msg);
|
|
||||||
// 국가 메세지
|
|
||||||
} elseif($genlist >= 9000 && $msg != "") {
|
|
||||||
if($me['nation'] == 0) {
|
|
||||||
$nation['name'] = '재야';
|
|
||||||
$nation['color'] = 'FFFFFF';
|
|
||||||
$nation['nation'] = 0;
|
|
||||||
} else {
|
|
||||||
$query = "select nation,name,color from nation where nation='{$me['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
$genlist -= 9000;
|
|
||||||
$query = "select nation,name,color from nation where nation='$genlist'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$dest = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
//$dest가 없다는건 수신도 재야.
|
|
||||||
if(empty($dest)){
|
|
||||||
$dest['name'] = '재야';
|
|
||||||
$dest['color'] = 'FFFFFF';
|
|
||||||
$dest['nation'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($nation['nation'] == $dest['nation']) {
|
|
||||||
PushMsg(2, $nation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:", $nation['color'], $dest['name'], $dest['color'], $msg);
|
|
||||||
} else {
|
|
||||||
//타국에 보내는 경우
|
|
||||||
PushMsg(2, $nation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$nation['name']}▶", $nation['color'], $dest['name'], $dest['color'], $msg);
|
|
||||||
// 수뇌이면 발송, 아니면 자국으로 돌림
|
|
||||||
if($me['level'] >= 5) {
|
|
||||||
PushMsg(3, $dest['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$nation['name']}▶", $nation['color'], $dest['name'], $dest['color'], $msg);
|
|
||||||
} else {
|
|
||||||
PushMsg(2, $nation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$nation['name']}▶", $nation['color'], $dest['name'], $dest['color'], "반송");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 개인 메세지
|
|
||||||
} elseif($genlist > 0 && $msg != "") {
|
|
||||||
$query = "select name,msgindex from general where no='$genlist'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$you = MYDB_fetch_array($result);
|
|
||||||
//발신, 수신인 코딩
|
|
||||||
$who = $me['no'] * 10000 + $genlist;
|
|
||||||
|
|
||||||
$msg = addslashes(SQ2DQ($msg));
|
|
||||||
|
|
||||||
$query = "select msg{$me['msgindex']}_when as priv_when from general where no='{$me['no']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$prev_msg = MYDB_fetch_array($result);
|
|
||||||
$diff_second = strtotime($date) - strtotime($prev_msg['priv_when']);
|
|
||||||
|
|
||||||
if($diff_second < 3) {
|
|
||||||
$who = 1 * 10000 + $me['no']; // 운영자가 본인에게
|
|
||||||
$msg = "개인메세지는 3초당 1건만 보낼 수 있습니다!";
|
|
||||||
//자신에게 표시
|
|
||||||
$me['msgindex']++;
|
|
||||||
if($me['msgindex'] >= 10) { $me['msgindex'] = 0; }
|
|
||||||
$query = "update general set msgindex='{$me['msgindex']}',msg{$me['msgindex']}='$msg',msg{$me['msgindex']}_type='10',msg{$me['msgindex']}_who='$who',msg{$me['msgindex']}_when='$date',newmsg=1 where no='{$me['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
} else {
|
|
||||||
//자신에게 표시
|
|
||||||
$me['msgindex']++;
|
|
||||||
if($me['msgindex'] >= 10) { $me['msgindex'] = 0; }
|
|
||||||
$query = "update general set msgindex='{$me['msgindex']}',msg{$me['msgindex']}='$msg',msg{$me['msgindex']}_type='9',msg{$me['msgindex']}_who='$who',msg{$me['msgindex']}_when='$date' where no='{$me['no']}'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
|
|
||||||
// 상대에게 발송
|
|
||||||
$you['msgindex']++;
|
|
||||||
if($you['msgindex'] >= 10) { $you['msgindex'] = 0; }
|
|
||||||
$query = "update general set msgindex='{$you['msgindex']}',msg{$you['msgindex']}='$msg',msg{$you['msgindex']}_type='10',msg{$you['msgindex']}_who='$who',msg{$you['msgindex']}_when='$date',newmsg=1 where no='$genlist'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
$fp = fopen("logs/_gen_msg.txt", "a");
|
|
||||||
//로그 파일에 기록
|
|
||||||
fwrite($fp, _String::Fill($me['name'],12," ")." > "._String::Fill($you['name'],12," ")." | {$msg}\n");
|
|
||||||
fclose($fp);
|
|
||||||
}
|
|
||||||
|
|
||||||
//echo "<script>location.replace('msglist.php');</script>";
|
|
||||||
echo 'msglist.php';//TODO:debug all and replace
|
|
||||||
|
|
||||||
@@ -199,6 +199,8 @@ $history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<
|
|||||||
$history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【이벤트】</b></>이민족의 기세는 그 누구도 막을 수 없을듯 합니다!";
|
$history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【이벤트】</b></>이민족의 기세는 그 누구도 막을 수 없을듯 합니다!";
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
|
|
||||||
echo "<script>location.replace('./');</script>";
|
echo "<script>location.replace('./');</script>";
|
||||||
|
|
||||||
function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$power,$intel,$personal,$special,$msg="") {
|
function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$power,$intel,$personal,$special,$msg="") {
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ $history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<
|
|||||||
$history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【이벤트】</b></>그러나 중원의 영웅들이라면 막아낼 수도 있을법 해 보입니다!";
|
$history[count($history)] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<L><b>【이벤트】</b></>그러나 중원의 영웅들이라면 막아낼 수도 있을법 해 보입니다!";
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
|
|
||||||
echo "<script>location.replace('./');</script>";
|
echo "<script>location.replace('./');</script>";
|
||||||
|
|
||||||
function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$power,$intel,$personal,$special,$msg="") {
|
function RegGeneral3($connect,$turnterm,$gencount,$nation,$level,$name,$leader,$power,$intel,$personal,$special,$msg="") {
|
||||||
|
|||||||
+35
-16
@@ -139,6 +139,40 @@ function getGeneralName($forceExit=false)
|
|||||||
return $generalName;
|
return $generalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 수도)를 반환해줌
|
||||||
|
*
|
||||||
|
* @param int|null $nationID 국가 코드
|
||||||
|
* @param bool $forceRefresh 강제 갱신 여부
|
||||||
|
*
|
||||||
|
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
|
||||||
|
*/
|
||||||
|
function getNationStaticInfo($nationID, $forceRefresh=false)
|
||||||
|
{
|
||||||
|
static $nationList = null;
|
||||||
|
|
||||||
|
if ($forceRefresh) {
|
||||||
|
$nationList = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($nationID === null || $nationID == 0){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($nationList === null){
|
||||||
|
$nationList = ArrayToDict(
|
||||||
|
getDB()->query("select nation, name, color, type, capital from nation"),
|
||||||
|
"nation");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($nationList[$nationID])){
|
||||||
|
return $nationList[$nationID];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function GetImageURL($imgsvr) {
|
function GetImageURL($imgsvr) {
|
||||||
global $image, $image1;
|
global $image, $image1;
|
||||||
if($imgsvr == 0) {
|
if($imgsvr == 0) {
|
||||||
@@ -293,7 +327,6 @@ function getTurn($connect, $general, $type, $font=1) {
|
|||||||
$str[$i] = "【{$city['name']}】(으)로 이동";
|
$str[$i] = "【{$city['name']}】(으)로 이동";
|
||||||
break;
|
break;
|
||||||
case 22: //등용
|
case 22: //등용
|
||||||
//TODO:등용장 재디자인
|
|
||||||
$double = $command[1];
|
$double = $command[1];
|
||||||
|
|
||||||
$query = "select name from general where no='$double'";
|
$query = "select name from general where no='$double'";
|
||||||
@@ -3724,6 +3757,7 @@ function deleteNation($connect, $general) {
|
|||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
|
getNationStaticInfo(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextRuler($connect, $general) {
|
function nextRuler($connect, $general) {
|
||||||
@@ -4040,21 +4074,6 @@ function getRandTurn2($term) {
|
|||||||
return $turntime;
|
return $turntime;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ScoutMsg($connect, $genNum, $nationName, $who, $msgIndex) {
|
|
||||||
return;
|
|
||||||
//TODO: 등용장 재 디자인.
|
|
||||||
//xxx: 일단 껐음
|
|
||||||
// 상대에게 발송
|
|
||||||
$msgIndex++;
|
|
||||||
if($msgIndex >= 10) { $msgIndex = 0; }
|
|
||||||
|
|
||||||
$date = date('Y-m-d H:i:s');
|
|
||||||
//등용 서신시 장수번호/내 번호
|
|
||||||
$me = $genNum * 10000 + $who;
|
|
||||||
$query = "update general set msgindex='$msgIndex',msg{$msgIndex}='{$nationName}(으)로 망명 권유 서신',msg{$msgIndex}_who='$me',msg{$msgIndex}_when='$date',msg{$msgIndex}_type='11' where no='$who'";
|
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
}
|
|
||||||
|
|
||||||
function command_Single($connect, $turn, $command) {
|
function command_Single($connect, $turn, $command) {
|
||||||
$command = EncodeCommand(0, 0, 0, $command);
|
$command = EncodeCommand(0, 0, 0, $command);
|
||||||
|
|
||||||
|
|||||||
@@ -867,6 +867,8 @@ function checkMerge($connect) {
|
|||||||
unset($mylog);
|
unset($mylog);
|
||||||
unset($youlog);
|
unset($youlog);
|
||||||
unset($history);
|
unset($history);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -985,6 +987,8 @@ function checkSurrender($connect) {
|
|||||||
unset($mylog);
|
unset($mylog);
|
||||||
unset($youlog);
|
unset($youlog);
|
||||||
unset($history);
|
unset($history);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+36
-25
@@ -98,6 +98,13 @@ function getMessage($msgType, $limit=30, $fromTime=NULL){
|
|||||||
|
|
||||||
function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption){
|
function sendRawMessage($msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption){
|
||||||
|
|
||||||
|
if(!$isSender && $mailBox < 9000){
|
||||||
|
//TODO:newmsg보단 lastmsg로 datetime을 넣는게 더 나아보임
|
||||||
|
getDB()->update('general', array(
|
||||||
|
'newmsg' => true
|
||||||
|
), 'no=%i', $dest['id']);
|
||||||
|
}
|
||||||
|
|
||||||
getDB()->insert('message', array(
|
getDB()->insert('message', array(
|
||||||
'address' => $dest,
|
'address' => $dest,
|
||||||
'type' => $msgType,
|
'type' => $msgType,
|
||||||
@@ -158,8 +165,37 @@ function sendMessage($msgType, $src, $dest, $msg, $date = null, $validUntil = nu
|
|||||||
sendRawMessage($msgType, true, $srcMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
sendRawMessage($msgType, true, $srcMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
||||||
}
|
}
|
||||||
sendRawMessage($msgType, false, $destMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
sendRawMessage($msgType, false, $destMailbox, $src, $dest, $msg, $date, $validUntil, null);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sendScoutMsg($src, $dest, $date) {
|
||||||
|
|
||||||
|
//$msgType, $isSender, $mailbox, $src, $dest, $msg, $date, $validUntil, $msgOption
|
||||||
|
|
||||||
|
if(!$src || !$src['id'] || !$src['nation_id'] || !$src['nation']){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$dest || !$dest['id']){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$msgType = 'private';
|
||||||
|
$option = [
|
||||||
|
"action" => "scout"
|
||||||
|
];
|
||||||
|
|
||||||
|
$msg = "{$src['nation']}(으)로 망명 권유 서신";
|
||||||
|
$validUntil = "9999-12-31 23:59:59";//등용장의 시간 제한 없음
|
||||||
|
|
||||||
|
sendRawMessage('private', false, $dest['id'], $src, $dest, $msg, $date, $validUntil, $option);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getMailboxList(){
|
function getMailboxList(){
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
@@ -409,27 +445,6 @@ function DecodeMsg($connect, $msg, $type, $who, $date, $bg, $num=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function MsgMe($connect, $bg) {
|
|
||||||
$query = "select no,nation,msgindex,
|
|
||||||
msg0,msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9,
|
|
||||||
msg0_type,msg1_type,msg2_type,msg3_type,msg4_type,msg5_type,msg6_type,msg7_type,msg8_type,msg9_type,
|
|
||||||
msg0_who,msg1_who,msg2_who,msg3_who,msg4_who,msg5_who,msg6_who,msg7_who,msg8_who,msg9_who,
|
|
||||||
msg0_when,msg1_when,msg2_when,msg3_when,msg4_when,msg5_when,msg6_when,msg7_when,msg8_when,msg9_when
|
|
||||||
from general where owner='{$_SESSION['noMember']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$me = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$index = $me['msgindex'];
|
|
||||||
for($i=0; $i < 10; $i++) {
|
|
||||||
if($me["msg{$index}"]) { echo "\n"; DecodeMsg($connect, $me["msg{$index}"], $me["msg{$index}_type"], $me["msg{$index}_who"], $me["msg{$index}_when"], $bg, $index); }
|
|
||||||
$index--;
|
|
||||||
if($index < 0) { $index = 9; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function moveMsg($connect, $table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $value) {
|
function moveMsg($connect, $table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $value) {
|
||||||
//TODO: moveMsg 쓰는 곳 모두 고쳐!!!
|
//TODO: moveMsg 쓰는 곳 모두 고쳐!!!
|
||||||
$query = "update {$table} set {$msgtype}{$msgnum}='$msg',{$msgtype}{$msgnum}_type='$type',{$msgtype}{$msgnum}_who='$who',{$msgtype}{$msgnum}_when='$when' where {$column}='$value'";
|
$query = "update {$table} set {$msgtype}{$msgnum}='$msg',{$msgtype}{$msgnum}_type='$type',{$msgtype}{$msgnum}_who='$who',{$msgtype}{$msgnum}_when='$when' where {$column}='$value'";
|
||||||
@@ -452,10 +467,6 @@ function MsgDip($connect, $bg) {
|
|||||||
if($nation['dip4']) { echo "\n"; DecodeMsg($connect, $nation['dip4'], $nation['dip4_type'], $nation['dip4_who'], $nation['dip4_when'], $bg, 4); }
|
if($nation['dip4']) { echo "\n"; DecodeMsg($connect, $nation['dip4'], $nation['dip4_type'], $nation['dip4_who'], $nation['dip4_when'], $bg, 4); }
|
||||||
}
|
}
|
||||||
|
|
||||||
function ShowMsgEx($msgType, $src, $dest, $msg, $datetime){
|
|
||||||
new League\Plates\Engine('templates');
|
|
||||||
}
|
|
||||||
|
|
||||||
function ShowMsg($skin, $bgcolor, $type, $picture, $imgsvr, $me, $mycolor, $you, $youcolor, $msg, $date, $num=0, $who=0, $when=0, $level=0, $note="") {
|
function ShowMsg($skin, $bgcolor, $type, $picture, $imgsvr, $me, $mycolor, $you, $youcolor, $msg, $date, $num=0, $who=0, $when=0, $level=0, $note="") {
|
||||||
if($msg == "") return;
|
if($msg == "") return;
|
||||||
|
|
||||||
|
|||||||
@@ -1042,6 +1042,7 @@ function RegCity($connect, $nation, $name, $cap=0) {
|
|||||||
if($cap > 0) {
|
if($cap > 0) {
|
||||||
@MYDB_query("update nation set capital='$city' where nation='$nation'",$connect) or Error(__LINE__.MYDB_error($connect),"");
|
@MYDB_query("update nation set capital='$city' where nation='$nation'",$connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
}
|
}
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Promotion($connect, $nation, $level) {
|
function Promotion($connect, $nation, $level) {
|
||||||
|
|||||||
+27
-8
@@ -1385,9 +1385,6 @@ function process_21($connect, &$general) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function process_22($connect, &$general) {
|
function process_22($connect, &$general) {
|
||||||
return;
|
|
||||||
//TODO: 등용장 재 디자인
|
|
||||||
//xxx: 일단 등용장 끔
|
|
||||||
$log = array();
|
$log = array();
|
||||||
$alllog = array();
|
$alllog = array();
|
||||||
$date = substr($general['turntime'],11,5);
|
$date = substr($general['turntime'],11,5);
|
||||||
@@ -1400,10 +1397,6 @@ function process_22($connect, &$general) {
|
|||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
$city = MYDB_fetch_array($result);
|
$city = MYDB_fetch_array($result);
|
||||||
|
|
||||||
$query = "select name from nation where nation='{$general['nation']}'";
|
|
||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
|
||||||
$nation = MYDB_fetch_array($result);
|
|
||||||
|
|
||||||
$command = DecodeCommand($general['turn0']);
|
$command = DecodeCommand($general['turn0']);
|
||||||
$who = $command[1];
|
$who = $command[1];
|
||||||
|
|
||||||
@@ -1432,7 +1425,21 @@ function process_22($connect, &$general) {
|
|||||||
$exp = CharExperience($exp, $general['personal']);
|
$exp = CharExperience($exp, $general['personal']);
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
$ded = CharDedication($ded, $general['personal']);
|
||||||
|
|
||||||
ScoutMsg($connect, $general['no'], $nation['name'], $who, $you['msgindex']);
|
$myNation = getNationStaticInfo($general['nation']);
|
||||||
|
$youNation = getNationStaticInfo($you['nation']);
|
||||||
|
|
||||||
|
sendScoutMsg([
|
||||||
|
'id' => $general['no'],
|
||||||
|
'nation_id' => util::array_get($myNation['nation'], 0),
|
||||||
|
'nation' => util::array_get($myNation['name'], '재야'),
|
||||||
|
'color' => util::array_get($myNation['color'], '#ffffff')
|
||||||
|
],[
|
||||||
|
'id' => $you['no'],
|
||||||
|
'nation_id' => util::array_get($youNation['nation'], 0),
|
||||||
|
'nation' => util::array_get($youNation['name'], '재야'),
|
||||||
|
'color' => util::array_get($youNation['color'], '#ffffff')
|
||||||
|
],$date);
|
||||||
|
//sendScoutMsg($connect, $general['no'], $nation['name'], $who, $you['msgindex']);
|
||||||
|
|
||||||
$general['intel2']++;
|
$general['intel2']++;
|
||||||
$query = "update general set resturn='SUCCESS',gold=gold-'$cost',intel2='{$general['intel2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
$query = "update general set resturn='SUCCESS',gold=gold-'$cost',intel2='{$general['intel2']}',dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||||
@@ -3691,6 +3698,8 @@ function process_46($connect, &$general) {
|
|||||||
$exp = 1000;
|
$exp = 1000;
|
||||||
$ded = 1000;
|
$ded = 1000;
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
|
|
||||||
// 성격 보정
|
// 성격 보정
|
||||||
$exp = CharExperience($exp, $general['personal']);
|
$exp = CharExperience($exp, $general['personal']);
|
||||||
$ded = CharDedication($ded, $general['personal']);
|
$ded = CharDedication($ded, $general['personal']);
|
||||||
@@ -3763,6 +3772,8 @@ function process_47($connect, &$general) {
|
|||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
pushAllLog($alllog);
|
pushAllLog($alllog);
|
||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
@@ -4390,6 +4401,8 @@ function process_55($connect, &$general) {
|
|||||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
$nationcount = MYDB_num_rows($result);
|
$nationcount = MYDB_num_rows($result);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
|
|
||||||
for($i=0; $i < $nationcount; $i++) {
|
for($i=0; $i < $nationcount; $i++) {
|
||||||
$younation = MYDB_fetch_array($result);
|
$younation = MYDB_fetch_array($result);
|
||||||
$query = "insert into diplomacy (me, you, state, term) values ('{$nation['nation']}', '{$younation['nation']}', '2', '0')";
|
$query = "insert into diplomacy (me, you, state, term) values ('{$nation['nation']}', '{$younation['nation']}', '2', '0')";
|
||||||
@@ -4446,6 +4459,8 @@ function process_56($connect, &$general) {
|
|||||||
//분쟁기록 모두 지움
|
//분쟁기록 모두 지움
|
||||||
DeleteConflict($connect, $general['nation']);
|
DeleteConflict($connect, $general['nation']);
|
||||||
deleteNation($connect, $general);
|
deleteNation($connect, $general);
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
pushAllLog($alllog);
|
pushAllLog($alllog);
|
||||||
pushGenLog($general, $log);
|
pushGenLog($general, $log);
|
||||||
@@ -4991,6 +5006,8 @@ function process_66($connect, &$general) {
|
|||||||
//경험치, 공헌치
|
//경험치, 공헌치
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
@@ -6308,6 +6325,8 @@ function process_81($connect, &$general) {
|
|||||||
//경험치, 공헌치
|
//경험치, 공헌치
|
||||||
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pushHistory($connect, $history);
|
pushHistory($connect, $history);
|
||||||
|
|||||||
+29
-8
@@ -253,18 +253,39 @@ if($me['userlevel'] >= 5) {
|
|||||||
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 style=font-size:13px;word-break:break-all; id=bg0>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=2>
|
<td colspan=2>
|
||||||
<form id="message" name="message" method="post" action="c_msgsubmit.php" target="msglist">
|
<div class="message_input_form bg0">
|
||||||
<?php genList($connect); ?>
|
<select id="mailbox_list" size="1">
|
||||||
<input type=textarea id=msg name=msg maxlength=99 style=color:white;background-color:black;font-size:13px;width:720px;>
|
|
||||||
<input type=button style=background-color:<?=$_basecolor2;?>;color:white;font-size:13px;width:100px; value='서신전달&갱신' onclick='refreshing(4,message)'>
|
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13">
|
||||||
<br>내용 없이 '서신전달&갱신'을 누르면 메세지창이 갱신됩니다.
|
</select>
|
||||||
</form>
|
<input type="textarea" id="msg_input" maxlength="99">
|
||||||
|
<button id="msg_submit">서신전달&갱신</button>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan=2><?=allButton()?></td></tr>
|
<tr><td colspan=2><?=allButton()?></td></tr>
|
||||||
<tr><td colspan=2>
|
<tr><td colspan=2>
|
||||||
<iframe id="msglist" name="msglist" src='msglist.php' width=1000 height=1375 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no>
|
<div id="message_board">
|
||||||
</iframe>
|
<div class="board_side">
|
||||||
|
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||||
|
<section class="public_message">
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||||
|
<section class="private_message">
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<div class="board_side">
|
||||||
|
<section class="diplomacy_message">
|
||||||
|
|
||||||
|
</section>
|
||||||
|
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||||
|
<section class="national_message">
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td colspan=2>
|
<tr><td colspan=2>
|
||||||
|
|
||||||
|
|||||||
+8
-16
@@ -74,13 +74,6 @@ if($con >= 2) {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: 원래는 필요없는 값이지만 예전 코드와 꼬일 수 있어 유지함.
|
|
||||||
$msg = str_replace('|', '', $msg);
|
|
||||||
|
|
||||||
//TODO: 몰라서 임시로 값 세팅해봄. 추후에 용도를 확인하고 수정 필요
|
|
||||||
//$s = 50;
|
|
||||||
//$msg = _String::SubStrForWidth($msg, $s, 198);
|
|
||||||
|
|
||||||
//SubStrForWidth는 반각은 1, 전각은 2로 측정하는듯 보이나, 대부분 글자수 단위로 카운트 하고 있어 mb_substr로 처리함.
|
//SubStrForWidth는 반각은 1, 전각은 2로 측정하는듯 보이나, 대부분 글자수 단위로 카운트 하고 있어 mb_substr로 처리함.
|
||||||
$msg = mb_substr($msg, 0, 99, 'UTF-8');
|
$msg = mb_substr($msg, 0, 99, 'UTF-8');
|
||||||
$msg = trim($msg);
|
$msg = trim($msg);
|
||||||
@@ -109,7 +102,7 @@ if($src['nation_id'] != 0) {
|
|||||||
|
|
||||||
// 전체 메세지
|
// 전체 메세지
|
||||||
if($destMailbox == 9999) {
|
if($destMailbox == 9999) {
|
||||||
sendMessage('public', $src, [], $msg, $date);
|
sendMessage('public', $src, null, $msg, $date);
|
||||||
// 국가 메세지
|
// 국가 메세지
|
||||||
} elseif($destMailbox >= 9000) {
|
} elseif($destMailbox >= 9000) {
|
||||||
|
|
||||||
@@ -119,9 +112,9 @@ if($destMailbox == 9999) {
|
|||||||
else{
|
else{
|
||||||
$real_nation = $dest - 9000;
|
$real_nation = $dest - 9000;
|
||||||
}
|
}
|
||||||
$nation = $db->queryFirstRow('select nation,name,color from nation where nation=%i',$real_nation);
|
$nation = getNationStaticInfo($real_nation);
|
||||||
|
|
||||||
if($nation === NULL || empty($nation)){
|
if($nation === null || empty($nation)){
|
||||||
$dest = ['nation_id' => 0];
|
$dest = ['nation_id' => 0];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -167,15 +160,14 @@ if($destMailbox == 9999) {
|
|||||||
'id' => $destMailbox,
|
'id' => $destMailbox,
|
||||||
'name' => $dest_user['name']
|
'name' => $dest_user['name']
|
||||||
];
|
];
|
||||||
if($dest_user['nation'] != 0){
|
$destNation = getNationStaticInfo($dest_user['nation']);
|
||||||
$nation = $db->queryFirstRow('select nation,name,color from nation where nation=%i',$dest_user['nation']);
|
if($destNation){
|
||||||
|
$color = $destNation['color'];
|
||||||
$color = $nation['color'];
|
|
||||||
$color = str_replace('##', '#', $color);
|
$color = str_replace('##', '#', $color);
|
||||||
//FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비
|
//FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비
|
||||||
$dest['color'] = $color;
|
$dest['color'] = $color;
|
||||||
$dest['nation'] = $nation['name'];
|
$dest['nation'] = $destNation['name'];
|
||||||
$dest['nation_id'] = $nation['nation'];
|
$dest['nation_id'] = $destNation['nation'];
|
||||||
}
|
}
|
||||||
sendMessage('private', $src, $dest, $msg, $date);
|
sendMessage('private', $src, $dest, $msg, $date);
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-1
@@ -252,6 +252,17 @@ function LogText($prefix, $variable){
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ArrayToDict($arr, $keyName){
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach($arr as $obj){
|
||||||
|
$key = $obj[$keyName];
|
||||||
|
$result[$key] = $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
function dictToArray($dict, $keys){
|
function dictToArray($dict, $keys){
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
@@ -288,6 +299,14 @@ function isDict(&$array){
|
|||||||
|
|
||||||
function eraseNullValue(&$dict, $depth=512){
|
function eraseNullValue(&$dict, $depth=512){
|
||||||
//TODO:Test 추가
|
//TODO:Test 추가
|
||||||
|
if($dict === null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(is_array($dict) && empty($dict)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if($depth <= 0){
|
if($depth <= 0){
|
||||||
return $dict;
|
return $dict;
|
||||||
}
|
}
|
||||||
@@ -297,10 +316,19 @@ function eraseNullValue(&$dict, $depth=512){
|
|||||||
unset($dict[$key]);
|
unset($dict[$key]);
|
||||||
}
|
}
|
||||||
else if(isDict($value)){
|
else if(isDict($value)){
|
||||||
$dict[$key] = eraseNullKey($value, $depth - 1);
|
$newValue = eraseNullKey($value, $depth - 1);
|
||||||
|
if($newValue === null){
|
||||||
|
unset($dict[$key]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$dict[$key] = $newValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $dict;
|
return $dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -1735,18 +1735,14 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) {
|
|||||||
$loseGeneralGold += $loseGold;
|
$loseGeneralGold += $loseGold;
|
||||||
$loseGeneralRice += $loseRice;
|
$loseGeneralRice += $loseRice;
|
||||||
|
|
||||||
/*
|
|
||||||
//TODO:등용장 재디자인
|
|
||||||
//xxx: 일단 끔
|
|
||||||
//모두 등용장 발부
|
//모두 등용장 발부
|
||||||
if($nation['name'] == "강족" || $nation['name'] == "저족" || $nation['name'] == "흉노족"
|
if($nation['name'] == "강족" || $nation['name'] == "저족" || $nation['name'] == "흉노족"
|
||||||
|| $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족"
|
|| $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족"
|
||||||
|| $nation['name'] == "왜족") {
|
|| $nation['name'] == "왜족") {
|
||||||
//등용장 미발부
|
//등용장 미발부
|
||||||
} elseif(rand() % 100 < 50) {
|
} elseif(rand() % 100 < 50) {
|
||||||
ScoutMsg($connect, $ruler['no'], $nation['name'], $gen['no'], $gen['msgindex']);
|
sendScoutMsg($connect, $ruler['no'], $nation['name'], $gen['no'], $gen['msgindex']);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
||||||
if($gen['npc'] >= 2 && $gen['npc'] <= 4 && rand() % 100 < 10) {
|
if($gen['npc'] >= 2 && $gen['npc'] <= 4 && rand() % 100 < 10) {
|
||||||
@@ -1864,6 +1860,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) {
|
|||||||
//장수 사기 감소
|
//장수 사기 감소
|
||||||
$query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'";
|
$query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'";
|
||||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||||
|
|
||||||
|
getNationStaticInfo(null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user