forked from devsam/core
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da7fcafb27 | ||
|
|
7f7d8b2099 | ||
|
|
b5fb2e9cf4 | ||
|
|
d9ffdf9df8 | ||
|
|
f919187b91 | ||
|
|
d5ead5b74f | ||
|
|
ec1be2c887 | ||
|
|
af0c470923 | ||
|
|
78ce7d20e3 | ||
|
|
932ce9bf51 | ||
|
|
3d602b49bf | ||
|
|
33b7d228f9 | ||
|
|
95a8fd5495 | ||
|
|
87bc416fc7 | ||
|
|
8c21eec168 | ||
|
|
7ef3f0d5c5 | ||
|
|
e90e508005 | ||
|
|
816daed570 | ||
|
|
3626266763 | ||
|
|
6c117a628c | ||
|
|
d3225dfb41 | ||
|
|
bd7e7540d8 | ||
|
|
48088748df | ||
|
|
7a5eecc3e1 | ||
|
|
51d7dede55 | ||
|
|
bcad77ec06 | ||
|
|
9b79d12521 | ||
|
|
4b33461c70 |
@@ -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){
|
||||
Json::die([
|
||||
'step'=>'admin',
|
||||
|
||||
@@ -29,6 +29,8 @@ class RootDB
|
||||
if (self::$uDB === null) {
|
||||
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->error_handler= function(){};
|
||||
self::$uDB->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
|
||||
+236
-191
@@ -26,281 +26,326 @@ $connect=$db->get();
|
||||
|
||||
switch($btn) {
|
||||
case "전체 접속허용":
|
||||
$query = "update general set con=0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'con'=>0
|
||||
], true);
|
||||
break;
|
||||
case "전체 접속제한":
|
||||
$query = "update general set con=1000";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'con'=>1000
|
||||
], true);
|
||||
break;
|
||||
case "블럭 해제":
|
||||
$db->update('general', [
|
||||
'block'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
DB::db()->query('update general set block=0 where no IN %li', $genlist);
|
||||
break;
|
||||
case "1단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
|
||||
//FIXME: subquery로 하는게 더 빠를 듯.
|
||||
$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 no IN %ls', $date, $uid);
|
||||
$db->update('general', [
|
||||
'block'=>1,
|
||||
'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;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set gold=0,rice=0,block=2,killturn=24 where no IN %li',$genlist);
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
'block'=>2,
|
||||
'killturn'=>24
|
||||
], '`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;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$db->query('update general set gold=0,rice=0,block=3,killturn=24 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);
|
||||
$db->update('general', [
|
||||
'gold'=>0,
|
||||
'rice'=>0,
|
||||
'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;
|
||||
case "무한삭턴":
|
||||
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
|
||||
$db->update('general', [
|
||||
'killturn'=>8000
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "강제 사망":
|
||||
$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;
|
||||
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++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$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);
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "특기 부여!";
|
||||
|
||||
$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']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득");
|
||||
pushGenLog($general, $log);
|
||||
$specialWar = SpecialityConst::pickSpecialWar($general);
|
||||
$db->update('general', [
|
||||
'specage2'=>$db->sqleval('age'),
|
||||
'special2'=>$specialWar
|
||||
], 'no=%i', $general['no']);
|
||||
$specialWarName = SpecialityConst::WAR[$specialWar][0];
|
||||
pushGeneralHistory($general, "<C>●</>{$year}년 {$month}월:특기 【<b><C>{$specialWarName}</></b>】(을)를 습득");
|
||||
pushGenLog($general, ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】(을)를 익혔습니다!"]);
|
||||
}
|
||||
|
||||
break;
|
||||
case "경험치1000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = $btn." 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = $btn." 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'experience'=>$db->sqleval('experience+1000')
|
||||
], '`no` IN %li', $genlist);
|
||||
|
||||
break;
|
||||
case "공헌치1000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = $btn." 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = $btn." 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dedication'=>$db->sqleval('dedication+1000')
|
||||
], '`no` IN %li', $genlist);
|
||||
|
||||
break;
|
||||
case "보숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "보병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "보병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex0'=>$db->sqleval('dex0+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "궁숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "궁병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "궁병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex10'=>$db->sqleval('dex10+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "기숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "기병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "기병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex20'=>$db->sqleval('dex20+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "귀숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "귀병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "귀병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex30'=>$db->sqleval('dex30+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "차숙10000":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
$msg = "차병숙련도+10000 지급!";
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
}
|
||||
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),"");
|
||||
$src = MessageTarget::buildQuick($session->generalID);
|
||||
$text = "차병숙련도+10000 지급!";
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
$db->update('general',[
|
||||
'dex40'=>$db->sqleval('dex40+10000')
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "접속 허용":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set con=0 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('genera',[
|
||||
'con'=>0
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "접속 제한":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set con=1000 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('genera',[
|
||||
'con'=>1000
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "메세지 전달":
|
||||
//TODO:새 갠메 시스템으로 변경
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
$text = $msg;
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$msg->send(true);
|
||||
}
|
||||
break;
|
||||
case "무기지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
|
||||
if($weap == 0) { $msg = "무기 회수!"; }
|
||||
else { $msg = getWeapName($weap)." 지급!"; }
|
||||
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
|
||||
|
||||
if($weap == 0) {
|
||||
$text = "무기 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set weap='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set weap='$weap' where no='$genlist[$i]' and weap<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getWeapName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$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;
|
||||
case "책지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$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);
|
||||
if($weap == 0) {
|
||||
$text = "책 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set book='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set book='$weap' where no='$genlist[$i]' and book<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getBookName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$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;
|
||||
case "말지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$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);
|
||||
if($weap == 0) {
|
||||
$text = "말 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set horse='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set horse='$weap' where no='$genlist[$i]' and horse<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getHorseName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$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;
|
||||
case "도구지급":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$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);
|
||||
if($weap == 0) {
|
||||
$text = "특수도구 회수!";
|
||||
}
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
if($weap == 0) {
|
||||
$query = "update general set item='0' where no='$genlist[$i]'";
|
||||
} else {
|
||||
$query = "update general set item='$weap' where no='$genlist[$i]' and item<'$weap'";
|
||||
}
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
else {
|
||||
$text = getItemName($weap)." 지급!";
|
||||
}
|
||||
|
||||
foreach($genlist as $generalID){
|
||||
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
|
||||
$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;
|
||||
case "NPC해제":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set npc=1 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'npc'=>1
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "하야입력":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set turn0='00000000000045' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'turn0'=>'00000000000045'
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "방랑해산":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set turn0='00000000000047',turn1='00000000000056' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'turn0'=>'00000000000047',
|
||||
'turn1'=>'00000000000056'
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "NPC설정":
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$query = "update general set npc=2 where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
$db->update('general', [
|
||||
'npc'=>2
|
||||
], '`no` IN %li', $genlist);
|
||||
break;
|
||||
case "00턴":
|
||||
$query = "select turnterm from game limit 1";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
$turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1');
|
||||
|
||||
for($i=0; $i < count($genlist); $i++) {
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
$cutTurn = cutTurn($turntime, $admin['turnterm']);
|
||||
$query = "update general set turntime='$cutTurn' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
foreach($genlist as $generalID){
|
||||
$turntime = getRandTurn($turnterm);
|
||||
$cutTurn = cutTurn($turntime, $turnterm);
|
||||
$db->update('general', [
|
||||
'turntime'=>$curTurn
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
break;
|
||||
case "랜덤턴":
|
||||
$query = "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++) {
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
$query = "update general set turntime='$turntime' where no='$genlist[$i]'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
foreach($genlist as $generalID){
|
||||
$turntime = getRandTurn($turnterm);
|
||||
$db->update('general', [
|
||||
'turntime'=>$turntime
|
||||
], '`no` IN %li', $genlist);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -31,21 +31,21 @@ switch($btn) {
|
||||
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
|
||||
//FIXME: subquery로 하는게 더 빠를 듯.
|
||||
$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;
|
||||
case "2단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$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);
|
||||
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;
|
||||
case "3단계 블럭":
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$db = DB::db();
|
||||
$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);
|
||||
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;
|
||||
case "무한삭턴":
|
||||
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
|
||||
|
||||
@@ -166,7 +166,7 @@ for ($i=0; $i < 21; $i++) {
|
||||
echo "<td align=center> </td>";
|
||||
} else {
|
||||
$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> </td>";
|
||||
} else {
|
||||
$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
@@ -164,7 +164,7 @@ for ($j=0; $j < $gencount; $j++) {
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
<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>{$general['age']}세</td>
|
||||
<td align=center>".getGenChar($general['personal'])."</td>
|
||||
|
||||
+25
-26
@@ -58,7 +58,7 @@ $nation = MYDB_fetch_array($result);
|
||||
|
||||
$lv = getNationChiefLevel($nation['level']);
|
||||
$turn = [];
|
||||
$gen = [];
|
||||
$gen = [[],[],[],[],[],[],[],[],[],[],[],[]];
|
||||
for($i=12; $i >= $lv; $i--) {
|
||||
$turn[$i] = getCoreTurn($nation, $i);
|
||||
|
||||
@@ -105,7 +105,6 @@ for($i=12; $i >= $lv; $i--) {
|
||||
$turntime[$i] = substr($gen[$i]['turntime'], 14);
|
||||
}
|
||||
|
||||
|
||||
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
|
||||
|
||||
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>"; }
|
||||
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>"; }
|
||||
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>"; }
|
||||
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>"; }
|
||||
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".$gen[$l1]['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>"; }
|
||||
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>"; }
|
||||
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>"; }
|
||||
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>"; }
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
<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($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($l1, $nation['level'])." : {$gen[$l1]['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($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 align=center id=bg1>.</td>
|
||||
</tr>
|
||||
";
|
||||
@@ -144,14 +143,14 @@ for($k=0; $k < 2; $k++) {
|
||||
$turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
|
||||
$turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
|
||||
$j = $i + 1;
|
||||
$td4 = $turndate[$l4] ?: "-";
|
||||
$td3 = $turndate[$l3] ?: "-";
|
||||
$td2 = $turndate[$l2] ?: "-";
|
||||
$td1 = $turndate[$l1] ?: "-";
|
||||
$tn4 = $turn[$l4][$i] ?? "-";
|
||||
$tn3 = $turn[$l3][$i] ?? "-";
|
||||
$tn2 = $turn[$l2][$i] ?? "-";
|
||||
$tn1 = $turn[$l1][$i] ?? "-";
|
||||
$td4 = $turndate[$l4]??"-";
|
||||
$td3 = $turndate[$l3]??"-";
|
||||
$td2 = $turndate[$l2]??"-";
|
||||
$td1 = $turndate[$l1]??"-";
|
||||
$tn4 = $turn[$l4][$i]??"-";
|
||||
$tn3 = $turn[$l3][$i]??"-";
|
||||
$tn2 = $turn[$l2][$i]??"-";
|
||||
$tn1 = $turn[$l1][$i]??"-";
|
||||
echo "
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
";
|
||||
if($totaldate[$l4] != "") { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
|
||||
if($totaldate[$l3] != "") { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
|
||||
if($totaldate[$l2] != "") { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
|
||||
if($totaldate[$l1] != "") { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
|
||||
if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
|
||||
if($totaldate[$l3]??'') { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
|
||||
if($totaldate[$l2]??'') { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
|
||||
if($totaldate[$l1]??'') { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
|
||||
}
|
||||
if($k == 0) {
|
||||
echo "<form action=processing.php method=post><tr><td colspan=5 align=right>";
|
||||
|
||||
@@ -32,7 +32,8 @@ $myNation = MYDB_fetch_array($result);
|
||||
<head>
|
||||
<title>도시정보</title>
|
||||
<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>
|
||||
|
||||
|
||||
+11
-14
@@ -25,7 +25,6 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""
|
||||
$nationcount = MYDB_num_rows($result);
|
||||
$nationnum = [];
|
||||
$nationname = [];
|
||||
$nationcolor = [];
|
||||
|
||||
$nationStr = "";
|
||||
$powerStr = "";
|
||||
@@ -41,7 +40,6 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
|
||||
$nationnum[] = $nation['nation'];
|
||||
$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>";
|
||||
$powerStr .= "국력 {$nation['power']}<br>";
|
||||
@@ -64,9 +62,10 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl
|
||||
$sum = array_sum($conflict);
|
||||
|
||||
foreach ($conflict as $nationID=>$killnum) {
|
||||
$conflict['percent'] = round(100*$killnum / $sum, 1);
|
||||
$conflict['name'] = $nationname[$nationID];
|
||||
$conflict['color'] = $nationcolor[$nationID];
|
||||
$conflict[$nationID] = ['killnum'=>$killnum];
|
||||
$conflict[$nationID]['percent'] = round(100*$killnum / $sum, 1);
|
||||
$conflict[$nationID]['name'] = $nationname[$nationID];
|
||||
$conflict[$nationID]['color'] = getNationStaticInfo($nationID)['color'];
|
||||
}
|
||||
|
||||
$realConflict[] = [$cityID, $cityName, $conflict];
|
||||
@@ -120,7 +119,7 @@ if($nationcount != 0) {
|
||||
|
||||
for($i=0; $i < $nationcount; $i++) {
|
||||
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 "
|
||||
</tr>";
|
||||
@@ -137,7 +136,7 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
}
|
||||
echo "
|
||||
<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++) {
|
||||
if($i == $k) {
|
||||
@@ -202,7 +201,7 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
cellpadding=0
|
||||
bordercolordark='gray'
|
||||
bordercolorlight='black'
|
||||
style='font-size:13px;word-break:break-all;'
|
||||
style='font-size:13px;word-break:break-all;width:100%;'
|
||||
class='bg0'
|
||||
>
|
||||
<?php foreach($conflict as $item): ?>
|
||||
@@ -212,12 +211,10 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
align=right
|
||||
style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
|
||||
><?=$item['name']?> </td>
|
||||
<td width=48 align=right><?=$item['percent']?>% </td>
|
||||
<td
|
||||
width='<?=$item['percent']?>%'
|
||||
style='background-color:<?=$item['color']?>;'
|
||||
></td>
|
||||
<td width=*></td>
|
||||
<td width=48 align=right><?=(float)$item['percent']?> % </td>
|
||||
<td width=*><div
|
||||
style='display:inline-block;width:<?=$item['percent']?>%;background-color:<?=$item['color']?>;'
|
||||
> </div></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
+10
-10
@@ -81,18 +81,18 @@ echo "
|
||||
";
|
||||
for($i=12; $i >= $lv; $i-=2) {
|
||||
$i1 = $i; $i2 = $i - 1;
|
||||
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']);
|
||||
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']);
|
||||
echo "
|
||||
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0);
|
||||
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
|
||||
?>
|
||||
<tr>
|
||||
<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=332><font size=4>";echo $level[$i1]['name']==''?"-":$level[$i1]['name']; echo " ({$level[$i1]['belong']}년)</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=332><font size=4>";echo $level[$i2]['name']==''?"-":$level[$i2]['name']; echo " ({$level[$i2]['belong']}년)</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']??'default.jpg'?>");background-size:64px;'></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=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><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
|
||||
</tr>
|
||||
";
|
||||
<?php
|
||||
}
|
||||
|
||||
echo "
|
||||
|
||||
@@ -24,6 +24,9 @@ $term = Util::getReq('term', 'int');
|
||||
$stuff = Util::getReq('stuff', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
|
||||
$msg = '';
|
||||
$msg2 = '';
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
|
||||
+3
-2
@@ -40,8 +40,9 @@ if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
|
||||
'troop'=>0
|
||||
], 'no=%i AND troop=(SELECT troop FROM troop WHERE no = %i)', $gen, $me['no']);
|
||||
} elseif($btn == "부 대 가 입" && $troop != 0) {
|
||||
$troop = $db->queryFirstField('SELECT troop FROM troop WHERE no = %i', $troop);
|
||||
if($troop){
|
||||
$troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troop);
|
||||
$troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `nation`=%i', $troopLeader, $me['nation']);
|
||||
if($troopLeaderNation){
|
||||
$db->update('general', [
|
||||
'troop'=>$troop
|
||||
], 'no=%i', $me['no']);
|
||||
|
||||
+7
-2
@@ -91,8 +91,13 @@
|
||||
}
|
||||
|
||||
.board_side{
|
||||
width:50%;
|
||||
float:left;
|
||||
height:1370px;
|
||||
width:498px;
|
||||
overflow-y: hidden;
|
||||
display:inline-block;
|
||||
border-left:groove 1px;
|
||||
border-right:groove 1px;
|
||||
border-bottom:groove 1px;
|
||||
}
|
||||
|
||||
.msg_body{
|
||||
|
||||
@@ -27,6 +27,8 @@ class DB{
|
||||
if(self::$uDB === null){
|
||||
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->error_handler= function(){};
|
||||
self::$uDB->throw_exception_on_error = true;
|
||||
self::$uDB->throw_exception_on_nonsql_error = true;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ require_once 'func_time_event.php';
|
||||
require_once('func_template.php');
|
||||
require_once('func_message.php');
|
||||
require_once('func_map.php');
|
||||
require_once('func_diplomacy.php');
|
||||
require_once('func_command.php');
|
||||
|
||||
/**
|
||||
@@ -1721,14 +1720,6 @@ function checkTurn() {
|
||||
$query = "update game set turntime='$date'";
|
||||
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'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
@@ -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
@@ -51,8 +51,8 @@ function Submit($url, $msg="", $msg2="") {
|
||||
echo "a"; // 파폭 버그 때문
|
||||
echo "
|
||||
<form method=post name=f1 action='{$url}'>
|
||||
<input type=hidden name=msg value='{$msg}'>
|
||||
<input type=hidden name=msg2 value='{$msg2}'>
|
||||
<input type=hidden name=msg value=\"{$msg}\">
|
||||
<input type=hidden name=msg2 value=\"{$msg2}\">
|
||||
</form>
|
||||
<script>f1.submit();</script>
|
||||
";
|
||||
|
||||
@@ -48,58 +48,6 @@ function getMailboxList(){
|
||||
|
||||
//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) {
|
||||
$db = DB::db();
|
||||
$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'";
|
||||
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 = " <input type=submit name=ok value=수락 onclick='return confirm(\"정말 수락하시겠습니까?\")'><input type=submit name=ok value=거절 onclick='return confirm(\"정말 거절하시겠습니까?\")'>";
|
||||
} else {
|
||||
$corebutton = " 【수락】【거절】";
|
||||
}
|
||||
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
@@ -521,7 +521,7 @@ function process_5(&$general, $type) {
|
||||
// 태수 보정
|
||||
if($general['level'] == 4 && $general['no'] == $city['gen1']) { $score *= 1.05; }
|
||||
|
||||
$rd = randF();
|
||||
$rd = Util::randF();
|
||||
$r = CriticalRatioDomestic($general, 1);
|
||||
// 특기보정 : 수비, 축성
|
||||
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;
|
||||
$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']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1075,7 +1075,7 @@ function process_13(&$general) {
|
||||
$exp = 100;
|
||||
$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']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1139,14 +1139,14 @@ function process_14(&$general) {
|
||||
// } elseif(intdiv($general['crewtype'], 10) == 4) {
|
||||
// $log[] = "<C>●</>{$admin['month']}월:병기는 사기 진작이 불가능합니다. <1>$date</>";
|
||||
} 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);
|
||||
|
||||
$log[] = "<C>●</>{$admin['month']}월:사기치가 <C>$score</> 상승했습니다. <1>$date</>";
|
||||
$exp = 100;
|
||||
$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']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1221,7 +1221,7 @@ function process_15(&$general) {
|
||||
$exp = 100 * 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']);
|
||||
$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']}'";
|
||||
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);
|
||||
|
||||
@@ -1814,17 +1814,17 @@ function process_41(&$general) {
|
||||
|
||||
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</>";
|
||||
} elseif($ratio < 66) {
|
||||
$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</>";
|
||||
} else {
|
||||
$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</>";
|
||||
}
|
||||
|
||||
|
||||
+383
-307
@@ -291,72 +291,87 @@ function process_27(&$general) {
|
||||
|
||||
|
||||
function process_51(&$general) {
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$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";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$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);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 권고 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -473,155 +488,186 @@ function process_52(&$general) {
|
||||
|
||||
function process_53(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$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";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
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']}'";
|
||||
$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"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$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);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
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='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);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$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";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
$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);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
@@ -724,138 +770,168 @@ function process_62(&$general) {
|
||||
|
||||
function process_63(&$general) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$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";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
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);
|
||||
$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 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"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$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);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
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='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);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
$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";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$admin = MYDB_fetch_array($result);
|
||||
if($general['level'] < 5 || $general['nation']==0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:수뇌부가 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
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);
|
||||
$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 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"]);
|
||||
$command = DecodeCommand($myTurn);
|
||||
$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);
|
||||
$srcNation = getNationStaticInfo($general['nation']);
|
||||
$destNation = getNationStaticInfo($which);
|
||||
|
||||
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='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);
|
||||
if($destNation['nation'] == 0) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:멸망한 국가입니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
|
||||
if($supply === null) {
|
||||
pushGenLog($general, ["<C>●</>{$month}월:아국이 아닙니다. 제의 실패. <1>$date</>"]);
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
|
||||
@@ -46,6 +46,9 @@ function process_22(&$general) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
$msg = ScoutMessage::buildScoutMessage($general['no'], $who, $reason);
|
||||
|
||||
/*
|
||||
sendScoutMsg([
|
||||
'id' => $general['no'],
|
||||
'nation_id' => Util::array_get($general['nation'], 0)
|
||||
@@ -53,7 +56,7 @@ function process_22(&$general) {
|
||||
'id' => $you['no'],
|
||||
'nation_id' => Util::array_get($you['nation'], 0)
|
||||
],$date);
|
||||
|
||||
*/
|
||||
$general['intel2']++;
|
||||
$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),"");
|
||||
|
||||
@@ -57,7 +57,7 @@ function process_32(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$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;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -93,8 +93,8 @@ function process_32(&$general) {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>(이)가 불타고 있습니다.";
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 화계가 성공했습니다. <1>$date</>";
|
||||
|
||||
$destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount;
|
||||
$destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount;
|
||||
$destcity['agri'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['comm'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
if($destcity['agri'] < 0) { $destcity['agri'] = 0; }
|
||||
if($destcity['comm'] < 0) { $destcity['comm'] = 0; }
|
||||
$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),"");
|
||||
$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;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -224,8 +224,8 @@ function process_33(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 탈취가 성공했습니다. <1>$date</>";
|
||||
|
||||
// 탈취 최대 400 * 8
|
||||
$gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level'];
|
||||
$rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount) * $destcity['level'];
|
||||
$gold = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
|
||||
$rice = (rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount) * $destcity['level'];
|
||||
|
||||
$nation['gold'] -= $gold;
|
||||
$nation['rice'] -= $rice;
|
||||
@@ -334,7 +334,7 @@ function process_34(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$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;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -371,8 +371,8 @@ function process_34(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 파괴가 성공했습니다. <1>$date</>";
|
||||
|
||||
// 파괴
|
||||
$destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount;
|
||||
$destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$defaultSabotageAmount;
|
||||
$destcity['def'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['wall'] -= rand() % GameConst::$sabotageAmountCoef + GameConst::$sabotageDefaultAmount;
|
||||
if($destcity['def'] < 100) { $destcity['def'] = 100; }
|
||||
if($destcity['wall'] < 100) { $destcity['wall'] = 100; }
|
||||
$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),"");
|
||||
$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;
|
||||
|
||||
if($general['item'] == 5) {
|
||||
@@ -499,8 +499,8 @@ function process_35(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:<G><b>{$destcity['name']}</b></>에 선동이 성공했습니다. <1>$date</>";
|
||||
|
||||
// 선동 최대 10
|
||||
$destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$defaultSabotageAmount;
|
||||
$destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$defaultSabotageAmount/50;
|
||||
$destcity['secu'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/2) + GameConst::$sabotageDefaultAmount;
|
||||
$destcity['rate'] -= rand() % Util::round(GameConst::$sabotageAmountCoef/50) + GameConst::$sabotageDefaultAmount/50;
|
||||
if($destcity['secu'] < 0) { $destcity['secu'] = 0; }
|
||||
if($destcity['rate'] < 0) { $destcity['rate'] = 0; }
|
||||
$query = "update city set state=32,rate='{$destcity['rate']}',secu='{$destcity['secu']}' where city='$destination'";
|
||||
|
||||
@@ -108,6 +108,9 @@ function commandButton() {
|
||||
if($me['level'] >= 2){
|
||||
$showSecret = true;
|
||||
}
|
||||
else if($me['level']== 0){
|
||||
$showSecret = false;
|
||||
}
|
||||
else if($me['belong'] >= $nation['secretlimit']){
|
||||
$showSecret = true;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ function getTournamentTerm() {
|
||||
$admin = MYDB_fetch_array($result);
|
||||
|
||||
switch($admin['tnmt_auto']) {
|
||||
case 0: $str = '설정 안됨'; break;
|
||||
case 1: $str = "경기당 12분"; break;
|
||||
case 2: $str = "경기당 7분"; break;
|
||||
case 3: $str = "경기당 3분"; break;
|
||||
|
||||
+6
-7
@@ -282,23 +282,22 @@ if ($session->userGrade >= 5) {
|
||||
|
||||
</select>
|
||||
<input type="textarea" id="msg_input" maxlength="99">
|
||||
<button id="msg_submit">서신전달&갱신</button>
|
||||
<button id="msg_submit">서신전달&갱신</button><br>
|
||||
내용 없이 '서신전달&갱신'을 누르면 메세지창이 갱신됩니다.
|
||||
</div>
|
||||
<div id="message_board">
|
||||
<div class="board_side">
|
||||
<div><?=allButton()?></div>
|
||||
<div id="message_board"><div class="board_side bg0">
|
||||
<div class="board_header bg0">전체 메시지(최고99자)</div>
|
||||
<section class="public_message"></section>
|
||||
<div class="board_header bg0">개인 메시지(최고99자)</div>
|
||||
<section class="private_message"></section>
|
||||
</div>
|
||||
<div class="board_side">
|
||||
</div><div class="board_side bg0">
|
||||
<section class="diplomacy_message">
|
||||
|
||||
</section>
|
||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||
<section class="national_message"></section>
|
||||
</div>
|
||||
</div>
|
||||
</div></div>
|
||||
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||
<?php PrintElapsedTime(); ?>
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
|
||||
$rootDB = RootDB::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){
|
||||
Json::die([
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ $mysqli_obj = $db->get();
|
||||
|
||||
|
||||
$scenarioObj = new Scenario($scenario, false);
|
||||
$startyear = $scenarioObj->getYear();
|
||||
$startyear = $scenarioObj->getYear()??GameConst::$defaultStartYear;
|
||||
|
||||
FileUtil::delInDir("logs");
|
||||
FileUtil::delInDir("data");
|
||||
|
||||
@@ -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);
|
||||
if(!$general){
|
||||
Json::die([
|
||||
@@ -44,87 +37,23 @@ if(!$general){
|
||||
]);
|
||||
}
|
||||
|
||||
list($result, $messageInfo) = getSingleMessage($msgID);
|
||||
|
||||
if (!$result) {
|
||||
$msg = Message::getMessageByID($msgID);
|
||||
if($msg === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>$messageInfo
|
||||
'reason'=>'올바르지 않은 메시지'
|
||||
]);
|
||||
}
|
||||
|
||||
'@phan-var-force mixed[] $messageInfo';
|
||||
|
||||
$msgType = $messageInfo['type'];
|
||||
|
||||
$validUntil = $messageInfo['valid_until'];
|
||||
$date = date('Y-m-d H:i:s');
|
||||
if ($validUntil < $date) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'만료된 메시지'
|
||||
]);
|
||||
if($msgResponse){
|
||||
$result = $msg->agreeMessage($general['no']);
|
||||
}
|
||||
|
||||
$msgOption = Json::decode(Util::array_get($messageInfo['option'], '{}'));
|
||||
$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, '처리 대상 아님'];
|
||||
else{
|
||||
$result = $msg->declineMessage($general['no']);
|
||||
}
|
||||
|
||||
|
||||
Json::die([
|
||||
'result' => $result[0],
|
||||
'reason' => $result[1]
|
||||
'result' => $result===DiplomaticMessage::ACCEPTED,
|
||||
'reason' => 'result'
|
||||
]);
|
||||
@@ -20,7 +20,7 @@ list($generalID, $nationID) = DB::db()->queryFirstList(
|
||||
if($nationID === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'소속 국가가 없습니다'
|
||||
'reason'=>'장수가 사망했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ if($mailbox == Message::MAILBOX_PUBLIC) {
|
||||
if($mailbox >= Message::MAILBOX_NATIONAL) {
|
||||
|
||||
if($me['level'] < 5){
|
||||
$destNationID = $me['nation_id'];
|
||||
$destNationID = $me['nation'];
|
||||
}
|
||||
else{
|
||||
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
|
||||
+3
-1
@@ -53,11 +53,13 @@ $leader = Util::getReq('leader', 'int', 50);
|
||||
$power = Util::getReq('power', 'int', 50);
|
||||
$intel = Util::getReq('intel', 'int', 50);
|
||||
|
||||
$join = Util::getReq('join'); //쓸모 없음
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$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) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ function hexToRgb(hex) {
|
||||
|
||||
function isBrightColor(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;
|
||||
}
|
||||
else{
|
||||
@@ -31,7 +31,7 @@ var generalList = {};
|
||||
|
||||
function responseMessage(msgID, response){
|
||||
$.ajax({
|
||||
url: 'j_decide_opt.php',
|
||||
url: 'j_msg_decide_opt.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
contentType: 'application/json',
|
||||
|
||||
@@ -32,7 +32,4 @@
|
||||
<%if(this.option && this.option.action) {%>
|
||||
<div class="msg_prompt">
|
||||
<button class="prompt_yes btn_prompt">수락</button> <button class="prompt_no btn_prompt">거절</button>
|
||||
</div>
|
||||
<%} %>
|
||||
</div>
|
||||
</div>
|
||||
</div><%} %></div></div>
|
||||
+4
-3
@@ -1775,13 +1775,14 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
|| $nation['name'] == "왜족") {
|
||||
//등용장 미발부
|
||||
} elseif(Util::randBool(0.5)) {
|
||||
sendScoutMsg([
|
||||
//TODO:등용장 보낼것
|
||||
/*sendScoutMsg([
|
||||
'id' => $ruler['no'],
|
||||
'nation_id' => $ruler['nation']
|
||||
],[
|
||||
'id' => $gen['no'],
|
||||
'nation_id' => $gen['nation']
|
||||
],$general['turntime']);
|
||||
],$general['turntime']);*/
|
||||
}
|
||||
|
||||
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
||||
@@ -1853,7 +1854,7 @@ function ConquerCity($game, $general, $city, $nation, $destnation) {
|
||||
], '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']);
|
||||
|
||||
$minCityName = CityConst::byID($minCity)->name;
|
||||
|
||||
+14
-14
@@ -1597,22 +1597,22 @@ function command_46($turn, $command) {
|
||||
?>
|
||||
</select>
|
||||
성향 : <select name=third size=1>
|
||||
<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=10 style=background-color:black;color:white;>".getNationType(10)."</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=5 style=background-color:black;color:white;>".getNationType(5)."</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=8 style=background-color:black;color:white;>".getNationType(8)."</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=12 style=background-color:black;color:white;>".getNationType(12)."</option>
|
||||
<option value=13 style=background-color:black;color:white;>".getNationType(13)."</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=10 style=background-color:black;color:white;><?=getNationType(10)?></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=5 style=background-color:black;color:white;><?=getNationType(5)?></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=8 style=background-color:black;color:white;><?=getNationType(8)?></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=12 style=background-color:black;color:white;><?=getNationType(12)?></option>
|
||||
<option value=13 style=background-color:black;color:white;><?=getNationType(13)?></option>
|
||||
</select>
|
||||
<input type=submit value=건국>
|
||||
<input type=hidden name=command value=$command>
|
||||
<input type=hidden name=command value=<?=$command?>>
|
||||
<?php
|
||||
for($i=0; $i < count($turn); $i++) {
|
||||
echo "<input type=hidden name=turn[] value=$turn[$i]>";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class DiplomacticMessage extends Message{
|
||||
class DiplomaticMessage extends Message{
|
||||
|
||||
const ACCEPTED = 1;
|
||||
const DECLINED = -1;
|
||||
@@ -49,7 +49,7 @@ class DiplomacticMessage extends Message{
|
||||
$this->validDiplomacy = false;
|
||||
}
|
||||
|
||||
if($this->$validUntil < (new \DateTime())){
|
||||
if($this->validUntil < (new \DateTime())){
|
||||
$this->validDiplomacy = false;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class DiplomacticMessage extends Message{
|
||||
|
||||
protected function noAggression(){
|
||||
$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){
|
||||
return [self::INVALID, '올바르지 않은 불가침 서신입니다.'];
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class DiplomacticMessage extends Message{
|
||||
|
||||
protected function cancelNA(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->noAggression();
|
||||
$chk = $helper->cancelNA();
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class DiplomacticMessage extends Message{
|
||||
|
||||
protected function stopWar(){
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->noAggression();
|
||||
$chk = $helper->stopWar();
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class DiplomacticMessage extends Message{
|
||||
|
||||
protected function acceptMerge(){
|
||||
$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){
|
||||
return $chk;
|
||||
}
|
||||
@@ -175,7 +175,7 @@ class DiplomacticMessage extends Message{
|
||||
|
||||
protected function acceptSurrender(){
|
||||
$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){
|
||||
return $chk;
|
||||
}
|
||||
@@ -219,6 +219,8 @@ class DiplomacticMessage extends Message{
|
||||
throw \RuntimeException('전송되지 않은 메시지에 수락 진행 중');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
||||
@@ -226,7 +228,20 @@ class DiplomacticMessage extends Message{
|
||||
$this->dest->nationID
|
||||
);
|
||||
|
||||
if($general){
|
||||
$this->dest->generalID = $receiverID;
|
||||
$this->dest->generalName = $general['name'];
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 실패."]);
|
||||
if($result === self::DECLINED){
|
||||
@@ -282,9 +297,9 @@ class DiplomacticMessage extends Message{
|
||||
"【외교】{$year}년 {$month}월: {$this->src->nationName}이 {$this->dest->nationName}에게 제안한 {$this->diplomacyName} 동의.",
|
||||
new \DateTime(),
|
||||
new \DateTime('9999-12-31'),
|
||||
Json::encode([
|
||||
[
|
||||
'delete'=>$this->id
|
||||
])
|
||||
]
|
||||
);
|
||||
$newMsg->send();
|
||||
|
||||
@@ -305,7 +320,13 @@ class DiplomacticMessage extends Message{
|
||||
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){
|
||||
pushGenLog(['no'=>$receiverID], ["<C>●</>{$reason} {$this->diplomacyName} 거절 불가."]);
|
||||
@@ -2,7 +2,7 @@
|
||||
namespace sammo\Engine;
|
||||
|
||||
use \sammo\DB;
|
||||
use \sammo\DiplomacticMessage;
|
||||
use \sammo\DiplomaticMessage;
|
||||
|
||||
//NOTE: A가 B에게 항복, 통합 서신을 보냈을 때 통합 후 대상이 A이므로 A가 주체임.
|
||||
class Diplomacy{
|
||||
@@ -73,49 +73,49 @@ class Diplomacy{
|
||||
//항복시 : 양국 다 외교제한이 지나지 않았어야함. 국력, 장수수가 적절해야함. 인접한 국가여야함. 서로 교전중이어선 안됨.
|
||||
// 송신자가 선포, 전쟁중이어선 안됨. 송신자가 C국과 불가침인데 수신자가 C국과 전쟁중이면 안됨
|
||||
|
||||
protected function checkValidNation(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkValidNation(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!$this->srcNation || !$this->destNation || !$this->valid){
|
||||
return [ScoutMessage::DECLINED, '이미 멸망한 국가입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '올바르지 않은 국가입니다.'];
|
||||
}
|
||||
|
||||
if($this->srcNation['level'] == 0 || $this->destNation['level'] == 0){
|
||||
return [DiplomacticMessage::DECLINED, '방랑군과 외교룰 수행할 수 없습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '방랑군과 외교룰 수행할 수 없습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkNotWar(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkNotWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcToDestDiplomacy['state'] == 0 || $this->srcToDestDiplomacy['state'] == 0
|
||||
||$this->destToSrcDiplomacy['state'] == 1 || $this->destToSrcDiplomacy['state'] == 1){
|
||||
return [DiplomacticMessage::DECLINED, '상대국과 선포, 전쟁 중입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkNonAggressionTreaty(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkNonAggressionTreaty(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcToDestDiplomacy['state'] !== 7 || $this->destToSrcDiplomacy['state'] !== 7){
|
||||
return [DiplomacticMessage::DECLINED, '상대국과 불가침 중이 아닙니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 불가침 중이 아닙니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkInWar(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkInWar(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
@@ -124,89 +124,89 @@ class Diplomacy{
|
||||
return $prev;
|
||||
}
|
||||
|
||||
return [DiplomacticMessage::DECLINED, '상대국과 선포, 전쟁 중이 아닙니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 선포, 전쟁 중이 아닙니다.'];
|
||||
}
|
||||
|
||||
protected function checkDiplomacyLimit(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkDiplomacyLimit(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->destNation['surlimit'] > 0){
|
||||
return [DiplomacticMessage::DECLINED, '본국의 외교 기한이 남아있습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '본국의 외교 기한이 남아있습니다.'];
|
||||
}
|
||||
|
||||
if($this->srcNation['surlimit'] > 0){
|
||||
return [DiplomacticMessage::DECLINED, '상대국의 외교 기한이 남아있습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 외교 기한이 남아있습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkStrictlyAdjacent(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkStrictlyAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], false)){
|
||||
return [DiplomacticMessage::DECLINED, '상대국의 도시들과 보급선이 이어지지 않았습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 도시들과 보급선이 이어지지 않았습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkAdjacent(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkAdjacent(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if(!\sammo\isClose($this->srcNation['nation'], $this->destNation['nation'], true)){
|
||||
return [DiplomacticMessage::DECLINED, '상대국의 도시와 인접하지 않았습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국의 도시와 인접하지 않았습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkAlreadyMerging(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkAlreadyMerging(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if((3 <= $this->srcToDestDiplomacy['state'] && $this->srcToDestDiplomacy['state'] <= 6)
|
||||
||(3 <= $this->destToSrcDiplomacy['state'] && $this->destToSrcDiplomacy['state'] <= 6)){
|
||||
return [DiplomacticMessage::DECLINED, '상대국과 합병 중입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 합병 중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkSrcNationHasNeutralDiplomacy(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkSrcNationHasNeutralDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
$db = \sammo\DB::db();
|
||||
|
||||
$states = $db->queryOneField(
|
||||
'SELECT `state` FROM diplomacy WHERE me = %i AND you != %i AND `state` NOT IN (2, 7) GROUP BY `state` ORDER BY `state`',
|
||||
$states = $db->queryFirstColumn(
|
||||
'SELECT `state` FROM diplomacy WHERE `state` NOT IN (2, 7) AND me=%i AND you <>%i',
|
||||
$this->srcNation['nation'],
|
||||
$this->destNation['nation']
|
||||
);
|
||||
|
||||
foreach($states as $state){
|
||||
if($state == 0 || $state == 1){
|
||||
return [DiplomacticMessage::DECLINED, '상대국이 전쟁 중입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 전쟁 중입니다.'];
|
||||
}
|
||||
if(3 <= $state && $state <= 6){
|
||||
return [DiplomacticMessage::DECLINED, '상대국이 합병 중입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 합병 중입니다.'];
|
||||
}
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkContradictoryDiplomacy(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkContradictoryDiplomacy(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
@@ -221,26 +221,26 @@ class Diplomacy{
|
||||
);
|
||||
|
||||
if($cnt > 0){
|
||||
return [DiplomacticMessage::DECLINED, '상대국이 본국의 교전국과 불가침중입니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국이 본국의 교전국과 불가침중입니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkMorePower(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkMorePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
if($this->srcNation['power'] < $this->destNation['power'] * 3){
|
||||
return [DiplomacticMessage::DECLINED, '상대국과 국력차가 크지 않습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '상대국과 국력차가 크지 않습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
protected function checkMergePower(array $prev = [DiplomacticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomacticMessage::ACCEPTED){
|
||||
protected function checkMergePower(array $prev = [DiplomaticMessage::ACCEPTED, '']){
|
||||
if($prev[0] !== DiplomaticMessage::ACCEPTED){
|
||||
return $prev;
|
||||
}
|
||||
|
||||
@@ -257,13 +257,13 @@ class Diplomacy{
|
||||
$mergedPower = ($this->srcNation['power'] + $this->destNation['power'])/2;
|
||||
$ZPower = ($mergedPower - $powerAvg) / $powerStddev;
|
||||
if($ZPower >= -0.25){
|
||||
return [DiplomacticMessage::DECLINED, '두 국가의 국력 평균이 상위 60% 보다 높습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '두 국가의 국력 평균이 상위 60% 보다 높습니다.'];
|
||||
}
|
||||
|
||||
$mergedGeneral = ($this->srcNation['gennum'] + $this->destNation['gennum'])/2;
|
||||
$ZGeneral = ($mergedGeneral - $genAvg) / $genStddev;
|
||||
if($ZGeneral >= -0.67){
|
||||
return [DiplomacticMessage::DECLINED, '두 국가의 장수수 평균이 상위 75% 보다 높습니다.'];
|
||||
return [DiplomaticMessage::DECLINED, '두 국가의 장수수 평균이 상위 75% 보다 높습니다.'];
|
||||
}
|
||||
|
||||
return $prev;
|
||||
@@ -275,7 +275,7 @@ class Diplomacy{
|
||||
$chk = $this->checkAlreadyMerging($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomacticMessage::ACCEPTED){
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ class Diplomacy{
|
||||
$chk = $this->checkNonAggressionTreaty($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomacticMessage::ACCEPTED){
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ class Diplomacy{
|
||||
$chk = $this->checkInWar($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomacticMessage::ACCEPTED){
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ class Diplomacy{
|
||||
$chk = $this->checkMergePower($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomacticMessage::ACCEPTED){
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
@@ -378,7 +378,7 @@ class Diplomacy{
|
||||
$chk = $this->checkMorePower($chk);
|
||||
|
||||
list($result, $reason) = $chk;
|
||||
if($result !== DiplomacticMessage::ACCEPTED){
|
||||
if($result !== DiplomaticMessage::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
|
||||
|
||||
+13
-9
@@ -67,7 +67,7 @@ class Message
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
}
|
||||
if($mailbox > Message::MAILBOX_NATIONAL){
|
||||
if($mailbox >= Message::MAILBOX_NATIONAL){
|
||||
if($this->msgType === Message::MSGTYPE_DIPLOMACY){
|
||||
$this->isInboxMail = true;
|
||||
break;
|
||||
@@ -150,7 +150,7 @@ class Message
|
||||
|
||||
$action = Util::array_get($option['action'], null);
|
||||
if ($msgType === self::MSGTYPE_DIPLOMACY) {
|
||||
$objMessage = new DiplomacticMessage(...$args);
|
||||
$objMessage = new DiplomaticMessage(...$args);
|
||||
} elseif ($action === 'scout') {
|
||||
$objMessage = new ScoutMessage(...$args);
|
||||
} else {
|
||||
@@ -167,9 +167,6 @@ class Message
|
||||
if ($mailbox > self::MAILBOX_PUBLIC) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox == self::MAILBOX_NATIONAL) {
|
||||
return false;
|
||||
}
|
||||
if ($mailbox <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -191,7 +188,7 @@ class Message
|
||||
{
|
||||
$db = DB::db();
|
||||
$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) {
|
||||
return null;
|
||||
}
|
||||
@@ -213,9 +210,12 @@ class Message
|
||||
throw new \InvalidArgumentException('올바르지 않은 $msgType');
|
||||
}
|
||||
|
||||
$date = (new \DateTime())->format('Y-m-d H:i:s');
|
||||
|
||||
$where = new \WhereClause('and');
|
||||
$where->add('mailbox = %i', $mailbox);
|
||||
$where->add('type = %s', $msgType);
|
||||
$where->add('valid_until > %s', $date);
|
||||
if ($fromSeq > 0) {
|
||||
$where->add('id > %i', $fromSeq);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ class Message
|
||||
$src_id = $this->src->generalID;
|
||||
$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;
|
||||
$dest_id = $this->dest->nationID + self::MAILBOX_NATIONAL;
|
||||
}
|
||||
@@ -286,6 +286,10 @@ class Message
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'no=%i',$this->dest->generalID);
|
||||
return $this->sendRaw($this->dest->generalID);
|
||||
}
|
||||
|
||||
@@ -340,8 +344,8 @@ class Message
|
||||
'text' => $this->msg,
|
||||
'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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
return [
|
||||
'id'=>$this->generalID,
|
||||
|
||||
+4
-3
@@ -7,9 +7,10 @@ include "func.php";
|
||||
$session = Session::requireLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
$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) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
@@ -17,14 +18,14 @@ if(!$member) {
|
||||
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) {
|
||||
header('Location:join.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$connect=$db->get();
|
||||
|
||||
?>
|
||||
|
||||
@@ -21,7 +21,7 @@ $face = (int)$_POST['face'];
|
||||
$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) {
|
||||
MessageBox("잘못된 접근입니다!!!");
|
||||
@@ -139,5 +139,6 @@ $rootDB->insert('member_log', [
|
||||
?>
|
||||
<script>
|
||||
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$npc['name']?>');
|
||||
</script>");
|
||||
<script>window.open('../i_other/help.php');</script>
|
||||
window.open('../i_other/help.php');
|
||||
location.href = './';
|
||||
</script>
|
||||
|
||||
+6
-12
@@ -20,8 +20,8 @@ CREATE TABLE `general` (
|
||||
`refcnt` INT(6) NULL DEFAULT '1',
|
||||
`picture` CHAR(32) NOT NULL,
|
||||
`imgsvr` INT(1) NULL DEFAULT '0',
|
||||
`name` CHAR(32) NOT NULL,
|
||||
`name2` CHAR(32) NULL DEFAULT NULL,
|
||||
`name` CHAR(32) NOT NULL COLLATE 'utf8mb4_bin',
|
||||
`name2` CHAR(32) NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
|
||||
`nation` INT(6) NULL DEFAULT '0',
|
||||
`nations` CHAR(64) NULL DEFAULT ',0,',
|
||||
`city` INT(6) NULL DEFAULT '3',
|
||||
@@ -168,7 +168,7 @@ ENGINE=InnoDB;
|
||||
|
||||
create table nation (
|
||||
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,
|
||||
onlinegen varchar(1024) default '',
|
||||
msg text default '',
|
||||
@@ -202,12 +202,6 @@ create table nation (
|
||||
type int(2) default 0,
|
||||
rule text 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,
|
||||
board1 text default '', board1_who int(6) default 0, board1_when datetime,
|
||||
board2 text default '', board2_who int(6) default 0, board2_when datetime,
|
||||
@@ -286,8 +280,8 @@ create table nation (
|
||||
###########################################################################
|
||||
## trade 100 이 표준 시세
|
||||
create table city (
|
||||
city int(6) not null auto_increment,
|
||||
name char(64) not null,
|
||||
`city` INT(6) NOT NULL AUTO_INCREMENT,
|
||||
`name` CHAR(64) NOT NULL,
|
||||
level int(1) default 0,
|
||||
upgrading int(1) default 0,
|
||||
nation int(6) default 0,
|
||||
@@ -318,7 +312,7 @@ create table city (
|
||||
state int(2) default 0,
|
||||
region int(2) default 0,
|
||||
term int(1) default 0,
|
||||
conflict varchar(500) default '{}'
|
||||
conflict varchar(500) default '{}',
|
||||
|
||||
PRIMARY KEY (city),
|
||||
KEY (nation)
|
||||
|
||||
@@ -9,7 +9,7 @@ $session = Session::requireLogin()->setReadOnly();
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
|
||||
$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;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
@@ -20,7 +20,7 @@ if(!$pw){
|
||||
//TODO: 탈퇴 처리하되 한달간 유지.
|
||||
$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)',
|
||||
$userID, $pw);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
|
||||
// 외부 파라미터
|
||||
|
||||
$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']){
|
||||
$picture = ServConfig::getSharedIconPath().'/default.jpg';
|
||||
|
||||
@@ -22,7 +22,7 @@ $imageType = $size[2];
|
||||
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
|
||||
|
||||
$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'];
|
||||
@@ -77,7 +77,7 @@ if(!is_uploaded_file($image['tmp_name'])) {
|
||||
$response['result'] = false;
|
||||
} else {
|
||||
$pic = "{$newPicName}?={$rf}";
|
||||
RootDB::db()->update('MEMBER',[
|
||||
RootDB::db()->update('member',[
|
||||
'PICTURE' => $pic,
|
||||
'IMGSVR' => 1
|
||||
], 'NO=%i', $userID);
|
||||
|
||||
@@ -10,7 +10,7 @@ $userID = Session::getUserID();
|
||||
|
||||
$respone = [];
|
||||
$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){
|
||||
$dt = substr($picName, -8);
|
||||
@@ -32,7 +32,7 @@ if($dt == $rf) {
|
||||
$response['reason'] = '1일 1회 변경 가능합니다!';
|
||||
$response['result'] = false;
|
||||
} else {
|
||||
$db->update('MEMBER', [
|
||||
$db->update('member', [
|
||||
'PICTURE'=>'default.jpg',
|
||||
'IMGSVR'=>0,
|
||||
], 'NO=%i', $userID);
|
||||
|
||||
@@ -56,7 +56,7 @@ function doAdminPost($action, $notice, $server){
|
||||
$response = ['result' => 'FAIL'];
|
||||
|
||||
if($action == 'notice') {
|
||||
RootDB::db()->update('SYSTEM', ['NOTICE'=>$notice], true);
|
||||
RootDB::db()->update('system', ['NOTICE'=>$notice], true);
|
||||
$response['result'] = 'SUCCESS';
|
||||
return $response;
|
||||
}
|
||||
|
||||
+1
-1
@@ -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){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -8,7 +8,7 @@ use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$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'){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -11,7 +11,7 @@ if($session->isLoggedIn()){
|
||||
$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'){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -12,7 +12,7 @@ if(!$access_token){
|
||||
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'){
|
||||
die('현재는 가입이 금지되어있습니다!');
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@
|
||||
.board_side{
|
||||
width:50%;
|
||||
float:left;
|
||||
border-left:groove 0.1em;
|
||||
border-right:groove 0.1em;
|
||||
}
|
||||
|
||||
.msg_body{
|
||||
|
||||
Reference in New Issue
Block a user