Compare commits

...
28 Commits
Author SHA1 Message Date
Hide_D da7fcafb27 사령부 NPC 색상 2018-04-17 03:45:57 +09:00
Hide_D 7f7d8b2099 명장일람 표기 오류 수정 2018-04-17 03:43:22 +09:00
Hide_D b5fb2e9cf4 중원 정보 분쟁 현황을 제대로 보여줌 2018-04-17 03:39:17 +09:00
Hide_D d9ffdf9df8 외교 서신 밀리는 버그 수정 2018-04-17 03:23:02 +09:00
Hide_D f919187b91 불가침 메시지 수정 2018-04-17 03:22:53 +09:00
Hide_D d5ead5b74f 재야일때 secretlimit 경고 뜨는거 해결 2018-04-17 03:11:00 +09:00
Hide_D ec1be2c887 합병 항복 안되는 버그 수정 2018-04-17 03:10:38 +09:00
Hide_D af0c470923 부대 가입 안되는 버그 수정 2018-04-17 03:10:25 +09:00
Hide_D 78ce7d20e3 거래장 에러로그 수정 2018-04-17 03:10:18 +09:00
Hide_D 932ce9bf51 도시 정보 배경 안보이는 ㅓㄱ수정 2018-04-17 03:06:55 +09:00
Hide_D 3d602b49bf 메시지 표기 프레임 변경 2018-04-17 02:14:58 +09:00
Hide_D 33b7d228f9 긴급 천도 버그 수정 2018-04-17 02:14:48 +09:00
Hide_D 95a8fd5495 토너먼트 표기 2018-04-17 02:14:38 +09:00
Hide_D 87bc416fc7 인사부 표기 버그 수정 2018-04-17 02:14:31 +09:00
Hide_D 8c21eec168 메시지 관련 버그 우회 2018-04-17 01:55:12 +09:00
Hide_D 7ef3f0d5c5 임시로 외교 서신 받는 기능 추가 2018-04-17 01:54:57 +09:00
Hide_D e90e508005 빙의 후 페이지 이동 2018-04-17 01:54:42 +09:00
Hide_D 816daed570 warning 방지 2018-04-17 01:54:03 +09:00
Hide_D 3626266763 시작 년도가 없는 경우 설정 2018-04-17 01:53:55 +09:00
Hide_D 6c117a628c 가운데에 버튼 세트 추가 2018-04-17 01:53:45 +09:00
Hide_D d3225dfb41 버그 수정 2018-04-17 01:53:32 +09:00
Hide_D bd7e7540d8 사령부 출력 오동작 수정 2018-04-17 01:53:23 +09:00
Hide_D 48088748df schema 버그 수정. DB에서 Exception 제대로 안 던지는 버그 해결 2018-04-17 00:18:38 +09:00
Hide_D 7a5eecc3e1 갠메를 보냈을 때 알림 표시 2018-04-17 00:03:40 +09:00
Hide_D 51d7dede55 nation table에서 외교 서신 보관용 column 삭제 2018-04-16 23:58:36 +09:00
Hide_D bcad77ec06 사령턴 외교 서신 재구현 2018-04-16 23:53:54 +09:00
Hide_D 9b79d12521 재야에서는 국메가 안보내지던 버그 수정
일반장이 국메를 보낼 수 없던 버그 수정
외교 서신 클래스 에러 수정
2018-04-16 23:29:17 +09:00
Hide_D 4b33461c70 _admin2의 query를 수정.
- 메시지 전송을 새로 만든 구현을 사용함.
- 테이블 두개 (MEMBER, SYSTEM)을 소문자로 변경
2018-04-16 22:31:54 +09:00
54 changed files with 910 additions and 1158 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ $rootDB->error_handler = function($params){
]); ]);
}; };
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER'); $memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from member');
if($memberCnt == 0){ if($memberCnt == 0){
Json::die([ Json::die([
'step'=>'admin', 'step'=>'admin',
+2
View File
@@ -29,6 +29,8 @@ class RootDB
if (self::$uDB === null) { if (self::$uDB === null) {
self::$uDB = new \MeekroDB(self::$host, self::$user, self::$password, self::$dbName, self::$port, self::$encoding); self::$uDB = new \MeekroDB(self::$host, self::$user, self::$password, self::$dbName, self::$port, self::$encoding);
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
self::$uDB->error_handler= function(){};
self::$uDB->throw_exception_on_error = true; self::$uDB->throw_exception_on_error = true;
self::$uDB->throw_exception_on_nonsql_error = true; self::$uDB->throw_exception_on_nonsql_error = true;
} }
+236 -191
View File
@@ -26,281 +26,326 @@ $connect=$db->get();
switch($btn) { switch($btn) {
case "전체 접속허용": case "전체 접속허용":
$query = "update general set con=0"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'con'=>0
], true);
break; break;
case "전체 접속제한": case "전체 접속제한":
$query = "update general set con=1000"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'con'=>1000
], true);
break; break;
case "블럭 해제": case "블럭 해제":
$db->update('general', [
'block'=>0
], '`no` IN %li', $genlist);
DB::db()->query('update general set block=0 where no IN %li', $genlist); DB::db()->query('update general set block=0 where no IN %li', $genlist);
break; break;
case "1단계 블럭": case "1단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist); 'block'=>1,
//FIXME: subquery로 하는게 더 빠를 듯. 'killturn'=>24
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); ], '`no` IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where no IN %ls', $date, $uid); $uid = $db->queryFirstColumn('SELECT `owner` FROM general WHERE `no` IN %li', $genlist);
RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "2단계 블럭": case "2단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set gold=0,rice=0,block=2,killturn=24 where no IN %li',$genlist); 'gold'=>0,
'rice'=>0,
'block'=>2,
'killturn'=>24
], '`no` IN %li', $genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "3단계 블럭": case "3단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set gold=0,rice=0,block=3,killturn=24 where no IN %li',$genlist); 'gold'=>0,
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); 'rice'=>0,
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); 'block'=>3,
'killturn'=>24
], '`no` IN %li', $genlist);
$uid = $db->queryFirstColumn('SELECT `owner` from general where no IN %li', $genlist);
RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "무한삭턴": case "무한삭턴":
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist); $db->update('general', [
'killturn'=>8000
], '`no` IN %li', $genlist);
break; break;
case "강제 사망": case "강제 사망":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
DB::db()->query('update general set turn0=0,killturn=0,turntime=%s where no IN %li',$date, $genlist); $db->update('general', [
'turn0'=>0,
'killturn'=>0,
'turntime'=>$date,
], '`no` IN %li', $genlist);
break; break;
case "특기 부여": case "특기 부여":
$admin = DB::db()->queryFirstRow('select `year`, `month` from `game` where `no`=1'); list($year, $month) = $db->queryFirstList('select `year`, `month` from `game` where `no`=1');
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "특기 부여!";
$msg = "특기 부여!";
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
}
for($i=0; $i < count($genlist); $i++) {
$query = "select no,leader,power,intel from general where no='$genlist[$i]'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
$special2 = getSpecial2($general['leader'], $general['power'], $general['intel']); foreach($db->query("SELECT `no`,leader,power,intel,dex0,dex10,dex20,dex30,dex40 FROM general WHERE `no` IN %li", $genlist) as $general){
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($general['no']), $text, new DateTime(), new DateTime('9999-12-31'), []);
$msg->send(true);
$query = "update general set specage2=age,special2='$special2' where no='{$general['no']}'"; $specialWar = SpecialityConst::pickSpecialWar($general);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('general', [
'specage2'=>$db->sqleval('age'),
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!"; 'special2'=>$specialWar
pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득"); ], 'no=%i', $general['no']);
pushGenLog($general, $log); $specialWarName = SpecialityConst::WAR[$specialWar][0];
pushGeneralHistory($general, "<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】(을)를 습득");
pushGenLog($general, ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】(을)를 익혔습니다!"]);
} }
break; break;
case "경험치1000": case "경험치1000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = $btn." 지급!";
$msg = $btn." 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set experience=experience+1000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'experience'=>$db->sqleval('experience+1000')
], '`no` IN %li', $genlist);
break; break;
case "공헌치1000": case "공헌치1000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = $btn." 지급!";
$msg = $btn." 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dedication=dedication+1000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dedication'=>$db->sqleval('dedication+1000')
], '`no` IN %li', $genlist);
break; break;
case "보숙10000": case "보숙10000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "보병숙련도+10000 지급!";
$msg = "보병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dex0=dex0+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex0'=>$db->sqleval('dex0+10000')
], '`no` IN %li', $genlist);
break; break;
case "궁숙10000": case "궁숙10000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "궁병숙련도+10000 지급!";
$msg = "궁병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dex10=dex10+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex10'=>$db->sqleval('dex10+10000')
], '`no` IN %li', $genlist);
break; break;
case "기숙10000": case "기숙10000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "기병숙련도+10000 지급!";
$msg = "기병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dex20=dex20+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex20'=>$db->sqleval('dex20+10000')
], '`no` IN %li', $genlist);
break; break;
case "귀숙10000": case "귀숙10000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "귀병숙련도+10000 지급!";
$msg = "귀병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dex30=dex30+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex30'=>$db->sqleval('dex30+10000')
], '`no` IN %li', $genlist);
break; break;
case "차숙10000": case "차숙10000":
for($i=0; $i < count($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "차병숙련도+10000 지급!";
$msg = "차병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < count($genlist); $i++) {
$query = "update general set dex40=dex40+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex40'=>$db->sqleval('dex40+10000')
], '`no` IN %li', $genlist);
break; break;
case "접속 허용": case "접속 허용":
for($i=0; $i < count($genlist); $i++) { $db->update('genera',[
$query = "update general set con=0 where no='$genlist[$i]'"; 'con'=>0
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "접속 제한": case "접속 제한":
for($i=0; $i < count($genlist); $i++) { $db->update('genera',[
$query = "update general set con=1000 where no='$genlist[$i]'"; 'con'=>1000
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "메세지 전달": case "메세지 전달":
//TODO:새 갠메 시스템으로 변경 $text = $msg;
$date = date('Y-m-d H:i:s'); foreach($genlist as $generalID){
for($i=0; $i < count($genlist); $i++) { $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $msg->send(true);
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
break; break;
case "무기지급": case "무기지급":
$date = date('Y-m-d H:i:s');
for($i=0; $i < count($genlist); $i++) { if($weap == 0) {
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "무기 회수!";
if($weap == 0) { $msg = "무기 회수!"; }
else { $msg = getWeapName($weap)." 지급!"; }
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < count($genlist); $i++) { else {
if($weap == 0) { $text = getWeapName($weap)." 지급!";
$query = "update general set weap='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set weap='$weap' where no='$genlist[$i]' and weap<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'weap'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'weap'=>$weap
], '`no` IN %li AND weap < %i', $genlist, $weap);
} }
break; break;
case "책지급": case "책지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < count($genlist); $i++) { $text = "책 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "서적 회수!"; }
else { $msg = getBookName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < count($genlist); $i++) { else {
if($weap == 0) { $text = getBookName($weap)." 지급!";
$query = "update general set book='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set book='$weap' where no='$genlist[$i]' and book<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'book'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'book'=>$weap
], '`no` IN %li AND book < %i', $genlist, $weap);
} }
break; break;
case "말지급": case "말지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < count($genlist); $i++) { $text = "말 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "말 회수!"; }
else { $msg = getHorseName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < count($genlist); $i++) { else {
if($weap == 0) { $text = getHorseName($weap)." 지급!";
$query = "update general set horse='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set horse='$weap' where no='$genlist[$i]' and horse<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'horse'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'horse'=>$weap
], '`no` IN %li AND horse < %i', $genlist, $weap);
} }
break; break;
case "도구지급": case "도구지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < count($genlist); $i++) { $text = "특수도구 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "특수도구 회수!"; }
else { $msg = getItemName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < count($genlist); $i++) { else {
if($weap == 0) { $text = getItemName($weap)." 지급!";
$query = "update general set item='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set item='$weap' where no='$genlist[$i]' and item<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'item'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'item'=>$weap
], '`no` IN %li AND item < %i', $genlist, $weap);
} }
break; break;
case "NPC해제": case "NPC해제":
for($i=0; $i < count($genlist); $i++) { $db->update('general', [
$query = "update general set npc=1 where no='$genlist[$i]'"; 'npc'=>1
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "하야입력": case "하야입력":
for($i=0; $i < count($genlist); $i++) { $db->update('general', [
$query = "update general set turn0='00000000000045' where no='$genlist[$i]'"; 'turn0'=>'00000000000045'
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "방랑해산": case "방랑해산":
for($i=0; $i < count($genlist); $i++) { $db->update('general', [
$query = "update general set turn0='00000000000047',turn1='00000000000056' where no='$genlist[$i]'"; 'turn0'=>'00000000000047',
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'turn1'=>'00000000000056'
} ], '`no` IN %li', $genlist);
break; break;
case "NPC설정": case "NPC설정":
for($i=0; $i < count($genlist); $i++) { $db->update('general', [
$query = "update general set npc=2 where no='$genlist[$i]'"; 'npc'=>2
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "00턴": case "00턴":
$query = "select turnterm from game limit 1"; $turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1');
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
for($i=0; $i < count($genlist); $i++) { foreach($genlist as $generalID){
$turntime = getRandTurn($admin['turnterm']); $turntime = getRandTurn($turnterm);
$cutTurn = cutTurn($turntime, $admin['turnterm']); $cutTurn = cutTurn($turntime, $turnterm);
$query = "update general set turntime='$cutTurn' where no='$genlist[$i]'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'turntime'=>$curTurn
], '`no` IN %li', $genlist);
} }
break; break;
case "랜덤턴": case "랜덤턴":
$query = "select turnterm from game limit 1"; foreach($genlist as $generalID){
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $turntime = getRandTurn($turnterm);
$admin = MYDB_fetch_array($result); $db->update('general', [
'turntime'=>$turntime
for($i=0; $i < count($genlist); $i++) { ], '`no` IN %li', $genlist);
$turntime = getRandTurn($admin['turnterm']);
$query = "update general set turntime='$turntime' where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
break; break;
} }
+3 -3
View File
@@ -31,21 +31,21 @@ switch($btn) {
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist); $db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
//FIXME: subquery로 하는게 더 빠를 듯. //FIXME: subquery로 하는게 더 빠를 듯.
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "2단계 블럭": case "2단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db = DB::db();
$db->query('update general set block=2,killturn=24 where no IN %li',$genlist); $db->query('update general set block=2,killturn=24 where no IN %li',$genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "3단계 블럭": case "3단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db = DB::db();
$db->query('update general set block=3,killturn=24 where no IN %li',$genlist); $db->query('update general set block=3,killturn=24 where no IN %li',$genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "무한삭턴": case "무한삭턴":
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist); DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
+2 -2
View File
@@ -166,7 +166,7 @@ for ($i=0; $i < 21; $i++) {
echo "<td align=center>&nbsp;</td>"; echo "<td align=center>&nbsp;</td>";
} else { } else {
$imageTemp = GetImageURL($gen['imgsvr']); $imageTemp = GetImageURL($gen['imgsvr']);
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>"; echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></td>";
} }
} }
@@ -267,7 +267,7 @@ for ($i=0; $i < 4; $i++) {
echo "<td align=center>&nbsp;</td>"; echo "<td align=center>&nbsp;</td>";
} else { } else {
$imageTemp = GetImageURL($gen['imgsvr']??0); $imageTemp = GetImageURL($gen['imgsvr']??0);
echo "<td align=center> width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>"; echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
} }
} }
+1 -1
View File
@@ -164,7 +164,7 @@ for ($j=0; $j < $gencount; $j++) {
$imageTemp = GetImageURL($general['imgsvr']); $imageTemp = GetImageURL($general['imgsvr']);
echo " echo "
<tr> <tr>
<td align=center> width='64' height='64' src={$imageTemp}/{$general['picture']}></img></td> <td align=center><img width='64' height='64' src={$imageTemp}/{$general['picture']}></img></td>
<td align=center>$name</td> <td align=center>$name</td>
<td align=center>{$general['age']}세</td> <td align=center>{$general['age']}세</td>
<td align=center>".getGenChar($general['personal'])."</td> <td align=center>".getGenChar($general['personal'])."</td>
+25 -26
View File
@@ -58,7 +58,7 @@ $nation = MYDB_fetch_array($result);
$lv = getNationChiefLevel($nation['level']); $lv = getNationChiefLevel($nation['level']);
$turn = []; $turn = [];
$gen = []; $gen = [[],[],[],[],[],[],[],[],[],[],[],[]];
for($i=12; $i >= $lv; $i--) { for($i=12; $i >= $lv; $i--) {
$turn[$i] = getCoreTurn($nation, $i); $turn[$i] = getCoreTurn($nation, $i);
@@ -105,7 +105,6 @@ for($i=12; $i >= $lv; $i--) {
$turntime[$i] = substr($gen[$i]['turntime'], 14); $turntime[$i] = substr($gen[$i]['turntime'], 14);
} }
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다. //FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
for($k=0; $k < 2; $k++) { for($k=0; $k < 2; $k++) {
@@ -118,22 +117,22 @@ for($k=0; $k < 2; $k++) {
]; ];
} }
if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".$gen[$l4]['name']."</font>"; } if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".($gen[$l4]['name']??'')."</font>"; }
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".$gen[$l4]['name']."</font>"; } elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".($gen[$l4]['name']??'')."</font>"; }
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".$gen[$l3]['name']."</font>"; } if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".($gen[$l3]['name']??'')."</font>"; }
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".$gen[$l3]['name']."</font>"; } elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".($gen[$l3]['name']??'')."</font>"; }
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".$gen[$l2]['name']."</font>"; } if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".($gen[$l2]['name']??'')."</font>"; }
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".$gen[$l2]['name']."</font>"; } elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".($gen[$l2]['name']??'')."</font>"; }
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".$gen[$l1]['name']."</font>"; } if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".($gen[$l1]['name']??'')."</font>"; }
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".$gen[$l1]['name']."</font>"; } elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".($gen[$l1]['name']??'')."</font>"; }
echo " echo "
<tr> <tr>
<td align=center id=bg1>.</td> <td align=center id=bg1>.</td>
<td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : {$gen[$l4]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : ".($gen[$l4]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : {$gen[$l3]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : ".($gen[$l3]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : {$gen[$l2]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : ".($gen[$l2]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : {$gen[$l1]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : ".($gen[$l1]['name']??'')."</b></td>
<td align=center id=bg1>.</td> <td align=center id=bg1>.</td>
</tr> </tr>
"; ";
@@ -144,14 +143,14 @@ for($k=0; $k < 2; $k++) {
$turndate[$l2] = substr($totaldate[$l2]??'', 11, 5); $turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
$turndate[$l1] = substr($totaldate[$l1]??'', 11, 5); $turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
$j = $i + 1; $j = $i + 1;
$td4 = $turndate[$l4] ?: "-"; $td4 = $turndate[$l4]??"-";
$td3 = $turndate[$l3] ?: "-"; $td3 = $turndate[$l3]??"-";
$td2 = $turndate[$l2] ?: "-"; $td2 = $turndate[$l2]??"-";
$td1 = $turndate[$l1] ?: "-"; $td1 = $turndate[$l1]??"-";
$tn4 = $turn[$l4][$i] ?? "-"; $tn4 = $turn[$l4][$i]??"-";
$tn3 = $turn[$l3][$i] ?? "-"; $tn3 = $turn[$l3][$i]??"-";
$tn2 = $turn[$l2][$i] ?? "-"; $tn2 = $turn[$l2][$i]??"-";
$tn1 = $turn[$l1][$i] ?? "-"; $tn1 = $turn[$l1][$i]??"-";
echo " echo "
<tr> <tr>
<td width=28 align=center id=bg0><b>$j</b></td> <td width=28 align=center id=bg0><b>$j</b></td>
@@ -166,10 +165,10 @@ for($k=0; $k < 2; $k++) {
<td width=28 align=center id=bg0><b>$j</b></td> <td width=28 align=center id=bg0><b>$j</b></td>
</tr> </tr>
"; ";
if($totaldate[$l4] != "") { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); } if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
if($totaldate[$l3] != "") { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); } if($totaldate[$l3]??'') { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
if($totaldate[$l2] != "") { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); } if($totaldate[$l2]??'') { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
if($totaldate[$l1] != "") { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); } if($totaldate[$l1]??'') { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
} }
if($k == 0) { if($k == 0) {
echo "<form action=processing.php method=post><tr><td colspan=5 align=right>"; echo "<form action=processing.php method=post><tr><td colspan=5 align=right>";
+2 -1
View File
@@ -32,7 +32,8 @@ $myNation = MYDB_fetch_array($result);
<head> <head>
<title>도시정보</title> <title>도시정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel='stylesheet' href='css/common.css' type='text/css'> <link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
</head> </head>
+11 -14
View File
@@ -25,7 +25,6 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""
$nationcount = MYDB_num_rows($result); $nationcount = MYDB_num_rows($result);
$nationnum = []; $nationnum = [];
$nationname = []; $nationname = [];
$nationcolor = [];
$nationStr = ""; $nationStr = "";
$powerStr = ""; $powerStr = "";
@@ -41,7 +40,6 @@ for($i=0; $i < $nationcount; $i++) {
$nationnum[] = $nation['nation']; $nationnum[] = $nation['nation'];
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
$nationcolor[$nation['nation']] = $nation['color'];
$nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>"; $nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>";
$powerStr .= "국력 {$nation['power']}<br>"; $powerStr .= "국력 {$nation['power']}<br>";
@@ -64,9 +62,10 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl
$sum = array_sum($conflict); $sum = array_sum($conflict);
foreach ($conflict as $nationID=>$killnum) { foreach ($conflict as $nationID=>$killnum) {
$conflict['percent'] = round(100*$killnum / $sum, 1); $conflict[$nationID] = ['killnum'=>$killnum];
$conflict['name'] = $nationname[$nationID]; $conflict[$nationID]['percent'] = round(100*$killnum / $sum, 1);
$conflict['color'] = $nationcolor[$nationID]; $conflict[$nationID]['name'] = $nationname[$nationID];
$conflict[$nationID]['color'] = getNationStaticInfo($nationID)['color'];
} }
$realConflict[] = [$cityID, $cityName, $conflict]; $realConflict[] = [$cityID, $cityName, $conflict];
@@ -120,7 +119,7 @@ if($nationcount != 0) {
for($i=0; $i < $nationcount; $i++) { for($i=0; $i < $nationcount; $i++) {
echo " echo "
<td align=center width={$width} style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>"; <td align=center width={$width} style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
} }
echo " echo "
</tr>"; </tr>";
@@ -137,7 +136,7 @@ for($i=0; $i < $nationcount; $i++) {
} }
echo " echo "
<tr> <tr>
<td align=center style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>"; <td align=center style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
for($k=0; $k < $nationcount; $k++) { for($k=0; $k < $nationcount; $k++) {
if($i == $k) { if($i == $k) {
@@ -202,7 +201,7 @@ for($i=0; $i < $nationcount; $i++) {
cellpadding=0 cellpadding=0
bordercolordark='gray' bordercolordark='gray'
bordercolorlight='black' bordercolorlight='black'
style='font-size:13px;word-break:break-all;' style='font-size:13px;word-break:break-all;width:100%;'
class='bg0' class='bg0'
> >
<?php foreach($conflict as $item): ?> <?php foreach($conflict as $item): ?>
@@ -212,12 +211,10 @@ for($i=0; $i < $nationcount; $i++) {
align=right align=right
style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;' style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
><?=$item['name']?>&nbsp;</td> ><?=$item['name']?>&nbsp;</td>
<td width=48 align=right><?=$item['percent']?>%&nbsp;</td> <td width=48 align=right><?=(float)$item['percent']?> %&nbsp;</td>
<td <td width=*><div
width='<?=$item['percent']?>%' style='display:inline-block;width:<?=$item['percent']?>%;background-color:<?=$item['color']?>;'
style='background-color:<?=$item['color']?>;' >&nbsp;</div></td>
></td>
<td width=*></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
+10 -10
View File
@@ -81,18 +81,18 @@ echo "
"; ";
for($i=12; $i >= $lv; $i-=2) { for($i=12; $i >= $lv; $i-=2) {
$i1 = $i; $i2 = $i - 1; $i1 = $i; $i2 = $i - 1;
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']); $imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0);
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']); $imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
echo " ?>
<tr> <tr>
<td width=98 align=center id=bg1><font size=4>".getLevel($i1, $nation['level'])."</font></td> <td width=98 align=center id=bg1><font size=4><?=getLevel($i1, $nation['level'])?></font></td>
<td width=64 height=64 style='background:no-repeat center url(\"{$imageTemp1}/{$level[$i1]['picture']}\");background-size:64px;'></td> <td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></td>
<td width=332><font size=4>";echo $level[$i1]['name']==''?"-":$level[$i1]['name']; echo " ({$level[$i1]['belong']}년)</font></td> <td width=332><font size=4><?=$level[$i1]['name']??'-'?>(<?=$level[$i1]['belong']??'-'?>년)</font></td>
<td width=98 align=center id=bg1><font size=4>".getLevel($i2, $nation['level'])."</font></td> <td width=98 align=center id=bg1><font size=4><?=getLevel($i2, $nation['level'])?></font></td>
<td width=64 height=64 style='background:no-repeat center url(\"{$imageTemp2}/{$level[$i2]['picture']}\");background-size:64px;'></td> <td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
<td width=332><font size=4>";echo $level[$i2]['name']==''?"-":$level[$i2]['name']; echo " ({$level[$i2]['belong']}년)</font></td> <td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
</tr> </tr>
"; <?php
} }
echo " echo "
+3
View File
@@ -24,6 +24,9 @@ $term = Util::getReq('term', 'int');
$stuff = Util::getReq('stuff', 'int'); $stuff = Util::getReq('stuff', 'int');
$sel = Util::getReq('sel', 'int'); $sel = Util::getReq('sel', 'int');
$msg = '';
$msg2 = '';
extractMissingPostToGlobals(); extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
+3 -2
View File
@@ -40,8 +40,9 @@ if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
'troop'=>0 'troop'=>0
], 'no=%i AND troop=(SELECT troop FROM troop WHERE no = %i)', $gen, $me['no']); ], 'no=%i AND troop=(SELECT troop FROM troop WHERE no = %i)', $gen, $me['no']);
} elseif($btn == "부 대 가 입" && $troop != 0) { } elseif($btn == "부 대 가 입" && $troop != 0) {
$troop = $db->queryFirstField('SELECT troop FROM troop WHERE no = %i', $troop); $troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troop);
if($troop){ $troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `nation`=%i', $troopLeader, $me['nation']);
if($troopLeaderNation){
$db->update('general', [ $db->update('general', [
'troop'=>$troop 'troop'=>$troop
], 'no=%i', $me['no']); ], 'no=%i', $me['no']);
+7 -2
View File
@@ -91,8 +91,13 @@
} }
.board_side{ .board_side{
width:50%; height:1370px;
float:left; width:498px;
overflow-y: hidden;
display:inline-block;
border-left:groove 1px;
border-right:groove 1px;
border-bottom:groove 1px;
} }
.msg_body{ .msg_body{
+2
View File
@@ -27,6 +27,8 @@ class DB{
if(self::$uDB === null){ if(self::$uDB === null){
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding); self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
self::$uDB->error_handler= function(){};
self::$uDB->throw_exception_on_error = true; self::$uDB->throw_exception_on_error = true;
self::$uDB->throw_exception_on_nonsql_error = true; self::$uDB->throw_exception_on_nonsql_error = true;
} }
-9
View File
@@ -18,7 +18,6 @@ require_once 'func_time_event.php';
require_once('func_template.php'); require_once('func_template.php');
require_once('func_message.php'); require_once('func_message.php');
require_once('func_map.php'); require_once('func_map.php');
require_once('func_diplomacy.php');
require_once('func_command.php'); require_once('func_command.php');
/** /**
@@ -1721,14 +1720,6 @@ function checkTurn() {
$query = "update game set turntime='$date'"; $query = "update game set turntime='$date'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 3턴 전 시간
$letterdate = subTurn($date, $admin['turnterm'], 3);
//기한 지난 외교 메세지 지움(3개월 유지)
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__);
for($i=0; $i < 5; $i++) {
$query = "update nation set dip{$i}='',dip{$i}_who='0',dip{$i}_type='0',dip{$i}_when='' where dip{$i}_when < '$letterdate'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
// 부상 과도 제한 // 부상 과도 제한
$query = "update general set injury='80' where injury>'80'"; $query = "update general set injury='80' where injury>'80'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
-224
View File
@@ -1,224 +0,0 @@
<?php
namespace sammo;
function checkScoutAvailable($messageInfo, $general, $srcGeneral, $startyear, $year){
$nationID = $messageInfo['src']['nationID'];
$srcNation = DB::db()->queryFirstRow('SELECT `level`, `scout` FROM `nation` WHERE `nation` = %i', $nationID);
$realNationID = $srcGeneral['nation'];
if($general['level'] == 12) {
return [false, "군주입니다."];
}
if(!$srcNation || $srcNation['level'] == 0) {
return [false, "없는 국가이거나 방랑군입니다."];
}
if($realNationID != $nationID){
return [false, "권유자의 소속이 바뀌었습니다."];
}
if($srcNation['scout'] != 0) {
return [false, "임관 금지중입니다."];
}
if($year < $startyear+3) {
return [false, "초반 제한중입니다."];
}
if(strpos($general['nations'], ",{$nationID},") > 0) {
return [false, "이미 임관했었던 국가입니다."];
}
return [true, null];
}
function acceptScout($messageInfo, $general, $msgResponse){
$me = $general;
$you = DB::db()->queryFirstRow('SELECT `no`, `name`, `nation` FROM `general` WHERE `no` = %i', $messageInfo['src']['id']);
list($startyear, $year, $month, $killturn) = Util::convertDictToArray(DB::db()->queryFirstRow('SELECT `startyear`, `year`, `month`, `killturn` FROM `game` LIMIT 1'), ['startyear', 'year', 'month', `killturn`]);
list($avaliableScout, $reason) = checkScoutAvailable($messageInfo, $general, $you, $startyear, $year);
if(!$msgResponse || !$avaliableScout){
return declineScout($messageInfo, $reason);
}
$nation = getNationStaticInfo($messageInfo['src']['nationID']);
$generalID = $me['no'];
$nationID = $nation['nation'];
$nationName = $nation['name'];
$myName = $me['name'];
$mylog = [];
$youlog = [];
$alllog = [];
$youlog[] = "<C>●</><Y>{$myName}</> 등용에 성공했습니다.";
$alllog[] = "<C>●</>{$month}월:<Y>{$myName}</>(이)가 <D><b>{$nationName}</b></>(으)로 <S>망명</>하였습니다.";
$mylog[] = "<C>●</><D>{$nationName}</>(으)로 망명하여 수도로 이동합니다.";
pushGeneralHistory($you, "<C>●</>{$year}{$month}월:<Y>{$myName}</> 등용에 성공");
pushGeneralHistory($me, "<C>●</>{$year}{$month}월:<D>{$nationName}</>(으)로 망명");
$me['nations'] .= "{$nationID},";
$updateMe = [
'belong'=>1,
'nation'=>$nationID,
'level'=>1,
'city'=>$nation['capital'],
'troop'=>0
];
//처리가 조금 다름.
$db = DB::db();
if($me['level'] > 0){
$updateOldNation = [
'totaltech' => $db->sqleval('`tech`*greatest(10, `gennum`-1)'),
'gennum' => $db->sqleval('greatest(10, `gennum`-1)')
];
if($me['gold'] > 1000){
$updateOldNation['gold'] = $db->sqleval('`gold` + %i', $me['gold'] - 1000);
$updateMe['gold'] = 1000;
}
if($me['rice'] > 1000){
$updateOldNation['rice'] = $db->sqleval('`rice` + %i', $me['rice'] - 1000);
$updateMe['rice'] = 1000;
}
$updateMe['betray'] = $db->sqleval('`betray` + 1');
$updateMe['dedication'] = $db->sqleval('dedication*(1-0.1*betray)');
$updateMe['experience'] = $db->sqleval('experience*(1-0.1*betray)');
$db->update('nation', $updateOldNation, 'nation = %i', $messageInfo['dest']['nationID']);
}
else{
$updateMe['dedication'] = $db->sqleval('dedication + 100');
$updateMe['experience'] = $db->sqleval('experience + 100');
}
if($me['npc'] < 2){
$updateMe['killturn'] = $killturn;
}
$db->update('general', $updateMe, 'no = %i', $generalID);
$db->query('UPDATE nation set '.
'gennum = greatest(10, (SELECT count(`id`) from general where `nation` = %i_nation)), '.
'totaltech = tech * greatest(10, (SELECT count(`id`) from general where `nation` = %i_nation)) '.
'where nation=%i_nation', ['nation'=>$nationID]);
//태수 군사 시중 해제
switch($me['level']) {
case 4:
$db->query('update city set gen1=0 where gen1=%i', $generalID);
break;
case 3:
$db->query('update city set gen3=0 where gen2=%i', $generalID);
break;
case 2:
$db->query('update city set gen3=0 where gen2=%i', $generalID);
break;
}
$db->query('UPDATE general left join troop on troop.troop = general.troop set general.troop = 0 where troop.no = %i', $generalID);
$db->query('delete from troop where no = %i', $generalID);
$db->query('UPDATE `message` SET `valid_until`=\'1234-11-22 11:22:33\' WHERE `id` = %i', $messageInfo['id']);
$msg = "{$nationName}(으)로 등용 제의 수락";
sendRawMessage('private', false, $general['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushGeneralPublicRecord($alllog, $year, $month);
pushWorldHistory($alllog, $year, $month);
return [true, 'success'];
}
function declineScout($messageInfo, $reason=null){
$me = [
'no'=>$messageInfo['dest']['id'],
'name'=>$messageInfo['dest']['name']
];
$you = ['no'=>$messageInfo['src']['id']];
$nation = getNationStaticInfo($messageInfo['src']['nationID']);
$generalID = $me['no'];
$nationID = $nation['nation'];
$nationName = $nation['name'];
$myName = $me['name'];
$mylog = [];
$youlog = [];
$nationName = $messageInfo['src']['nation'];
if($reason){
$mylog[] = "<C>●</>{$reason} 등용 수락 불가.";
$msg = "{$nationName}(으)로 등용 제의 수락 불가";
}
else{
$youlog[] = "<C>●</><Y>{$me['name']}</>(이)가 등용을 거부했습니다.";
$mylog[] = "<C>●</><D>{$nationName}</>(으)로 망명을 거부했습니다.";
$msg = "{$nationName}(으)로 등용 제의 거부";
}
$db = DB::db();
$db->query('UPDATE `message` SET `valid_until`=\'1234-11-22 11:22:33\' WHERE `id` = %i', $messageInfo['id']);
sendRawMessage('private', false, $you['no'], $messageInfo['src'], $messageInfo['dest'], $msg, null, null, ['parent'=>$messageInfo['id']]);
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
return [true, 'success'];
}
function acceptAlly($messageInfo, $general, $msgResponse){
return [false, 'NYI'];
}
function declineAlly($messageInfo, $general, $msgResponse){
}
function acceptBreakAlly($messageInfo, $general, $msgResponse){
}
function declineBreakAlly($messageInfo, $general, $msgResponse){
}
function acceptStopWar($messageInfo, $general, $msgResponse){
}
function declineStopWar($messageInfo, $general, $msgResponse){
}
function acceptMergeNations($messageInfo, $general, $msgResponse){
}
function declineMergeNations($messageInfo, $general, $msgResponse){
}
function acceptSurrender($messageInfo, $general, $msgResponse){
}
function declineSurrender($messageInfo, $general, $msgResponse){
}
+2 -2
View File
@@ -51,8 +51,8 @@ function Submit($url, $msg="", $msg2="") {
echo "a"; // 파폭 버그 때문 echo "a"; // 파폭 버그 때문
echo " echo "
<form method=post name=f1 action='{$url}'> <form method=post name=f1 action='{$url}'>
<input type=hidden name=msg value='{$msg}'> <input type=hidden name=msg value=\"{$msg}\">
<input type=hidden name=msg2 value='{$msg2}'> <input type=hidden name=msg2 value=\"{$msg2}\">
</form> </form>
<script>f1.submit();</script> <script>f1.submit();</script>
"; ";
-127
View File
@@ -48,58 +48,6 @@ function getMailboxList(){
//Legacy //Legacy
// type : xx,xx(불가침기간,타입)
// who : xxxx,xxxx(발신인, 수신인)
function DecodeMsg($msg, $type, $who, $date, $bg, $num=0) {
$db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
//FIXME: 폐기
$query = "select no,nation,name,picture,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
// 1 : 전메, 2 : 아국->타국, 3 : 타국->아국
// 4 : 합병, 5 : 통합, 6 : 불가침, 7 : 종전, 8 : 파기
// 9 : 자신->타인, 10 : 타인 -> 자신, 11 : 등용
$category = $type % 100;
$term = intdiv($type, 100);
$from = intdiv($who, 10000);
$to = $who % 10000;
$query = "select name,picture,imgsvr,nation from general where no='$from'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$sndr = MYDB_fetch_array($result);
$sndrnation = getNationStaticInfo($sndr['nation']);
switch($bg) {
case 2:
case 4: $bgcolor = "#CC6600"; break;
}
if($category == 6) {
$query = "select reserved from diplomacy where me='{$sndr['nation']}' and you='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}", $sndrnation['color'], $sndr['name'], $sndrnation['color'], $msg, $date, $num, $from, $term, $me['level'], $dip['reserved']);
} elseif($category <= 8) {
$rcvrnation = getNationStaticInfo($to);
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}", $sndrnation['color'], $rcvrnation['name'], $rcvrnation['color'], $msg, $date, $num, $from, $term, $me['level']);
} elseif($category <= 11) {
$query = "select name,picture,nation from general where no='$to'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$rcvr = MYDB_fetch_array($result);
$rcvrnation = getNationStaticInfo($rcvr['nation']);
ShowMsg($bgcolor, $category, $sndr['picture'], $sndr['imgsvr'], "{$sndr['name']}:{$sndrnation['name']}", $sndrnation['color'], "{$rcvr['name']}:{$rcvrnation['name']}", $rcvrnation['color'], $msg, $date, $num, $from, $term);
}
}
function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $value) { function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $value) {
$db = DB::db(); $db = DB::db();
$connect=$db->get(); $connect=$db->get();
@@ -108,78 +56,3 @@ function moveMsg($table, $msgtype, $msgnum, $msg, $type, $who, $when, $column, $
$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'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
function MsgDip($bg) {
$db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select dip0,dip1,dip2,dip3,dip4,dip0_who,dip1_who,dip2_who,dip3_who,dip4_who,dip0_when,dip1_when,dip2_when,dip3_when,dip4_when,dip0_type,dip1_type,dip2_type,dip3_type,dip4_type from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
if($nation['dip0']) { echo "\n"; DecodeMsg($nation['dip0'], $nation['dip0_type'], $nation['dip0_who'], $nation['dip0_when'], $bg, 0); }
if($nation['dip1']) { echo "\n"; DecodeMsg($nation['dip1'], $nation['dip1_type'], $nation['dip1_who'], $nation['dip1_when'], $bg, 1); }
if($nation['dip2']) { echo "\n"; DecodeMsg($nation['dip2'], $nation['dip2_type'], $nation['dip2_who'], $nation['dip2_when'], $bg, 2); }
if($nation['dip3']) { echo "\n"; DecodeMsg($nation['dip3'], $nation['dip3_type'], $nation['dip3_who'], $nation['dip3_when'], $bg, 3); }
if($nation['dip4']) { echo "\n"; DecodeMsg($nation['dip4'], $nation['dip4_type'], $nation['dip4_who'], $nation['dip4_when'], $bg, 4); }
}
function ShowMsg($bgcolor, $type, $picture, $imgsvr, $me, $mycolor, $you, $youcolor, $msg, $date, $num=0, $who=0, $when=0, $level=0, $note="") {
if($msg == "") return;
$msg = Tag2Code($msg);
$site = ""; $form = ""; $form2 = "";
if($type == 11 || ($type >= 4 && $type <= 8 && $level >= 5)) {
$corebutton = "&nbsp;<input type=submit name=ok value=수락 onclick='return confirm(\"정말 수락하시겠습니까?\")'><input type=submit name=ok value=거절 onclick='return confirm(\"정말 거절하시겠습니까?\")'>";
} else {
$corebutton = "&nbsp;【수락】【거절】";
}
if($type == 6) {
$corebutton .= "<br>비고: {$note}";
}
switch($type) {
case 1: $sign = ""; $corebutton = ""; break;
case 2: $sign = ""; $corebutton = ""; break;
case 3: $sign = ""; $corebutton = ""; break;
case 4: $sign = ""; $site = "d_surrender.php"; break;
case 5: $sign = ""; $site = "d_merge.php"; break;
case 6: $sign = ""; $site = "d_ally.php"; break;
case 7: $sign = ""; $site = "d_cease.php"; break;
case 8: $sign = ""; $site = "d_cancel.php"; break;
case 9: $sign = ""; $corebutton = ""; break;
case 10: $sign = ""; $corebutton = ""; break;
case 11: $sign = ""; $site = "d_scout.php"; break;
}
$imageTemp = GetImageURL($imgsvr);
$naming = "[<font color=$mycolor>$me</font>{$sign}<font color=$youcolor>$you</font>]";
$picture = "<img width='64' height='64' src={$imageTemp}/{$picture}>";
if($site != "") {
$form = "<form name=scout method=post action={$site}>";
$form2 = "</form>";
}
if($num >= 0) { $num = "<input type=hidden name=num value=$num>"; }
else { $num = ""; }
if($who > 0) { $who = "<input type=hidden name=gen value=$who>"; }
else { $who = ""; }
if($when > 0) { $when = "<input type=hidden name=when value=$when>"; }
else { $when = ""; }
echo "
<table width=498 border=1 bordercolordark=gray bordercolorlight=black cellpadding=0 cellspacing=0 bgcolor='$bgcolor' style=font-size:13px;table-layout:fixed;word-break:break-all;>
<tr>
<td width=64 height=64>$picture</td>
$form
<td width=434 valign=top><b>$naming</b><font size=1><$date></font> <br>{$msg}{$corebutton}</td>
$num
$who
$when
$form2
</tr>
</table>
";
}
+10 -10
View File
@@ -521,7 +521,7 @@ function process_5(&$general, $type) {
// 태수 보정 // 태수 보정
if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; } if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; }
$rd = randF(); $rd = Util::randF();
$r = CriticalRatioDomestic($general, 1); $r = CriticalRatioDomestic($general, 1);
// 특기보정 : 수비, 축성 // 특기보정 : 수비, 축성
if($type == 1 && $general['special'] == 11) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } if($type == 1 && $general['special'] == 11) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; }
@@ -1006,7 +1006,7 @@ function process_11(&$general, $type) {
$exp = $crew; $exp = $crew;
$ded = $crew; $ded = $crew;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $armtype, $crew); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $armtype, $crew);
// 성격 보정 // 성격 보정
$exp = CharExperience($exp, $general['personal']); $exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
@@ -1075,7 +1075,7 @@ function process_13(&$general) {
$exp = 100; $exp = 100;
$ded = 70; $ded = 70;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
// 성격 보정 // 성격 보정
$exp = CharExperience($exp, $general['personal']); $exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
@@ -1139,14 +1139,14 @@ function process_14(&$general) {
// } elseif(intdiv($general['crewtype'], 10) == 4) { // } elseif(intdiv($general['crewtype'], 10) == 4) {
// $log[] = "<C>●</>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date</>"; // $log[] = "<C>●</>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date</>";
} else { } else {
$score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * GameConst::$trainAtmos); $score = Util::round(getGeneralLeadership($general, true, true, true)*100 / $general['crew'] * GameConst::$atmosDelta);
$gold = $general['gold'] - Util::round($general['crew']/100); $gold = $general['gold'] - Util::round($general['crew']/100);
$log[] = "<C>●</>{$admin['month']}월:사기치가 <C>$score</> 상승했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:사기치가 <C>$score</> 상승했습니다. <1>$date</>";
$exp = 100; $exp = 100;
$ded = 70; $ded = 70;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
// 성격 보정 // 성격 보정
$exp = CharExperience($exp, $general['personal']); $exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
@@ -1221,7 +1221,7 @@ function process_15(&$general) {
$exp = 100 * 3; $exp = 100 * 3;
$ded = 70 * 3; $ded = 70 * 3;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100 * 3)); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100 * 3));
// 성격 보정 // 성격 보정
$exp = CharExperience($exp, $general['personal']); $exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
@@ -1309,7 +1309,7 @@ function process_16(&$general) {
$query = "update city set state=43,term=3 where city='{$destcity['city']}'"; $query = "update city set state=43,term=3 where city='{$destcity['city']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], Util::round($general['crew']/100)); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], Util::round($general['crew']/100));
// 전투 처리 // 전투 처리
$dead = processWar($general, $destcity); $dead = processWar($general, $destcity);
@@ -1814,17 +1814,17 @@ function process_41(&$general) {
if($ratio < 33) { if($ratio < 33) {
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도 향상이 <span class='ev_failed'>지지부진</span>했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도 향상이 <span class='ev_failed'>지지부진</span>했습니다. <1>$date</>";
} elseif($ratio < 66) { } elseif($ratio < 66) {
$exp = $exp * 2; $exp = $exp * 2;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 2); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 2);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 향상되었습니다. <1>$date</>";
} else { } else {
$exp = $exp * 3; $exp = $exp * 3;
// 숙련도 증가 // 숙련도 증가
addGenDex($general['no'], GameConst::$maxatmos, GameConst::$maxtrain, $general['crewtype'], $crewexp * 3); addGenDex($general['no'], GameConst::$maxAtmosByCommand, GameConst::$maxTrainByCommand, $general['crewtype'], $crewexp * 3);
$log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 <S>일취월장</>했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:$crewstr 숙련도가 <S>일취월장</>했습니다. <1>$date</>";
} }
+383 -307
View File
@@ -291,72 +291,87 @@ function process_27(&$general) {
function process_51(&$general) { function process_51(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
$query = "select year,month from game limit 1"; if($general['level'] < 5 || $general['nation']==0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>"]);
$admin = MYDB_fetch_array($result); return;
$query = "select nation,supply from city where city='{$general['city']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
$which = $command[1];
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
if($younation['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 권고 실패. <1>$date</>";
} elseif($general['level'] < 5) {
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>";
} elseif($city['nation'] != $general['nation']) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 권고 실패. <1>$date</>";
} elseif($city['supply'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 권고 실패. <1>$date</>";
} else {
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>";
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
$deleted = 4;
for($i=0; $i < 5; $i++) {
if($younation["dip{$i}"] == "") { $deleted = $i; }
}
//기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
}
//권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation'];
$date = date('Y-m-d H:i:s');
$query = "update nation set dip0='{$nation['name']}의 항복 권고 서신',dip0_type='4',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $log = checkAbility($general, $log);
} }
pushGenLog($general, $log); $supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
$command = DecodeCommand($myTurn);
$which = $command[1];
$srcNation = getNationStaticInfo($general['nation']);
$destNation = getNationStaticInfo($which);
if($destNation['nation'] == 0) {
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 권고 실패. <1>$date</>"]);
return;
}
if($supply === null) {
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 권고 실패. <1>$date</>"]);
return;
}
if($supply === 0) {
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 권고 실패. <1>$date</>"]);
return;
}
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
$src = new MessageTarget(
$general['no'],
$general['name'],
$srcNation['nation'],
$srcNation['name'],
$srcNation['color'],
GetImageURL($general['imgsvr'], $general['picture'])
);
$dest = new MessageTarget(
0,
'',
$destNation['nation'],
$destNation['name'],
$destNation['color']
);
$now = new \DateTime($date);
$validUntil = new \DateTime($date);
$validMinutes = max(30, $turnterm*3);
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
$msg = new DiplomaticMessage(
Message::MSGTYPE_DIPLOMACY,
$src,
$dest,
"{$srcNation['name']}의 항복 권고 서신",
$now,
$validUntil,
['action'=>DiplomaticMessage::TYPE_SURRENDER]
);
$msg->send();
$db->update('general', [
'dedication'=>$db->sqleval('dedication+%i', $ded),
'experience'=>$db->sqleval('experience+%i', $exp)
], 'no=%i', $general['no']);
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 항복 권고 서신을 보냈습니다.<1>$date</>"]);
} }
function process_52(&$general) { function process_52(&$general) {
@@ -473,155 +488,186 @@ function process_52(&$general) {
function process_53(&$general) { function process_53(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
$query = "select year,month from game limit 1"; if($general['level'] < 5 || $general['nation']==0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
$admin = MYDB_fetch_array($result); return;
}
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
$query = "select nation,supply from city where city='{$general['city']}'"; $command = DecodeCommand($myTurn);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
$which = $command[1]; $which = $command[1];
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'"; $srcNation = getNationStaticInfo($general['nation']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $destNation = getNationStaticInfo($which);
$younation = MYDB_fetch_array($result);
if($younation['nation'] == 0) { if($destNation['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>"; pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
} elseif($general['level'] < 5) { return;
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"; }
} elseif($city['nation'] != $general['nation']) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>"; if($supply === null) {
} elseif($city['supply'] == 0) { pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>"; return;
} else {
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>(으)로 통합 제의 서신을 보냈습니다.<1>$date</>";
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
$deleted = 4;
for($i=0; $i < 5; $i++) {
if($younation["dip{$i}"] == "") { $deleted = $i; }
}
//기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
}
//권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation'];
$date = date('Y-m-d H:i:s');
$query = "update nation set dip0='{$nation['name']}의 통합 제의 서신',dip0_type='5',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $log = checkAbility($general, $log);
} }
pushGenLog($general, $log);
if($supply === 0) {
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
return;
}
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
$src = new MessageTarget(
$general['no'],
$general['name'],
$srcNation['nation'],
$srcNation['name'],
$srcNation['color'],
GetImageURL($general['imgsvr'], $general['picture'])
);
$dest = new MessageTarget(
0,
'',
$destNation['nation'],
$destNation['name'],
$destNation['color']
);
$now = new \DateTime($date);
$validUntil = new \DateTime($date);
$validMinutes = max(30, $turnterm*3);
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
$msg = new DiplomaticMessage(
Message::MSGTYPE_DIPLOMACY,
$src,
$dest,
"{$srcNation['name']}의 통합 제의 서신",
$now,
$validUntil,
['action'=>DiplomaticMessage::TYPE_MERGE]
);
$msg->send();
$db->update('general', [
'dedication'=>$db->sqleval('dedication+%i', $ded),
'experience'=>$db->sqleval('experience+%i', $exp)
], 'no=%i', $general['no']);
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>(으)로 통합 제의 서신을 보냈습니다.<1>$date</>"]);
} }
function process_61(&$general) { function process_61(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
$query = "select year,month,develcost,turnterm from game limit 1"; if($general['level'] < 5 || $general['nation']==0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
$admin = MYDB_fetch_array($result); return;
$query = "select nation,supply from city where city='{$general['city']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result);
$query = "select gold,rice,name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
$when = $command[2];
$which = $command[1];
if($when < 1) { $when = 1; }
elseif($when > 20) { $when = 20; }
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
if($younation['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>";
} elseif($general['level'] < 5) {
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>";
} elseif($city['nation'] != $general['nation']) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>";
} elseif($city['supply'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>";
} else {
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 불가침 제의 서신을 보냈습니다.<1>$date</>";
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
$deleted = 4;
for($i=0; $i < 5; $i++) {
if($younation["dip{$i}"] == "") { $deleted = $i; }
}
//기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
}
//권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation'];
$type = $when * 100 + 6;
$date = date('Y-m-d H:i:s');
$query = "update nation set dip0='{$nation['name']}{$when}년 불가침 제의 서신',dip0_type='$type',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 3턴후
$date = addTurn($date, $admin['turnterm'], 3);
//조건 표시기한 설정
$query = "update diplomacy set showing='{$date}' where me='{$general['nation']}' and you='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $admin['develcost']*10씩 차감
// $amount = $admin['develcost'];
// $query = "update nation set gold=gold-'$amount',rice=rice-'$amount' where nation='{$general['nation']}'";
// MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $log = checkAbility($general, $log);
} }
pushGenLog($general, $log);
$supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
$myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
$command = DecodeCommand($myTurn);
$which = $command[1];
$when = Util::valueFit($command[2], 1, 20);
$srcNation = getNationStaticInfo($general['nation']);
$destNation = getNationStaticInfo($which);
if($destNation['nation'] == 0) {
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
return;
}
if($supply === null) {
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
return;
}
if($supply === 0) {
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
return;
}
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
$src = new MessageTarget(
$general['no'],
$general['name'],
$srcNation['nation'],
$srcNation['name'],
$srcNation['color'],
GetImageURL($general['imgsvr'], $general['picture'])
);
$dest = new MessageTarget(
0,
'',
$destNation['nation'],
$destNation['name'],
$destNation['color']
);
$now = new \DateTime($date);
$validUntil = new \DateTime($date);
$validMinutes = max(30, $turnterm*3);
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
//FIXME: 현재 command가 숫자로만 이루어져 있어서 문자열을 처리할 수 없다.
//XXX: 으악.
//TODO: 커맨드 처리 방식을 json으로 변경
$option = $db->queryFirstField('SELECT reserved FROM diplomacy WHERE me=%i AND you=%i', $src->nationID, $dest->nationID);
$msg = new DiplomaticMessage(
Message::MSGTYPE_DIPLOMACY,
$src,
$dest,
"{$srcNation['name']}의 불가침 제의 서신",
$now,
$validUntil,
[
'action'=>DiplomaticMessage::TYPE_NO_AGGRESSION,
'year'=>$when,
'option'=>$option
]
);
$msg->send();
//NOTE: 현재 내무부 외교란의 비고는 diplomacy가 기준이니까 유지할 필요는 있다.
//FIXME: 외교란도 message란의 diplomacy를 참조하든가 하도록.
$db->update('diplomacy', [
'showing'=>$validUntil->format('Y-m-d H:i:s')
], 'me=%i AND you=%i', $src->nationID, $dest->nationID);
// 3턴후
$db->update('general', [
'dedication'=>$db->sqleval('dedication+%i', $ded),
'experience'=>$db->sqleval('experience+%i', $exp)
], 'no=%i', $general['no']);
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 불가침 제의 서신을 보냈습니다.<1>$date</>"]);
} }
function process_62(&$general) { function process_62(&$general) {
@@ -724,138 +770,168 @@ function process_62(&$general) {
function process_63(&$general) { function process_63(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
$query = "select year,month from game limit 1"; if($general['level'] < 5 || $general['nation']==0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
$admin = MYDB_fetch_array($result); return;
}
$query = "select nation,supply from city where city='{$general['city']}'"; $supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
$city = MYDB_fetch_array($result);
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $command = DecodeCommand($myTurn);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
$which = $command[1]; $which = $command[1];
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'"; $srcNation = getNationStaticInfo($general['nation']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $destNation = getNationStaticInfo($which);
$younation = MYDB_fetch_array($result);
if($younation['nation'] == 0) { if($destNation['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>"; pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
} elseif($general['level'] < 5) { return;
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"; }
} elseif($city['nation'] != $general['nation']) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>"; if($supply === null) {
} elseif($city['supply'] == 0) { pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>"; return;
} else {
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 종전 제의 서신을 보냈습니다. <1>$date</>";
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
$deleted = 4;
for($i=0; $i < 5; $i++) {
if($younation["dip{$i}"] == "") { $deleted = $i; }
}
//기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
}
//권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation'];
$date = date('Y-m-d H:i:s');
$query = "update nation set dip0='{$nation['name']}의 종전 제의 서신',dip0_type='7',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $log = checkAbility($general, $log);
} }
pushGenLog($general, $log);
if($supply === 0) {
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
return;
}
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
$src = new MessageTarget(
$general['no'],
$general['name'],
$srcNation['nation'],
$srcNation['name'],
$srcNation['color'],
GetImageURL($general['imgsvr'], $general['picture'])
);
$dest = new MessageTarget(
0,
'',
$destNation['nation'],
$destNation['name'],
$destNation['color']
);
$now = new \DateTime($date);
$validUntil = new \DateTime($date);
$validMinutes = max(30, $turnterm*3);
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
$msg = new DiplomaticMessage(
Message::MSGTYPE_DIPLOMACY,
$src,
$dest,
"{$srcNation['name']}의 종전 제의 서신",
$now,
$validUntil,
['action'=>DiplomaticMessage::TYPE_STOP_WAR]
);
$msg->send();
$db->update('general', [
'dedication'=>$db->sqleval('dedication+%i', $ded),
'experience'=>$db->sqleval('experience+%i', $exp)
], 'no=%i', $general['no']);
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 종전 제의 서신을 보냈습니다. <1>$date</>"]);
} }
function process_64(&$general) { function process_64(&$general) {
$db = DB::db(); $db = DB::db();
$connect=$db->get();
$log = [];
$alllog = [];
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
list($year, $month, $turnterm) = $db->queryFirstList('SELECT year,month,turnterm FROM game LIMIT 1');
$query = "select year,month from game limit 1"; if($general['level'] < 5 || $general['nation']==0) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
$admin = MYDB_fetch_array($result); return;
}
$query = "select nation,supply from city where city='{$general['city']}'"; $supply = $db->queryFirstField('SELECT supply FROM city WHERE city=%i AND nation=%i', $general['city'], $general['nation']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $myTurn = $db->queryFirstField('SELECT %b FROM nation WHERE nation=%i', "l{$general['level']}turn0", $general['nation']);
$city = MYDB_fetch_array($result);
$query = "select name,l{$general['level']}turn0 from nation where nation='{$general['nation']}'"; $command = DecodeCommand($myTurn);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$command = DecodeCommand($nation["l{$general['level']}turn0"]);
$which = $command[1]; $which = $command[1];
$query = "select nation,name,dip0,dip0_type,dip0_who,dip0_when,dip1,dip1_type,dip1_who,dip1_when,dip2,dip2_type,dip2_who,dip2_when,dip3,dip3_type,dip3_who,dip3_when,dip4,dip4_type,dip4_who,dip4_when from nation where nation='$which'"; $srcNation = getNationStaticInfo($general['nation']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $destNation = getNationStaticInfo($which);
$younation = MYDB_fetch_array($result);
if($younation['nation'] == 0) { if($destNation['nation'] == 0) {
$log[] = "<C>●</>{$admin['month']}월:멸망한 국가입니다. 제의 실패. <1>$date</>"; pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
} elseif($general['level'] < 5) { return;
$log[] = "<C>●</>{$admin['month']}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"; }
} elseif($city['nation'] != $general['nation']) {
$log[] = "<C>●</>{$admin['month']}월:아국이 아닙니다. 제의 실패. <1>$date</>"; if($supply === null) {
} elseif($city['supply'] == 0) { pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
$log[] = "<C>●</>{$admin['month']}월:고립된 도시입니다. 제의 실패. <1>$date</>"; return;
} else {
$log[] = "<C>●</>{$admin['month']}월:<D><b>{$younation['name']}</b></>으로 파기 제의 서신을 보냈습니다. <1>$date</>";
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
//먼저 삭제된 칸 중 가장 오래된 칸 찾음
$deleted = 4;
for($i=0; $i < 5; $i++) {
if($younation["dip{$i}"] == "") { $deleted = $i; }
}
//기존 메세지 한칸씩 뒤로 미룸
for($i=$deleted-1; $i >=0; $i--) {
moveMsg("nation", "dip", $i+1, $younation["dip{$i}"], $younation["dip{$i}_type"], $younation["dip{$i}_who"], $younation["dip{$i}_when"], "nation", $younation['nation']);
}
//권고 서신시 장수번호/상대국 번호
$me = $general['no'] * 10000 + $younation['nation'];
$date = date('Y-m-d H:i:s');
$query = "update nation set dip0='{$nation['name']}의 불가침 파기 서신',dip0_type='8',dip0_who='$me',dip0_when='$date' where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set dedication=dedication+'$ded',experience=experience+'$exp' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// $log = checkAbility($general, $log);
} }
pushGenLog($general, $log);
if($supply === 0) {
pushGenLog($general, ["<C>●</>{$month}월:고립된 도시입니다. 제의 실패. <1>$date</>"]);
return;
}
$exp = 5;
$ded = 5;
// 성격 보정
$exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']);
// 상대에게 발송
$src = new MessageTarget(
$general['no'],
$general['name'],
$srcNation['nation'],
$srcNation['name'],
$srcNation['color'],
GetImageURL($general['imgsvr'], $general['picture'])
);
$dest = new MessageTarget(
0,
'',
$destNation['nation'],
$destNation['name'],
$destNation['color']
);
$now = new \DateTime($date);
$validUntil = new \DateTime($date);
$validMinutes = max(30, $turnterm*3);
$validUntil->add(new \DateInterval("PT{$validMinutes}M"));
$msg = new DiplomaticMessage(
Message::MSGTYPE_DIPLOMACY,
$src,
$dest,
"{$srcNation['name']}의 불가침 파기 제의 서신",
$now,
$validUntil,
['action'=>DiplomaticMessage::TYPE_CANCEL_NA]
);
$msg->send();
$db->update('general', [
'dedication'=>$db->sqleval('dedication+%i', $ded),
'experience'=>$db->sqleval('experience+%i', $exp)
], 'no=%i', $general['no']);
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>(으)로 불가침 파기 제의 서신을 보냈습니다.<1>$date</>"]);
} }
function process_65(&$general) { function process_65(&$general) {
+4 -1
View File
@@ -46,6 +46,9 @@ function process_22(&$general) {
$exp = CharExperience($exp, $general['personal']); $exp = CharExperience($exp, $general['personal']);
$ded = CharDedication($ded, $general['personal']); $ded = CharDedication($ded, $general['personal']);
$msg = ScoutMessage::buildScoutMessage($general['no'], $who, $reason);
/*
sendScoutMsg([ sendScoutMsg([
'id' => $general['no'], 'id' => $general['no'],
'nation_id' => Util::array_get($general['nation'], 0) 'nation_id' => Util::array_get($general['nation'], 0)
@@ -53,7 +56,7 @@ function process_22(&$general) {
'id' => $you['no'], 'id' => $you['no'],
'nation_id' => Util::array_get($you['nation'], 0) 'nation_id' => Util::array_get($you['nation'], 0)
],$date); ],$date);
*/
$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']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
+12 -12
View File
@@ -57,7 +57,7 @@ function process_32(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$intelgen = MYDB_fetch_array($result); $intelgen = MYDB_fetch_array($result);
$ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); $ratio = Util::round(((getGeneralIntel($general, true, true, true, false) - getGeneralIntel($intelgen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
$ratio2 = rand() % 100; $ratio2 = rand() % 100;
if($general['item'] == 5) { if($general['item'] == 5) {
@@ -93,8 +93,8 @@ function process_32(&$general) {
$alllog[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>(이)가 불타고 있습니다."; $alllog[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>(이)가 불타고 있습니다.";
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 화계가 성공했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 화계가 성공했습니다. <1>$date</>";
$destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; $destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
$destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; $destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
if($destcity['agri'] < 0) { $destcity['agri'] = 0; } if($destcity['agri'] < 0) { $destcity['agri'] = 0; }
if($destcity['comm'] < 0) { $destcity['comm'] = 0; } if($destcity['comm'] < 0) { $destcity['comm'] = 0; }
$query = "update city set state=32,agri='{$destcity['agri']}',comm='{$destcity['comm']}' where city='$destination'"; $query = "update city set state=32,agri='{$destcity['agri']}',comm='{$destcity['comm']}' where city='$destination'";
@@ -187,7 +187,7 @@ function process_33(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$powergen = MYDB_fetch_array($result); $powergen = MYDB_fetch_array($result);
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
$ratio2 = rand() % 100; $ratio2 = rand() % 100;
if($general['item'] == 5) { if($general['item'] == 5) {
@@ -224,8 +224,8 @@ function process_33(&$general) {
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 탈취가 성공했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 탈취가 성공했습니다. <1>$date</>";
// 탈취 최대 400 * 8 // 탈취 최대 400 * 8
$gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level']; $gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
$rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level']; $rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
$nation['gold'] -= $gold; $nation['gold'] -= $gold;
$nation['rice'] -= $rice; $nation['rice'] -= $rice;
@@ -334,7 +334,7 @@ function process_34(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$powergen = MYDB_fetch_array($result); $powergen = MYDB_fetch_array($result);
$ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); $ratio = Util::round(((getGeneralPower($general, true, true, true, false) - getGeneralPower($powergen, true, true, true, false)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
$ratio2 = rand() % 100; $ratio2 = rand() % 100;
if($general['item'] == 5) { if($general['item'] == 5) {
@@ -371,8 +371,8 @@ function process_34(&$general) {
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 파괴가 성공했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 파괴가 성공했습니다. <1>$date</>";
// 파괴 // 파괴
$destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; $destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
$destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount; $destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
if($destcity['def'] < 100) { $destcity['def'] = 100; } if($destcity['def'] < 100) { $destcity['def'] = 100; }
if($destcity['wall'] < 100) { $destcity['wall'] = 100; } if($destcity['wall'] < 100) { $destcity['wall'] = 100; }
$query = "update city set state=34,def='{$destcity['def']}',wall='{$destcity['wall']}' where city='$destination'"; $query = "update city set state=34,def='{$destcity['def']}',wall='{$destcity['wall']}' where city='$destination'";
@@ -462,7 +462,7 @@ function process_35(&$general) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$defaultSabotageProb)*100); $ratio = Util::round(((getGeneralLeadership($general, true, true, true) - getGeneralLeadership($gen, true, true, true)) / GameConst::$sabotageProbCoefByStat - ($destcity['secu']/$destcity['secu2'])/5 + GameConst::$sabotageDefaultProb)*100);
$ratio2 = rand() % 100; $ratio2 = rand() % 100;
if($general['item'] == 5) { if($general['item'] == 5) {
@@ -499,8 +499,8 @@ function process_35(&$general) {
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 선동이 성공했습니다. <1>$date</>"; $log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 선동이 성공했습니다. <1>$date</>";
// 선동 최대 10 // 선동 최대 10
$destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$defaultSabotageAmount; $destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$sabotageDefaultAmount;
$destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$defaultSabotageAmount/50; $destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$sabotageDefaultAmount/50;
if($destcity['secu'] < 0) { $destcity['secu'] = 0; } if($destcity['secu'] < 0) { $destcity['secu'] = 0; }
if($destcity['rate'] < 0) { $destcity['rate'] = 0; } if($destcity['rate'] < 0) { $destcity['rate'] = 0; }
$query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'"; $query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'";
+3
View File
@@ -108,6 +108,9 @@ function commandButton() {
if($me['level'] >= 2){ if($me['level'] >= 2){
$showSecret = true; $showSecret = true;
} }
else if($me['level']== 0){
$showSecret = false;
}
else if($me['belong'] >= $nation['secretlimit']){ else if($me['belong'] >= $nation['secretlimit']){
$showSecret = true; $showSecret = true;
} }
+1
View File
@@ -117,6 +117,7 @@ function getTournamentTerm() {
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
switch($admin['tnmt_auto']) { switch($admin['tnmt_auto']) {
case 0: $str = '설정 안됨'; break;
case 1: $str = "경기당 12분"; break; case 1: $str = "경기당 12분"; break;
case 2: $str = "경기당 7분"; break; case 2: $str = "경기당 7분"; break;
case 3: $str = "경기당 3분"; break; case 3: $str = "경기당 3분"; break;
+6 -7
View File
@@ -282,23 +282,22 @@ if ($session->userGrade >= 5) {
</select> </select>
<input type="textarea" id="msg_input" maxlength="99"> <input type="textarea" id="msg_input" maxlength="99">
<button id="msg_submit">서신전달&amp;갱신</button> <button id="msg_submit">서신전달&amp;갱신</button><br>
내용 없이 '서신전달&amp;갱신' 누르면 메세지창이 갱신됩니다.
</div> </div>
<div id="message_board"> <div><?=allButton()?></div>
<div class="board_side"> <div id="message_board"><div class="board_side bg0">
<div class="board_header bg0">전체 메시지(최고99자)</div> <div class="board_header bg0">전체 메시지(최고99자)</div>
<section class="public_message"></section> <section class="public_message"></section>
<div class="board_header bg0">개인 메시지(최고99자)</div> <div class="board_header bg0">개인 메시지(최고99자)</div>
<section class="private_message"></section> <section class="private_message"></section>
</div> </div><div class="board_side bg0">
<div class="board_side">
<section class="diplomacy_message"> <section class="diplomacy_message">
</section> </section>
<div class="board_header bg0">국가 메시지(최고99자)</div> <div class="board_header bg0">국가 메시지(최고99자)</div>
<section class="national_message"></section> <section class="national_message"></section>
</div> </div></div>
</div>
<div style="clear:left;"><?=allButton()?><?=banner()?></div> <div style="clear:left;"><?=allButton()?><?=banner()?></div>
<?php PrintElapsedTime(); ?> <?php PrintElapsedTime(); ?>
</div> </div>
+1 -1
View File
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
$rootDB = RootDB::db(); $rootDB = RootDB::db();
$db = DB::db(); $db = DB::db();
$image = $rootDB->queryFirstRow('SELECT picture, imgsvr FROM `MEMBER` WHERE no = %i', $userID); $image = $rootDB->queryFirstRow('SELECT picture, imgsvr FROM `member` WHERE no = %i', $userID);
if(!$image){ if(!$image){
Json::die([ Json::die([
+1 -1
View File
@@ -98,7 +98,7 @@ $mysqli_obj = $db->get();
$scenarioObj = new Scenario($scenario, false); $scenarioObj = new Scenario($scenario, false);
$startyear = $scenarioObj->getYear(); $startyear = $scenarioObj->getYear()??GameConst::$defaultStartYear;
FileUtil::delInDir("logs"); FileUtil::delInDir("logs");
FileUtil::delInDir("data"); FileUtil::delInDir("data");
+9 -80
View File
@@ -29,13 +29,6 @@ if ($msgID === null || !is_bool($msgResponse)) {
]); ]);
} }
$msg = Message::getMessageByID($msgID);
if($msg === null){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 메시지'
]);
}
$general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID); $general = DB::db()->queryFirstRow('select `no`, `name`, `nation`, `nations`, `level`, `npc`, `gold`, `rice`, `troop` from `general` where `no` = %i', $generalID);
if(!$general){ if(!$general){
Json::die([ Json::die([
@@ -44,87 +37,23 @@ if(!$general){
]); ]);
} }
list($result, $messageInfo) = getSingleMessage($msgID); $msg = Message::getMessageByID($msgID);
if($msg === null){
if (!$result) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>$messageInfo 'reason'=>'올바르지 않은 메시지'
]); ]);
} }
'@phan-var-force mixed[] $messageInfo'; if($msgResponse){
$result = $msg->agreeMessage($general['no']);
$msgType = $messageInfo['type'];
$validUntil = $messageInfo['valid_until'];
$date = date('Y-m-d H:i:s');
if ($validUntil < $date) {
Json::die([
'result'=>false,
'reason'=>'만료된 메시지'
]);
} }
else{
$msgOption = Json::decode(Util::array_get($messageInfo['option'], '{}')); $result = $msg->declineMessage($general['no']);
$msgAction = Util::array_get($msgOption['action'], null);
$messageInfo['option'] = $msgOption;
$msgSrc = Json::decode($messageInfo['src']);
$messageInfo['src'] = $msgSrc;
$msgDest = Json::decode($messageInfo['dest']);
$messageInfo['dest'] = $msgDest;
if (!$msgAction) {
Json::die([
'result'=>false,
'reason'=>'응답 대상 메시지 아님'
]);
}
if ($msgType == 'diplomacy' && $msgSrc['nation_id'] != $msgDest['nation_id']) {
//여기로 올일이 있나?
Json::die([
'result'=>false,
'reason'=>'(버그) 외교 대상 동일'
]);
}
if($msgType == 'diplomacy'){
if($general['level'] < 6){
Json::die([
'result'=>false,
'reason'=>'외교 권한 없음'
]);
}
if($general['nation'] != $msgDest['nation_id']){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 소속 국가'
]);
}
}
switch ($msgAction) {
case 'scout':
//TODO: 등용장 받음. 함수 호출
$result = acceptScout($messageInfo, $general, $msgResponse);
break;
case 'ally':
$result = acceptAlly($messageInfo, $general, $msgResponse);
break;
//TODO:기타 등등
case '':
Json::die([]);
break;
default:
//구현이 정상적으로 된 경우 이쪽으로 오지 않음
$result = [false, '처리 대상 아님'];
} }
Json::die([ Json::die([
'result' => $result[0], 'result' => $result===DiplomaticMessage::ACCEPTED,
'reason' => $result[1] 'reason' => 'result'
]); ]);
+1 -1
View File
@@ -20,7 +20,7 @@ list($generalID, $nationID) = DB::db()->queryFirstList(
if($nationID === null){ if($nationID === null){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'소속 국가가 없습니다' 'reason'=>'장수가 사망했습니다.'
]); ]);
} }
+1 -1
View File
@@ -100,7 +100,7 @@ if($mailbox == Message::MAILBOX_PUBLIC) {
if($mailbox >= Message::MAILBOX_NATIONAL) { if($mailbox >= Message::MAILBOX_NATIONAL) {
if($me['level'] < 5){ if($me['level'] < 5){
$destNationID = $me['nation_id']; $destNationID = $me['nation'];
} }
else{ else{
$destNationID = $mailbox - Message::MAILBOX_NATIONAL; $destNationID = $mailbox - Message::MAILBOX_NATIONAL;
+1 -1
View File
@@ -14,7 +14,7 @@ if (!$userID) {
} }
//회원 테이블에서 정보확인 //회원 테이블에서 정보확인
$member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from MEMBER where no= %i", $userID); $member = RootDB::db()->queryFirstRow("select no,name,picture,imgsvr,grade from member where no= %i", $userID);
if (!$member) { if (!$member) {
MessageBox("잘못된 접근입니다!!!"); MessageBox("잘못된 접근입니다!!!");
+3 -1
View File
@@ -53,11 +53,13 @@ $leader = Util::getReq('leader', 'int', 50);
$power = Util::getReq('power', 'int', 50); $power = Util::getReq('power', 'int', 50);
$intel = Util::getReq('intel', 'int', 50); $intel = Util::getReq('intel', 'int', 50);
$join = Util::getReq('join'); //쓸모 없음
extractMissingPostToGlobals(); extractMissingPostToGlobals();
$rootDB = RootDB::db(); $rootDB = RootDB::db();
//회원 테이블에서 정보확인 //회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM MEMBER WHERE no=%i', $userID); $member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM member WHERE no=%i', $userID);
if (!$member) { if (!$member) {
MessageBox("잘못된 접근입니다!!!"); MessageBox("잘못된 접근입니다!!!");
+2 -2
View File
@@ -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',
+1 -4
View File
@@ -32,7 +32,4 @@
<%if(this.option && this.option.action) {%> <%if(this.option && this.option.action) {%>
<div class="msg_prompt"> <div class="msg_prompt">
<button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button> <button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button>
</div> </div><%} %></div></div>
<%} %>
</div>
</div>
+4 -3
View File
@@ -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% 확률로 임관(엔장, 인재, 의병)
@@ -1853,7 +1854,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]); ], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]);
//수도였으면 긴급 천도 //수도였으면 긴급 천도
if(!isset($destnation['capital']) && $destnation['capital'] == $city['city']) { if(isset($destnation['capital']) && $destnation['capital'] == $city['city']) {
$minCity = findNextCapital($city['city'], $destnation['nation']); $minCity = findNextCapital($city['city'], $destnation['nation']);
$minCityName = CityConst::byID($minCity)->name; $minCityName = CityConst::byID($minCity)->name;
+14 -14
View File
@@ -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]>";
@@ -1,7 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
class DiplomacticMessage extends Message{ class DiplomaticMessage extends Message{
const ACCEPTED = 1; const ACCEPTED = 1;
const DECLINED = -1; const DECLINED = -1;
@@ -49,7 +49,7 @@ class DiplomacticMessage extends Message{
$this->validDiplomacy = false; $this->validDiplomacy = false;
} }
if($this->$validUntil < (new \DateTime())){ if($this->validUntil < (new \DateTime())){
$this->validDiplomacy = false; $this->validDiplomacy = false;
} }
} }
@@ -72,7 +72,7 @@ class DiplomacticMessage extends Message{
protected function noAggression(){ protected function noAggression(){
$year = Util::array_get($this->msgOption['year']); $year = Util::array_get($this->msgOption['year']);
$option = Util::array_get($this->msgOption['option']); $option = Util::array_get($this->msgOption['option'])??'';
if($year < 1 || $year > 30){ if($year < 1 || $year > 30){
return [self::INVALID, '올바르지 않은 불가침 서신입니다.']; return [self::INVALID, '올바르지 않은 불가침 서신입니다.'];
} }
@@ -95,7 +95,7 @@ class DiplomacticMessage 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 DiplomacticMessage 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 DiplomacticMessage 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($this->src->generalID, $this->dest->generalID);
if($chk[0] !== self::ACCEPTED){ if($chk[0] !== self::ACCEPTED){
return $chk; return $chk;
} }
@@ -175,7 +175,7 @@ class DiplomacticMessage 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($this->src->generalID, $this->dest->generalID);
if($chk[0] !== self::ACCEPTED){ if($chk[0] !== self::ACCEPTED){
return $chk; return $chk;
} }
@@ -219,6 +219,8 @@ class DiplomacticMessage 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 DiplomacticMessage 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 DiplomacticMessage 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 DiplomacticMessage 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} 거절 불가."]);
+48 -48
View File
@@ -2,7 +2,7 @@
namespace sammo\Engine; namespace sammo\Engine;
use \sammo\DB; use \sammo\DB;
use \sammo\DiplomacticMessage; use \sammo\DiplomaticMessage;
//NOTE: A가 B에게 항복, 통합 서신을 보냈을 때 통합 후 대상이 A이므로 A가 주체임. //NOTE: A가 B에게 항복, 통합 서신을 보냈을 때 통합 후 대상이 A이므로 A가 주체임.
class Diplomacy{ class Diplomacy{
@@ -73,49 +73,49 @@ class Diplomacy{
//항복시 : 양국 다 외교제한이 지나지 않았어야함. 국력, 장수수가 적절해야함. 인접한 국가여야함. 서로 교전중이어선 안됨. //항복시 : 양국 다 외교제한이 지나지 않았어야함. 국력, 장수수가 적절해야함. 인접한 국가여야함. 서로 교전중이어선 안됨.
// 송신자가 선포, 전쟁중이어선 안됨. 송신자가 C국과 불가침인데 수신자가 C국과 전쟁중이면 안됨 // 송신자가 선포, 전쟁중이어선 안됨. 송신자가 C국과 불가침인데 수신자가 C국과 전쟁중이면 안됨
protected function checkValidNation(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkValidNation(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if(!$this->srcNation || !$this->destNation || !$this->valid){ if(!$this->srcNation || !$this->destNation || !$this->valid){
return [ScoutMessage::DECLINED, '이미 멸망한 국가입니다.']; return [DiplomaticMessage::DECLINED, '올바르지 않은 국가입니다.'];
} }
if($this->srcNation['level'] == 0 || $this->destNation['level'] == 0){ if($this->srcNation['level'] == 0 || $this->destNation['level'] == 0){
return [DiplomacticMessage::DECLINED, '방랑군과 외교룰 수행할 수 없습니다.']; return [DiplomaticMessage::DECLINED, '방랑군과 외교룰 수행할 수 없습니다.'];
} }
return $prev; return $prev;
} }
protected function checkNotWar(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkNotWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if($this->srcToDestDiplomacy['state'] == 0 || $this->srcToDestDiplomacy['state'] == 0 if($this->srcToDestDiplomacy['state'] == 0 || $this->srcToDestDiplomacy['state'] == 0
||$this->destToSrcDiplomacy['state'] == 1 || $this->destToSrcDiplomacy['state'] == 1){ ||$this->destToSrcDiplomacy['state'] == 1 || $this->destToSrcDiplomacy['state'] == 1){
return [DiplomacticMessage::DECLINED, '상대국과 선포, 전쟁 중입니다.']; return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중입니다.'];
} }
return $prev; return $prev;
} }
protected function checkNonAggressionTreaty(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkNonAggressionTreaty(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if($this->srcToDestDiplomacy['state'] !== 7 || $this->destToSrcDiplomacy['state'] !== 7){ if($this->srcToDestDiplomacy['state'] !== 7 || $this->destToSrcDiplomacy['state'] !== 7){
return [DiplomacticMessage::DECLINED, '상대국과 불가침 중이 아닙니다.']; return [DiplomaticMessage::DECLINED, '상대국과 불가침 중이 아닙니다.'];
} }
return $prev; return $prev;
} }
protected function checkInWar(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkInWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
@@ -124,89 +124,89 @@ class Diplomacy{
return $prev; return $prev;
} }
return [DiplomacticMessage::DECLINED, '상대국과 선포, 전쟁 중이 아닙니다.']; return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중이 아닙니다.'];
} }
protected function checkDiplomacyLimit(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkDiplomacyLimit(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if($this->destNation['surlimit'] > 0){ if($this->destNation['surlimit'] > 0){
return [DiplomacticMessage::DECLINED, '본국의 외교 기한이 남아있습니다.']; return [DiplomaticMessage::DECLINED, '본국의 외교 기한이 남아있습니다.'];
} }
if($this->srcNation['surlimit'] > 0){ if($this->srcNation['surlimit'] > 0){
return [DiplomacticMessage::DECLINED, '상대국의 외교 기한이 남아있습니다.']; return [DiplomaticMessage::DECLINED, '상대국의 외교 기한이 남아있습니다.'];
} }
return $prev; return $prev;
} }
protected function checkStrictlyAdjacent(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkStrictlyAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], false)){ if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], false)){
return [DiplomacticMessage::DECLINED, '상대국의 도시들과 보급선이 이어지지 않았습니다.']; return [DiplomaticMessage::DECLINED, '상대국의 도시들과 보급선이 이어지지 않았습니다.'];
} }
return $prev; return $prev;
} }
protected function checkAdjacent(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], true)){ if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], true)){
return [DiplomacticMessage::DECLINED, '상대국의 도시와 인접하지 않았습니다.']; return [DiplomaticMessage::DECLINED, '상대국의 도시와 인접하지 않았습니다.'];
} }
return $prev; return $prev;
} }
protected function checkAlreadyMerging(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkAlreadyMerging(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if((3 <= $this->srcToDestDiplomacy['state'] && $this->srcToDestDiplomacy['state'] <= 6) if((3 <= $this->srcToDestDiplomacy['state'] && $this->srcToDestDiplomacy['state'] <= 6)
||(3 <= $this->destToSrcDiplomacy['state'] && $this->destToSrcDiplomacy['state'] <= 6)){ ||(3 <= $this->destToSrcDiplomacy['state'] && $this->destToSrcDiplomacy['state'] <= 6)){
return [DiplomacticMessage::DECLINED, '상대국과 합병 중입니다.']; return [DiplomaticMessage::DECLINED, '상대국과 합병 중입니다.'];
} }
return $prev; return $prev;
} }
protected function checkSrcNationHasNeutralDiplomacy(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkSrcNationHasNeutralDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
$db = \sammo\DB::db(); $db = \sammo\DB::db();
$states = $db->queryOneField( $states = $db->queryFirstColumn(
'SELECT `state` FROM diplomacy WHERE me = %i AND you != %i AND `state` NOT IN (2, 7) GROUP BY `state` ORDER BY `state`', 'SELECT `state` FROM diplomacy WHERE `state` NOT IN (2, 7) AND me=%i AND you <>%i',
$this->srcNation['nation'], $this->srcNation['nation'],
$this->destNation['nation'] $this->destNation['nation']
); );
foreach($states as $state){ foreach($states as $state){
if($state == 0 || $state == 1){ if($state == 0 || $state == 1){
return [DiplomacticMessage::DECLINED, '상대국이 전쟁 중입니다.']; return [DiplomaticMessage::DECLINED, '상대국이 전쟁 중입니다.'];
} }
if(3 <= $state && $state <= 6){ if(3 <= $state && $state <= 6){
return [DiplomacticMessage::DECLINED, '상대국이 합병 중입니다.']; return [DiplomaticMessage::DECLINED, '상대국이 합병 중입니다.'];
} }
} }
return $prev; return $prev;
} }
protected function checkContradictoryDiplomacy(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkContradictoryDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
@@ -221,26 +221,26 @@ class Diplomacy{
); );
if($cnt > 0){ if($cnt > 0){
return [DiplomacticMessage::DECLINED, '상대국이 본국의 교전국과 불가침중입니다.']; return [DiplomaticMessage::DECLINED, '상대국이 본국의 교전국과 불가침중입니다.'];
} }
return $prev; return $prev;
} }
protected function checkMorePower(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkMorePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
if($this->srcNation['power'] < $this->destNation['power'] * 3){ if($this->srcNation['power'] < $this->destNation['power'] * 3){
return [DiplomacticMessage::DECLINED, '상대국과 국력차가 크지 않습니다.']; return [DiplomaticMessage::DECLINED, '상대국과 국력차가 크지 않습니다.'];
} }
return $prev; return $prev;
} }
protected function checkMergePower(array $prev = [DiplomacticMessage::ACCEPTED, '']){ protected function checkMergePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
if($prev[0] !== DiplomacticMessage::ACCEPTED){ if($prev[0] !== DiplomaticMessage::ACCEPTED){
return $prev; return $prev;
} }
@@ -257,13 +257,13 @@ class Diplomacy{
$mergedPower = ($this->srcNation['power'] + $this->destNation['power'])/2; $mergedPower = ($this->srcNation['power'] + $this->destNation['power'])/2;
$ZPower = ($mergedPower - $powerAvg) / $powerStddev; $ZPower = ($mergedPower - $powerAvg) / $powerStddev;
if($ZPower >= -0.25){ if($ZPower >= -0.25){
return [DiplomacticMessage::DECLINED, '두 국가의 국력 평균이 상위 60% 보다 높습니다.']; return [DiplomaticMessage::DECLINED, '두 국가의 국력 평균이 상위 60% 보다 높습니다.'];
} }
$mergedGeneral = ($this->srcNation['gennum'] + $this->destNation['gennum'])/2; $mergedGeneral = ($this->srcNation['gennum'] + $this->destNation['gennum'])/2;
$ZGeneral = ($mergedGeneral - $genAvg) / $genStddev; $ZGeneral = ($mergedGeneral - $genAvg) / $genStddev;
if($ZGeneral >= -0.67){ if($ZGeneral >= -0.67){
return [DiplomacticMessage::DECLINED, '두 국가의 장수수 평균이 상위 75% 보다 높습니다.']; return [DiplomaticMessage::DECLINED, '두 국가의 장수수 평균이 상위 75% 보다 높습니다.'];
} }
return $prev; return $prev;
@@ -275,7 +275,7 @@ class Diplomacy{
$chk = $this->checkAlreadyMerging($chk); $chk = $this->checkAlreadyMerging($chk);
list($result, $reason) = $chk; list($result, $reason) = $chk;
if($result !== DiplomacticMessage::ACCEPTED){ if($result !== DiplomaticMessage::ACCEPTED){
return $chk; return $chk;
} }
@@ -297,7 +297,7 @@ class Diplomacy{
$chk = $this->checkNonAggressionTreaty($chk); $chk = $this->checkNonAggressionTreaty($chk);
list($result, $reason) = $chk; list($result, $reason) = $chk;
if($result !== DiplomacticMessage::ACCEPTED){ if($result !== DiplomaticMessage::ACCEPTED){
return $chk; return $chk;
} }
@@ -319,7 +319,7 @@ class Diplomacy{
$chk = $this->checkInWar($chk); $chk = $this->checkInWar($chk);
list($result, $reason) = $chk; list($result, $reason) = $chk;
if($result !== DiplomacticMessage::ACCEPTED){ if($result !== DiplomaticMessage::ACCEPTED){
return $chk; return $chk;
} }
@@ -345,7 +345,7 @@ class Diplomacy{
$chk = $this->checkMergePower($chk); $chk = $this->checkMergePower($chk);
list($result, $reason) = $chk; list($result, $reason) = $chk;
if($result !== DiplomacticMessage::ACCEPTED){ if($result !== DiplomaticMessage::ACCEPTED){
return $chk; return $chk;
} }
@@ -378,7 +378,7 @@ class Diplomacy{
$chk = $this->checkMorePower($chk); $chk = $this->checkMorePower($chk);
list($result, $reason) = $chk; list($result, $reason) = $chk;
if($result !== DiplomacticMessage::ACCEPTED){ if($result !== DiplomaticMessage::ACCEPTED){
return $chk; return $chk;
} }
+13 -9
View File
@@ -67,7 +67,7 @@ class Message
$this->isInboxMail = true; $this->isInboxMail = true;
break; break;
} }
if($mailbox > Message::MAILBOX_NATIONAL){ if($mailbox >= Message::MAILBOX_NATIONAL){
if($this->msgType === Message::MSGTYPE_DIPLOMACY){ if($this->msgType === Message::MSGTYPE_DIPLOMACY){
$this->isInboxMail = true; $this->isInboxMail = true;
break; break;
@@ -150,7 +150,7 @@ class Message
$action = Util::array_get($option['action'], null); $action = Util::array_get($option['action'], null);
if ($msgType === self::MSGTYPE_DIPLOMACY) { if ($msgType === self::MSGTYPE_DIPLOMACY) {
$objMessage = new DiplomacticMessage(...$args); $objMessage = new DiplomaticMessage(...$args);
} elseif ($action === 'scout') { } elseif ($action === 'scout') {
$objMessage = new ScoutMessage(...$args); $objMessage = new ScoutMessage(...$args);
} else { } else {
@@ -167,9 +167,6 @@ class Message
if ($mailbox > self::MAILBOX_PUBLIC) { if ($mailbox > self::MAILBOX_PUBLIC) {
return false; return false;
} }
if ($mailbox == self::MAILBOX_NATIONAL) {
return false;
}
if ($mailbox <= 0) { if ($mailbox <= 0) {
return false; return false;
} }
@@ -191,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;
} }
@@ -213,9 +210,12 @@ class Message
throw new \InvalidArgumentException('올바르지 않은 $msgType'); throw new \InvalidArgumentException('올바르지 않은 $msgType');
} }
$date = (new \DateTime())->format('Y-m-d H:i:s');
$where = new \WhereClause('and'); $where = new \WhereClause('and');
$where->add('mailbox = %i', $mailbox); $where->add('mailbox = %i', $mailbox);
$where->add('type = %s', $msgType); $where->add('type = %s', $msgType);
$where->add('valid_until > %s', $date);
if ($fromSeq > 0) { if ($fromSeq > 0) {
$where->add('id > %i', $fromSeq); $where->add('id > %i', $fromSeq);
} }
@@ -239,7 +239,7 @@ class Message
$src_id = $this->src->generalID; $src_id = $this->src->generalID;
$dest_id = self::MAILBOX_PUBLIC; $dest_id = self::MAILBOX_PUBLIC;
} }
else if($mailbox > self::MAILBOX_NATIONAL){ else if($mailbox >= self::MAILBOX_NATIONAL){
$src_id = $this->src->nationID + self::MAILBOX_NATIONAL; $src_id = $this->src->nationID + self::MAILBOX_NATIONAL;
$dest_id = $this->dest->nationID + self::MAILBOX_NATIONAL; $dest_id = $this->dest->nationID + self::MAILBOX_NATIONAL;
} }
@@ -286,6 +286,10 @@ class Message
} }
if($this->msgType === self::MSGTYPE_PRIVATE){ if($this->msgType === self::MSGTYPE_PRIVATE){
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
DB::db()->update('general', [
'newmsg'=>1
], 'no=%i',$this->dest->generalID);
return $this->sendRaw($this->dest->generalID); return $this->sendRaw($this->dest->generalID);
} }
@@ -340,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);
} }
} }
+23
View File
@@ -56,6 +56,29 @@ class MessageTarget extends Target {
); );
} }
/**
* DB 부하 감수하고 일일히 찾아줌.
* 게임 로직과 크게 연관이 없는 곳에서 메시지를 생성해야 경우에만 사용할 것을 권함.
* @return MessageTarget
*/
public static function buildQuick(int $generalID){
$db = DB::db();
list(
$generalName,
$nationID,
$imgsvr,
$picture
) = $db->queryFirstList('SELECT `name`, nation, imgsvr, picture FROM general WHERE `no`=%i', $generalID);
if($generalName === null){
return null;
}
$icon = GetImageURL($imgsvr, $picture);
$nation = getNationStaticInfo($nationID);
return new MessageTarget($generalID, $generalName, $nationID, $nation['name'], $nation['color'], $icon);
}
public function toArray() : array{ public function toArray() : array{
return [ return [
'id'=>$this->generalID, 'id'=>$this->generalID,
+4 -3
View File
@@ -7,9 +7,10 @@ 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);
if(!$member) { if(!$member) {
MessageBox("잘못된 접근입니다!!!"); MessageBox("잘못된 접근입니다!!!");
@@ -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();
?> ?>
+4 -3
View File
@@ -21,7 +21,7 @@ $face = (int)$_POST['face'];
$rootDB = RootDB::db(); $rootDB = RootDB::db();
//회원 테이블에서 정보확인 //회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM MEMBER WHERE no=%i', $userID); $member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM member WHERE no=%i', $userID);
if(!$member) { if(!$member) {
MessageBox("잘못된 접근입니다!!!"); MessageBox("잘못된 접근입니다!!!");
@@ -139,5 +139,6 @@ $rootDB->insert('member_log', [
?> ?>
<script> <script>
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$npc['name']?>'); window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$npc['name']?>');
</script>"); window.open('../i_other/help.php');
<script>window.open('../i_other/help.php');</script> location.href = './';
</script>
+6 -12
View File
@@ -20,8 +20,8 @@ CREATE TABLE `general` (
`refcnt` INT(6) NULL DEFAULT '1', `refcnt` INT(6) NULL DEFAULT '1',
`picture` CHAR(32) NOT NULL, `picture` CHAR(32) NOT NULL,
`imgsvr` INT(1) NULL DEFAULT '0', `imgsvr` INT(1) NULL DEFAULT '0',
`name` CHAR(32) NOT NULL, `name` CHAR(32) NOT NULL COLLATE 'utf8mb4_bin',
`name2` CHAR(32) NULL DEFAULT NULL, `name2` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
`nation` INT(6) NULL DEFAULT '0', `nation` INT(6) NULL DEFAULT '0',
`nations` CHAR(64) NULL DEFAULT ',0,', `nations` CHAR(64) NULL DEFAULT ',0,',
`city` INT(6) NULL DEFAULT '3', `city` INT(6) NULL DEFAULT '3',
@@ -168,7 +168,7 @@ ENGINE=InnoDB;
create table nation ( create table nation (
nation int(6) not null auto_increment, nation int(6) not null auto_increment,
`name` CHAR(64) NOT NULL COLLATE 'utf8_bin', `name` CHAR(64) NOT NULL COLLATE 'utf8mb4_bin',
color char(10) not null, can_change_flag int(1) default 1, color char(10) not null, can_change_flag int(1) default 1,
onlinegen varchar(1024) default '', onlinegen varchar(1024) default '',
msg text default '', msg text default '',
@@ -202,12 +202,6 @@ create table nation (
type int(2) default 0, type int(2) default 0,
rule text default '', rule text default '',
history mediumtext default '', history mediumtext default '',
dip0 char(150) default '', dip0_type int(4) default 0, dip0_who int(9) default 0, dip0_when datetime,
dip1 char(150) default '', dip1_type int(4) default 0, dip1_who int(9) default 0, dip1_when datetime,
dip2 char(150) default '', dip2_type int(4) default 0, dip2_who int(9) default 0, dip2_when datetime,
dip3 char(150) default '', dip3_type int(4) default 0, dip3_who int(9) default 0, dip3_when datetime,
dip4 char(150) default '', dip4_type int(4) default 0, dip4_who int(9) default 0, dip4_when datetime,
dip5 char(150) default '', dip5_type int(4) default 0, dip5_who int(9) default 0, dip5_when datetime,
board0 text default '', board0_who int(6) default 0, board0_when datetime, board0 text default '', board0_who int(6) default 0, board0_when datetime,
board1 text default '', board1_who int(6) default 0, board1_when datetime, board1 text default '', board1_who int(6) default 0, board1_when datetime,
board2 text default '', board2_who int(6) default 0, board2_when datetime, board2 text default '', board2_who int(6) default 0, board2_when datetime,
@@ -286,8 +280,8 @@ create table nation (
########################################################################### ###########################################################################
## trade 100 ## trade 100
create table city ( create table city (
city int(6) not null auto_increment, `city` INT(6) NOT NULL AUTO_INCREMENT,
name char(64) not null, `name` CHAR(64) NOT NULL,
level int(1) default 0, level int(1) default 0,
upgrading int(1) default 0, upgrading int(1) default 0,
nation int(6) default 0, nation int(6) default 0,
@@ -318,7 +312,7 @@ create table city (
state int(2) default 0, state int(2) default 0,
region int(2) default 0, region int(2) default 0,
term int(1) default 0, term int(1) default 0,
conflict varchar(500) default '{}' conflict varchar(500) default '{}',
PRIMARY KEY (city), PRIMARY KEY (city),
KEY (nation) KEY (nation)
+1 -1
View File
@@ -9,7 +9,7 @@ $session = Session::requireLogin()->setReadOnly();
$templates = new \League\Plates\Engine('templates'); $templates = new \League\Plates\Engine('templates');
$db = RootDB::db(); $db = RootDB::db();
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `SYSTEM` WHERE `NO`=1'); $notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1');
$userGrade = $session->userGrade; $userGrade = $session->userGrade;
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
+1 -1
View File
@@ -20,7 +20,7 @@ if(!$pw){
//TODO: 탈퇴 처리하되 한달간 유지. //TODO: 탈퇴 처리하되 한달간 유지.
$db = RootDB::db(); $db = RootDB::db();
$userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM MEMBER '. $userInfo = $db->queryFirstRow('SELECT oauth_id, oauth_type, email, delete_after FROM member '.
'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)', 'WHERE `no`=%i and pw=sha2(concat(salt, %s, salt), 512)',
$userID, $pw); $userID, $pw);
+1 -1
View File
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
// 외부 파라미터 // 외부 파라미터
$db = RootDB::db(); $db = RootDB::db();
$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `MEMBER` WHERE `NO` = %i', $userID); $member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture` FROM `member` WHERE `NO` = %i', $userID);
if(!$member['picture']){ if(!$member['picture']){
$picture = ServConfig::getSharedIconPath().'/default.jpg'; $picture = ServConfig::getSharedIconPath().'/default.jpg';
+2 -2
View File
@@ -22,7 +22,7 @@ $imageType = $size[2];
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF); $availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
$db = RootDB::db(); $db = RootDB::db();
$member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `MEMBER` WHERE `NO` = %i', $userID); $member = $db->queryFirstRow('SELECT `ID`, `PICTURE` FROM `member` WHERE `NO` = %i', $userID);
$picName = $member['PICTURE']; $picName = $member['PICTURE'];
@@ -77,7 +77,7 @@ if(!is_uploaded_file($image['tmp_name'])) {
$response['result'] = false; $response['result'] = false;
} else { } else {
$pic = "{$newPicName}?={$rf}"; $pic = "{$newPicName}?={$rf}";
RootDB::db()->update('MEMBER',[ RootDB::db()->update('member',[
'PICTURE' => $pic, 'PICTURE' => $pic,
'IMGSVR' => 1 'IMGSVR' => 1
], 'NO=%i', $userID); ], 'NO=%i', $userID);
+2 -2
View File
@@ -10,7 +10,7 @@ $userID = Session::getUserID();
$respone = []; $respone = [];
$db = RootDB::db(); $db = RootDB::db();
$picName = $db->queryFirstField('SELECT picture FROM `MEMBER` WHERE `NO` = %i', $userID); $picName = $db->queryFirstField('SELECT picture FROM `member` WHERE `NO` = %i', $userID);
if($picName && strlen($picName) > 11){ if($picName && strlen($picName) > 11){
$dt = substr($picName, -8); $dt = substr($picName, -8);
@@ -32,7 +32,7 @@ if($dt == $rf) {
$response['reason'] = '1일 1회 변경 가능합니다!'; $response['reason'] = '1일 1회 변경 가능합니다!';
$response['result'] = false; $response['result'] = false;
} else { } else {
$db->update('MEMBER', [ $db->update('member', [
'PICTURE'=>'default.jpg', 'PICTURE'=>'default.jpg',
'IMGSVR'=>0, 'IMGSVR'=>0,
], 'NO=%i', $userID); ], 'NO=%i', $userID);
+1 -1
View File
@@ -56,7 +56,7 @@ function doAdminPost($action, $notice, $server){
$response = ['result' => 'FAIL']; $response = ['result' => 'FAIL'];
if($action == 'notice') { if($action == 'notice') {
RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], true); RootDB::db()->update('system', ['NOTICE'=>$notice], true);
$response['result'] = 'SUCCESS'; $response['result'] = 'SUCCESS';
return $response; return $response;
} }
+1 -1
View File
@@ -35,7 +35,7 @@ if(!$userInfo){
]); ]);
} }
$canLogin = $RootDB->queryFirstField('SELECT `LOGIN` FROM `SYSTEM` WHERE `NO` = 1'); $canLogin = $RootDB->queryFirstField('SELECT `LOGIN` FROM `system` WHERE `NO` = 1');
if($canLogin != 'Y' && $userInfo['grade'] < 5){ if($canLogin != 'Y' && $userInfo['grade'] < 5){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
+1 -1
View File
@@ -8,7 +8,7 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
$session = Session::getInstance(); $session = Session::getInstance();
$canJoin = RootDB::db()->queryFirstField('SELECT REG FROM `SYSTEM` WHERE `NO` = 1'); $canJoin = RootDB::db()->queryFirstField('SELECT REG FROM `system` WHERE `NO` = 1');
if($canJoin != 'Y'){ if($canJoin != 'Y'){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
+1 -1
View File
@@ -11,7 +11,7 @@ if($session->isLoggedIn()){
$session->logout(); $session->logout();
} }
$canLogin = RootDB::db()->queryFirstField('SELECT `LOGIN` FROM `SYSTEM` WHERE `NO` = 1'); $canLogin = RootDB::db()->queryFirstField('SELECT `LOGIN` FROM `system` WHERE `NO` = 1');
if($canLogin != 'Y'){ if($canLogin != 'Y'){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
+1 -1
View File
@@ -12,7 +12,7 @@ if(!$access_token){
header('Location:oauth_fail.html'); header('Location:oauth_fail.html');
} }
$canJoin = RootDB::db()->queryFirstField('SELECT REG FROM `SYSTEM` WHERE `NO` = 1'); $canJoin = RootDB::db()->queryFirstField('SELECT REG FROM `system` WHERE `NO` = 1');
if($canJoin != 'Y'){ if($canJoin != 'Y'){
die('현재는 가입이 금지되어있습니다!'); die('현재는 가입이 금지되어있습니다!');
} }
+2
View File
@@ -76,6 +76,8 @@
.board_side{ .board_side{
width:50%; width:50%;
float:left; float:left;
border-left:groove 0.1em;
border-right:groove 0.1em;
} }
.msg_body{ .msg_body{