Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b46303f9f | ||
|
|
b98668bc60 | ||
|
|
947e8e9512 | ||
|
|
681918cb63 | ||
|
|
d0fae44430 | ||
|
|
3e752461e8 | ||
|
|
1a9e6f3b1a | ||
|
|
580275a8cf | ||
|
|
ee74771f16 | ||
|
|
81fa97d3ee | ||
|
|
ae8b94b2d7 | ||
|
|
7670d55f3c | ||
|
|
528ab4e203 | ||
|
|
cf1dc90137 | ||
|
|
f78fcc2b71 | ||
|
|
fb2d30f2c9 | ||
|
|
8781e7c6ad | ||
|
|
c34317b1e5 | ||
|
|
b09730b422 | ||
|
|
0f1725a7ab | ||
|
|
b12e0358d6 | ||
|
|
7ef841746a | ||
|
|
2b52b2379e | ||
|
|
8dd5965c44 | ||
|
|
b273082492 | ||
|
|
da088d88ba | ||
|
|
fd13570074 | ||
|
|
b5630a9dae | ||
|
|
0e2cab6409 | ||
|
|
38dc587318 | ||
|
|
6fbddcb7c2 | ||
|
|
df1df2964d | ||
|
|
9b9c2546c8 | ||
|
|
6ce0e72b33 | ||
|
|
a7784d7870 | ||
|
|
306ca3e04f | ||
|
|
82988b0e08 | ||
|
|
8b27d0e249 | ||
|
|
bfae547240 | ||
|
|
0abd026f78 | ||
|
|
3362a76de7 | ||
|
|
355b6c2e7d | ||
|
|
4e3c643e43 | ||
|
|
760cb97db4 | ||
|
|
0be6f7f57e | ||
|
|
d31223fa0c | ||
|
|
86ee9befc1 | ||
|
|
d5689b061f | ||
|
|
a3c4da4455 | ||
|
|
ee9f97f917 | ||
|
|
270c7377de | ||
|
|
9044b57306 | ||
|
|
9ad815a44a | ||
|
|
b7e432228b | ||
|
|
78da30f2ad | ||
|
|
aeea53017f | ||
|
|
f21ebfc366 | ||
|
|
2549aa5809 | ||
|
|
b733b70ad8 | ||
|
|
f9f59bd7c2 | ||
|
|
58933a6bcd | ||
|
|
45d7a29a95 | ||
|
|
e9d1fdb4ee | ||
|
|
2785ca9f31 | ||
|
|
12912a62aa | ||
|
|
2c2b078514 | ||
|
|
110294103f | ||
|
|
a9f3b839ec | ||
|
|
6bd677ad6f | ||
|
|
7d1c5f3510 | ||
|
|
a49508fd20 | ||
|
|
5870213ff0 | ||
|
|
65c3d7f925 | ||
|
|
33f4fd8fee | ||
|
|
9bdc34dc42 | ||
|
|
ff654df997 | ||
|
|
b7758da2f3 | ||
|
|
747089f1a8 | ||
|
|
9ee3021b76 | ||
|
|
0c60ea66e3 | ||
|
|
c3bb312b5f | ||
|
|
7447a42d40 | ||
|
|
3e9cc367af | ||
|
|
4c1790014f | ||
|
|
03fc7a579a | ||
|
|
a53db257cf | ||
|
|
b093cab493 | ||
|
|
9b484dc819 | ||
|
|
5ab26a9f8c | ||
|
|
b800a63bd2 | ||
|
|
43a5e47fb3 | ||
|
|
319545106e | ||
|
|
39b261b8a0 | ||
|
|
c9e61d1098 | ||
|
|
0bffdaa5fc | ||
|
|
9228510834 | ||
|
|
0b002a8946 | ||
|
|
ad43ddabe6 | ||
|
|
24c022a329 | ||
|
|
0e48cee0d6 | ||
|
|
4ad1794d95 | ||
|
|
46cf25b585 | ||
|
|
b3d78fc30f | ||
|
|
556bc06da4 | ||
|
|
7e8f9c463b | ||
|
|
568c7779b6 | ||
|
|
0a0d237f4d | ||
|
|
c243ccbdce | ||
|
|
64b79d6af5 | ||
|
|
016c0f3743 | ||
|
|
fd1599e0a7 | ||
|
|
7408aa6b72 | ||
|
|
e6b2107fa9 | ||
|
|
9aff52eaad | ||
|
|
bf5bda0f85 | ||
|
|
ffbf2d0a93 | ||
|
|
82f59ef5a2 | ||
|
|
c2c40abbb4 | ||
|
|
bb54d732d0 | ||
|
|
eee4e0c676 | ||
|
|
d9457ae017 | ||
|
|
bbc0b18b19 | ||
|
|
da7651311e | ||
|
|
72846f0817 | ||
|
|
05ef3387ab | ||
|
|
eed44e5737 | ||
|
|
27c7a85a21 | ||
|
|
4f6dd046ec | ||
|
|
89fad9ada7 | ||
|
|
bc31b49b99 | ||
|
|
09444e3624 | ||
|
|
7586243a95 | ||
|
|
1e1c7801e1 | ||
|
|
a363f6ef5f | ||
|
|
334e1fd2da | ||
|
|
2e8e29e93c | ||
|
|
5e5a1a3668 | ||
|
|
b93b464ebf | ||
|
|
842ba46a95 | ||
|
|
03b27d8e8f | ||
|
|
c11b41c6ba | ||
|
|
018cc526ee | ||
|
|
edf4508e6b | ||
|
|
d26a1f0312 | ||
|
|
2984f6a453 | ||
|
|
a00058d959 | ||
|
|
8e56a457f1 | ||
|
|
74d5f021cd | ||
|
|
a37715315d | ||
|
|
d9c9977610 | ||
|
|
c2f0cbb10a | ||
|
|
a34d00d822 | ||
|
|
9924ec6963 | ||
|
|
9036201887 | ||
|
|
b2435d2430 | ||
|
|
afd6148770 | ||
|
|
b70b58a35a | ||
|
|
df963c2780 | ||
|
|
1b732c76e6 | ||
|
|
f9489b0173 | ||
|
|
18942c55ae | ||
|
|
bf34b2f1ca | ||
|
|
a717a021c2 | ||
|
|
dcf718d592 | ||
|
|
f5eeb2b839 | ||
|
|
bc435adc11 |
Vendored
+1
@@ -0,0 +1 @@
|
||||
"use strict";!function(t,r){var n=function(t){function r(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function n(t){return t.replace(/"/g,""")}function e(t){if(!t)return"";var r=[];for(var e in t){var i=t[e]+"";r.push(e+'="'+n(i)+'"')}return r.join(" ")}function i(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i=new a(i);for(var f=o(t),u=[],c=0;c<f.length;c++){var p=f[c];if("nl"===p.type&&i.nl2br)u.push("<br>\n");else if(p.isLink&&i.check(p)){var l=i.resolve(p),s=l.formatted,g=l.formattedHref,y=l.tagName,h=l.className,v=l.target,k=l.attributes,S="<"+y+' href="'+n(g)+'"';h&&(S+=' class="'+n(h)+'"'),v&&(S+=' target="'+n(v)+'"'),k&&(S+=" "+e(k)),S+=">"+r(s)+"</"+y+">",u.push(S)}else u.push(r(p.toString()))}return u.join("")}var o=t.tokenize,f=t.options,a=f.Options;if(!String.prototype.linkify)try{Object.defineProperty(String.prototype,"linkify",{a:function(){},get:function(){return function(t){return i(this,t)}}})}catch(u){String.prototype.linkify||(String.prototype.linkify=function(t){return i(this,t)})}return i}(r);t.linkifyStr=n}(window,linkify);
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
+13
File diff suppressed because one or more lines are too long
+13
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
+14
-2
@@ -88,19 +88,28 @@ function getExceptionTraceAsString($exception) {
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
function logError(string $err, string $errstr, array $trace){
|
||||
function logError(string $err, string $errstr, string $errpath, array $trace){
|
||||
$fdb = FileDB::db(ROOT.'/d_log/err_log.sqlite3', ROOT.'/f_install/sql/err_log.sql');
|
||||
$date = date("Ymd_His");
|
||||
|
||||
$errpath = str_replace(ROOT, '{ROOT}', $errpath);
|
||||
$trace = array_map(function(string $text){
|
||||
return str_replace(ROOT, '{ROOT}', $text);
|
||||
}, $trace);
|
||||
|
||||
$owner = Util::get_client_ip();
|
||||
$session = Session::getInstance();
|
||||
if($session->isLoggedIn(true)){
|
||||
$owner .= '('.$session->getUserID().','.$session->userName.')';
|
||||
}
|
||||
|
||||
$fdb->insert('err_log', [
|
||||
'date'=>$date,
|
||||
'err'=>$err,
|
||||
'errstr'=>$errstr,
|
||||
'trace'=>Json::encode($trace)
|
||||
'errpath'=>$errpath,
|
||||
'trace'=>Json::encode($trace),
|
||||
'webuser'=>$owner
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -116,6 +125,7 @@ function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, in
|
||||
logError(
|
||||
getFriendlyErrorType($errno),
|
||||
$errstr,
|
||||
$errfile.':'.$errline,
|
||||
getExceptionTraceAsString($e)
|
||||
);
|
||||
}
|
||||
@@ -123,9 +133,11 @@ set_error_handler("\sammo\logErrorByCustomHandler");
|
||||
|
||||
|
||||
function logExceptionByCustomHandler(\Throwable $e){
|
||||
|
||||
logError(
|
||||
get_class($e),
|
||||
$e->getMessage(),
|
||||
$e->getFile().':'.$e->getLine(),
|
||||
getExceptionTraceAsString($e)
|
||||
);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ CREATE TABLE `member` (
|
||||
`PICTURE` VARCHAR(64) NULL DEFAULT 'default.jpg',
|
||||
`IMGSVR` INT(1) NULL DEFAULT '0',
|
||||
`acl` TEXT NOT NULL DEFAULT '{}' COMMENT 'json',
|
||||
`penalty` TEXT NOT NULL DEFAULT '{}' COMMENT 'json',
|
||||
`GRADE` INT(1) NULL DEFAULT '1',
|
||||
`REG_NUM` INT(3) NULL DEFAULT '0',
|
||||
`REG_DATE` DATETIME NOT NULL,
|
||||
|
||||
@@ -3,7 +3,9 @@ CREATE TABLE IF NOT EXISTS `err_log` (
|
||||
`date` TEXT NOT NULL,
|
||||
`err` TEXT NOT NULL,
|
||||
`errstr` TEXT NOT NULL,
|
||||
`trace` TEXT NOT NULL
|
||||
`errpath` TEXT NOT NULL,
|
||||
`trace` TEXT NOT NULL,
|
||||
`webuser` TEXT NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS `date` ON `err_log` (
|
||||
`date` DESC
|
||||
|
||||
+3
-3
@@ -40,10 +40,10 @@ case "분당김":
|
||||
$gameStor->tnmt_time = $tnmt_time->format('Y-m-d H:i:s');
|
||||
|
||||
$db->update('general', [
|
||||
'turntime'=>$db->sqleval('DATE_ADD(turntime, INTERVAL %i MINUTE)', $minute)
|
||||
'turntime'=>$db->sqleval('DATE_SUB(turntime, INTERVAL %i MINUTE)', $minute)
|
||||
], true);
|
||||
$db->update('auction', [
|
||||
'expire'=>$db->sqleval('DATE_ADD(expire, INTERVAL %i MINUTE)', $minute)
|
||||
'expire'=>$db->sqleval('DATE_SUB(expire, INTERVAL %i MINUTE)', $minute)
|
||||
], true);
|
||||
break;
|
||||
case "분지연":
|
||||
@@ -87,4 +87,4 @@ case "락풀기":
|
||||
break;
|
||||
}
|
||||
|
||||
header('Location:_119.php');
|
||||
header('Location:_119.php', true, 303);
|
||||
+1
-38
@@ -73,7 +73,6 @@ $sel[$type] = "selected";
|
||||
<td width=130 align=center id=bg1>국 가 명</td>
|
||||
<td width=80 align=center id=bg1>상 태</td>
|
||||
<td width=60 align=center id=bg1>기 간</td>
|
||||
<td align=center id=bg1>비 고</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
@@ -95,11 +94,7 @@ for ($i=0; $i < $dipcount; $i++) {
|
||||
$me = $dip['me'];
|
||||
$you = $dip['you'];
|
||||
|
||||
$query = "select reserved,showing from diplomacy where you='$me' and me='$you'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$dip2 = MYDB_fetch_array($result2);
|
||||
|
||||
if ($dip['state'] == 2 && $dip['fixed'] == "" && $dip['reserved'] == "" && $dip2['reserved'] == "") {
|
||||
if ($dip['state'] == 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -115,37 +110,6 @@ for ($i=0; $i < $dipcount; $i++) {
|
||||
}
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$note = "";
|
||||
if ($dip['fixed'] != "") {
|
||||
if ($dip['state'] == 7) {
|
||||
$note .= $dip['fixed'];
|
||||
} else {
|
||||
$note .= "<font color=gray>{$dip['fixed']}</font>";
|
||||
}
|
||||
if ($dip['reserved'] != "" || $dip2['reserved'] != "") {
|
||||
$note .= "<br>";
|
||||
}
|
||||
}
|
||||
if ($dip['reserved'] != "") {
|
||||
if ($dip['showing'] >= $date) {
|
||||
$note .= "<font color=skyblue>아국측 제의</font>: {$dip['reserved']}";
|
||||
} else {
|
||||
$note .= "<font color=gray>아국측 제의: {$dip['reserved']}</font>";
|
||||
}
|
||||
if ($dip2['reserved'] != "") {
|
||||
$note .= "<br>";
|
||||
}
|
||||
}
|
||||
if ($dip2['reserved'] != "") {
|
||||
if ($dip2['showing'] >= $date) {
|
||||
$note .= "<font color=limegreen>상대측 제의</font>: {$dip2['reserved']}";
|
||||
} else {
|
||||
$note .= "<font color=gray>상대측 제의: {$dip2['reserved']}</font>";
|
||||
}
|
||||
}
|
||||
if ($note == "") {
|
||||
$note = " ";
|
||||
}
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
@@ -153,7 +117,6 @@ for ($i=0; $i < $dipcount; $i++) {
|
||||
<td align=center style=color:".newColor($nationColor[$you]).";background-color:{$nationColor[$you]};>$nationName[$you]</td>
|
||||
<td align=center>$state</td>
|
||||
<td align=center>{$dip['term']} 개월</td>
|
||||
<td align=left style=font-size:7px;>{$note}</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
if($session->userGrade < 5) {
|
||||
die('권한 부족');
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
if(!$gameStor->isunited){
|
||||
die('아직 천통하지 않았습니다');
|
||||
}
|
||||
|
||||
foreach($db->queryFirstColumn(
|
||||
'SELECT no FROM general WHERE npc != 0 and age >= %i',
|
||||
GameConst::$retirementYear
|
||||
) as $generalNo){
|
||||
CheckHall($generalNo);
|
||||
}
|
||||
+13
-3
@@ -49,6 +49,12 @@ increaseRefresh("명장일람", 1);
|
||||
<div style="margin:auto;width=1000px;">
|
||||
<?php
|
||||
|
||||
$ownerNameList = [];
|
||||
if($gameStor->isunited){
|
||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
||||
$ownerNameList[$ownerID] = $ownerName;
|
||||
}
|
||||
}
|
||||
|
||||
$nationName = [0=>'재야'];
|
||||
$nationColor = [0=>'#000000'];
|
||||
@@ -60,8 +66,11 @@ foreach (getAllNationStaticInfo() as $nation) {
|
||||
$types = [
|
||||
["명 성", "int", function($v){$v['value'] = $v['experience']; return $v; }],
|
||||
["계 급", "int", function($v){$v['value'] = $v['dedication']; return $v; }],
|
||||
["계 략 성 공", "int", function($v){
|
||||
["계 략 성 공", "int", function($v) use ($gameStor){
|
||||
$v['value'] = $v['firenum'];
|
||||
if($gameStor->isunited){
|
||||
return $v;
|
||||
}
|
||||
$v['nationName'] = '???';
|
||||
$v['pictureFullPath'] = GetImageURL(0)."/default.jpg";
|
||||
$v['name'] = '???';
|
||||
@@ -166,7 +175,7 @@ $generals = array_map(function($general) use($nationColor, $nationName) {
|
||||
|
||||
return $general;
|
||||
}, $db->query(
|
||||
"SELECT nation,no,name,name2 as owner_name, picture, imgsvr,
|
||||
"SELECT nation,no,name,name2 as owner_name, owner, picture, imgsvr,
|
||||
experience, dedication, firenum, warnum, killnum, killcrew, deathcrew,
|
||||
dex0, dex10, dex20, dex30, dex40,
|
||||
ttw, ttd, ttl, tlw, tld, tll, tpw, tpd, tpl, tiw, tid, til,
|
||||
@@ -179,7 +188,8 @@ $templates = new \League\Plates\Engine('templates');
|
||||
|
||||
foreach($types as $idx=>[$typeName, $typeValue, $typeFunc]){
|
||||
$validCnt = 0;
|
||||
$typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt){
|
||||
$typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt, $ownerNameList){
|
||||
$general['owner_name'] = $ownerNameList[$general['owner']]??null;
|
||||
$general = ($typeFunc)($general);
|
||||
$value = $general['value'];
|
||||
|
||||
|
||||
+34
-22
@@ -30,6 +30,13 @@ if ($type <= 0 || $type > 15) {
|
||||
$type = 9;
|
||||
}
|
||||
|
||||
$ownerNameList = [];
|
||||
if($gameStor->isunited){
|
||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
||||
$ownerNameList[$ownerID] = $ownerName;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -82,26 +89,26 @@ foreach (getAllNationStaticInfo() as $nation) {
|
||||
$nationlevel[$nation['nation']] = $nation['level'];
|
||||
}
|
||||
|
||||
switch ($type) { //FIXME: $query 처리 조심.
|
||||
case 1: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by nation"; break;
|
||||
case 2: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by leader desc"; break;
|
||||
case 3: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by power desc"; break;
|
||||
case 4: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by intel desc"; break;
|
||||
case 5: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by experience desc"; break;
|
||||
case 6: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by dedication desc"; break;
|
||||
case 7: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by level desc"; break;
|
||||
case 8: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by killturn"; break;
|
||||
default:
|
||||
case 9: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by connect desc"; break;
|
||||
case 10: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by experience desc"; break;
|
||||
case 11: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by personal"; break;
|
||||
case 12: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by special desc"; break;
|
||||
case 13: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by special2 desc"; break;
|
||||
case 14: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by age desc"; break;
|
||||
case 15: $query = "select no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by npc desc"; break;
|
||||
}
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
[$orderKey, $orderDesc] = [
|
||||
1=>['nation', false],
|
||||
2=>['leader', true],
|
||||
3=>['power', true],
|
||||
4=>['intel', true],
|
||||
5=>['experience', true],
|
||||
6=>['dedication', true],
|
||||
7=>['level', true],
|
||||
8=>['killturn', false],
|
||||
9=>['connect', true],
|
||||
10=>['experience', true],
|
||||
11=>['personal', true],
|
||||
12=>['special', true],
|
||||
13=>['special2', true],
|
||||
14=>['age', true],
|
||||
15=>['npc', true],
|
||||
][$type];
|
||||
|
||||
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':'');
|
||||
|
||||
echo"
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
@@ -122,8 +129,7 @@ echo"
|
||||
<td width=45 align=center id=bg1>삭턴</td>
|
||||
<td width=70 align=center id=bg1>벌점</td>
|
||||
</tr>";
|
||||
for ($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
foreach($generalList as $general){
|
||||
$nation = $nationname[$general['nation']];
|
||||
|
||||
if ($general['level'] == 12) {
|
||||
@@ -152,6 +158,8 @@ for ($j=0; $j < $gencount; $j++) {
|
||||
$intel = "{$general['intel']}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($general['npc'] >= 2) {
|
||||
$name = "<font color=cyan>{$general['name']}</font>";
|
||||
} elseif ($general['npc'] == 1) {
|
||||
@@ -160,6 +168,10 @@ for ($j=0; $j < $gencount; $j++) {
|
||||
$name = "{$general['name']}";
|
||||
}
|
||||
|
||||
if(key_exists($general['owner'], $ownerNameList)){
|
||||
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
||||
}
|
||||
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
|
||||
+11
-1
@@ -92,12 +92,22 @@ $types = [
|
||||
|
||||
$templates = new \League\Plates\Engine('templates');
|
||||
|
||||
$ownerNameList = [];
|
||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
||||
$ownerNameList[$ownerID] = $ownerName;
|
||||
}
|
||||
|
||||
foreach($types as $idx=>[$typeName, $typeValue]) {
|
||||
$hallResult = $db->query('SELECT * FROM ng_hall WHERE `type`=%i AND %? ORDER BY `value` DESC LIMIT 10', $idx, $searchFilter);
|
||||
|
||||
$hallResult = array_map(function($general)use($typeValue){
|
||||
$hallResult = array_map(function($general)use($typeValue, $ownerNameList){
|
||||
$aux = Json::decode($general['aux']);
|
||||
$general += $aux;
|
||||
|
||||
if(key_exists($general['owner'], $ownerNameList)){
|
||||
$general['owner_name'] = $ownerNameList[$general['owner']];
|
||||
}
|
||||
|
||||
if(!key_exists('bgColor', $general)){
|
||||
if(!key_exists('color', $general)){
|
||||
$general['bgColor'] = GameConst::$basecolor4;
|
||||
|
||||
+21
-3
@@ -130,6 +130,19 @@ for($i=1; $i <= $count; $i++) {
|
||||
elseif($level5['npc'] == 1) { $l5 = "<font color=skyblue>{$level5['name']}</font>"; }
|
||||
else { $l5 = $level5['name']; }
|
||||
|
||||
$generals = $db->query('SELECT no,nation,npc,name,level,penalty,permission FROM general WHERE nation=%i ORDER BY no ASC', $nation['nation']);
|
||||
$ambassadors = [];
|
||||
$auditors = [];
|
||||
foreach($generals as $general){
|
||||
$generalPermission = checkSecretPermission($general, false);
|
||||
if($generalPermission == 4){
|
||||
$ambassadors[] = $general['name'];
|
||||
}
|
||||
else if($generalPermission == 3){
|
||||
$auditors[] = $general['name'];
|
||||
}
|
||||
}
|
||||
|
||||
echo "
|
||||
<table align=center width=1000 class='tb_layout bg2'>
|
||||
<tr>
|
||||
@@ -143,7 +156,7 @@ for($i=1; $i <= $count; $i++) {
|
||||
<td width=80 align=center id=bg1>국 력</td>
|
||||
<td width=170 align=center>{$nation['power']}</td>
|
||||
<td width=80 align=center id=bg1>장수 / 속령</td>
|
||||
<td width=170 align=center>{$gencount} / {$citycount}</td>
|
||||
<td width=170 align=center>".count($generals)." / {$citycount}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>".getLevel(12, $nation['level'])."</td>
|
||||
@@ -165,6 +178,12 @@ for($i=1; $i <= $count; $i++) {
|
||||
<td align=center id=bg1>".getLevel( 5, $nation['level'])."</td>
|
||||
<td align=center>$l5</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center id=bg1>외교권자</td><td colspan=5>";
|
||||
echo join(', ', $ambassadors);
|
||||
echo "</td><td align=center id=bg1>조언자</td><td align=center >";
|
||||
echo count($auditors).'명';
|
||||
echo "</td></tr>
|
||||
<tr>
|
||||
<td colspan=8>";
|
||||
if($nation['level'] > 0) {
|
||||
@@ -190,8 +209,7 @@ for($i=1; $i <= $count; $i++) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=8> 장수 일람 : ";
|
||||
for($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
foreach($generals as $general){
|
||||
if($general['npc'] >= 2) { echo "<font color=cyan>{$general['name']}</font>, "; }
|
||||
elseif($general['npc'] == 1) { echo "<font color=skyblue>{$general['name']}</font>, "; }
|
||||
else { echo "{$general['name']}, "; }
|
||||
|
||||
+10
-7
@@ -33,7 +33,7 @@ $query = "select nation from general where no='$gen'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
|
||||
$query = "select no,nation,level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -47,11 +47,14 @@ if ($con >= 2) {
|
||||
exit();
|
||||
}
|
||||
|
||||
//재야인 경우
|
||||
$meLevel = $me['level'];
|
||||
if ($meLevel == 0 || ($meLevel == 1 && $me['belong'] < $nation['secretlimit'])) {
|
||||
echo "수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
exit();
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
}
|
||||
else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
//잘못된 접근
|
||||
@@ -158,7 +161,7 @@ for ($i=0; $i < $gencount; $i++) {
|
||||
<?=getBatResRecent($gen, 24)?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($npc > 1 || $meLevel >= 5): ?>
|
||||
<?php if($npc > 1 || $permission >= 2): ?>
|
||||
<tr>
|
||||
<td align=center id=bg1><font color=orange size=3>개인 기록</font></td>
|
||||
<td align=center id=bg1><font color=orange size=3> </font></td>
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("기밀실", 1);
|
||||
|
||||
$query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
if($me['level'] < 5) {
|
||||
echo "수뇌부가 아닙니다.";
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=UniqueConst::$serverName?>: 기밀실</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style='width:1000px;margin:auto'>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td>기 밀 실<br><?=backButton()?></td></tr>
|
||||
<form name=form1 method=post action=c_chiefboard.php>
|
||||
<tr><td align=center>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
<input type=hidden name=num value=-1>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$nation = getNation($me['nation']);
|
||||
|
||||
//20개 메세지
|
||||
$index = $nation['coreindex'];
|
||||
for($i=0; $i < 20; $i++) {
|
||||
$who = "coreboard{$index}_who";
|
||||
$query = "select name,picture,imgsvr from general where no='$nation[$who]'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($nation["coreboard{$index}"] != '') { msgprint($nation["coreboard{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["coreboard{$index}_when"], $index, 1); }
|
||||
$index--;
|
||||
if($index < 0) { $index = 19; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=backButton()?></td></tr>
|
||||
<tr><td><?=banner()?></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,20 +13,21 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("사령부", 1);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
|
||||
$query = "select no,nation,level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select secretlimit from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
|
||||
|
||||
if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) {
|
||||
echo "수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
exit();
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
}
|
||||
else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
if($me['level'] >= 5) { $btn = "submit"; $btn2 = "button"; }
|
||||
|
||||
@@ -179,7 +179,7 @@ if($valid == 0 && $userGrade < 5) {
|
||||
$city = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $citylist);
|
||||
$cityNation = getNationStaticInfo($city['nation']);
|
||||
|
||||
//태수, 군사, 시중
|
||||
//태수, 군사, 종사
|
||||
$gen1 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen1']);
|
||||
$gen2 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen2']);
|
||||
$gen3 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen3']);
|
||||
@@ -282,6 +282,7 @@ for($j=0; $j < $gencount; $j++) {
|
||||
|
||||
$generalsFormat[] = [
|
||||
'ourGeneral'=>$ourGeneral,
|
||||
'iconPath'=>GetImageURL($general['imgsvr']).'/'.$general['picture'],
|
||||
'isNPC'=>$isNPC,
|
||||
'wounded'=>$wounded,
|
||||
'name'=>$name,
|
||||
@@ -415,7 +416,7 @@ foreach($generalsFormat as $general){
|
||||
<td align=center><?=$gen1['name']??'-'?></td>
|
||||
<td align=center class=bg1>군사</td>
|
||||
<td align=center><?=$gen2['name']??'-'?></td>
|
||||
<td align=center class=bg1>시중</td>
|
||||
<td align=center class=bg1>종사</td>
|
||||
<td align=center><?=$gen3['name']??'-'?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
+15
-44
@@ -13,9 +13,9 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("내무부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, con, turntime, belong FROM general WHERE owner=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$nation = $db->queryFirstRow('SELECT secretlimit, msg, scoutmsg FROM nation WHERE nation = %i', $me['nation']);
|
||||
$nation = $db->queryFirstRow('SELECT msg, scoutmsg FROM nation WHERE nation = %i', $me['nation']);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
@@ -23,9 +23,14 @@ if ($con >= 2) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) {
|
||||
echo "수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
exit();
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
}
|
||||
else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
if ($me['level'] >= 5) {
|
||||
@@ -45,7 +50,7 @@ if ($me['level'] >= 5) {
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<title><?=UniqueConst::$serverName?>: 내무부</title>
|
||||
<script>
|
||||
var editable = <?=($me['level']>=5?'true':'false')?>;
|
||||
var editable = <?=(($me['level']>=5||$permission==4)?'true':'false')?>;
|
||||
var nationMsg = <?=Json::encode($nation['msg']??'')?>;
|
||||
var scoutmsg = <?=Json::encode($nation['scoutmsg']??'')?>;
|
||||
</script>
|
||||
@@ -80,7 +85,6 @@ var scoutmsg = <?=Json::encode($nation['scoutmsg']??'')?>;
|
||||
<td width=80 align=center class=bg1>상태</td>
|
||||
<td width=60 align=center class=bg1>기간</td>
|
||||
<td width=100 align=center class=bg1>종 료 시 점</td>
|
||||
<td align=center class=bg1>비 고</td>
|
||||
</tr>
|
||||
<?php
|
||||
$admin = $gameStor->getValues(['year','month']);
|
||||
@@ -106,19 +110,15 @@ for ($i=0; $i < $nationcount; $i++) {
|
||||
<td align=center>-</td>
|
||||
<td align=center>-</td>
|
||||
<td align=center>-</td>
|
||||
<td align=left style=font-size:7px;>-</td>
|
||||
</tr>";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$query = "select state,term,fixed,reserved,showing from diplomacy where me='{$me['nation']}' and you='{$nation['nation']}'";
|
||||
$query = "select state,term from diplomacy where me='{$me['nation']}' and you='{$nation['nation']}'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$dip = MYDB_fetch_array($result2);
|
||||
|
||||
$query = "select reserved,showing from diplomacy where you='{$me['nation']}' and me='{$nation['nation']}'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$dip2 = MYDB_fetch_array($result2);
|
||||
//속령수
|
||||
$query = "select city from city where nation='{$nation['nation']}'";
|
||||
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
@@ -144,33 +144,6 @@ for ($i=0; $i < $nationcount; $i++) {
|
||||
}
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$note = "";
|
||||
if ($dip['fixed'] != "") {
|
||||
if ($dip['state'] == 7) {
|
||||
$note .= $dip['fixed'];
|
||||
} else {
|
||||
$note .= "<font color=gray>{$dip['fixed']}</font>";
|
||||
}
|
||||
if ($dip['reserved'] != "" || $dip2['reserved'] != "") {
|
||||
$note .= "<br>";
|
||||
}
|
||||
}
|
||||
if ($dip['showing'] >= $date) {
|
||||
if ($dip['reserved'] != "") {
|
||||
$note .= "<font color=skyblue>아국측 제의</font>: ".$dip['reserved'];
|
||||
if ($dip2['reserved'] != "") {
|
||||
$note .= "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($dip2['showing'] >= $date) {
|
||||
if ($dip2['reserved'] != "") {
|
||||
$note .= "<font color=limegreen>상대측 제의</font>: ".$dip2['reserved'];
|
||||
}
|
||||
}
|
||||
if ($note == "") {
|
||||
$note = " ";
|
||||
}
|
||||
|
||||
echo "
|
||||
<tr>
|
||||
@@ -188,9 +161,7 @@ for ($i=0; $i < $nationcount; $i++) {
|
||||
<td align=center>-</td>
|
||||
<td align=center>-</td>";
|
||||
}
|
||||
echo "
|
||||
<td align=left style=font-size:7px;>{$note}</td>
|
||||
</tr>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "
|
||||
</table>
|
||||
@@ -302,8 +273,8 @@ if ($budgetricediff > 0) {
|
||||
<tr>
|
||||
<td align=right class=bg1>세율 (5 ~ 30%) </td>
|
||||
<td align=center><input type=text <?=$read?> name=rate style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['rate']?>>% <input type=<?=$btn?> name=btn value=세율></td>
|
||||
<td align=right class=bg1>봉급 지급율 (20 ~ 200%) </td>
|
||||
<td align=center><input type=text <?=$read?> name=bill style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['bill']?>>% <input type=<?=$btn?> name=btn value=지급율></td>
|
||||
<td align=right class=bg1>봉급 지급률 (20 ~ 200%) </td>
|
||||
<td align=center><input type=text <?=$read?> name=bill style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['bill']?>>% <input type=<?=$btn?> name=btn value=지급률></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right class=bg1>기밀 권한 (1 ~ 99년) </td>
|
||||
|
||||
+10
-5
@@ -19,11 +19,11 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("암행부", 1);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
|
||||
$query = "select no,nation,level,con,turntime,belong,permission,penalty from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select level,secretlimit from nation where nation='{$me['nation']}'";
|
||||
$query = "select level from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -33,9 +33,14 @@ if ($con >= 2) {
|
||||
exit();
|
||||
}
|
||||
|
||||
if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) {
|
||||
echo "수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
exit();
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
echo '국가에 소속되어있지 않습니다.';
|
||||
die();
|
||||
}
|
||||
else if ($permission < 1) {
|
||||
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
|
||||
die();
|
||||
}
|
||||
|
||||
$sel = [];
|
||||
|
||||
+80
-8
@@ -35,8 +35,12 @@ if($meLevel == 0) {
|
||||
<title><?=UniqueConst::$serverName?>: 인사부</title>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/bossInfo.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<script type="text/javascript">
|
||||
@@ -45,6 +49,51 @@ function out() {
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result); //국가정보
|
||||
|
||||
$ambassadors = $db->query('SELECT no, name, level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nation['nation']);
|
||||
$auditors = $db->query('SELECT no, name, level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nation['nation']);
|
||||
$candidateAmbassadors = [];
|
||||
$candidateAuditors = [];
|
||||
foreach($ambassadors as $ambassador){
|
||||
$candidateAmbassadors[] = $ambassador;
|
||||
}
|
||||
foreach($auditors as $auditor){
|
||||
$candidateAuditors[] = $auditor;
|
||||
}
|
||||
foreach($db->query('SELECT no, name, nation, level, penalty, permission FROM general WHERE nation = %i AND permission = \'normal\' AND level != 12', $nation['nation']) as $candidate){
|
||||
$maxPermission = checkSecretMaxPermission($candidate);
|
||||
if($maxPermission == 4){
|
||||
$candidateAmbassadors[] = $candidate;
|
||||
}
|
||||
if($maxPermission >= 3){
|
||||
$candidateAuditors[] = $candidate;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<script>
|
||||
var candidateAmbassadors = <?=Json::encode(array_map(function($value){
|
||||
return [
|
||||
'id'=>$value['no'],
|
||||
'text'=>$value['name'],
|
||||
"selected"=>($value['permission']!='normal')
|
||||
];
|
||||
}, $candidateAmbassadors))?>;
|
||||
|
||||
var candidateAuditors = <?=Json::encode(array_map(function($value){
|
||||
return [
|
||||
'id'=>$value['no'],
|
||||
'text'=>$value['name'],
|
||||
"selected"=>($value['permission']!='normal')
|
||||
];
|
||||
}, $candidateAuditors))?>;
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -55,10 +104,6 @@ function out() {
|
||||
|
||||
<?php
|
||||
|
||||
$query = "select nation,name,level,color,l12set,l11set,l10set,l9set,l8set,l7set,l6set,l5set from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result); //국가정보
|
||||
|
||||
$lv = getNationChiefLevel($nation['level']);
|
||||
if($meLevel >= 5) { $btn = "submit"; }
|
||||
else { $btn = "hidden"; }
|
||||
@@ -77,6 +122,7 @@ $tigerresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connec
|
||||
$query = "select name,picture,firenum from general where nation='{$nation['nation']}' order by firenum desc limit 7"; // 건안칠자
|
||||
$eagleresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
|
||||
echo "
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
@@ -279,9 +325,35 @@ for($i=10; $i >= $lv; $i--) {
|
||||
echo "
|
||||
<tr><td colspan=4>※ <font color=red>빨간색</font>은 현재 임명중인 장수, <font color=orange>노란색</font>은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다.</td></tr>
|
||||
</table>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td colspan=5 height=5></td></tr>
|
||||
|
||||
";
|
||||
|
||||
if($meLevel == 12):
|
||||
?>
|
||||
<table align='center' width='1000' class='tb_layout bg0'>
|
||||
<tr><td colspan='4' height='5'></td></tr>
|
||||
<tr><td colspan='4' align='center' bgcolor='purple'>외 교 권 자 임 명</td></tr>
|
||||
<tr>
|
||||
<td width=98 align=right id=bg1>외교권자</td>
|
||||
<td width=398>
|
||||
<select id="selectAmbassador" multiple="multiple">
|
||||
</select>
|
||||
<button id='changeAmbassador' type='button'>임명</button>
|
||||
</td>
|
||||
<td width=98 align=right id=bg1>조언자</td>
|
||||
<td width=398>
|
||||
<select id="selectAuditor" multiple="multiple">
|
||||
</select>
|
||||
<button id='changeAuditor' type='button'>임명</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<table align=center width=1000 id='officer_list' class='tb_layout bg0'>
|
||||
<tr><td colspan=5 height=5></td></tr>
|
||||
<?php
|
||||
if($meLevel >= 5) {
|
||||
echo "
|
||||
<tr><td colspan=5 align=center bgcolor=orange>도 시 관 직 임 명</td></tr>
|
||||
@@ -395,7 +467,7 @@ if($meLevel >= 5) {
|
||||
</form>
|
||||
<form method=post action=c_myBossInfo.php>
|
||||
<tr>
|
||||
<td colspan=3 align=right id=bg2>시 중 임 명</td>
|
||||
<td colspan=3 align=right id=bg2>종 사 임 명</td>
|
||||
<td colspan=2>
|
||||
<select name=citylist size=1 style=color:white;background-color:black;>
|
||||
";
|
||||
@@ -455,7 +527,7 @@ echo "
|
||||
<td width=158 align=center id=bg1 colspan=2><font size=4>도 시</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>태 수 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>군 사 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>시 중 (사관) 【현재도시】</font></td>
|
||||
<td width=278 align=center id=bg1><font size=4>종 사 (사관) 【현재도시】</font></td>
|
||||
</tr>
|
||||
";
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ for ($j=0; $j < $citycount; $j++) {
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$gen2 = MYDB_fetch_array($genresult);
|
||||
|
||||
$query = "select name from general where no='{$city['gen3']}'"; // 시중
|
||||
$query = "select name from general where no='{$city['gen3']}'"; // 종사
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$gen3 = MYDB_fetch_array($genresult);
|
||||
|
||||
@@ -163,7 +163,7 @@ for ($j=0; $j < $citycount; $j++) {
|
||||
<td align=center>";
|
||||
echo $gen2['name']==''?"-":"{$gen2['name']}";
|
||||
echo "</td>
|
||||
<td align=center id=bg1>시중</td>
|
||||
<td align=center id=bg1>종사</td>
|
||||
<td align=center>";
|
||||
echo $gen3['name']==''?"-":"{$gen3['name']}";
|
||||
echo "</td>
|
||||
|
||||
+34
-44
@@ -14,6 +14,7 @@ $session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("세력장수", 1);
|
||||
@@ -29,6 +30,14 @@ if($me['level'] == 0) {
|
||||
|
||||
$sel = [$type => "selected"];
|
||||
|
||||
$ownerNameList = [];
|
||||
if($gameStor->isunited){
|
||||
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
|
||||
$ownerNameList[$ownerID] = $ownerName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -74,48 +83,26 @@ $sel = [$type => "selected"];
|
||||
<?php
|
||||
|
||||
$nationLevel = DB::db()->queryFirstField('select level from nation where nation = %i', $me['nation']);
|
||||
$orderByText = '';//FIXME: 쿼리 재작성
|
||||
switch($type) {
|
||||
case 1: $orderByText = " order by level desc"; break;
|
||||
case 2: $orderByText = " order by dedication desc"; break;
|
||||
case 3: $orderByText = " order by experience desc"; break;
|
||||
case 4: $orderByText = " order by leader desc"; break;
|
||||
case 5: $orderByText = " order by power desc"; break;
|
||||
case 6: $orderByText = " order by intel desc"; break;
|
||||
case 7: $orderByText = " order by gold desc"; break;
|
||||
case 8: $orderByText = " order by rice desc"; break;
|
||||
case 9: $orderByText = " order by crew desc"; break;
|
||||
case 10: $orderByText = " order by connect desc"; break;
|
||||
case 11: $orderByText = " order by personal"; break;
|
||||
case 12: $orderByText = " order by special desc"; break;
|
||||
case 13: $orderByText = " order by special2 desc"; break;
|
||||
case 14: $orderByText = " order by belong desc"; break;
|
||||
case 15: $orderByText = " order by npc desc"; break;
|
||||
}
|
||||
$query =
|
||||
"select
|
||||
npc,
|
||||
special,
|
||||
special2,
|
||||
personal,
|
||||
picture,
|
||||
imgsvr,
|
||||
name,
|
||||
level,
|
||||
dedication,
|
||||
experience,
|
||||
injury,
|
||||
leader,
|
||||
power,
|
||||
intel,
|
||||
gold,
|
||||
rice,
|
||||
belong,
|
||||
connect,
|
||||
killturn
|
||||
from general where nation='{$me['nation']}' ".$orderByText;
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
[$orderKey, $orderDesc] = [
|
||||
1=>['level', true],
|
||||
2=>['dedication', true],
|
||||
3=>['experience', true],
|
||||
4=>['leader', true],
|
||||
5=>['power', true],
|
||||
6=>['intel', true],
|
||||
7=>['gold', true],
|
||||
8=>['rice', true],
|
||||
9=>['crew', true],
|
||||
10=>['connect', true],
|
||||
11=>['personal', true],
|
||||
12=>['special', true],
|
||||
13=>['special2', true],
|
||||
14=>['belong', true],
|
||||
15=>['npc', true],
|
||||
][$type];
|
||||
|
||||
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc?'desc':'');
|
||||
|
||||
echo"
|
||||
<table align=center class='tb_layout bg0'>
|
||||
@@ -136,8 +123,7 @@ echo"
|
||||
<td width=48 align=center id=bg1>사 관</td>
|
||||
<td width=70 align=center id=bg1>벌점</td>
|
||||
</tr>";
|
||||
for($j=0; $j < $gencount; $j++) {
|
||||
$general = MYDB_fetch_array($genresult);
|
||||
foreach($generalList as $general){
|
||||
|
||||
if($general['level'] == 12) {
|
||||
$lbonus = $nationLevel * 2;
|
||||
@@ -169,6 +155,10 @@ for($j=0; $j < $gencount; $j++) {
|
||||
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; }
|
||||
else { $name = "{$general['name']}"; }
|
||||
|
||||
if(key_exists($general['owner'], $ownerNameList)){
|
||||
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
|
||||
}
|
||||
|
||||
$imageTemp = GetImageURL($general['imgsvr']);
|
||||
echo "
|
||||
<tr>
|
||||
|
||||
@@ -120,7 +120,7 @@ echo "
|
||||
<td align=center>+$goldincomeList[0] / +$deadIncome</td>
|
||||
<td align=center id=bg1>세곡/둔전</td>
|
||||
<td align=center>+$riceincomeList[0] / +$riceincomeList[1]</td>
|
||||
<td align=center id=bg1>지급율</td>
|
||||
<td align=center id=bg1>지급률</td>
|
||||
<td align=center colspan=3>"; echo $me['nation']==0?"해당 없음":"{$nation['bill']} %"; echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
+24
-7
@@ -28,7 +28,7 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("내정보", 1);
|
||||
|
||||
$query = "select no,npc,mode,tnmt,myset from general where owner='{$userID}'";
|
||||
$query = "select no,npc,mode,tnmt,myset,train,atmos from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
@@ -46,13 +46,30 @@ if (($btn == "설정저장" || $detachNPC) && $me['myset'] > 0) {
|
||||
$submit = 'hidden';
|
||||
}
|
||||
|
||||
$me['myset'] -= 1;
|
||||
if($mode == 0){
|
||||
$db->update('general', [
|
||||
'myset'=>$db->sqleval('myset-1'),
|
||||
'mode'=>$mode,
|
||||
'train'=>max(0, $me['train'] - 3),
|
||||
'atmos'=>max(0, $me['atmos'] - 3),
|
||||
], 'owner=%i AND mode!=%i', $userID, $mode);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'myset'=>$db->sqleval('myset-1'),
|
||||
'mode'=>$mode
|
||||
], 'owner=%i AND mode!=%i', $userID, $mode);
|
||||
}
|
||||
|
||||
$db->update('general', [
|
||||
'myset'=>$db->sqleval('myset-1'),
|
||||
'mode'=>$mode,
|
||||
'tnmt'=>$tnmt
|
||||
], 'owner=%i', $userID);
|
||||
if($db->affectedRows()){
|
||||
$me['myset'] -= 1;
|
||||
}
|
||||
|
||||
if($me['tnmt'] != $tnmt){
|
||||
$db->update('general', [
|
||||
'tnmt'=>$tnmt
|
||||
], 'owner=%i', $userID);
|
||||
}
|
||||
|
||||
$me['mode'] = $mode;
|
||||
$me['tnmt'] = $tnmt;
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$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);
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=UniqueConst::$serverName?>: 회의실</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style='width:1000px;margin:auto'>
|
||||
<table width=1000 class='tb_layout bg0'>
|
||||
<tr><td>회 의 실<br><?=backButton()?></td></tr>
|
||||
<form name=form1 method=post action=c_nationboard.php>
|
||||
<tr><td align=center>
|
||||
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
<input type=hidden name=num value=-1>
|
||||
</td></tr>
|
||||
</form>
|
||||
</table>
|
||||
<br>
|
||||
<?php
|
||||
$nation = getNation($me['nation']);
|
||||
|
||||
//20개 메세지
|
||||
$index = $nation['boardindex'];
|
||||
for($i=0; $i < 20; $i++) {
|
||||
$who = "board{$index}_who";
|
||||
$query = "select name,picture,imgsvr from general where no='$nation[$who]'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($nation["board{$index}"] != '') { msgprint($nation["board{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["board{$index}_when"], $index, 0); }
|
||||
$index--;
|
||||
if($index < 0) { $index = 19; }
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<table width=1000 class='tb_layout bg0'>
|
||||
<tr><td><?=backButton()?></td></tr>
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
increaseRefresh("국법", 1);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=UniqueConst::$serverName?>: 국법</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr><td>국 법<br><?=backButton()?></td></tr>
|
||||
<tr><td>
|
||||
|
||||
<?php
|
||||
$query = "select no,nation,level from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select rule from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
if($me['level'] >= 5) {
|
||||
echo "
|
||||
<form name=form1 method=post action=c_nationrule.php>
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:500px;>{$nation['rule']}</textarea><br>
|
||||
<input type=submit value=저장하기>
|
||||
</form>";
|
||||
} else {
|
||||
echo "
|
||||
<textarea name=msg style=color:white;background-color:black;width:998px;height:500px; readonly>{$nation['rule']}</textarea><br>";
|
||||
}
|
||||
|
||||
?>
|
||||
</td></tr>
|
||||
<tr><td><?=backButton()?></td></tr>
|
||||
<tr><td><?=banner()?> </td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -255,7 +255,7 @@ $startYear = $gameStor->getValue('startyear');
|
||||
<option value="1">일반</option>
|
||||
<option value="4">태수</option>
|
||||
<option value="3">군사</option>
|
||||
<option value="2">시중</option>
|
||||
<option value="2">종사</option>
|
||||
<option value="10">무장 수뇌</option>
|
||||
<option value="9">지장 수뇌</option>
|
||||
<option value="11">참모</option>
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$title = Util::getReq('title');
|
||||
$msg = Util::getReq('msg');
|
||||
$num = Util::getReq('num', 'int');
|
||||
$reply = Util::getReq('reply');
|
||||
// $title, $msg, $num
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
if (getBlockLevel() == 1 || getBlockLevel() == 3) {
|
||||
header('location:b_chiefboard.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
$title = str_replace("|", " ", $title);
|
||||
$msg = str_replace("|", " ", $msg);
|
||||
$reply = str_replace("|", " ", $reply);
|
||||
$title = trim($title);
|
||||
$msg = trim($msg);
|
||||
$reply = trim($reply);
|
||||
|
||||
$nation = getNation($me['nation']);
|
||||
|
||||
//새글 추가시
|
||||
if($num == -1 && $title != "" && $msg != "") {
|
||||
$num = $nation['coreindex'] + 1;
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//$num에 댓글시
|
||||
} elseif($num >= 0 && $reply != "") {
|
||||
$newmsg = $nation["coreboard{$num}"]."|".$me['no']."|".$reply;
|
||||
$newmsg = addslashes(SQ2DQ($newmsg));
|
||||
|
||||
$query = "update nation set coreboard{$num}='$newmsg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
header('location:b_chiefboard.php');
|
||||
+9
-4
@@ -18,11 +18,16 @@ $userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$me = $db->queryFirstRow('SELECT `no`,nation,`level` FROM general WHERE `owner`=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT `no`,nation,`level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
//내가 수뇌부이어야함
|
||||
if($me['level'] < 5) {
|
||||
header('location:b_myBossInfo.php');
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
else if ($me['level'] < 5 && $permission != 4) {
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -42,7 +47,7 @@ if($btn == "국가방침 수정") {
|
||||
$db->update('nation', [
|
||||
'rate'=>$rate,
|
||||
], 'nation=%i', $me['nation']);
|
||||
} elseif($btn == "지급율") {
|
||||
} elseif($btn == "지급률") {
|
||||
$bill = Util::valueFit($bill, 20, 200);
|
||||
$db->update('nation', [
|
||||
'bill'=>$bill
|
||||
|
||||
+5
-10
@@ -55,7 +55,7 @@ if($command == 46) {
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:./');
|
||||
header('Location:./', true, 303);
|
||||
die();
|
||||
|
||||
}
|
||||
@@ -82,7 +82,7 @@ if($command == 53) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
header('location:b_chiefcenter.php');
|
||||
header('location:b_chiefcenter.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -93,11 +93,6 @@ if($command == 61) {
|
||||
$me = MYDB_fetch_array($result);
|
||||
|
||||
if($me['level'] >= 5) {
|
||||
$note = StringUtil::neutralize($note, 90);
|
||||
|
||||
$query = "update diplomacy set reserved='{$note}' where me='{$me['nation']}' and you='$double'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$count = count($turn);
|
||||
$str = "type=type";
|
||||
for($i=0; $i < $count; $i++) {
|
||||
@@ -107,7 +102,7 @@ if($command == 61) {
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
header('location:b_chiefcenter.php');
|
||||
header('location:b_chiefcenter.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -131,7 +126,7 @@ if($command == 23 || $command == 24 || $command == 27 || $command == 51 || $comm
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
header('location:b_chiefcenter.php');
|
||||
header('location:b_chiefcenter.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -141,5 +136,5 @@ foreach($turn as $turnIdx){
|
||||
$query['turn'.$turnIdx] = $comStr;
|
||||
}
|
||||
$db->update('general', $query, 'owner=%i', $userID);
|
||||
header('Location:./');
|
||||
header('Location:./', true, 303);
|
||||
|
||||
|
||||
+53
-33
@@ -32,7 +32,7 @@ $ruler = MYDB_fetch_array($result);
|
||||
|
||||
//수뇌가 아니면 아무것도 할 수 없음
|
||||
if($meLevel < 5){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -45,45 +45,52 @@ if($btn == "임명") {
|
||||
}
|
||||
|
||||
if($genlist != 0 && !$general){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
//임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($meLevel < 5 || ($genlist != 0 && $general['nation'] != $me['nation']) || ($genlist != 0 && $general['level'] == 12)) {
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
} elseif($btn == "추방") {
|
||||
if(!$outlist){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
$query = "select no,name,gold,rice,nation,troop,level,npc,picture,imgsvr from general where no='$outlist'";
|
||||
$query = "select no,name,gold,rice,nation,troop,level,npc,picture,imgsvr,permission,penalty,belong from general where no='$outlist'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
if(!$general){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
|
||||
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $outlist != 0)) {
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
//추방할사람이 외교권자이면 불가
|
||||
$permission = checkSecretPermission($general);
|
||||
if($permission == 4){
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
//NPC 부대장 추방 불가
|
||||
if($general['npc'] == 5){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//나와 대상 장수는 국가가 같아야 함
|
||||
if($genlist != 0 && $me['nation'] != $general['nation']){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -143,11 +150,13 @@ if($btn == "추방") {
|
||||
'level'=>0,
|
||||
'nation'=>0,
|
||||
'belong'=>0,
|
||||
'permission'=>'normal',
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
else{
|
||||
$db->update('general', [
|
||||
'level'=>0,
|
||||
'permission'=>'normal',
|
||||
'nation'=>0,
|
||||
'belong'=>0,
|
||||
'makelimit'=>12,
|
||||
@@ -243,7 +252,7 @@ if($btn == "추방") {
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
}
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -294,34 +303,36 @@ if($btn == "임명" && $level >= 5 && $level <= 11) {
|
||||
}
|
||||
}
|
||||
}
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
if($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) {
|
||||
switch($level) {
|
||||
case 4: $lv = 1; break;
|
||||
case 3: $lv = 2; break;
|
||||
case 2: $lv = 3; break;
|
||||
case 4: $genlv = 'gen1'; $genlvset = 'gen1set'; break;
|
||||
case 3: $genlv = 'gen2'; $genlvset = 'gen2set'; break;
|
||||
case 2: $genlv = 'gen3'; $genlvset = 'gen3set'; break;
|
||||
}
|
||||
|
||||
$query = "select gen{$lv} from city where nation='{$me['nation']}' and city='$citylist'";
|
||||
$query = "select {$genlv} from city where nation='{$me['nation']}' and city='$citylist'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$city = MYDB_fetch_array($result);
|
||||
if(!$city){
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
$oldlist = $city["gen{$lv}"];
|
||||
$oldlist = $city[$genlv];
|
||||
|
||||
if($oldlist != 0) {
|
||||
//기존 장수 일반으로
|
||||
$query = "update general set level=1 where no='$oldlist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'level'=>1
|
||||
], 'no=%i', $oldlist);
|
||||
//기존 자리 공석으로
|
||||
$query = "update city set gen{$lv}=0 where city='$citylist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('city', [
|
||||
$genlv=>0
|
||||
], 'city = %i AND nation = %i', $citylist , $me['nation']);
|
||||
}
|
||||
if($genlist != 0) {
|
||||
$valid = 0;
|
||||
@@ -333,24 +344,33 @@ if($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) {
|
||||
|
||||
if($valid == 1) {
|
||||
// 신임 장수의 원래 자리 해제
|
||||
$query = "update city set gen1=0 where gen1='$genlist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen2=0 where gen2='$genlist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen3=0 where gen3='$genlist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('city', [
|
||||
'gen1'=>0,
|
||||
], 'gen1=%i', $genlist);
|
||||
$db->update('city', [
|
||||
'gen2'=>0,
|
||||
], 'gen2=%i', $genlist);
|
||||
$db->update('city', [
|
||||
'gen3'=>0,
|
||||
], 'gen3=%i', $genlist);
|
||||
|
||||
//신임 장수
|
||||
$query = "update general set level='$level' where no='$genlist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen{$lv}='$genlist',gen{$lv}set='1' where city='$citylist'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('city', [
|
||||
$genlv=>$genlist,
|
||||
$genlvset=>1
|
||||
], 'city=%i AND nation=%i', $citylist, $general['nation']);
|
||||
if($db->affectedRows() > 0){
|
||||
$db->update('general',[
|
||||
'level'=>$level
|
||||
], 'no=%i', $genlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
header('location:b_myBossInfo.php');
|
||||
header('location:b_myBossInfo.php', true, 303);
|
||||
|
||||
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $title, $msg, $num
|
||||
$title = Util::getReq('title');
|
||||
$msg = Util::getReq('msg');
|
||||
$num = Util::getReq('num', 'int');
|
||||
$reply = Util::getReq('reply');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
if(getBlockLevel() != 1 && getBlockLevel() != 3) {
|
||||
$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);
|
||||
|
||||
$title = str_replace("|", " ", $title);
|
||||
$msg = str_replace("|", " ", $msg);
|
||||
$reply = str_replace("|", " ", $reply);
|
||||
$title = trim($title);
|
||||
$msg = trim($msg);
|
||||
$reply = trim($reply);
|
||||
|
||||
$nation = getNation($me['nation']);
|
||||
|
||||
//새글 추가시
|
||||
if($num == -1 && $title != "" && $msg != "") {
|
||||
$num = $nation['boardindex'] + 1;
|
||||
if($num >= 20) { $num = 0; }
|
||||
$msg = $title."|".$msg;
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
$date = date('Y-m-d H:i:s');
|
||||
$query = "update nation set board{$num}='$msg',board{$num}_who='{$me['no']}',board{$num}_when='$date' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update nation set boardindex='$num' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//$num에 댓글시
|
||||
} elseif($num >= 0 && $reply != "") {
|
||||
$newmsg = $nation["board{$num}"]."|".$me['no']."|".$reply;
|
||||
$newmsg = addslashes(SQ2DQ($newmsg));
|
||||
|
||||
$query = "update nation set board{$num}='$newmsg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
}
|
||||
|
||||
header('location:b_nationboard.php');
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $msg
|
||||
$msg = Util::getReq('msg');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$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);
|
||||
|
||||
$msg = addslashes(SQ2DQ($msg));
|
||||
|
||||
$query = "update nation set rule='$msg' where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
header('location:b_nationrule.php');
|
||||
+1
-1
@@ -63,4 +63,4 @@ if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
|
||||
}
|
||||
}
|
||||
|
||||
header('Location:b_troop.php');
|
||||
header('Location:b_troop.php', true, 303);
|
||||
|
||||
+4
-2
@@ -12,8 +12,10 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$killturn = $gameStor->killturn;
|
||||
|
||||
$db->update('general', ['killturn'=>$killturn*3], 'owner=%i', $userID);
|
||||
$db->update('general', [
|
||||
'killturn'=>$killturn*3,
|
||||
], 'owner=%i', $userID);
|
||||
|
||||
|
||||
header('location:b_myPage.php');
|
||||
header('location:b_myPage.php', true, 303);
|
||||
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ else if($btn == "댓글" && trim($comment) != "") {
|
||||
}
|
||||
|
||||
if(!$isVoteAdmin){
|
||||
header('location:a_vote.php');
|
||||
header('location:a_vote.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -85,4 +85,4 @@ if($btn == "수정") {
|
||||
$gameStor->voteopen = 2;
|
||||
}
|
||||
|
||||
header('location:a_vote.php');
|
||||
header('location:a_vote.php', true, 303);
|
||||
+1
-1
@@ -111,7 +111,7 @@ function myCommandList() {
|
||||
echo "
|
||||
<tr height=28>
|
||||
<td width=24 align=center height=24 id=bg0><b>$j</b></td>
|
||||
<td width=71 align=center height=24 id=bg1 style='overflow:hidden;'><b>{$year}年 {$month}月</b></td>
|
||||
<td width=71 align=center height=24 id=bg1 style='max-width:68px;white-space:nowrap;overflow:hidden;'><b>{$year}年 {$month}月</b></td>
|
||||
<td width=42 align=center bgcolor=black><b>$turndate</b></td>
|
||||
<td width=150 align=center height=24 style=table-layout:fixed;>$turn[$i]</td>
|
||||
</tr>";
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#newArticle{
|
||||
width:1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.titleInput{
|
||||
width:100%;
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
margin:1px 5px;
|
||||
}
|
||||
|
||||
.contentInput{
|
||||
width:100%;
|
||||
min-height:3em;
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
padding:1px 5px;
|
||||
}
|
||||
|
||||
.articleFrame{
|
||||
width:1000px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.authorName, .comment .author{
|
||||
width:110px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.date{
|
||||
width:125px;
|
||||
font-size:85%;
|
||||
}
|
||||
|
||||
.text{
|
||||
text-align:left;
|
||||
padding:1px 5px;
|
||||
}
|
||||
|
||||
.submitComment{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.commentText{
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
padding:1px 5px;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#newLetter {
|
||||
width:1000px;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
#newLetter th{
|
||||
width:20ch;
|
||||
}
|
||||
|
||||
#newLetter textarea{
|
||||
width:100%;
|
||||
min-height:3em;
|
||||
color:white;
|
||||
background-color:transparent;
|
||||
border:none;
|
||||
}
|
||||
|
||||
.letterFrame{
|
||||
width:1000px;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
.letterFrame th{
|
||||
width:20ch;
|
||||
}
|
||||
|
||||
.letterHeader{
|
||||
position: relative;
|
||||
font-size:200%;
|
||||
}
|
||||
|
||||
.letterDate{
|
||||
position: absolute;
|
||||
right:1ch;
|
||||
bottom:0.2em;
|
||||
font-size:50%;
|
||||
|
||||
}
|
||||
|
||||
.letterBrief, .letterDetail{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.letterSignerPlate{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.letterSrc, .letterDest{
|
||||
display:inline-block;
|
||||
margin: 0 10px;
|
||||
border: 1px solid gray;
|
||||
width:110px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.signerNation, .signerName{
|
||||
border-top: 1px solid gray;
|
||||
}
|
||||
@@ -67,4 +67,15 @@ color:white;
|
||||
|
||||
.nation_info td{
|
||||
height:18px;
|
||||
}
|
||||
|
||||
#sidebar{
|
||||
position:fixed;
|
||||
right:0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
#sidebar button{
|
||||
/*width:100px;*/
|
||||
}
|
||||
@@ -61,6 +61,7 @@
|
||||
position:absolute;
|
||||
right:0;
|
||||
bottom:0;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
.map_body .map_toggle_cityname::after{
|
||||
@@ -71,6 +72,18 @@
|
||||
content: "켜기"
|
||||
}
|
||||
|
||||
.map_body .map_toggle_single_tap{
|
||||
display:none;
|
||||
}
|
||||
|
||||
.map_body .map_toggle_single_tap::after{
|
||||
content: "끄기"
|
||||
}
|
||||
|
||||
.map_body .map_toggle_single_tap.active::after{
|
||||
content: "켜기"
|
||||
}
|
||||
|
||||
.world_map .city_tooltip{
|
||||
position: absolute;
|
||||
z-index:6;
|
||||
|
||||
+26
-3
@@ -59,12 +59,16 @@
|
||||
height:667px;
|
||||
}
|
||||
|
||||
.private_message{
|
||||
height:667px;
|
||||
.diplomacy_message{
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.national_message{
|
||||
height:1350px;
|
||||
height:667px;
|
||||
}
|
||||
|
||||
.private_message{
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.msg_icon{
|
||||
@@ -83,6 +87,7 @@
|
||||
font-weight: bold;
|
||||
margin-bottom:3px;
|
||||
color:white;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.message_input_form{
|
||||
@@ -129,6 +134,16 @@
|
||||
outline-style:solid;
|
||||
outline-width:1px;
|
||||
outline-color: gray;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: column;
|
||||
}
|
||||
.board_side > div{
|
||||
height: 1.2em;
|
||||
}
|
||||
|
||||
.msg_invalid{
|
||||
color:rgba(255,255,255,0.5);
|
||||
}
|
||||
|
||||
.msg_body{
|
||||
@@ -143,6 +158,14 @@
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.btn-delete-msg{
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin:2px 2px 0 2px;
|
||||
font-size:8px;
|
||||
}
|
||||
|
||||
/*
|
||||
.public_message .msg_target{
|
||||
box-shadow: 2px 2px darkslategrey;
|
||||
|
||||
+106
-72
@@ -243,7 +243,7 @@ function cityInfo() {
|
||||
<td height=7>".bar($wall)."</td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>시세</b></td>
|
||||
<td height=7>".bar($trade)."</td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>시중</b></td>
|
||||
<td rowspan=2 style='text-align:center;' class='bg1'><b>종사</b></td>
|
||||
<td rowspan=2 style='text-align:center;'>{$gen3['name']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -322,7 +322,7 @@ function myNationInfo() {
|
||||
<td class='center'>";echo $me['nation']==0?"해당 없음":"{$nation['rice']}";echo "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bg1 center'><b>지급율</b></td>
|
||||
<td class='bg1 center'><b>지급률</b></td>
|
||||
<td class='center'>";
|
||||
if($me['nation'] == 0) {
|
||||
echo "해당 없음";
|
||||
@@ -399,25 +399,89 @@ function myNationInfo() {
|
||||
";
|
||||
}
|
||||
|
||||
function checkSecretMaxPermission($me){
|
||||
$secretMax = 4;
|
||||
if($penalty['noTopSecret']??false){
|
||||
$secretMax = 1;
|
||||
}
|
||||
else if($penalty['noChief']??false){
|
||||
$secretMax = 1;
|
||||
}
|
||||
else if($penalty['noAmbassador']??false){
|
||||
$secretMax = 2;
|
||||
}
|
||||
return $secretMax;
|
||||
}
|
||||
|
||||
function checkSecretPermission($me, $checkSecretLimit=true){
|
||||
if(!key_exists('penalty', $me) || !key_exists('permission', $me)){
|
||||
trigger_error ('canAccessSecret() 함수에 필요한 인자가 부족');
|
||||
}
|
||||
$penalty = Json::decode($me['penalty'])??[];
|
||||
$permission = $me['permission'];
|
||||
|
||||
if(!$me['nation']){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($me['level'] == 0){
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if($pernalty['noSecret']??false){
|
||||
return 0;
|
||||
}
|
||||
|
||||
$secretMin = 0;
|
||||
$secretMax = checkSecretMaxPermission($me);
|
||||
|
||||
|
||||
if($me['level'] == 12){
|
||||
$secretMin = 4;
|
||||
}
|
||||
else if($me['permission'] == 'ambassador'){
|
||||
$secretMin = 4;
|
||||
}
|
||||
else if($me['permission'] == 'auditor'){
|
||||
$secretMin = 3;
|
||||
}
|
||||
else if($me['level'] >= 5){
|
||||
$secretMin = 2;
|
||||
}
|
||||
else if($me['level'] > 1){
|
||||
$secretMin = 1;
|
||||
}
|
||||
else if($checkSecretLimit){
|
||||
$db = DB::db();
|
||||
$secretLimit = $db->queryFirstField('SELECT secretlimit FROM nation WHERE nation = %i', $me['nation']);
|
||||
if ($me['belong'] >= $secretLimit) {
|
||||
$secretMin = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return min($secretMin, $secretMax);
|
||||
}
|
||||
|
||||
function addCommand($typename, $value, $valid = 1, $color=0) {
|
||||
if($valid == 1) {
|
||||
switch($color) {
|
||||
case 0:
|
||||
echo "
|
||||
<option style=color:white;background-color:black; value={$value}>{$typename}</option>";
|
||||
<option style='color:white;background-color:black;' value='{$value}'>{$typename}</option>";
|
||||
break;
|
||||
case 1:
|
||||
echo "
|
||||
<option style=color:skyblue;background-color:black; value={$value}>{$typename}</option>";
|
||||
<option style='color:skyblue;background-color:black;' value='{$value}'>{$typename}</option>";
|
||||
break;
|
||||
case 2:
|
||||
echo "
|
||||
<option style=color:orange;background-color:black; value={$value}>{$typename}</option>";
|
||||
<option style='color:orange;background-color:black;' value='{$value}'>{$typename}</option>";
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
echo "
|
||||
<option style=color:white;background-color:red; value={$value}>{$typename}(불가)</option>";
|
||||
<option style='color:white;background-color:red;' value='{$value}'>{$typename}(불가)</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,8 +910,8 @@ function generalInfo($no) {
|
||||
|
||||
if($nation['color'] == "") { $nation['color'] = "#000000"; }
|
||||
|
||||
if($general['age'] < 60) { $general['age'] = "<font color=limegreen>{$general['age']} 세</font>"; }
|
||||
elseif($general['age'] < 80) { $general['age'] = "<font color=yellow>{$general['age']} 세</font>"; }
|
||||
if($general['age'] < GameConst::$retirementYear*0.75) { $general['age'] = "<font color=limegreen>{$general['age']} 세</font>"; }
|
||||
elseif($general['age'] < GameConst::$retirementYear) { $general['age'] = "<font color=yellow>{$general['age']} 세</font>"; }
|
||||
else { $general['age'] = "<font color=red>{$general['age']} 세</font>"; }
|
||||
|
||||
$general['connect'] = Util::round($general['connect'] / 10) * 10;
|
||||
@@ -1128,59 +1192,6 @@ function nationMsg() {
|
||||
return $msg?:'';
|
||||
}
|
||||
|
||||
function msgprint($msg, $name, $picture, $imgsvr, $when, $num, $type) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$message = explode('|', $msg);
|
||||
$count = (count($message) - 2)/2;
|
||||
$message[0] = Tag2Code($message[0]);
|
||||
$message[1] = Tag2Code($message[1]);
|
||||
// $message[0] = str_replace("\n", "<br>", $message[0]);
|
||||
// $message[1] = str_replace("\n", "<br>", $message[1]);
|
||||
|
||||
if($type == 0) { $board = "c_nationboard.php"; }
|
||||
else { $board = "c_chiefboard.php"; }
|
||||
|
||||
$imageTemp = GetImageURL($imgsvr);
|
||||
echo "
|
||||
<table style='text-align:center;' width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=90 style='text-align:center;' class='bg1'><font size=1>$name</font></td>
|
||||
<td width=746 style='text-align:center;' class='bg1'><font size=4><b>$message[0]</b></font></td>
|
||||
<td width=148 style='text-align:center;' class='bg1'>$when</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=90 height=64 valign=top><img width='64' height='64' class='generalIcon' src='{$imageTemp}/{$picture}' border='0'></td>
|
||||
<td width=906 colspan=2>$message[1]</td>
|
||||
</tr>";
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$who = Tag2Code($message[2+$i*2]);
|
||||
$reply = Tag2Code($message[3+$i*2]);
|
||||
$query = "select name from general where no='$who'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$regen = MYDB_fetch_array($result);
|
||||
echo "
|
||||
<tr>
|
||||
<td width=90 style='text-align:center;'><font size=1>{$regen['name']}</font></td>
|
||||
<td width=906 colspan=2>$reply</td>
|
||||
</tr>";
|
||||
}
|
||||
echo "
|
||||
<tr>
|
||||
<form name=reply_form{$num} method=post action=$board>
|
||||
<td width=90 style='text-align:center;'>댓글달기</td>
|
||||
<td width=906 colspan=2>
|
||||
<input type=textarea name=reply maxlength=250 style=color:white;background-color:black;width:804px;>
|
||||
<input type=submit value=댓글달기>
|
||||
<input type=hidden name=num value=$num>
|
||||
</td>
|
||||
</form>
|
||||
</tr>
|
||||
</table>
|
||||
<br>";
|
||||
}
|
||||
|
||||
function banner() {
|
||||
|
||||
return sprintf(
|
||||
@@ -1431,10 +1442,10 @@ function checkDelay() {
|
||||
$threshold = 1;
|
||||
}
|
||||
else if($term >= 10){
|
||||
$threshold = 2;
|
||||
$threshold = 3;
|
||||
}
|
||||
else{
|
||||
$threshold = 3;
|
||||
$threshold = 6;
|
||||
}
|
||||
//지연 해야할 밀린 턴 횟수
|
||||
$iter = intdiv($timeMinDiff, $term);
|
||||
@@ -1942,6 +1953,7 @@ function updateTurntime($no) {
|
||||
'npc'=>$general['npc_org'],
|
||||
'killturn'=>$general['killturn'],
|
||||
'mode'=>2,
|
||||
'permission'=>'normal',
|
||||
'name2'=>null
|
||||
], 'no=%i',$no);
|
||||
|
||||
@@ -1957,7 +1969,7 @@ function updateTurntime($no) {
|
||||
nextRuler($general);
|
||||
}
|
||||
|
||||
//도시의 태수, 군사, 시중직도 초기화
|
||||
//도시의 태수, 군사, 종사직도 초기화
|
||||
$query = "update city set gen1='0' where gen1='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen2='0' where gen2='{$general['no']}'";
|
||||
@@ -2066,7 +2078,7 @@ function updateTurntime($no) {
|
||||
}
|
||||
}
|
||||
|
||||
if($general['age'] >= 80 && $general['npc'] == 0) {
|
||||
if($general['age'] >= GameConst::$retirementYear && $general['npc'] == 0) {
|
||||
if($admin['isunited'] == 0) {
|
||||
CheckHall($no);
|
||||
}
|
||||
@@ -2139,6 +2151,11 @@ function CheckHall($no) {
|
||||
|
||||
[$scenarioIdx, $scenarioName, $startTime] = $gameStor->getValuesAsArray(['scenario', 'scenario_text', 'starttime']);
|
||||
|
||||
$ownerName = $general['name2'];
|
||||
if($general['owner']){
|
||||
$ownerName = RootDB::db()->queryFirstField('SELECT name FROM member WHERE no = %i', $general['owner']);
|
||||
}
|
||||
|
||||
foreach($types as $idx=>$typeName) {
|
||||
|
||||
|
||||
@@ -2168,7 +2185,7 @@ function CheckHall($no) {
|
||||
'imgsvr'=>$general['imgsvr'],
|
||||
'startTime'=>$startTime,
|
||||
'unitedTime'=>$unitedDate,
|
||||
'owner_name'=>$general['name2'],
|
||||
'owner_name'=>$ownerName,
|
||||
'serverID'=>UniqueConst::$serverID,
|
||||
'serverIdx'=>$serverCnt,
|
||||
'serverName'=>UniqueConst::$serverName,
|
||||
@@ -2176,7 +2193,7 @@ function CheckHall($no) {
|
||||
];
|
||||
$jsonAux = Json::encode($aux);
|
||||
|
||||
$db->insertUpdate('ng_hall', [
|
||||
$db->insertIgnore('ng_hall', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'scenario'=>$scenarioIdx,
|
||||
'general_no'=>$no,
|
||||
@@ -2184,10 +2201,21 @@ function CheckHall($no) {
|
||||
'value'=>$general[$typeName]??0,
|
||||
'owner'=>$general['owner']??null,
|
||||
'aux'=>$jsonAux
|
||||
],[
|
||||
'value'=>$general[$typeName]??0,
|
||||
'aux'=>$jsonAux
|
||||
]);
|
||||
|
||||
if($db->affectedRows() == 0){
|
||||
$db->update('ng_hall', [
|
||||
'value'=>$general[$typeName]??0,
|
||||
'aux'=>$jsonAux
|
||||
],
|
||||
'server_id = %s AND scenario = %i AND general_no = %i AND type = %i AND value < %d',
|
||||
UniqueConst::$serverID,
|
||||
$scenarioIdx,
|
||||
$no,
|
||||
$idx,
|
||||
$general[$typeName]??0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2222,7 +2250,13 @@ function uniqueItem($general, $log, $vote=0) {
|
||||
//아이템 습득 상황
|
||||
if(rand() % $prob == 0) {
|
||||
//셋중 선택
|
||||
$sel = rand() % 4;
|
||||
$selGroup = [
|
||||
20 - $db->queryFirstField('SELECT count(*) from general where weap > 6'),
|
||||
20 - $db->queryFirstField('SELECT count(*) from general where book > 6'),
|
||||
20 - $db->queryFirstField('SELECT count(*) from general where horse > 6'),
|
||||
20 - $db->queryFirstField('SELECT count(*) from general where item > 6')
|
||||
];
|
||||
$sel = Util::choiceRandomUsingWeight($selGroup);
|
||||
switch($sel) {
|
||||
case 0: $type = "weap"; break;
|
||||
case 1: $type = "book"; break;
|
||||
@@ -2548,7 +2582,7 @@ function deleteNation($general) {
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
|
||||
// 전 장수 재야로 // 전 장수 소속 무소속으로
|
||||
$query = "update general set belong=0,troop=0,level=0,nation=0,makelimit=12 where nation='{$general['nation']}'";
|
||||
$query = "update general set belong=0,troop=0,level=0,nation=0,permission='normal',makelimit=12 where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 도시 공백지로
|
||||
$query = "update city set nation=0,front=0,gen1=0,gen2=0,gen3=0 where nation='{$general['nation']}'";
|
||||
|
||||
+18
-13
@@ -478,9 +478,7 @@ function processCommand($no) {
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar from general where no='$no'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
$general = $db->queryFirstRow('SELECT npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset from general where no = %i', $no);
|
||||
|
||||
list($month, $killturn) = $gameStor->getValuesAsArray(['month', 'killturn']);
|
||||
$log = [];
|
||||
@@ -540,23 +538,30 @@ function processCommand($no) {
|
||||
}
|
||||
|
||||
//장수정보 재로드
|
||||
$query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar from general where no='$no'";
|
||||
$query = "select npc,no,name,picture,imgsvr,nation,nations,city,troop,injury,affinity,leader,leader2,power,power2,intel,intel2,experience,dedication,level,gold,rice,crew,crewtype,train,atmos,weap,book,horse,item,turntime,makenation,makelimit,killturn,block,dedlevel,explevel,age,belong,personal,special,special2,term,turn0,dex0,dex10,dex20,dex30,dex40,warnum,killnum,deathnum,killcrew,deathcrew,recwar,myset from general where no='$no'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
}
|
||||
|
||||
$command = DecodeCommand($general['turn0']);
|
||||
$newKillturn = $killturn;
|
||||
//삭턴 처리
|
||||
if($general['npc'] >= 2 || $general['killturn'] > $killturn) {
|
||||
$query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$newKillturn = $general['killturn'] - 1;
|
||||
} elseif($command[0] == 0) {
|
||||
$query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn=killturn-1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$newKillturn = $general['killturn'] - 1;
|
||||
} else {
|
||||
$query = "update general set recturn=turn0,resturn='FAIL',myset=3,con=0,killturn='{$killturn}' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$newKillturn = $killturn;
|
||||
}
|
||||
|
||||
$newMySet = min($general['myset'] + 1, 3);
|
||||
$db->update('general', [
|
||||
'recturn'=>$db->sqleval('turn0'),
|
||||
'resturn'=>'FAIL',
|
||||
'con'=>0,
|
||||
'killturn'=>$newKillturn,
|
||||
'myset'=>$newMySet
|
||||
], 'no = %i', $general['no']);
|
||||
//FIXME: 운영자 같이 사망하면 안되는 인물에 대한 처리가 필요
|
||||
|
||||
//연속턴 아닌경우 텀 리셋
|
||||
@@ -702,7 +707,7 @@ where nation='{$general['nation']}'
|
||||
|
||||
function command_Single($turn, $command) {
|
||||
if(!$turn){
|
||||
header('location:commandlist.php');
|
||||
header('location:commandlist.php', true, 303);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -717,7 +722,7 @@ function command_Single($turn, $command) {
|
||||
}
|
||||
$db->update('general', $setValues, 'owner=%i',$userID);
|
||||
|
||||
header('location:commandlist.php');
|
||||
header('location:commandlist.php', true, 303);
|
||||
}
|
||||
|
||||
function command_Chief($turn, $command) {
|
||||
@@ -740,7 +745,7 @@ function command_Chief($turn, $command) {
|
||||
$query = "update nation set {$str} where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
header('location:b_chiefcenter.php');
|
||||
header('location:b_chiefcenter.php', true, 303);
|
||||
}
|
||||
|
||||
function command_Other($turn, $commandtype) {
|
||||
|
||||
+31
-35
@@ -278,11 +278,11 @@ function getLevel($level, $nlevel=8) {
|
||||
|
||||
case 712: $call = '황제'; break; case 612: $call = '왕'; break;
|
||||
case 711: $call = '승상'; break; case 611: $call = '광록훈'; break;
|
||||
case 710: $call = '위장군'; break; case 610: $call = '전장군'; break;
|
||||
case 710: $call = '표기장군'; break; case 610: $call = '좌장군'; break;
|
||||
case 709: $call = '사공'; break; case 609: $call = '상서령'; break;
|
||||
case 708: $call = '표기장군'; break; case 608: $call = '좌장군'; break;
|
||||
case 708: $call = '거기장군'; break; case 608: $call = '우장군'; break;
|
||||
case 707: $call = '태위'; break; case 607: $call = '중서령'; break;
|
||||
case 706: $call = '거기장군'; break; case 606: $call = '우장군'; break;
|
||||
case 706: $call = '위장군'; break; case 606: $call = '전장군'; break;
|
||||
case 705: $call = '사도'; break; case 605: $call = '비서령'; break;
|
||||
|
||||
case 512: $call = '공'; break; case 412: $call = '주목'; break;
|
||||
@@ -302,7 +302,7 @@ function getLevel($level, $nlevel=8) {
|
||||
|
||||
case 4: $call = '태수'; break;
|
||||
case 3: $call = '군사'; break;
|
||||
case 2: $call = '시중'; break;
|
||||
case 2: $call = '종사'; break;
|
||||
case 1: $call = '일반'; break;
|
||||
case 0: $call = '재야'; break;
|
||||
default: $call = '-'; break;
|
||||
@@ -453,36 +453,32 @@ function getTechCall($tech) : string {
|
||||
function getDexLevelList(): array{
|
||||
return [
|
||||
[0, 'navy', 'F-'],
|
||||
[2500, 'navy', 'F'],
|
||||
[7500, 'navy', 'F+'],
|
||||
[15000, 'skyblue', 'E-'],
|
||||
[25000, 'skyblue', 'E'],
|
||||
[37500, 'skyblue', 'E+'],
|
||||
[52500, 'seagreen', 'D-'],
|
||||
[70000, 'seagreen', 'D'],
|
||||
[90000, 'seagreen', 'D+'],
|
||||
[112500, 'teal', 'C-'],
|
||||
[137500, 'teal', 'C'],
|
||||
[165000, 'teal', 'C+'],
|
||||
[195000, 'limegreen', 'B-'],
|
||||
[227500, 'limegreen', 'B'],
|
||||
[262500, 'limegreen', 'B+'],
|
||||
[300000, 'gold', 'A-'],
|
||||
[340000, 'gold', 'A'],
|
||||
[382500, 'gold', 'A+'],
|
||||
[427500, 'darkorange', 'S-'],
|
||||
[475000, 'darkorange', 'S'],
|
||||
[525000, 'darkorange', 'S+'],
|
||||
[577500, 'tomato', 'SS-'],
|
||||
[632500, 'tomato', 'SS'],
|
||||
[690000, 'tomato', 'SS+'],
|
||||
[750000, 'red', 'SSS-'],
|
||||
[812500, 'red', 'SSS'],
|
||||
[877500, 'red', 'SSS+'],
|
||||
[945000, 'darkviolet', 'Z-'],
|
||||
[1015000, 'darkviolet', 'Z'],
|
||||
[1087500, 'darkviolet', 'Z+'],
|
||||
[1162500, 'white', '?']
|
||||
[350, 'navy', 'F'],
|
||||
[1375, 'navy', 'F+'],
|
||||
[3500, 'skyblue', 'E-'],
|
||||
[7125, 'skyblue', 'E'],
|
||||
[12650, 'skyblue', 'E+'],
|
||||
[20475, 'seagreen', 'D-'],
|
||||
[31000, 'seagreen', 'D'],
|
||||
[44625, 'seagreen', 'D+'],
|
||||
[61750, 'teal', 'C-'],
|
||||
[82775, 'teal', 'C'],
|
||||
[108100, 'teal', 'C+'],
|
||||
[138125, 'limegreen', 'B-'],
|
||||
[173250, 'limegreen', 'B'],
|
||||
[213875, 'limegreen', 'B+'],
|
||||
[260400, 'darkorange', 'A-'],
|
||||
[313225, 'darkorange', 'A'],
|
||||
[372750, 'darkorange', 'A+'],
|
||||
[439375, 'tomato', 'S-'],
|
||||
[513500, 'tomato', 'S'],
|
||||
[595525, 'tomato', 'S+'],
|
||||
[685850, 'darkviolet', 'Z-'],
|
||||
[784875, 'darkviolet', 'Z'],
|
||||
[893000, 'darkviolet', 'Z+'],
|
||||
[1010625, 'gold', 'EX-'],
|
||||
[1138150, 'gold', 'EX'],
|
||||
[1275975, 'white', 'EX+'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -520,7 +516,7 @@ function getDexLevel(int $dex) : int {
|
||||
}
|
||||
|
||||
function getDexLog($dex1, $dex2) {
|
||||
$ratio = (getDexLevel($dex1) - getDexLevel($dex2)) / 50 + 1;
|
||||
$ratio = (getDexLevel($dex1) - getDexLevel($dex2)) / 55 + 1;
|
||||
return $ratio;
|
||||
}
|
||||
|
||||
|
||||
@@ -776,6 +776,7 @@ function checkMerge() {
|
||||
|
||||
$db->update('general', [
|
||||
'nation'=>0,
|
||||
'permission'=>'normal',
|
||||
], 'nation=%i AND npc = 5', $me['nation']);
|
||||
|
||||
$query = "delete from nation where nation='{$me['nation']}'";
|
||||
@@ -922,6 +923,7 @@ function checkSurrender() {
|
||||
|
||||
$db->update('general', [
|
||||
'nation'=>0,
|
||||
'permission'=>'normal',
|
||||
], 'nation=%i AND npc = 5', $me['nation']);
|
||||
|
||||
$query = "delete from nation where nation='{$me['nation']}'";
|
||||
@@ -1041,7 +1043,7 @@ function updateNationState() {
|
||||
while($genStep > 0){
|
||||
$lastAssemblerID += 1;
|
||||
$npcObj = new Scenario\NPC(
|
||||
999, '부대장'.$lastAssemblerID, null, $nation['nation'], null,
|
||||
999, sprintf('부대장%3d',$lastAssemblerID), null, $nation['nation'], null,
|
||||
10, 10, 10, 1, $admin['year'] - 15, $admin['year'] + 15, '은둔', '척사'
|
||||
);
|
||||
$npcObj->npc = 5;
|
||||
|
||||
@@ -5,14 +5,15 @@ function getMailboxList(){
|
||||
|
||||
$generalNations = [];
|
||||
|
||||
foreach(DB::db()->queryAllLists('select `no`, `name`, `nation`, `level`, `npc` from `general` where `npc` < 2') as $general)
|
||||
foreach(DB::db()->query('select `no`, `name`, `nation`, `level`, `npc`, `permission`, `penalty` from `general` where `npc` < 2') as $general)
|
||||
{
|
||||
list($generalID, $generalName, $nationID, $level, $npc) = $general;
|
||||
[$generalID, $generalName, $nationID, $level, $npc] = [$general['no'], $general['name'], $general['nation'], $general['level'], $general['npc']];
|
||||
if(!isset($generalNations[$nationID])){
|
||||
$generalNations[$nationID] = [];
|
||||
}
|
||||
|
||||
$obj = [$generalID, $generalName, 0];
|
||||
$permission = checkSecretPermission($general, false);
|
||||
|
||||
if($level == 12){
|
||||
$obj[2] |= 1;
|
||||
@@ -22,6 +23,10 @@ function getMailboxList(){
|
||||
$obj[2] |= 2;
|
||||
}
|
||||
|
||||
if($permission == 4){
|
||||
$obj[2] |= 4;
|
||||
}
|
||||
|
||||
$generalNations[$nationID][] = $obj;
|
||||
}
|
||||
|
||||
@@ -37,7 +42,7 @@ function getMailboxList(){
|
||||
"mailbox"=>$mailbox,
|
||||
"name"=>$nationName,
|
||||
"color"=>$color,
|
||||
"general"=>$generals
|
||||
"general"=>$generals,
|
||||
];
|
||||
}, array_merge([getNationStaticInfo(0)], getAllNationStaticInfo()));
|
||||
|
||||
|
||||
+25
-4
@@ -204,7 +204,24 @@ function processAI($no) {
|
||||
'killturn'=>1
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
else if($general['level'] == 12){
|
||||
$newRuler = $db->queryFirstField('SELECT `no` FROM general WHERE nation = %i AND no != %i ORDER BY RAND() LIMIT 1', $general['nation'], $general['no']);
|
||||
if($newRuler){
|
||||
$command = EncodeCommand(0, 0, $newRuler, 54); //선양
|
||||
$db->update('general', [
|
||||
'turn0'=>$command,
|
||||
'turn1'=>$command,
|
||||
'turn2'=>$command,
|
||||
'turn3'=>$command,
|
||||
'turn4'=>$command,
|
||||
'killturn'=>rand(70,75),
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
$newKillTurn = ($general['killturn'] + Util::randRangeInt(1, 4)) % 5;
|
||||
$newKillTurn += 70;
|
||||
$command = EncodeCommand(0, 0, 0, 26); //집합
|
||||
$db->update('general', [
|
||||
'turn0'=>$command,
|
||||
@@ -213,7 +230,7 @@ function processAI($no) {
|
||||
'turn3'=>$command,
|
||||
'turn4'=>$command,
|
||||
'turn5'=>$command,
|
||||
'killturn'=>rand(70,75),
|
||||
'killturn'=>$newKillTurn,
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
|
||||
@@ -437,12 +454,12 @@ function processAI($no) {
|
||||
} elseif($admin['month'] == 12) {
|
||||
//세율
|
||||
$nation['rate'] = TaxRate($general['nation']);
|
||||
//지급율
|
||||
//지급률
|
||||
GoldBillRate($nation['nation'], $nation['rate'], $admin['gold_rate'], $nation['type'], $nation['gold']);
|
||||
} elseif($admin['month'] == 6) {
|
||||
//세율
|
||||
$nation['rate'] = TaxRate($general['nation']);
|
||||
//지급율
|
||||
//지급률
|
||||
RiceBillRate($nation['nation'], $nation['rate'], $admin['rice_rate'], $nation['type'], $nation['rice']);
|
||||
}
|
||||
|
||||
@@ -1338,7 +1355,7 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
return Util::choiceRandomUsingWeight($commandList);
|
||||
}
|
||||
|
||||
//종전하기, 지급율
|
||||
//종전하기, 지급률
|
||||
//$command = $fourth * 100000000 + $type * 100000 + $crew * 100 + 11;
|
||||
|
||||
function Promotion($nation, $level) {
|
||||
@@ -1416,6 +1433,10 @@ function Promotion($nation, $level) {
|
||||
$query = "update general set level={$i2} where no='{$level['no']}'";
|
||||
MYDB_query($query, $connect) or Error("Promotion_02 ".MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
$db->update('general', [
|
||||
'permission'=>'ambassador',
|
||||
], 'nation=%i AND npc < 2 AND level > 4', $nation);
|
||||
}
|
||||
|
||||
function TaxRate($nation) {
|
||||
|
||||
+29
-9
@@ -273,8 +273,15 @@ function process_1(&$general, $type) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
if($city['front'] == 1 && $city['city'] != $nation['capital']){
|
||||
$score *= 0.5;
|
||||
if($city['front'] == 1){
|
||||
if($city['city'] == $nation['capital']){
|
||||
$degrade = 1 - ($admin['year'] - $admin['startyear'] - 5) * 0.025;
|
||||
$score *= Util::valueFit($degrade, 0.5, 1);
|
||||
}
|
||||
else{
|
||||
$score *= 0.5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$score += $city["$stype"];
|
||||
@@ -373,7 +380,7 @@ function process_3(&$general) {
|
||||
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i', $general['nation']);
|
||||
$gencnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $general['nation']);
|
||||
if ($gencnt_eff < GameConst::$initialNationGenLimit) {
|
||||
$gencount = GameConst::$initialNationGenLimit;
|
||||
$gencount = max(GameConst::$initialNationGenLimit, $gencount);
|
||||
$gencnt_eff = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
@@ -446,7 +453,7 @@ function process_4(&$general) {
|
||||
|
||||
// 군주, 참모 보정
|
||||
if($general['level'] == 12 || $general['level'] == 11) { $score *= 1.05; }
|
||||
// 시중 보정
|
||||
// 종사 보정
|
||||
if($general['level'] == 2 && $general['no'] == $city['gen3']) { $score *= 1.05; }
|
||||
|
||||
$rd = Util::randF();
|
||||
@@ -571,14 +578,27 @@ function process_5(&$general, $type) {
|
||||
$exp = $score * 0.7;
|
||||
$ded = $score * 1.0;
|
||||
|
||||
if($city['front'] == 1 && $city['city'] != $nation['capital']){
|
||||
if($stype == 'def'){
|
||||
$score *= 0.5;
|
||||
if($city['front'] == 1){
|
||||
if($city['city'] == $nation['capital']){
|
||||
if($stype == 'def'){
|
||||
$degrade = 1 - ($admin['year'] - $admin['startyear'] - 5) * 0.025;
|
||||
$score *= Util::valueFit($degrade, 0.5, 1);
|
||||
}
|
||||
else{
|
||||
$degrade = 1 - ($admin['year'] - $admin['startyear'] - 5) * 0.0375;
|
||||
$score *= Util::valueFit($degrade, 0.25, 1);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$score *= 0.25;
|
||||
if($stype == 'def'){
|
||||
$score *= 0.5;
|
||||
}
|
||||
else{
|
||||
$score *= 0.25;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 성격 보정
|
||||
@@ -646,7 +666,7 @@ function process_7(&$general) {
|
||||
|
||||
// 군주, 참모 보정
|
||||
if($general['level'] == 12 || $general['level'] == 11) { $score *= 1.05; }
|
||||
// 시중 보정
|
||||
// 종사 보정
|
||||
if($general['level'] == 2 && $general['no'] == $city['gen3']) { $score *= 1.05; }
|
||||
|
||||
$rd = Util::randF();
|
||||
|
||||
+45
-34
@@ -605,11 +605,6 @@ function process_61(&$general) {
|
||||
$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,
|
||||
@@ -619,19 +614,11 @@ function process_61(&$general) {
|
||||
$validUntil,
|
||||
[
|
||||
'action'=>DiplomaticMessage::TYPE_NO_AGGRESSION,
|
||||
'year'=>$when,
|
||||
'option'=>$option
|
||||
'year'=>$when
|
||||
]
|
||||
);
|
||||
$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턴후
|
||||
|
||||
pushGenLog($general, ["<C>●</>{$month}월:<D><b>{$destNation['name']}</b></>으로 불가침 제의 서신을 보냈습니다.<1>$date</>"]);
|
||||
}
|
||||
|
||||
@@ -1981,31 +1968,55 @@ function process_76(&$general) {
|
||||
$avgNation = MYDB_fetch_array($result);
|
||||
$gencount = 5 + Util::round($avgNation['gennum'] / 10);
|
||||
|
||||
$query = "select avg(age) as age, max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0) as dex0, avg(dex10) as dex10, avg(dex20) as dex20, avg(dex30) as dex30, avg(dex40) as dex40 from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$avgGen = MYDB_fetch_array($result);
|
||||
$avgGen = $db->queryFirstRow('SELECT max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0+dex10+dex20+dex30) as dex_t, avg(age) as age, avg(dex40) as dex40 from general where npc < 5 and nation = %i', $general['nation']);
|
||||
|
||||
$dexTotal = $avgGen['dex_t'];
|
||||
|
||||
//의병추가
|
||||
$npc = 4;
|
||||
$npcid = $admin['npccount'];
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
// 무장 40%, 지장 40%, 무지장 20%
|
||||
$type = rand() % 10;
|
||||
switch($type) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatTotal - $leader - $intel;
|
||||
//무장 50%, 지장 50%, 무지장 0%
|
||||
$stat_tier1 = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$stat_tier3 = GameConst::$defaultStatMin + rand()%6;
|
||||
$stat_tier2 = GameConst::$defaultStatTotal - $stat_tier1 - $stat_tier3;
|
||||
$type = Util::choiceRandomUsingWeight([
|
||||
'power0'=>1,
|
||||
'power1'=>1,
|
||||
'power2'=>1,
|
||||
'intel'=>3,
|
||||
'neutral'=>0
|
||||
]);
|
||||
switch($type){
|
||||
case 'power0':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal*5/8, $dexTotal/8, $dexTotal/8, $dexTotal/8];
|
||||
break;
|
||||
case 4: case 5: case 6: case 7:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$power = GameConst::$defaultStatMin + rand()%6;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
case 'power1':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal/8, $dexTotal*5/8, $dexTotal/8, $dexTotal/8];
|
||||
break;
|
||||
case 8: case 9:
|
||||
$leader = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
case 'power2':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal*5/8, $dexTotal/8];
|
||||
break;
|
||||
case 'intel':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier3;
|
||||
$intel = $stat_tier2;
|
||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal/8, $dexTotal*5/8];
|
||||
break;
|
||||
default:
|
||||
$leader = $stat_tier3;
|
||||
$power = $stat_tier1;
|
||||
$intel = $stat_tier2;
|
||||
$dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4];
|
||||
break;
|
||||
}
|
||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||
@@ -2039,7 +2050,7 @@ function process_76(&$general) {
|
||||
$intel -= $over3;
|
||||
}
|
||||
// 낮은 능치쪽으로 합산
|
||||
if($type == 0) {
|
||||
if($type == 'power') {
|
||||
$intel = $intel + $over1 + $over2 + $over3;
|
||||
} else {
|
||||
$power = $power + $over1 + $over2 + $over3;
|
||||
@@ -2079,7 +2090,7 @@ function process_76(&$general) {
|
||||
'1','100','100','0','".GameUnitConst::DEFAULT_CREWTYPE."','0','0','0',
|
||||
'0','0','0','$turntime','$killturn','{$avgGen['age']}','1','$personal','0','0','0','0','',
|
||||
'0','$bornyear','$deadyear',
|
||||
'{$avgGen['dex0']}','{$avgGen['dex10']}','{$avgGen['dex20']}','{$avgGen['dex30']}','{$avgGen['dex40']}'
|
||||
'{$dexVal[0]}','{$dexVal[1]}','{$dexVal[2]}','{$dexVal[3]}','{$avgGen['dex40']}'
|
||||
)",
|
||||
$connect
|
||||
) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
+125
-81
@@ -131,6 +131,16 @@ function process_25(&$general) {
|
||||
$generals[$nation] = $cnt;
|
||||
}
|
||||
|
||||
foreach($db->queryAllLists('SELECT count(no), nation FROM general WHERE 3 <= npc and npc <= 4 AND nation > 0 GROUP BY nation') as list($cnt, $nation)){
|
||||
//의병, 인탐장은 1/3로 카운트
|
||||
if(key_exists($nation, $generals)){
|
||||
$generals[$nation] += $cnt / 3;
|
||||
}
|
||||
else{
|
||||
$generals[$nation] = $cnt / 3;
|
||||
}
|
||||
}
|
||||
|
||||
$allGen = array_sum($generals);
|
||||
|
||||
$genLimit = GameConst::$defaultMaxGeneral;
|
||||
@@ -243,6 +253,7 @@ function process_25(&$general) {
|
||||
'nation'=>$nation['nation'],
|
||||
'nations'=>Json::encode($joinedNations),
|
||||
'level'=>1,
|
||||
'permission'=>'normal',
|
||||
'experience'=>$db->sqleval('experience + %i', $exp),
|
||||
'city'=>$king['city'],
|
||||
'belong'=>1
|
||||
@@ -279,7 +290,7 @@ function process_29(&$general) {
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$admin = $gameStor->getValues(['startyear','year','month','develcost','npccount','turnterm','scenario']);
|
||||
$admin = $gameStor->getValues(['startyear','year','month','develcost','npccount','turnterm','scenario','maxgeneral']);
|
||||
|
||||
$query = "select nation,name,level,gennum,scout from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -290,30 +301,39 @@ function process_29(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야입니다. 인재탐색 실패. <1>$date</>";
|
||||
} elseif($nation['level'] <= 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:방랑군입니다. 인재탐색 실패. <1>$date</>";
|
||||
} elseif($admin['year'] < $admin['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 <D>{$nation['name']}</>{$josaUn} 탐색이 제한되고 있습니다. 인재탐색 실패.";
|
||||
} elseif($general['gold'] < $admin['develcost']) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:자금이 모자랍니다. 인재탐색 실패. <1>$date</>";
|
||||
} else {
|
||||
$query = "select no from general where nation='{$general['nation']}' and npc<2";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
|
||||
$query = "select no from general where nation='{$general['nation']}' and npc=3";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$npccount = MYDB_num_rows($result);
|
||||
$max_gen_cnt = $admin['maxgeneral'];
|
||||
|
||||
$query = "select no from general where nation!='{$general['nation']}' and npc=3";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$otherNpccount = MYDB_num_rows($result);
|
||||
$otherNpccount = Util::round(sqrt($otherNpccount + 1)) - 1;
|
||||
|
||||
if($gencount <= 0) { $gencount = 1; }
|
||||
if($npccount <= 0) { $npccount = 1; }
|
||||
$criteria = $gencount * $npccount + $otherNpccount;
|
||||
$total_gen_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc <= 2');
|
||||
$total_npc_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4');
|
||||
|
||||
$gen_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc <= 2 AND nation = %i', $general['nation']);
|
||||
$npc_cnt = $db->queryFirstField('SELECT count(`no`) FROM general WHERE 3 <= npc AND npc <= 4 AND nation = %i', $general['nation']);
|
||||
|
||||
$nation_cnt = $db->queryFirstField('SELECT count(`nation`) FROM nation WHERE `level` > 0');
|
||||
|
||||
$curr_cnt = Util::toInt($total_gen_cnt + $total_npc_cnt / 2);
|
||||
$remain_slot = $max_gen_cnt - $curr_cnt;
|
||||
|
||||
$avg_cnt = $curr_cnt / $nation_cnt;
|
||||
|
||||
$found_prop_main = pow($remain_slot / $max_gen_cnt, 6);
|
||||
$found_prop_small = 1 / ($total_npc_cnt / 3 + 1);
|
||||
$found_prop_big = 1 / $max_gen_cnt;
|
||||
|
||||
if($total_npc_cnt < 50){
|
||||
$found_prop = max($found_prop_main, $found_prop_small);
|
||||
}
|
||||
else{
|
||||
$found_prop = max($found_prop_main, $found_prop_big);
|
||||
}
|
||||
$found_npc = Util::randBool($found_prop);
|
||||
|
||||
// 탐색 실패
|
||||
if(rand() % $criteria > 0) {
|
||||
if(!$found_npc) {
|
||||
$exp = 100;
|
||||
$ded = 70;
|
||||
switch(Util::choiceRandomUsingWeight([$general['leader'], $general['power'], $general['intel']])) {
|
||||
@@ -343,7 +363,17 @@ function process_29(&$general) {
|
||||
$name = "{$name}{$count}";
|
||||
}
|
||||
|
||||
if($nation['scout'] != 0) {
|
||||
$join_prop = 0.55 * $avg_cnt / ($gen_cnt + $npc_cnt / 2);
|
||||
|
||||
$no_scout = false;
|
||||
if($nation['scout'] != 0){
|
||||
$no_scout = true;
|
||||
}
|
||||
else if($admin['year'] < $admin['startyear']+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
|
||||
$no_scout = true;
|
||||
}
|
||||
|
||||
if($no_scout || !Util::randBool($join_prop)) {
|
||||
$scoutType = "발견";
|
||||
$scoutLevel = 0;
|
||||
$scoutNation = 0;
|
||||
@@ -359,50 +389,54 @@ function process_29(&$general) {
|
||||
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>{$josaYi} <Y>$name</>{$josaRa}는 <C>인재</>를 {$scoutType}하였습니다!";
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y>$name</>{$josaRa}는 <C>인재</>를 {$scoutType}");
|
||||
|
||||
$query = "select max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0) as dex0, avg(dex10) as dex10, avg(dex20) as dex20, avg(dex30) as dex30, avg(dex40) as dex40 from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$avgGen = MYDB_fetch_array($result);
|
||||
$avgGen = $db->queryFirstRow('SELECT max(leader+power+intel) as lpi, avg(dedication) as ded,avg(experience) as exp, avg(dex0+dex10+dex20+dex30) as dex_t, avg(dex40) as dex40 from general where npc < 5 and nation = %i', $general['nation']);
|
||||
|
||||
// 체섭시 무장 20%, 지장 20%, 무지장 60%
|
||||
// 마이너 무장 40%, 지장 40%, 무지장 20%
|
||||
$type = rand() % 10;
|
||||
if($admin['scenario'] < 100) {
|
||||
switch($type) {
|
||||
case 0: case 1:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatTotal - $leader - $intel;
|
||||
break;
|
||||
case 2: case 3:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$power = GameConst::$defaultStatMin + rand()%6;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
break;
|
||||
case 4: case 5: case 6: case 7: case 8: case 9:
|
||||
$leader = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch($type) {
|
||||
case 0: case 1: case 2: case 3:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatTotal - $leader - $intel;
|
||||
break;
|
||||
case 4: case 5: case 6: case 7:
|
||||
$leader = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$power = GameConst::$defaultStatMin + rand()%6;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
break;
|
||||
case 8: case 9:
|
||||
$leader = GameConst::$defaultStatMin + rand()%6;
|
||||
$power = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$intel = GameConst::$defaultStatTotal - $leader - $power;
|
||||
break;
|
||||
}
|
||||
$dexTotal = $avgGen['dex_t'];
|
||||
|
||||
//무장 40%, 지장 40%, 무지장 20%
|
||||
$stat_tier1 = GameConst::$defaultStatMax - 10 + rand()%11;
|
||||
$stat_tier3 = GameConst::$defaultStatMin + rand()%6;
|
||||
$stat_tier2 = GameConst::$defaultStatTotal - $stat_tier1 - $stat_tier3;
|
||||
$type = Util::choiceRandomUsingWeight([
|
||||
'power0'=>2,
|
||||
'power1'=>2,
|
||||
'power2'=>2,
|
||||
'intel'=>6,
|
||||
'neutral'=>3
|
||||
]);
|
||||
switch($type){
|
||||
case 'power0':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal*5/8, $dexTotal/8, $dexTotal/8, $dexTotal/8];
|
||||
break;
|
||||
case 'power1':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal/8, $dexTotal*5/8, $dexTotal/8, $dexTotal/8];
|
||||
break;
|
||||
case 'power2':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier2;
|
||||
$intel = $stat_tier3;
|
||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal*5/8, $dexTotal/8];
|
||||
break;
|
||||
case 'intel':
|
||||
$leader = $stat_tier1;
|
||||
$power = $stat_tier3;
|
||||
$intel = $stat_tier2;
|
||||
$dexVal = [$dexTotal/8, $dexTotal/8, $dexTotal/8, $dexTotal*5/8];
|
||||
break;
|
||||
default:
|
||||
$leader = $stat_tier3;
|
||||
$power = $stat_tier1;
|
||||
$intel = $stat_tier2;
|
||||
$dexVal = [$dexTotal/4, $dexTotal/4, $dexTotal/4, $dexTotal/4];
|
||||
break;
|
||||
}
|
||||
|
||||
// 국내 최고능치 기준으로 랜덤성 스케일링
|
||||
if($avgGen['lpi'] > 210) {
|
||||
$leader = Util::round($leader * $avgGen['lpi'] / GameConst::$defaultStatTotal * (60+rand()%31)/100);
|
||||
@@ -434,7 +468,7 @@ function process_29(&$general) {
|
||||
$intel -= $over3;
|
||||
}
|
||||
// 낮은 능치쪽으로 합산
|
||||
if($type == 0) {
|
||||
if($type == 'power') {
|
||||
$intel = $intel + $over1 + $over2 + $over3;
|
||||
} else {
|
||||
$power = $power + $over1 + $over2 + $over3;
|
||||
@@ -461,12 +495,12 @@ function process_29(&$general) {
|
||||
$bornyear = $admin['year'];
|
||||
$deadyear = $admin['year'] + 3;
|
||||
$age = 20;
|
||||
$specage = Util::round((80 - $age)/12) + $age;
|
||||
$specage2 = Util::round((80 - $age)/3) + $age;
|
||||
$specage = Util::round((GameConst::$retirementYear - $age)/12) + $age;
|
||||
$specage2 = Util::round((GameConst::$retirementYear - $age)/3) + $age;
|
||||
//$specage = $age + 1 + rand() % 3;
|
||||
//$specage2 = $age + 5 + rand() % 5;
|
||||
// 10년 ~ 50년
|
||||
$killturn = rand()%480 + 120;
|
||||
// 20년 ~ 50년
|
||||
$killturn = Util::randRangeInt(20, 50) * 12;
|
||||
|
||||
@MYDB_query("
|
||||
insert into general (
|
||||
@@ -482,7 +516,7 @@ function process_29(&$general) {
|
||||
'$scoutLevel','100','100','0','".GameUnitConst::DEFAULT_CREWTYPE."','0','0','0',
|
||||
'0','0','0','$turntime','$killturn','$age','1','$personal','0','$specage','0','$specage2','',
|
||||
'0','$bornyear','$deadyear',
|
||||
'{$avgGen['dex0']}','{$avgGen['dex10']}','{$avgGen['dex20']}','{$avgGen['dex30']}','{$avgGen['dex40']}'
|
||||
'{$dexVal[0]}','{$dexVal[1]}','{$dexVal[2]}','{$dexVal[3]}','{$avgGen['dex40']}'
|
||||
)",
|
||||
$connect
|
||||
) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -595,11 +629,11 @@ function process_45(&$general) {
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에서 하야");
|
||||
|
||||
// 국적 바꾸고 등급 재야로 // 명성/공헌 N*10% 감소
|
||||
$query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}',betray=betray+1 where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,permission='normal',experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}',betray=betray+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
//도시의 태수, 군사, 시중직도 초기화
|
||||
//도시의 태수, 군사, 종사직도 초기화
|
||||
$query = "update city set gen1='0' where gen1='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen2='0' where gen2='{$general['no']}'";
|
||||
@@ -846,18 +880,28 @@ function process_54(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:현재 통합 진행중입니다. 선양 실패.";
|
||||
} else {
|
||||
//군주 교체
|
||||
$query = "update general set level='12' where no='$who'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 태수,군사,시중이었다면 해제
|
||||
$query = "update city set gen1='0' where gen1='$who'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen2='0' where gen2='$who'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen3='0' where gen3='$who'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('general', [
|
||||
'level'=>12,
|
||||
'permission'=>'normal'
|
||||
], 'no=%i', $who);
|
||||
|
||||
$query = "update general set resturn='SUCCESS',level='1',experience=experience*0.7 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 태수,군사,종사이었다면 해제
|
||||
$db->update('city', [
|
||||
'gen1'=>0,
|
||||
], 'gen1=%i', $who);
|
||||
$db->update('city', [
|
||||
'gen2'=>0,
|
||||
], 'gen2=%i', $who);
|
||||
$db->update('city', [
|
||||
'gen3'=>0,
|
||||
], 'gen3=%i', $who);
|
||||
|
||||
$db->update('general', [
|
||||
'resturn'=>'SUCCESS',
|
||||
'level'=>1,
|
||||
'permission'=>'auditor',
|
||||
'experience'=>$db->sqleval('experience*0.7'),
|
||||
], 'no=%i', $general['no']);
|
||||
|
||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
||||
$history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【선양】</b></><Y>{$general['name']}</>{$josaYi} <D><b>{$nation['name']}</b></>의 군주 자리를 <Y>{$nextruler['name']}</>에게 선양했습니다.";
|
||||
@@ -1059,7 +1103,7 @@ function process_57(&$general) {
|
||||
//군주 교체
|
||||
$query = "update general set resturn='SUCCESS',level='12' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 태수,군사,시중이었다면 해제
|
||||
// 태수,군사,종사이었다면 해제
|
||||
$query = "update city set gen1='0' where gen1='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update city set gen2='0' where gen2='{$general['no']}'";
|
||||
|
||||
@@ -136,7 +136,7 @@ function commandButton() {
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow("select no,nation,level,belong from general where owner=%i", $userID);
|
||||
$me = $db->queryFirstRow("select no,nation,level,belong,permission,penalty from general where owner=%i", $userID);
|
||||
|
||||
$nation = $db->queryFirstRow("select nation,level,color,secretlimit from nation where nation=%i",$me['nation'])??[
|
||||
'nation'=>0,
|
||||
@@ -150,22 +150,21 @@ function commandButton() {
|
||||
|
||||
$templates = new \League\Plates\Engine(__dir__.'/templates');
|
||||
$showSecret = false;
|
||||
if($me['level'] >= 2){
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission >= 1){
|
||||
$showSecret = true;
|
||||
}
|
||||
else if($me['level']== 0){
|
||||
$showSecret = false;
|
||||
}
|
||||
else if($me['belong'] >= $nation['secretlimit']){
|
||||
$showSecret = true;
|
||||
}
|
||||
|
||||
return $templates->render('commandButton', [
|
||||
'bgColor'=>$bgColor,
|
||||
'fgColor'=>$fgColor,
|
||||
'meLevel'=>$me['level'],
|
||||
'nationLevel'=>$nation['level'],
|
||||
'showSecret'=>$showSecret
|
||||
'showSecret'=>$showSecret,
|
||||
'permission'=>$permission,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -40,7 +40,7 @@ function processSpring() {
|
||||
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
|
||||
pushWorldHistory(["<R>★</>{$admin['year']}년 {$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>삼국일보</> 애독해 주시고, <M>훼접</>은 삼가주세요~</>"], $admin['year'], $admin['month']);
|
||||
pushWorldHistory(["<R>★</>{$admin['year']}년 {$admin['month']}월: <S>모두들 즐거운 게임 하고 계신가요? ^^ <Y>매너 있는 플레이</> 부탁드리고, <M>지나친 훼접</>은 삼가주세요~</>"], $admin['year'], $admin['month']);
|
||||
}
|
||||
|
||||
function processGoldIncome() {
|
||||
@@ -68,25 +68,25 @@ function processGoldIncome() {
|
||||
// 기본량도 안될경우
|
||||
if($nation['gold'] < GameConst::$basegold) {
|
||||
$realoutcome = 0;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = 0;
|
||||
//기본량은 넘지만 요구량이 안될경우
|
||||
} elseif($nation['gold'] - GameConst::$basegold < $outcome) {
|
||||
$realoutcome = $nation['gold'] - GameConst::$basegold;
|
||||
$nation['gold'] = GameConst::$basegold;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = $realoutcome / $originoutcome;
|
||||
} else {
|
||||
$realoutcome = $outcome;
|
||||
$nation['gold'] -= $realoutcome;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = $realoutcome / $originoutcome;
|
||||
}
|
||||
$adminLog[] = StringUtil::padStringAlignRight((string)$nation['name'],12," ")
|
||||
." // 세금 : ".StringUtil::padStringAlignRight((string)$income,6," ")
|
||||
." // 세출 : ".StringUtil::padStringAlignRight((string)$originoutcome,6," ")
|
||||
." // 실제 : ".tab2((string)$realoutcome,6," ")
|
||||
." // 지급율 : ".tab2((string)round($ratio*100,2),5," ")
|
||||
." // 지급률 : ".tab2((string)round($ratio*100,2),5," ")
|
||||
." % // 결과금 : ".tab2((string)$nation['gold'],6," ");
|
||||
|
||||
$query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'";
|
||||
@@ -223,7 +223,7 @@ function getGoldIncome($nationNo, $rate, $admin_rate, $type) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
$level3[$gen['no']] = $gen['city'];
|
||||
}
|
||||
$query = "select no,city from general where nation='$nationNo' and level=2"; // 시중
|
||||
$query = "select no,city from general where nation='$nationNo' and level=2"; // 종사
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($j=0; $j < $count; $j++) {
|
||||
@@ -391,25 +391,25 @@ function processRiceIncome() {
|
||||
// 기본량도 안될경우
|
||||
if($nation['rice'] < GameConst::$baserice) {
|
||||
$realoutcome = 0;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = 0;
|
||||
//기본량은 넘지만 요구량이 안될경우
|
||||
} elseif($nation['rice'] - GameConst::$baserice < $outcome) {
|
||||
$realoutcome = $nation['rice'] - GameConst::$baserice;
|
||||
$nation['rice'] = GameConst::$baserice;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = $realoutcome / $originoutcome;
|
||||
} else {
|
||||
$realoutcome = $outcome;
|
||||
$nation['rice'] -= $realoutcome;
|
||||
// 실지급율
|
||||
// 실지급률
|
||||
$ratio = $realoutcome / $originoutcome;
|
||||
}
|
||||
$adminLog[] = StringUtil::padStringAlignRight($nation['name'],12," ")
|
||||
." // 세곡 : ".StringUtil::padStringAlignRight((string)$income,6," ")
|
||||
." // 세출 : ".StringUtil::padStringAlignRight((string)$originoutcome,6," ")
|
||||
." // 실제 : ".tab2((string)$realoutcome,6," ")
|
||||
." // 지급율 : ".tab2((string)round($ratio*100,2),5," ")
|
||||
." // 지급률 : ".tab2((string)round($ratio*100,2),5," ")
|
||||
." % // 결과곡 : ".tab2((string)$nation['rice'],6," ");
|
||||
|
||||
$query = "select no,name,nation from general where nation='{$nation['nation']}' and level>='9'";
|
||||
@@ -467,7 +467,7 @@ function getRiceIncome($nationNo, $rate, $admin_rate, $type) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
$level3[$gen['no']] = $gen['city'];
|
||||
}
|
||||
$query = "select no,city from general where nation='$nationNo' and level=2"; // 시중
|
||||
$query = "select no,city from general where nation='$nationNo' and level=2"; // 종사
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$count = MYDB_num_rows($result);
|
||||
for($j=0; $j < $count; $j++) {
|
||||
|
||||
+18
-4
@@ -235,6 +235,8 @@ function startTournament($auto, $type) {
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
$prevWinner = $gameStor->prev_winner;
|
||||
|
||||
eraseTnmtFightLogAll();
|
||||
|
||||
switch($auto) {
|
||||
@@ -263,12 +265,24 @@ function startTournament($auto, $type) {
|
||||
$query = "truncate tournament";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$opener = $db->queryFirstField('SELECT `general`.`name` FROM `general` JOIN `nation` ON `general`.`nation` = `nation`.`nation` WHERE `general`.`level` = 12 AND `nation`.`level` = 7 ORDER BY rand() LIMIT 1');
|
||||
if(!$opener){
|
||||
$opener = $gameStor->prev_winner;
|
||||
}
|
||||
|
||||
if($opener){
|
||||
$openerText = "황제 <Y>{$opener}</>의 명으로 ";
|
||||
}
|
||||
else{
|
||||
$openerText = '';
|
||||
}
|
||||
|
||||
$history = [];
|
||||
switch($type) {
|
||||
case 0: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>전력전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>영웅</span>들을 모집하고 있습니다!"; break;
|
||||
case 1: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>통솔전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>명사</span>들을 모집하고 있습니다!"; break;
|
||||
case 2: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>일기토</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>용사</span>들을 모집하고 있습니다!"; break;
|
||||
case 3: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: <C>설전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>책사</span>들을 모집하고 있습니다!"; break;
|
||||
case 0: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>전력전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>영웅</span>들을 모집하고 있습니다!"; break;
|
||||
case 1: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>통솔전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>명사</span>들을 모집하고 있습니다!"; break;
|
||||
case 2: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>일기토</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>용사</span>들을 모집하고 있습니다!"; break;
|
||||
case 3: $history[] = "<S>◆</>{$admin['year']}년 {$admin['month']}월: $openerText<C>설전</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>책사</span>들을 모집하고 있습니다!"; break;
|
||||
}
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
}
|
||||
|
||||
+31
-13
@@ -88,6 +88,9 @@ $mapTheme = $admin['map_theme'];
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/main.js')?>
|
||||
@@ -105,7 +108,7 @@ $(function(){
|
||||
|
||||
setInterval(function(){
|
||||
refreshMsg();
|
||||
}, 10000);
|
||||
}, 5000);
|
||||
});
|
||||
</script>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
@@ -114,6 +117,7 @@ $(function(){
|
||||
<?=WebUtil::printCSS('css/main.css')?>
|
||||
<?=WebUtil::printCSS('css/map.css')?>
|
||||
<?=WebUtil::printCSS('css/msg.css')?>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
|
||||
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic|Nanum+Myeongjo|Nanum+Pen+Script" rel="stylesheet">
|
||||
|
||||
</head>
|
||||
@@ -230,7 +234,7 @@ else if($session->userGrade == 4){
|
||||
?>
|
||||
|
||||
</table>
|
||||
<table class="tb_layout bg0" style="width:1000px;">
|
||||
<table class="tb_layout bg0" style="width:1000px;" id='map_position'>
|
||||
<tr>
|
||||
<td style='width:700px;height:520px;' colspan=2>
|
||||
<?=getMapHtml($mapTheme)?>
|
||||
@@ -262,7 +266,7 @@ else if($session->userGrade == 4){
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right style="'width:650px;border:none;">
|
||||
<td align=right style="'width:650px;border:none;"><br>
|
||||
<?php commandTable(); ?>
|
||||
<input id="mainBtnSubmit" type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='실 행' onclick='refreshing(this, 3,form2)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px; value='갱 신' onclick='refreshing(this, 0,0)'><input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px; value='로비로' onclick=location.replace('../')><br>
|
||||
</td>
|
||||
@@ -276,7 +280,7 @@ else if($session->userGrade == 4){
|
||||
</tr>
|
||||
<tr><td colspan=2><?=commandButton()?></td></tr>
|
||||
</table>
|
||||
<table class="tb_layout bg0">
|
||||
<table class="tb_layout bg0" id='history_position'>
|
||||
<tr>
|
||||
<td width=498 class='bg1 center'><b>장수 동향</b></td>
|
||||
<td width=498 class='bg1 center'><b>개인 기록</b></td>
|
||||
@@ -302,25 +306,39 @@ else if($session->userGrade == 4){
|
||||
</div>
|
||||
<div><?=allButton()?></div>
|
||||
<div id="message_board"><div style="left:0;" 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 style="right:0;" class="board_side bg0">
|
||||
<section class="diplomacy_message">
|
||||
|
||||
<div class="board_header bg0" id='public_talk_position'>전체 메시지(최고99자)</div>
|
||||
<section class="public_message">
|
||||
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="public">이전 메시지 불러오기</button>
|
||||
</section>
|
||||
<div class="board_header bg0" id='secret_talk_position'>개인 메시지(최고99자)</div>
|
||||
<section class="private_message">
|
||||
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="private">이전 메시지 불러오기</button>
|
||||
</section>
|
||||
</div><div style="right:0;" class="board_side bg0">
|
||||
<div class="board_header bg0">국가 메시지(최고99자)</div>
|
||||
<section class="national_message"></section>
|
||||
<section class="national_message">
|
||||
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="national">이전 메시지 불러오기</button>
|
||||
</section>
|
||||
<div class="board_header bg0">외교 메시지(최고99자)</div>
|
||||
<section class="diplomacy_message">
|
||||
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="diplomacy">이전 메시지 불러오기</button>
|
||||
</section>
|
||||
</div></div>
|
||||
<div style="clear:left;"><?=allButton()?><?=banner()?></div>
|
||||
</div>
|
||||
<div id='sidebar' class='btn-group-vertical'>
|
||||
<button type="button" class="btn btn-primary" onclick='refreshing(this, 0,0)'><i class="fas fa-sync-alt"></i> 갱신</button>
|
||||
<a class="btn btn-secondary" href="#map_position" role="button">지도 & 턴입력</a>
|
||||
<a class="btn btn-secondary" href="#history_position" role="button">장수 동향</a>
|
||||
<a class="btn btn-secondary" href="#public_talk_position" role="button">국가 메시지</a>
|
||||
<a class="btn btn-secondary" href="#secret_talk_position" role="button">개인 메시지</a>
|
||||
</div>
|
||||
<?php
|
||||
if ($con == 1) {
|
||||
MessageBox("접속제한이 얼마 남지 않았습니다!");
|
||||
}
|
||||
if ($me['newmsg'] == 1) {
|
||||
MessageBox("개인 서신이 도착했습니다!");
|
||||
MessageBox("새로운 서신이 도착했습니다!");
|
||||
}
|
||||
if ($me['newvote'] == 1) {
|
||||
$develcost = $admin['develcost']*5;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
namespace sammo;
|
||||
|
||||
include('lib.php');
|
||||
include 'func.php';
|
||||
|
||||
$result = [
|
||||
"generalID"=>null,
|
||||
@@ -11,14 +12,18 @@ $result = [
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$generalInfo = DB::db()->queryFirstRow('SELECT `no`, `nation`, `level` from `general` where `owner`=%i', $userID);
|
||||
$generalInfo = DB::db()->queryFirstRow('SELECT `no`, `nation`, `level`, belong, penalty, permission from `general` where `owner`=%i', $userID);
|
||||
if(!$generalInfo){
|
||||
Json::die($result);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($generalInfo);
|
||||
|
||||
|
||||
$result['generalID'] = $generalInfo['no'];
|
||||
$result['myNationID'] = $generalInfo['nation'];
|
||||
$result['isChief'] = ($generalInfo['level'] == 12);
|
||||
$result['generalLevel'] = $generalInfo['level'];
|
||||
$result['permission'] = $permission;
|
||||
|
||||
Json::die($result);
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
$title = Util::getReq('title');
|
||||
$text = Util::getReq('text');
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty, `picture`,`imgsvr` FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($title === null || $text === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$title = trim($title);
|
||||
$text = trim($text);
|
||||
|
||||
if(!$title && !$text){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'제목과 내용이 둘다 비어있습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'국가에 소속되어있지 않습니다.'
|
||||
]);
|
||||
|
||||
}
|
||||
else if ($isSecretBoard && $permission < 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$icon = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$db->insert('board', [
|
||||
'nation_no'=>$me['nation'],
|
||||
'is_secret'=>$isSecretBoard,
|
||||
'date'=>TimeUtil::DatetimeNow(),
|
||||
'general_no'=>$me['no'],
|
||||
'author'=>$me['name'],
|
||||
'author_icon'=>$icon,
|
||||
'title'=>$title,
|
||||
'text'=>$text
|
||||
]);
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success',
|
||||
'row_id'=>$db->insertId()
|
||||
]);
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$articleNo = Util::getReq('articleNo', 'int');
|
||||
$text = Util::getReq('text');
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, name, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($articleNo === null || $text === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$text = trim($text);
|
||||
|
||||
if(!$text){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'내용이 비어있습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$article = $db->queryFirstRow('SELECT * FROM board WHERE no = %i AND nation_no = %i', $articleNo, $me['nation']);
|
||||
if(!$article){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'게시물이 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$isSecretBoard = $article['is_secret'];
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'국가에 소속되어있지 않습니다.'
|
||||
]);
|
||||
|
||||
}
|
||||
else if ($isSecretBoard && $permission < 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$db->insert('comment', [
|
||||
'nation_no'=>$me['nation'],
|
||||
'is_secret'=>$isSecretBoard,
|
||||
'date'=>TimeUtil::DatetimeNow(),
|
||||
'document_no'=>$articleNo,
|
||||
'general_no'=>$me['no'],
|
||||
'author'=>$me['name'],
|
||||
'text'=>$text
|
||||
]);
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success',
|
||||
'row_id'=>$db->insertId()
|
||||
]);
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
increaseRefresh("회의실", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'국가에 소속되어있지 않습니다.'
|
||||
]);
|
||||
|
||||
}
|
||||
else if ($isSecretBoard && $permission < 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$articles = [];
|
||||
|
||||
foreach(
|
||||
$db->query(
|
||||
'SELECT * FROM board WHERE nation_no = %i AND is_secret = %i ORDER BY date desc',
|
||||
$me['nation'],
|
||||
$isSecretBoard
|
||||
) as $article
|
||||
){
|
||||
//TODO:아이콘 받아오기
|
||||
$article['comment'] = [];
|
||||
$articles[$article['no']] = $article;
|
||||
}
|
||||
|
||||
foreach(
|
||||
$db->query(
|
||||
'SELECT * FROM comment WHERE nation_no = %i AND is_secret = %i ORDER BY date asc',
|
||||
$me['nation'],
|
||||
$isSecretBoard
|
||||
) as $comment
|
||||
){
|
||||
//TODO:아이콘 받아오기?
|
||||
$articles[$comment['document_no']]['comment'][] = $comment;
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'articles'=>$articles,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$letterNo = Util::getReq('letterNo', 'int');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($letterNo === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 4) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$letter = $db->queryFirstRow('SELECT * FROM ng_diplomacy WHERE no=%i AND (src_nation_id = %i OR dest_nation_id = %i) AND state = \'activated\'', $letterNo, $me['nation'], $me['nation']);
|
||||
if(!$letter){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'서신이 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$aux = Json::decode($letter['aux']);
|
||||
|
||||
|
||||
$stateOpt = $aux['state_opt']??null;
|
||||
|
||||
if(($stateOpt == 'try_destroy_src' && $letter['src_nation_id'] == $me['nation'])||
|
||||
($stateOpt == 'try_destroy_dest' && $letter['dest_nation_id'] == $me['nation'])){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'이미 파기 신청을 했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$srcNation = getNationStaticInfo($letter['src_nation_id']);
|
||||
$destNation = getNationStaticInfo($letter['dest_nation_id']);
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
|
||||
if($letter['src_nation_id'] == $me['nation']){
|
||||
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
|
||||
}
|
||||
else{
|
||||
$src = new MessageTarget($me['no'], $me['name'], $destNation['nation'], $destNation['name'], $destNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $srcNation['nation'], $srcNation['name'], $srcNation['color']);
|
||||
}
|
||||
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
if(in_array($stateOpt, ['try_destroy_src', 'try_destroy_dest'])){
|
||||
$deleteLetterNo = $letterNo;
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'cancelled',
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
while(true){
|
||||
$deleteLetter = $db->queryFirstRow('SELECT prev_no, aux FROM ng_diplomacy WHERE no = %i AND state = \'replaced\'', $currentLetterNo);
|
||||
if(!$deleteLetter){
|
||||
break;
|
||||
}
|
||||
$deleteAux = Json::decode($deleteLetter['aux']);
|
||||
$deleteLetterNo = $deleteLetter['prev_no'];
|
||||
$deleteAux['reason'] = [
|
||||
'who'=>$me['no'],
|
||||
'action'=>'destroy',
|
||||
'reason'=>'파기'
|
||||
];
|
||||
}
|
||||
$msgText = "외교 서신 #{$letterNo}를 파기했습니다.";
|
||||
$lastState = 'cancelled';
|
||||
}
|
||||
else{
|
||||
if ($letter['src_nation_id'] == $me['nation']) {
|
||||
$aux['state_opt'] = 'try_destroy_src';
|
||||
}
|
||||
else{
|
||||
$aux['state_opt'] = 'try_destroy_dest';
|
||||
}
|
||||
$db->update('ng_diplomacy', [
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
|
||||
$msgText = "외교 서신 #{$letterNo}를 파기 요청합니다.";
|
||||
$lastState = 'activated';
|
||||
}
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success',
|
||||
'state'=>$lastState
|
||||
]);
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$isSecretBoard = Util::getReq('isSecret', 'bool', false);
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, permission, con, turntime, belong, penalty FROM general WHERE owner=%i', $userID);
|
||||
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if($permission < 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'국가에 소속되어있지 않습니다.'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$letters = [];
|
||||
|
||||
foreach(
|
||||
$db->query(
|
||||
'SELECT * FROM ng_diplomacy WHERE (src_nation_id = %i OR dest_nation_id = %i) AND state != \'cancelled\' ORDER BY date desc',
|
||||
$me['nation'], $me['nation']
|
||||
) as $letter
|
||||
){
|
||||
|
||||
if($permission < 3 && $letter['text_detail']){
|
||||
$letter['text_detail'] = '(권한이 부족합니다)';
|
||||
}
|
||||
$letter['aux'] = Json::decode($letter['aux']);
|
||||
$letter['src'] = $letter['aux']['src'];
|
||||
$letter['dest'] = $letter['aux']['dest'];
|
||||
|
||||
$letter['src']['nationID'] = $letter['src_nation_id'];
|
||||
$letter['dest']['nationID'] = $letter['dest_nation_id'];
|
||||
|
||||
$letters[$letter['no']] = [
|
||||
'no'=>$letter['no'],
|
||||
'src'=>$letter['src'],
|
||||
'dest'=>$letter['dest'],
|
||||
'prev_no'=>$letter['prev_no'],
|
||||
'state'=>$letter['state'],
|
||||
'state_opt'=>($letter['aux']['state_opt']??null),
|
||||
'brief'=>$letter['text_brief'],
|
||||
'detail'=>$letter['text_detail'],
|
||||
'date'=>$letter['date']
|
||||
];
|
||||
}
|
||||
|
||||
$nations = [];
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['nation'] == 0 || $nation['nation'] == $me['nation']){
|
||||
continue;
|
||||
}
|
||||
$nations[] = $nation;
|
||||
}
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'nations'=>$nations,
|
||||
'letters'=>$letters,
|
||||
'myNationID'=>$me['nation'],
|
||||
'reason'=>'success'
|
||||
]);
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$letterNo = Util::getReq('letterNo', 'int');
|
||||
$isAgree = Util::getReq('isAgree', 'bool', false);
|
||||
$reason = Util::getReq('reason', 'string', '');
|
||||
|
||||
|
||||
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($letterNo === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 4) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$reason = trim($reason);
|
||||
|
||||
$letter = $db->queryFirstRow('SELECT * FROM ng_diplomacy WHERE no=%i AND dest_nation_id = %i AND state = \'proposed\'', $letterNo, $me['nation']);
|
||||
if(!$letter){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'서신이 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$aux = Json::decode($letter['aux']);
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$srcNation = getNationStaticInfo($letter['src_nation_id']);
|
||||
$destNation = getNationStaticInfo($letter['dest_nation_id']);
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $destNation['nation'], $destNation['name'], $destNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $srcNation['nation'], $srcNation['name'], $srcNation['color']);
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
if($isAgree){
|
||||
$aux['dest']['generalName'] = $me['name'];
|
||||
$aux['dest']['generalIcon'] = $me['icon'];
|
||||
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'activated',
|
||||
'dest_signer'=>$me['no'],
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
//TODO: 외교 서신에 대한 메시지를 양국에 발송해야함
|
||||
|
||||
$prevLetterNo = $letter['prev_no'];
|
||||
while($prevLetterNo !== null){
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'replaced',
|
||||
], 'no=%i', $prevLetterNo);
|
||||
$prevLetterNo = $db->queryFirstField('SELECT prev_no FROM ng_diplomacy WHERE state != \'cancelled\' AND no = %i', $prevLetterNo);
|
||||
}
|
||||
$msgText = "외교 서신 #{$letterNo}가 승인되었습니다.";
|
||||
}
|
||||
else{
|
||||
$aux['reason'] = [
|
||||
'who'=>$me['no'],
|
||||
'action'=>'disagree',
|
||||
'reason'=>$reason
|
||||
];
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'cancelled',
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
$msgText = "외교 서신 #{$letterNo}가 거부되었습니다.";
|
||||
if($reason){
|
||||
$msgText .= ' 이유 : '.$reason;
|
||||
}
|
||||
}
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_NATIONAL,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$letterNo = Util::getReq('letterNo', 'int');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($letterNo === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 4) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$reason = trim($reason);
|
||||
|
||||
$letter = $db->queryFirstRow('SELECT * FROM ng_diplomacy WHERE no=%i AND src_nation_id = %i AND state = \'proposed\'', $letterNo, $me['nation']);
|
||||
if(!$letter){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'서신이 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$aux = Json::decode($letter['aux']);
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$srcNation = getNationStaticInfo($letter['src_nation_id']);
|
||||
$destNation = getNationStaticInfo($letter['dest_nation_id']);
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
$aux['reason'] = [
|
||||
'who'=>$me['no'],
|
||||
'action'=>'cancelled',
|
||||
'reason'=>$reason
|
||||
];
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'cancelled',
|
||||
'aux'=>Json::encode($aux)
|
||||
], 'no=%i', $letterNo);
|
||||
$msgText = "외교 서신 #{$letterNo}가 회수되었습니다.";
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
|
||||
$destNationNo = Util::getReq('destNation', 'int', 0);
|
||||
$prevNo = Util::getReq('prevNo', 'int', null);
|
||||
$textBrief = Util::getReq('brief');
|
||||
$textDetail = Util::getReq('detail');
|
||||
|
||||
increaseRefresh("외교부", 1);
|
||||
|
||||
if($prevNo < 1){
|
||||
$prevNo = null;
|
||||
}
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, name, nation, level, permission, con, turntime, belong, penalty, picture, imgsvr FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'접속 제한입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($destNationNo == $me['nation']){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'자국으로 보낼 수 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($textBrief === null || $textDetail === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$textBrief = trim($textBrief);
|
||||
$textDetail = trim($textDetail);
|
||||
|
||||
if(!$textBrief){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'요약문이 비어있습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
if ($permission < 4) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'권한이 부족합니다. 수뇌부가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$srcNationNo = $me['nation'];
|
||||
|
||||
if($prevNo !== null){
|
||||
//state는 체크하지 않는걸로 하자. 파기한 것을 재 송신하는 경우도 있을 수 있음.
|
||||
$prevLetter = $db->queryFirstRow(
|
||||
'SELECT no, src_nation_id, dest_nation_id, state, aux FROM ng_diplomacy WHERE no = %i AND src_nation_id IN (%i, %i) AND dest_nation_id IN (%i, %i)',
|
||||
$prevNo,
|
||||
$srcNationNo, $destNationNo,
|
||||
$srcNationNo, $destNationNo
|
||||
);
|
||||
|
||||
if(!$prevLetter){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'이전 문서가 없습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
//새로 나온 문서가 있는지 확인하자
|
||||
$newerLetter = $db->queryFirstField(
|
||||
'SELECT count(no) FROM ng_diplomacy WHERE prev_no = %i AND state != \'cancelled\'', $prevNo
|
||||
);
|
||||
if($newerLetter){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'해당 문서에 대한 새로운 문서가 이미 있습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($prevLetter['src_nation_id'] != $srcNationNo){
|
||||
$destNationNo = $prevLetter['src_nation_id'];
|
||||
}
|
||||
else{
|
||||
$destNationNo = $prevLetter['dest_nation_id'];
|
||||
}
|
||||
|
||||
if($prevLetter['state'] == 'proposed'){
|
||||
$prevAux = Json::decode($prevLetter['aux']);
|
||||
$prevAux['reason'] = [
|
||||
'who'=>$me['no'],
|
||||
'action'=>'new_letter',
|
||||
'reason'=>'new_letter'
|
||||
];
|
||||
$db->update('ng_diplomacy', [
|
||||
'state'=>'replaced',
|
||||
'aux'=>Json::encode($prevAux)
|
||||
], 'no=%i', $prevNo);
|
||||
}
|
||||
}
|
||||
|
||||
$nations = $db->query('SELECT nation, name, color FROM nation WHERE nation IN (%i, %i)', $srcNationNo, $destNationNo);
|
||||
if(count($nations) != 2){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 국가입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($nations[0]['nation'] == $me['nation']){
|
||||
//index 순서에 따라 또 모름.
|
||||
$srcNation = $nations[0];
|
||||
$destNation = $nations[1];
|
||||
}
|
||||
else{
|
||||
$srcNation = $nations[1];
|
||||
$destNation = $nations[0];
|
||||
}
|
||||
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$db->insert('ng_diplomacy', [
|
||||
'src_nation_id'=>$srcNation['nation'],
|
||||
'dest_nation_id'=>$destNation['nation'],
|
||||
'prev_no'=>$prevNo,
|
||||
'state'=>'proposed',
|
||||
'text_brief'=>$textBrief,
|
||||
'text_detail'=>$textDetail,
|
||||
'date'=>TimeUtil::DatetimeNow(),
|
||||
'src_signer'=>$me['no'],
|
||||
'dest_signer'=>null,
|
||||
'aux'=>Json::encode([
|
||||
'src'=>[
|
||||
'nationName'=>$srcNation['name'],
|
||||
'nationColor'=>$srcNation['color'],
|
||||
'generalName'=>$me['name'],
|
||||
'generalIcon'=>$me['icon']
|
||||
],
|
||||
'dest'=>[
|
||||
'nationName'=>$destNation['name'],
|
||||
'nationColor'=>$destNation['color']
|
||||
]
|
||||
]),
|
||||
]);
|
||||
$newLetterNo = $db->insertId();
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
|
||||
|
||||
$now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
$josaYi = JosaUtil::pick($newLetterNo, '이');
|
||||
if($prevNo){
|
||||
$msgText = "문서 #{$prevNo}의 새로운 외교 문서 #{$newLetterNo}{$josaYi} 준비되었습니다. 외교부에서 확인해주세요.";
|
||||
}
|
||||
else{
|
||||
$msgText = "새로운 외교 문서 #{$newLetterNo}{$josaYi} 준비되었습니다. 외교부에서 확인해주세요.";
|
||||
}
|
||||
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_DIPLOMACY,
|
||||
$src,
|
||||
$dest,
|
||||
$msgText,
|
||||
$now,
|
||||
$unlimited,
|
||||
['invalid' => true]
|
||||
);
|
||||
$msgID = $msg->send();
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success',
|
||||
'row_id'=>$db->insertId()
|
||||
]);
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
// $btn, $level, $genlist, $outlist
|
||||
|
||||
//TODO: 변경이 완료되면 항상 공지되어야함
|
||||
|
||||
$isAmbassador = Util::getReq('isAmbassador', 'bool');
|
||||
$genlist = Util::getReq('genlist', 'array_int');
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$me = $db->queryFirstRow('SELECT no, level, nation FROM general WHERE owner = %i', $userID);
|
||||
|
||||
if(!$me || $me['level'] != 12){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'군주가 아닙니다',
|
||||
'tmp'=>$me
|
||||
]);
|
||||
}
|
||||
|
||||
$nationID = $me['nation'];
|
||||
|
||||
if($isAmbassador){
|
||||
$targetType = 'ambassador';
|
||||
$targetLevel = 4;
|
||||
if(count($genlist) > 2){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'외교권자는 최대 둘까지만 설정 가능합니다.'
|
||||
]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$targetType = 'auditor';
|
||||
$targetLevel = 3;
|
||||
}
|
||||
|
||||
$db->update('general', [
|
||||
'permission'=>'normal'
|
||||
], 'nation = %i AND permission = %s', $nationID, $targetType);
|
||||
|
||||
if(!$genlist){
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
}
|
||||
$realCandidates = [];
|
||||
foreach($db->query('SELECT no, nation, level, penalty, permission FROM general WHERE nation = %i AND level != 12 AND permission = \'normal\' AND no IN %li', $nationID, $genlist) as $candidate){
|
||||
$maxPermission = checkSecretMaxPermission($candidate);
|
||||
if($maxPermission < $targetLevel){
|
||||
continue;
|
||||
}
|
||||
$realCandidates[] = $candidate['no'];
|
||||
}
|
||||
|
||||
if(!$realCandidates){
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
}
|
||||
|
||||
$db->update('general', [
|
||||
'permission'=>$targetType,
|
||||
], 'no IN %li', $realCandidates);
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
]);
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include('lib.php');
|
||||
include('func.php');
|
||||
|
||||
$session = Session::requireGameLogin([]);
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$msgID = Util::getReq('msgID', 'int');
|
||||
if($msgID === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 범위 입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
|
||||
$now = new \DateTime();
|
||||
$delayTime = false;
|
||||
if(count($lastMsgGet) >= 10){
|
||||
try{
|
||||
if($lastMsgGet[0] !== 'string'){
|
||||
throw new \Exception('Why not string?');
|
||||
}
|
||||
$first = new \DateTime($lastMsgGet[0]);
|
||||
$diff = $first->diff($now);
|
||||
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 5){
|
||||
$delayTime = true;
|
||||
}
|
||||
array_shift($lastMsgGet);
|
||||
}
|
||||
catch(\Exception $e){
|
||||
$lastMsgGet = [];
|
||||
}
|
||||
}
|
||||
$lastMsgGet[] = $now;
|
||||
$session->lastMsgGet = Json::encode($lastMsgGet);
|
||||
|
||||
if($delayTime){
|
||||
sleep(1);
|
||||
}
|
||||
$session->setReadOnly();
|
||||
|
||||
list($generalID, $nationID, $generalName) = DB::db()->queryFirstList(
|
||||
'select `no`, `nation`, `name` from `general` where owner = %i',
|
||||
$userID
|
||||
);
|
||||
|
||||
if($nationID === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'장수가 사망했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$reason = Message::deleteMsg($msgID, $generalID);
|
||||
if($reason === null){
|
||||
$result = [
|
||||
'result'=>true,
|
||||
'reason'=>'success'
|
||||
];
|
||||
}
|
||||
else{
|
||||
$result = [
|
||||
'result'=>false,
|
||||
'reason'=>$reason
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Json::die($result);
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include('lib.php');
|
||||
include('func.php');
|
||||
|
||||
$session = Session::requireGameLogin([]);
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$reqTo = Util::getReq('to', 'int');
|
||||
$reqType = Util::getReq('type', 'string');
|
||||
|
||||
if($reqTo === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 범위 입니다.'
|
||||
]);
|
||||
}
|
||||
if($reqType === null || !in_array($reqType, ['private', 'public', 'national', 'diplomacy'])){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'올바르지 않은 타입입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
|
||||
$now = new \DateTime();
|
||||
$delayTime = false;
|
||||
if(count($lastMsgGet) >= 10){
|
||||
try{
|
||||
if($lastMsgGet[0] !== 'string'){
|
||||
throw new \Exception('Why not string?');
|
||||
}
|
||||
$first = new \DateTime($lastMsgGet[0]);
|
||||
$diff = $first->diff($now);
|
||||
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 1){
|
||||
$delayTime = true;
|
||||
}
|
||||
array_shift($lastMsgGet);
|
||||
}
|
||||
catch(\Exception $e){
|
||||
$lastMsgGet = [];
|
||||
}
|
||||
}
|
||||
$lastMsgGet[] = $now;
|
||||
$session->lastMsgGet = Json::encode($lastMsgGet);
|
||||
|
||||
if($delayTime){
|
||||
sleep(1);
|
||||
}
|
||||
$session->setReadOnly();
|
||||
|
||||
$me = DB::db()->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if($me === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'장수가 사망했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
|
||||
$permission = checkSecretPermission($me, false);
|
||||
|
||||
$result = [
|
||||
'private'=>[],
|
||||
'public'=>[],
|
||||
'national'=>[],
|
||||
'diplomacy'=>[],
|
||||
'result'=>true,
|
||||
'keepRecent'=>true,
|
||||
'sequence'=>0,
|
||||
'nationID'=>$nationID,
|
||||
'generalName'=>$generalName,
|
||||
];
|
||||
$result['result'] = true;
|
||||
|
||||
$nextSequence = $reqTo;
|
||||
|
||||
if($reqType == 'private'){
|
||||
$result['private'] = array_map(function(Message $msg) use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBoxOld($generalID, Message::MSGTYPE_PRIVATE, $reqTo, 20));
|
||||
}
|
||||
else if($reqType == 'public'){
|
||||
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, $reqTo, 20));
|
||||
}
|
||||
else if($reqType == 'national'){
|
||||
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 20));
|
||||
}
|
||||
else{
|
||||
$result['diplomacy'] = array_map(function(Message $msg)use (&$nextSequence, $permission){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
$values = $msg->toArray();
|
||||
if($msg->dest->nationID != 0 && $permission < 3){
|
||||
$values['text'] = '(외교 메시지입니다)';//TODO: 외교서신이라 읽을 수 없음을 보여줘야함
|
||||
$values['option']['invalid'] = true;
|
||||
}
|
||||
return $values;
|
||||
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, $reqTo, 20));
|
||||
}
|
||||
|
||||
Json::die($result);
|
||||
+75
-17
@@ -4,57 +4,115 @@ namespace sammo;
|
||||
include('lib.php');
|
||||
include('func.php');
|
||||
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$session = Session::requireGameLogin([]);
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$reqSequence = Util::getReq('sequence', 'int', 0);
|
||||
$reqSequence = Util::getReq('sequence', 'int', -1);
|
||||
|
||||
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
|
||||
$now = new \DateTime();
|
||||
$delayTime = false;
|
||||
if(count($lastMsgGet) >= 10){
|
||||
try{
|
||||
if($lastMsgGet[0] !== 'string'){
|
||||
throw new \Exception('Why not string?');
|
||||
}
|
||||
$first = new \DateTime($lastMsgGet[0]);
|
||||
$diff = $first->diff($now);
|
||||
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 1){
|
||||
$delayTime = true;
|
||||
}
|
||||
array_shift($lastMsgGet);
|
||||
}
|
||||
catch(\Exception $e){
|
||||
$lastMsgGet = [];
|
||||
}
|
||||
}
|
||||
$lastMsgGet[] = $now;
|
||||
$session->lastMsgGet = Json::encode($lastMsgGet);
|
||||
|
||||
if($delayTime){
|
||||
sleep(0.2);
|
||||
}
|
||||
$session->setReadOnly();
|
||||
|
||||
|
||||
list($generalID, $nationID, $generalName) = DB::db()->queryFirstList(
|
||||
'select `no`, `nation`, `name` from `general` where owner = %i',
|
||||
$userID
|
||||
);
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
|
||||
if($nationID === null){
|
||||
if($me === null){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'장수가 사망했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
|
||||
$permission = checkSecretPermission($me, false);
|
||||
|
||||
$result = [];
|
||||
$result['result'] = true;
|
||||
|
||||
$result['keepRecent'] = false;
|
||||
$nextSequence = $reqSequence;
|
||||
$minSequence = $reqSequence;
|
||||
$lastType = null;
|
||||
|
||||
$result['private'] = array_map(function(Message $msg) use (&$nextSequence){
|
||||
$result['private'] = array_map(function(Message $msg) use (&$nextSequence, &$minSequence, &$lastType){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
if($msg->id <= $minSequence){
|
||||
$minSequence = $msg->id;
|
||||
$lastType = 'private';
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 10, $reqSequence));
|
||||
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 20, $reqSequence));
|
||||
|
||||
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
$result['public'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
if($msg->id <= $minSequence){
|
||||
$minSequence = $msg->id;
|
||||
$lastType = 'public';
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 10, $reqSequence));
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 20, $reqSequence));
|
||||
|
||||
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
|
||||
$result['national'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
if($msg->id <= $minSequence){
|
||||
$minSequence = $msg->id;
|
||||
$lastType = 'national';
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
|
||||
|
||||
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence){
|
||||
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType, $permission){
|
||||
if($msg->id > $nextSequence){
|
||||
$nextSequence = $msg->id;
|
||||
}
|
||||
return $msg->toArray();
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 10, 0));
|
||||
if($msg->id <= $minSequence){
|
||||
$minSequence = $msg->id;
|
||||
$lastType = 'diplomacy';
|
||||
}
|
||||
$values = $msg->toArray();
|
||||
if($msg->dest->nationID != 0 && $permission < 3){
|
||||
$values['text'] = '(외교 메시지입니다)';//TODO: 외교서신이라 읽을 수 없음을 보여줘야함
|
||||
$values['option']['invalid'] = true;
|
||||
}
|
||||
return $values;
|
||||
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 20, $reqSequence));
|
||||
|
||||
if($lastType !== null){
|
||||
array_pop($result[$lastType]);
|
||||
$result['keepRecent'] = true;
|
||||
}
|
||||
else if($reqSequence <= 0){
|
||||
$result['keepRecent'] = true;
|
||||
}
|
||||
|
||||
$result['sequence'] = $nextSequence;
|
||||
$result['nationID'] = $nationID;
|
||||
|
||||
+22
-6
@@ -49,7 +49,7 @@ $now = new \DateTime();
|
||||
$unlimited = new \DateTime('9999-12-31');
|
||||
|
||||
$db = DB::db();
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr` FROM general WHERE `owner`=%i', $userID);
|
||||
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,penalty,permission,belong FROM general WHERE `owner`=%i', $userID);
|
||||
|
||||
if(!$me){
|
||||
$session->logoutGame();
|
||||
@@ -70,7 +70,7 @@ if($con >= 2) {
|
||||
}
|
||||
|
||||
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
|
||||
|
||||
$permission = checkSecretPermission($me);
|
||||
$srcNation = getNationStaticInfo($me['nation']);
|
||||
|
||||
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
|
||||
@@ -99,19 +99,26 @@ if($mailbox == Message::MAILBOX_PUBLIC) {
|
||||
// 국가 메세지
|
||||
if($mailbox >= Message::MAILBOX_NATIONAL) {
|
||||
|
||||
if($me['level'] < 5){
|
||||
if($permission < 4){
|
||||
$destNationID = $me['nation'];
|
||||
}
|
||||
else{
|
||||
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
|
||||
}
|
||||
|
||||
if($destNationID == $me['nation']){
|
||||
$msgType = Message::MSGTYPE_NATIONAL;
|
||||
}
|
||||
else{
|
||||
$msgType = Message::MSGTYPE_DIPLOMACY;
|
||||
}
|
||||
|
||||
$destNation = getNationStaticInfo($destNationID);
|
||||
|
||||
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
|
||||
|
||||
$msg = new Message(
|
||||
Message::MSGTYPE_NATIONAL,
|
||||
$msgType,
|
||||
$src,
|
||||
$dest,
|
||||
$text,
|
||||
@@ -143,8 +150,8 @@ if($mailbox > 0) {
|
||||
|
||||
$session->lastMsg = $now->format('Y-m-d H:i:s');
|
||||
|
||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`con`,`picture`,`imgsvr` FROM general WHERE `no`=%i',$mailbox);
|
||||
|
||||
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i',$mailbox);
|
||||
|
||||
if(!$destUser){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
@@ -153,6 +160,15 @@ if($mailbox > 0) {
|
||||
]);
|
||||
}
|
||||
|
||||
$destPermission = checkSecretPermission($destUser, false);
|
||||
if($permission == 4 && $destPermission == 4 && $destUser['nation'] != $me['nation']){
|
||||
Json::die([
|
||||
'result' => false,
|
||||
'reason' => '외교권자끼리는 메시지를 보낼 수 없습니다.',
|
||||
'msgID' => null
|
||||
]);
|
||||
}
|
||||
|
||||
$destNation = getNationStaticInfo($destUser['nation']);
|
||||
|
||||
$dest = new MessageTarget(
|
||||
|
||||
@@ -77,6 +77,7 @@ $db->update('general', [
|
||||
'npc'=>1,
|
||||
'killturn'=>6,
|
||||
'mode'=>2,
|
||||
'permission'=>'normal',
|
||||
'owner'=>$userID,
|
||||
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
|
||||
|
||||
|
||||
+2
-2
@@ -162,11 +162,11 @@ if ($genius) {
|
||||
$specage2 = $age;
|
||||
$special2 = getSpecial2($leader, $power, $intel);
|
||||
} else {
|
||||
$specage2 = Util::valueFit(Util::round((80 - $age)/4 - $relYear / 2), 3) + $age;
|
||||
$specage2 = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/4 - $relYear / 2), 3) + $age;
|
||||
$special2 = 0;
|
||||
}
|
||||
//내특
|
||||
$specage = Util::valueFit(Util::round((80 - $age)/12 - $relYear / 2), 3) + $age;
|
||||
$specage = Util::valueFit(Util::round((GameConst::$retirementYear - $age)/12 - $relYear / 2), 3) + $age;
|
||||
$special = 0;
|
||||
|
||||
if ($admin['scenario'] >= 1000) {
|
||||
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
|
||||
|
||||
function submitArticle(){
|
||||
var $article = $('#newArticle');
|
||||
var $title = $article.find('.titleInput');
|
||||
var $text = $article.find('.contentInput');
|
||||
var title = $.trim($title.val());
|
||||
var text = $.trim($text.val());
|
||||
|
||||
|
||||
if(!text && !title){
|
||||
return false;
|
||||
}
|
||||
|
||||
$title.val('');
|
||||
$text.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_board_article_add.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
isSecret:isSecretBoard,
|
||||
title:title,
|
||||
text:text
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$title.val(title);
|
||||
$text.val(text);
|
||||
alert()
|
||||
return quickReject('글을 올리는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$title.val(title);
|
||||
$text.val(text);
|
||||
return quickReject('글을 올리는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
return loadArticles().done(drawArticles);
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function submitComment(){
|
||||
var $this = $(this);
|
||||
|
||||
var $article = $this.closest('.articleObj').eq(0);
|
||||
var articleNo = $article.data('no');
|
||||
var $text = $article.find('input.commentText');
|
||||
var text = $.trim($text.val());
|
||||
|
||||
if(!text){
|
||||
return false;
|
||||
}
|
||||
|
||||
$text.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_board_comment_add.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
articleNo:articleNo,
|
||||
text:text
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$text.val(text);
|
||||
alert()
|
||||
return quickReject('댓글을 다는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$text.val(text);
|
||||
return quickReject('댓글을 다는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
return loadArticles().done(drawArticles);
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawArticle(idx, articleObj){
|
||||
var $articleFrame = $('#articleTemplate > .articleFrame');
|
||||
var $commentFrame = $($('#commentTemplate').prop('content'));
|
||||
|
||||
var $article = $articleFrame.clone();
|
||||
$article.addClass('articleObj')
|
||||
.data('no', articleObj.no)
|
||||
.data('author', articleObj.general_no);
|
||||
|
||||
|
||||
$article.find('.articleNo').text(articleObj.no);
|
||||
$article.find('.authorName').text(articleObj.author);
|
||||
$article.find('.articleTitle').text(articleObj.title);
|
||||
$article.find('.date').text(articleObj.date);
|
||||
if(articleObj.author_icon){
|
||||
$article.find('.authorIcon').attr('src', articleObj.author_icon);
|
||||
}
|
||||
//$article.find('.text').text(articleObj.text);
|
||||
$article.find('.text').html(nl2br(escapeHtml(articleObj.text)));
|
||||
//TODO: 바꿀 것
|
||||
|
||||
var $articleComment = $article.find('.commentList');
|
||||
|
||||
$.each(articleObj.comment, function(_, commentObj){
|
||||
var $comment = $commentFrame.clone();
|
||||
$comment.find('.author').text(commentObj.author);
|
||||
//$comment.find('.text').text(commentObj.text);
|
||||
$comment.find('.text').html(nl2br(escapeHtml(commentObj.text)));
|
||||
$comment.find('.date').text(commentObj.date);
|
||||
$articleComment.append($comment);
|
||||
});
|
||||
|
||||
$article.find('.submitComment').click(submitComment);
|
||||
$article.find('.commentText').on('keypress', function (e) {
|
||||
if(e.which === 13){
|
||||
$article.find('.submitComment').click();
|
||||
}
|
||||
});
|
||||
$article.find('.inputCommentHeader').click(function(){
|
||||
$article.find('.commentText').focus();
|
||||
})
|
||||
|
||||
var $board = $('#board');
|
||||
|
||||
$board.prepend($article);
|
||||
}
|
||||
|
||||
function drawArticles(articlesObj){
|
||||
var deferred = $.Deferred();
|
||||
if(!articlesObj){
|
||||
return quickReject('받아오는데 실패했습니다.');
|
||||
}
|
||||
if(!articlesObj.result){
|
||||
return quickReject('에러가 발생했습니다. : '+articlesObj.reason);
|
||||
}
|
||||
|
||||
$('.articleObj').detach();//첫 버전이니까 일괄 삭제 일괄 로드
|
||||
$.each(articlesObj.articles, drawArticle);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function loadArticles(){
|
||||
return $.post({
|
||||
url:'j_board_get_articles.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
isSecret:isSecretBoard, //첫 버전이니까 전체 다 불러오자
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resizeTextarea($obj){
|
||||
$obj.height(1).height($obj.prop('scrollHeight')+12 );
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('textarea.autosize').on('keydown keyup', function(){
|
||||
resizeTextarea($(this));
|
||||
})
|
||||
|
||||
$('#submitArticle').click(submitArticle);
|
||||
|
||||
loadArticles()
|
||||
.then(drawArticles, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
function changePermission(isAmbassador, rawGeneralList){
|
||||
console.log(isAmbassador);
|
||||
console.log(rawGeneralList);
|
||||
|
||||
var generalList = [];
|
||||
$.each(rawGeneralList, function(idx, value){
|
||||
generalList.push(parseInt(value.id));
|
||||
})
|
||||
|
||||
$.post({
|
||||
url:'j_general_set_permission.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
isAmbassador:isAmbassador,
|
||||
genlist:generalList
|
||||
},
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
alert('변경하지 못했습니다.');
|
||||
return false;
|
||||
}
|
||||
if(!data.result){
|
||||
alert('변경하지 못했습니다. : '+data.reason);
|
||||
return false;
|
||||
}
|
||||
alert('변경했습니다.');
|
||||
location.reload();
|
||||
}, errUnknown);
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('#selectAmbassador').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
allowClear: true,
|
||||
language: "ko",
|
||||
width:300,
|
||||
maximumSelectionLength: 2,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:candidateAmbassadors,
|
||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
$('#selectAuditor').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
allowClear: true,
|
||||
language: "ko",
|
||||
width:300,
|
||||
maximumSelectionLength: 2,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:candidateAuditors,
|
||||
//containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
$('#changeAmbassador').click(function(){
|
||||
if(!confirm('외교권자를 변경할까요?')){
|
||||
return false;
|
||||
}
|
||||
|
||||
changePermission(true, $('#selectAmbassador').select2('data'));
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#changeAuditor').click(function(){
|
||||
if(!confirm('조언자를 변경할까요?')){
|
||||
return false;
|
||||
}
|
||||
|
||||
changePermission(false, $('#selectAuditor').select2('data'));
|
||||
return false;
|
||||
})
|
||||
})
|
||||
+62
-4
@@ -70,6 +70,27 @@ String.prototype.format = function() {
|
||||
};
|
||||
|
||||
|
||||
function hexToRgb(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null;
|
||||
}
|
||||
|
||||
|
||||
function isBrightColor(color){
|
||||
color = hexToRgb(color);
|
||||
if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 게임내에서 지원하는 color type만 선택할 수 있도록 해주는 함수
|
||||
* @param {string} color #AAAAAA 또는 AAAAAA 형태로 작성된 RGB hex color string
|
||||
@@ -102,6 +123,10 @@ function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
function linkifyStrWithOpt(text){
|
||||
return linkifyStr(text, {});
|
||||
}
|
||||
|
||||
/**
|
||||
* 단순한 Template 함수. <%변수명%>으로 template 가능
|
||||
* @see https://github.com/krasimir/absurd/blob/master/lib/processors/html/helpers/TemplateEngine.js
|
||||
@@ -122,6 +147,7 @@ var TemplateEngine = function (html, options) {
|
||||
return add;
|
||||
}
|
||||
options.e = escapeHtml;
|
||||
options.linkifyStr = linkifyStrWithOpt;
|
||||
while (match = re.exec(html)) {
|
||||
add(html.slice(cursor, match.index))(match[1], true);
|
||||
cursor = match.index + match[0].length;
|
||||
@@ -185,13 +211,16 @@ function activeFlipItem($img){
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
$('.obj_tooltip').each(function(){
|
||||
$('.obj_tooltip').mouseover(function(){
|
||||
var $objTooltip = $(this);
|
||||
if($objTooltip.data('setObjTooltip')){
|
||||
return true;
|
||||
}
|
||||
|
||||
var tooltipClassText = $objTooltip.data('tooltip-class');
|
||||
if(!tooltipClassText){
|
||||
tooltipClassText = '';
|
||||
}
|
||||
console.log($objTooltip.data('tooltip-class'));
|
||||
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
|
||||
.format(tooltipClassText);
|
||||
|
||||
@@ -201,9 +230,15 @@ jQuery(function($){
|
||||
},
|
||||
template:template,
|
||||
html:true
|
||||
});
|
||||
|
||||
}).tooltip('show');
|
||||
|
||||
$objTooltip.data('setObjTooltip', true);
|
||||
});
|
||||
/*each(function(){
|
||||
var $objTooltip = $(this);
|
||||
|
||||
|
||||
});*/
|
||||
|
||||
activeFlip();
|
||||
|
||||
@@ -216,3 +251,26 @@ jQuery(function($){
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
function errUnknown(){
|
||||
alert('작업을 실패했습니다.');
|
||||
}
|
||||
|
||||
function quickReject(errMsg){
|
||||
if(errMsg === undefined){
|
||||
errMsg = '작업을 실패했습니다.';
|
||||
}
|
||||
var deferred = $.Deferred();
|
||||
deferred.reject(errMsg);
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function nl2br(text){
|
||||
return text.replace(/\n/g,"<br>");
|
||||
}
|
||||
/*
|
||||
function br2nl (text) {
|
||||
return text.replace(/<\s*\/?br\s*[\/]?>/gi, '\n');
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,425 @@
|
||||
|
||||
|
||||
function submitLetter(){
|
||||
var $brief = $('#inputBrief');
|
||||
var $detail = $('#inputDetail');
|
||||
var $prevNo = $('#inputPrevNo');
|
||||
var $destNation = $('#inputDestNation');
|
||||
var brief = $.trim($brief.val());
|
||||
var detail = $.trim($detail.val());
|
||||
var prevNo = parseInt($prevNo.val());
|
||||
var destNation = parseInt($destNation.val());
|
||||
|
||||
if(prevNo !== null && prevNo < 1){
|
||||
prevNo = null;
|
||||
}
|
||||
|
||||
console.log(brief);
|
||||
if(!brief){
|
||||
return false;
|
||||
}
|
||||
|
||||
$brief.val('');
|
||||
$detail.val('');
|
||||
|
||||
$.post({
|
||||
url:'j_diplomacy_send_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
brief:brief,
|
||||
detail:detail,
|
||||
destNation:destNation,
|
||||
prevNo:prevNo
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
$brief.val(brief);
|
||||
$detail.val(detail);
|
||||
return quickReject('외교 서신을 보내는데 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
$brief.val(brief);
|
||||
$detail.val(detail);
|
||||
return quickReject('외교 서신을 보내는데 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
alert('전송했습니다.');
|
||||
location.reload();
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function repondLetter(letterNo, isAgree, reason){
|
||||
$.post({
|
||||
url:'j_diplomacy_respond_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
isAgree:isAgree,
|
||||
reason:reason,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
alert()
|
||||
return quickReject('응답을 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('응답을 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
if(isAgree){
|
||||
alert('승인했습니다.');
|
||||
}
|
||||
else{
|
||||
alert('거부했습니다.');
|
||||
}
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function rollbackLetter(letterNo){
|
||||
$.post({
|
||||
url:'j_diplomacy_rollback_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
alert()
|
||||
return quickReject('회수를 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('회수를 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
alert('회수 했습니다.');
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function destroyLetter(letterNo){
|
||||
$.post({
|
||||
url:'j_diplomacy_destroy_letter.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
letterNo:letterNo,
|
||||
}
|
||||
}).then(function(data){
|
||||
if(!data){
|
||||
alert()
|
||||
return quickReject('파기를 실패했습니다.');
|
||||
}
|
||||
if(!data.result){
|
||||
return quickReject('파기를 실패했습니다. : '+data.reason);
|
||||
}
|
||||
|
||||
if(data.state == 'activated'){
|
||||
alert('파기를 요청 했습니다.');
|
||||
}
|
||||
else{
|
||||
alert('파기 되었습니다.');
|
||||
}
|
||||
|
||||
location.reload();
|
||||
return false;
|
||||
|
||||
}, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function drawLetter(idx, letterObj){
|
||||
|
||||
if(letterObj.state == 'cancelled'){
|
||||
//TODO: 취소되거나, 대체된 문서도 보여줄 방법을 찾아볼 것
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(letterObj);
|
||||
|
||||
var $letterFrame = $('#letterTemplate > .letterFrame');
|
||||
|
||||
var srcColorFormat = {
|
||||
'background-color':letterObj.src.nationColor,
|
||||
'color':isBrightColor(letterObj.src.nationColor)?'#000000':'#ffffff'
|
||||
};
|
||||
|
||||
var destColorFormat = {
|
||||
'background-color':letterObj.dest.nationColor,
|
||||
'color':isBrightColor(letterObj.dest.nationColor)?'#000000':'#ffffff'
|
||||
};
|
||||
|
||||
var targetNation = letterObj.src.nationID==myNationID?letterObj.dest:letterObj.src;
|
||||
var targetColor = letterObj.src.nationID==myNationID?destColorFormat:srcColorFormat;
|
||||
|
||||
var $letter = $letterFrame.clone();
|
||||
|
||||
if(letterObj.state == 'replaced'){
|
||||
$letter.hide();
|
||||
}
|
||||
|
||||
$letter.addClass('letterObj')
|
||||
.data('no', letterObj.no)
|
||||
.data('brief', letterObj.brief)
|
||||
.data('detail', letterObj.detail)
|
||||
.attr('id', 'letter_'+letterObj.no);
|
||||
|
||||
$letter.find('.letterHeader').css(targetColor);
|
||||
$letter.find('.letterNationName').text(targetNation.nationName);
|
||||
$letter.find('.letterDate').text(letterObj.date);
|
||||
$letter.find('.letterNo').text('#'+letterObj.no);
|
||||
|
||||
var stateText = {
|
||||
'proposed':'제안됨',
|
||||
'activated':'승인됨',
|
||||
'cancelled':'거부됨',
|
||||
'replaced':'대체됨',
|
||||
};
|
||||
|
||||
var stateOptionText = {
|
||||
'try_destroy_src':'송신측의 파기 요청',
|
||||
'try_destroy_dest':'수신측의 파기 요청',
|
||||
}
|
||||
$letter.find('.letterStatus').text(stateText[letterObj.state]);
|
||||
|
||||
if(letterObj.state_opt !== null){
|
||||
$letter.find('.letterStatusOpt').text('('+stateOptionText[letterObj.state_opt]+')');
|
||||
}
|
||||
if(letterObj.prev_no !== null){
|
||||
var $showPrev = $('<a href="#">#{0}</a>'.format(letterObj.prev_no));
|
||||
$showPrev.click(function(){
|
||||
$('#letter_'+letterObj.prev_no).toggle();
|
||||
})
|
||||
$letter.find('.letterPrevNo').html($showPrev);
|
||||
}
|
||||
else{
|
||||
$letter.find('.letterPrevNo').text('신규');
|
||||
}
|
||||
$letter.find('.letterBrief').html(nl2br(escapeHtml(letterObj.brief)));
|
||||
$letter.find('.letterDetail').html(nl2br(escapeHtml(letterObj.detail)));
|
||||
|
||||
$letter.find('.letterSrc .signerImg img.generalIcon').attr('src', letterObj.src.generalIcon);
|
||||
$letter.find('.letterSrc .signerNation').text(letterObj.src.nationName).css(srcColorFormat);
|
||||
$letter.find('.letterSrc .signerName').text(letterObj.src.generalName).css(srcColorFormat);
|
||||
|
||||
if(letterObj.dest.generalName){
|
||||
$letter.find('.letterDest .signerImg img.generalIcon').attr('src', letterObj.dest.generalIcon);
|
||||
$letter.find('.letterDest .signerNation').text(letterObj.dest.nationName).css(destColorFormat);
|
||||
$letter.find('.letterDest .signerName').text(letterObj.dest.generalName).css(destColorFormat);
|
||||
}
|
||||
|
||||
if(letterObj.state == 'proposed' && letterObj.src.nationID != myNationID){
|
||||
$letter.find('.btnAgree').show().click(function(){
|
||||
if(!confirm('승인하시겠습니까?')){
|
||||
return false;
|
||||
}
|
||||
return repondLetter(letterObj.no, true, null);
|
||||
});
|
||||
$letter.find('.btnDisagree').show().click(function(){
|
||||
var reason = prompt('거부하시겠습니까? (이유 [최대 50자])');
|
||||
if(reason === null){
|
||||
return false;
|
||||
}
|
||||
reason = substr.substr(0, 50);
|
||||
return repondLetter(letterObj.no, false, reason);
|
||||
});
|
||||
}
|
||||
|
||||
if(letterObj.state == 'proposed' && letterObj.src.nationID == myNationID){
|
||||
$letter.find('.btnRollback').show().click(function(){
|
||||
if(!confirm('회수하시겠습니까?')){
|
||||
return false;
|
||||
}
|
||||
return rollbackLetter(letterObj.no);
|
||||
});
|
||||
}
|
||||
|
||||
if(letterObj.state == 'activated'){
|
||||
var $btnDestroy = $letter.find('.btnDestroy');
|
||||
if((letterObj.src.nationID==myNationID && letterObj.state_opt == 'try_destroy_src') ||
|
||||
(letterObj.dest.nationID==myNationID && letterObj.state_opt == 'try_destroy_dest')){
|
||||
$btnDestroy.show().prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$btnDestroy.show().click(function(){
|
||||
if(!confirm('본 문서를 파기하겠습니까? (상호 동의 필요)')){
|
||||
return false;
|
||||
}
|
||||
return destroyLetter(letterObj.no);
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$letter.find('.btnRenew').click(function(){
|
||||
var $inputPrevNo = $('#inputPrevNo');
|
||||
$inputPrevNo.val(letterObj.no);
|
||||
$inputPrevNo.trigger('change');
|
||||
})
|
||||
|
||||
|
||||
$('#letters').prepend($letter);
|
||||
}
|
||||
|
||||
function initNewLetterForm(lettersObj){
|
||||
console.log(lettersObj);
|
||||
var nationList = [];
|
||||
$.each(lettersObj.nations, function(idx, nation){
|
||||
nation.id = nation.nation;
|
||||
nation.text = nation.name;
|
||||
nationList.push(nation);
|
||||
})
|
||||
|
||||
var $destNation = $('#inputDestNation').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
language: "ko",
|
||||
width:300,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:nationList,
|
||||
templateResult: colorNation,
|
||||
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
|
||||
|
||||
var prevNoList = [{
|
||||
id:0,
|
||||
text:'-새 문서-',
|
||||
nation:null,
|
||||
}];
|
||||
|
||||
$.each(lettersObj.letters, function(idx, letterObj){
|
||||
if(letterObj.state == 'replaced' || letterObj.state == 'cancelled'){
|
||||
return true;
|
||||
}
|
||||
var targetNation = letterObj.src.nationID==myNationID?letterObj.dest:letterObj.src;
|
||||
prevNoList.push({
|
||||
id:letterObj.no,
|
||||
text:'#{0} <{1}>'.format(letterObj.no, targetNation.nationName),
|
||||
nation:targetNation.nationID
|
||||
});
|
||||
});
|
||||
|
||||
var $inputPrevNo = $('#inputPrevNo').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "",
|
||||
language: "ko",
|
||||
width:300,
|
||||
containerCss: {
|
||||
display: "inline-block !important;",
|
||||
color: 'white !important'
|
||||
},
|
||||
data:prevNoList,
|
||||
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
$inputPrevNo.on('change', function(e){
|
||||
var data = $inputPrevNo.select2('data')[0];
|
||||
console.log(data);
|
||||
if(data.nation == null){
|
||||
$destNation.prop("disabled", false);
|
||||
}
|
||||
else{
|
||||
$destNation.val(data.nation).prop("disabled", true);
|
||||
var $targetLetter = $('#letter_'+data.id);
|
||||
resizeTextarea($('#inputBrief').val($targetLetter.data('brief')));
|
||||
resizeTextarea($('#inputDetail').val($targetLetter.data('detail')));
|
||||
}
|
||||
});
|
||||
|
||||
$('#btnSend').click(submitLetter);
|
||||
|
||||
$('#newLetter').show();
|
||||
}
|
||||
|
||||
function drawLetters(lettersObj){
|
||||
var deferred = $.Deferred();
|
||||
if(!lettersObj){
|
||||
return quickReject('받아오는데 실패했습니다.');
|
||||
}
|
||||
|
||||
if(!lettersObj.result){
|
||||
return quickReject('에러가 발생했습니다. : '+lettersObj.reason);
|
||||
}
|
||||
|
||||
window.myNationID = lettersObj.myNationID;
|
||||
|
||||
if(permissionLevel == 4){
|
||||
initNewLetterForm(lettersObj);
|
||||
$('.letterActionPlate').show();
|
||||
}
|
||||
|
||||
$('.letterObj').detach();//첫 버전이니까 일괄 삭제 일괄 로드
|
||||
$.each(lettersObj.letters, drawLetter);
|
||||
return true;
|
||||
}
|
||||
|
||||
function loadLetters(){
|
||||
return $.post({
|
||||
url:'j_diplomacy_get_letter.php',
|
||||
dataType:'json', //첫 버전이니까 전체 다 불러오자
|
||||
data:{
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function colorNation(nationInfo){
|
||||
if(!nationInfo.color){
|
||||
return nationInfo.text;
|
||||
}
|
||||
|
||||
var fgColor = isBrightColor(nationInfo.color)?'#000000':'#ffffff';
|
||||
var $nationForm = $('<div>'+nationInfo.text+'</div>').css({
|
||||
'color':fgColor,
|
||||
'background-color':nationInfo.color
|
||||
});
|
||||
return $nationForm;
|
||||
}
|
||||
|
||||
function resizeTextarea($obj){
|
||||
$obj.height(1).height($obj.prop('scrollHeight')+12 );
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
$('textarea.autosize').on('keydown keyup', function(){
|
||||
resizeTextarea($(this));
|
||||
})
|
||||
|
||||
loadLetters()
|
||||
.then(drawLetters, errUnknown)
|
||||
.fail(function(reason){
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
});
|
||||
+26
-35
@@ -81,13 +81,13 @@ $(function() {
|
||||
|
||||
var $win = $('<div id="ext_win" style="padding:0;" title="관직 임명"><table style="padding:0;margin:0;" cellspacing="0" cellpadding="0" border="0"><tr><td width="700px" style="padding:0;"><iframe id="in_frame" src="map.php?type=1&graphic=1" width="700" height="520" frameborder="0" marginwidth="0" marginheight="0" topmargin="0" scrolling="no"></iframe></td>'+
|
||||
'<td width="305px" style="padding:0;vertical-align:top;height:520px;"><div style="height:520px;width:305px;overflow-y:scroll;overflow-x:hidden;">'+
|
||||
'<table id="inner_table"><thead><tr><th width="35">도시</th><th width="85">태수</th><th width="85">군사</th><th width="85">시중</th></tr></thead><tbody class="content">'+
|
||||
'<table id="inner_table"><thead><tr><th width="35">도시</th><th width="85">태수</th><th width="85">군사</th><th width="85">종사</th></tr></thead><tbody class="content">'+
|
||||
'</tbody></table></div></td></tr></table>'+
|
||||
'<form name="form1" id="fake_form"><span id="user_name"></span> : <select name="double" id="city_select"></select>'+
|
||||
'<div id="duty_radio" style="display:inline;">'+
|
||||
'<input type="radio" id="duty_type1" value="4" name="duty_radio"><label for="duty_type1">태수</label>'+
|
||||
'<input type="radio" id="duty_type2" value="3" name="duty_radio"><label for="duty_type2">군사</label>'+
|
||||
'<input type="radio" id="duty_type3" value="2" name="duty_radio"><label for="duty_type3">시중</label>'+
|
||||
'<input type="radio" id="duty_type3" value="2" name="duty_radio"><label for="duty_type3">종사</label>'+
|
||||
'</div></form></div>');
|
||||
$win.hide();
|
||||
|
||||
@@ -135,17 +135,17 @@ $(function() {
|
||||
|
||||
var p태수 = cityInfo.p태수 && currUser.p태수;
|
||||
var p군사 = cityInfo.p군사 && currUser.p군사;
|
||||
var p시중 = cityInfo.p시중 && currUser.p시중;
|
||||
var p종사 = cityInfo.p종사 && currUser.p종사;
|
||||
|
||||
//console.log(p태수,p군사,p시중);
|
||||
//console.log(p태수,p군사,p종사);
|
||||
|
||||
$('#duty_type1').button({disabled:!p태수});
|
||||
$('#duty_type2').button({disabled:!p군사});
|
||||
$('#duty_type3').button({disabled:!p시중});
|
||||
$('#duty_type3').button({disabled:!p종사});
|
||||
|
||||
var $태수 = cityInfo.$태수;
|
||||
var $군사 = cityInfo.$군사;
|
||||
var $시중 = cityInfo.$시중;
|
||||
var $종사 = cityInfo.$종사;
|
||||
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ $(function() {
|
||||
|
||||
var p태수 = cityInfo.p태수 && currUser.p태수;
|
||||
var p군사 = cityInfo.p군사 && currUser.p군사;
|
||||
var p시중 = cityInfo.p시중 && currUser.p시중;
|
||||
var p종사 = cityInfo.p종사 && currUser.p종사;
|
||||
|
||||
var newInfo = {
|
||||
지역 : 지역,
|
||||
@@ -232,12 +232,12 @@ $(function() {
|
||||
city : cityInfo,
|
||||
p태수 : p태수,
|
||||
p군사 : p군사,
|
||||
p시중 : p시중
|
||||
p종사 : p종사
|
||||
};
|
||||
|
||||
//console.log(newInfo);
|
||||
|
||||
if(p태수 || p군사 || p시중){
|
||||
if(p태수 || p군사 || p종사){
|
||||
if(typeof subCityGroupList[지역] == 'undefined'){
|
||||
subCityGroupList[지역] = [];
|
||||
}
|
||||
@@ -296,11 +296,11 @@ $(function() {
|
||||
}).css('cursor','pointer');
|
||||
}
|
||||
|
||||
var $시중 = cityInfo.$시중.clone();
|
||||
$city.append($시중);
|
||||
if(!newInfo.p시중)$시중.css('color','red');
|
||||
var $종사 = cityInfo.$종사.clone();
|
||||
$city.append($종사);
|
||||
if(!newInfo.p종사)$종사.css('color','red');
|
||||
else{
|
||||
$시중.click(function(){
|
||||
$종사.click(function(){
|
||||
$('#duty_radio :radio:eq(2)').attr('checked','checked');
|
||||
$('#duty_radio :radio').button('refresh');
|
||||
}).css('cursor','pointer');
|
||||
@@ -330,16 +330,7 @@ $(function() {
|
||||
//window.$html = $html;
|
||||
|
||||
var cnt =0;
|
||||
var $tmpTable = null;
|
||||
$html.each(function(idx){
|
||||
if(this.tagName == "TABLE"){
|
||||
cnt+=1;
|
||||
if(cnt==5){
|
||||
$tmpTable = $(this);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
var $tmpTable = $html.filter('#officer_list').eq(0);
|
||||
|
||||
$selects = $tmpTable.find("select");
|
||||
if($selects.length == 0){
|
||||
@@ -389,22 +380,22 @@ $(function() {
|
||||
$.each(cityList,function(idx,cityInfo){
|
||||
cityInfo.p태수=false;
|
||||
cityInfo.p군사=false;
|
||||
cityInfo.p시중=false;
|
||||
cityInfo.p종사=false;
|
||||
});
|
||||
|
||||
$.each(userList,function(idx,userInfo){
|
||||
userInfo.p태수=false;
|
||||
userInfo.p군사=false;
|
||||
userInfo.p시중=false;
|
||||
userInfo.p종사=false;
|
||||
});
|
||||
|
||||
setUserAvailable($selects.eq(1).find("option"),"p태수");
|
||||
setUserAvailable($selects.eq(3).find("option"),"p군사");
|
||||
setUserAvailable($selects.eq(5).find("option"),"p시중");
|
||||
setUserAvailable($selects.eq(5).find("option"),"p종사");
|
||||
|
||||
setCityAvailiable($selects.eq(0).find("option"),"p태수");
|
||||
setCityAvailiable($selects.eq(2).find("option"),"p군사");
|
||||
setCityAvailiable($selects.eq(4).find("option"),"p시중");
|
||||
setCityAvailiable($selects.eq(4).find("option"),"p종사");
|
||||
|
||||
|
||||
$.each(cityList,function(idx,cityInfo){
|
||||
@@ -484,10 +475,10 @@ $(function() {
|
||||
|
||||
addBtn($name,cityInfo,userInfo,4,'태수');
|
||||
addBtn($name,cityInfo,userInfo,3,'군사');
|
||||
addBtn($name,cityInfo,userInfo,2,'시중');
|
||||
addBtn($name,cityInfo,userInfo,2,'종사');
|
||||
|
||||
//특수 버튼!
|
||||
if(userInfo.p태수||userInfo.p군사||userInfo.p시중){
|
||||
if(userInfo.p태수||userInfo.p군사||userInfo.p종사){
|
||||
var $btn = $('<button>...</button>');
|
||||
$btn.addClass('for_duty');
|
||||
if(userInfo.is수뇌){
|
||||
@@ -594,8 +585,8 @@ $(function() {
|
||||
if(cityList[cityName].$군사.text() == name){
|
||||
cityList[cityName].$군사.css('color','lightgreen');
|
||||
}
|
||||
if(cityList[cityName].$시중.text() == name){
|
||||
cityList[cityName].$시중.css('color','lightgreen');
|
||||
if(cityList[cityName].$종사.text() == name){
|
||||
cityList[cityName].$종사.css('color','lightgreen');
|
||||
}
|
||||
|
||||
userList[name]={
|
||||
@@ -606,7 +597,7 @@ $(function() {
|
||||
val:'-1',
|
||||
p태수:false,
|
||||
p군사:false,
|
||||
p시중:false,
|
||||
p종사:false,
|
||||
is수뇌:is수뇌
|
||||
};
|
||||
|
||||
@@ -680,7 +671,7 @@ $(function() {
|
||||
|
||||
cityInfo.p태수 = false;
|
||||
cityInfo.p군사 = false;
|
||||
cityInfo.p시중 = false;
|
||||
cityInfo.p종사 = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -777,12 +768,12 @@ $(function() {
|
||||
|
||||
}
|
||||
|
||||
//태수,군사,시중
|
||||
//태수,군사,종사
|
||||
{
|
||||
var $baseTr = $this.find('tr:eq(2)');
|
||||
cityInfo.$태수 = $baseTr.find('td:eq(7)');
|
||||
cityInfo.$군사 = $baseTr.find('td:eq(9)');
|
||||
cityInfo.$시중 = $baseTr.find('td:eq(11)');
|
||||
cityInfo.$종사 = $baseTr.find('td:eq(11)');
|
||||
}
|
||||
|
||||
//기타
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"typeAcquisition": {
|
||||
"include": [
|
||||
"jquery"
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
+2
-23
@@ -26,8 +26,7 @@ function refreshing(obj, arg1, arg2) {
|
||||
}
|
||||
// if(term <= 0) {
|
||||
switch(arg1) {
|
||||
case 0: location.reload(); break;
|
||||
case 1: go(arg2); break;
|
||||
case 0: document.location.reload(); break;
|
||||
case 2: turn(arg2); break;
|
||||
case 3: arg2.submit(); break;
|
||||
case 4:
|
||||
@@ -37,6 +36,7 @@ function refreshing(obj, arg1, arg2) {
|
||||
message.msg.focus();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function moveProcessing(commandtype, turn){
|
||||
@@ -44,27 +44,6 @@ function moveProcessing(commandtype, turn){
|
||||
$.redirect("processing.php",{ commandtype: commandtype, turn: turn}, 'post');
|
||||
}
|
||||
|
||||
function go(type) {
|
||||
if(type == 1) location.replace('b_nationboard.php');
|
||||
else if(type == 2) location.replace('b_troop.php');
|
||||
else if(type == 3) location.replace('b_nationrule.php');
|
||||
else if(type == 4) location.replace('b_chiefboard.php');
|
||||
else if(type == 5) location.replace('b_chiefcenter.php');
|
||||
else if(type == 6) window.open('b_genList.php');
|
||||
else if(type == 7) location.replace('b_myKingdomInfo.php');
|
||||
else if(type == 8) location.replace('b_myCityInfo.php');
|
||||
else if(type == 9) location.replace('b_myGenInfo.php');
|
||||
else if(type == 10) location.replace('b_myBossInfo.php');
|
||||
else if(type == 11) location.replace('b_currentCity.php');
|
||||
else if(type == 12) location.replace('b_myPage.php');
|
||||
else if(type == 13) location.replace('b_dipcenter.php');
|
||||
else if(type == 14) location.replace('b_diplomacy.php');
|
||||
else if(type == 15) window.open('b_tournament.php');
|
||||
else if(type == 16) window.open('b_betting.php');
|
||||
else if(type == 17) window.open('b_auction.php');
|
||||
else if(type == 18) window.open('b_battleCenter.php');
|
||||
}
|
||||
|
||||
function turn(type) {
|
||||
num = form2.sel.value;
|
||||
commandlist.location.replace('turn.php?type=' + type + '&sel=' + num);
|
||||
|
||||
+126
-2
@@ -1,5 +1,20 @@
|
||||
|
||||
function is_touch_device() {
|
||||
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
|
||||
var mq = function(query) {
|
||||
return window.matchMedia(query).matches;
|
||||
}
|
||||
|
||||
if (('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// include the 'heartz' as a way to have a non matching MQ to help terminate the join
|
||||
// https://git.io/vznFH
|
||||
var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
|
||||
return mq(query);
|
||||
}
|
||||
|
||||
function reloadWorldMap(option){
|
||||
var $world_map = $('.world_map');
|
||||
@@ -368,8 +383,76 @@ function reloadWorldMap(option){
|
||||
|
||||
var $map_body = $('.world_map .map_body');
|
||||
|
||||
//터치스크린 탭
|
||||
|
||||
if(!option.neutralView && is_touch_device()){
|
||||
$objs.on('touchstart', function(e){
|
||||
if(window.sam_toggleSingleTap){
|
||||
return true;
|
||||
}
|
||||
var $this = $(this);
|
||||
|
||||
var touchMode = $this.data('touchMode');
|
||||
if($tooltip_city.data('target') != $this.data('id')){
|
||||
$this.data('touchMode', 1);
|
||||
}
|
||||
else if(touchMode === undefined){
|
||||
$this.data('touchMode', 1);
|
||||
}
|
||||
else{
|
||||
$this.data('touchMode', touchMode + 1);
|
||||
}
|
||||
$map_body.data('touchMode', 1);
|
||||
|
||||
$tooltip_city.data('target', $this.data('id'));
|
||||
|
||||
|
||||
});
|
||||
|
||||
$objs.on('touchend', function(e){
|
||||
if(window.sam_toggleSingleTap){
|
||||
return true;
|
||||
}
|
||||
var $this = $(this);
|
||||
var position = $this.parent().position();
|
||||
$tooltip_city.html($this.data('text'));
|
||||
|
||||
var nation_text = $this.data('nation');
|
||||
if(nation_text){
|
||||
$tooltip_nation.html(nation_text).show();
|
||||
}
|
||||
else{
|
||||
$tooltip_nation.html('').hide();
|
||||
}
|
||||
|
||||
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show();
|
||||
|
||||
var touchMode = $this.data('touchMode');
|
||||
if(touchMode <= 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
||||
$this.data('touchMode', 0);
|
||||
});
|
||||
|
||||
$map_body.on('touchend',function(e){
|
||||
if(window.sam_toggleSingleTap){
|
||||
return true;
|
||||
}
|
||||
//위의 touchend bind에 해당하지 않는 경우 -> 빈 지도 터치
|
||||
$tooltip.hide();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//Mouse over 모드 작동
|
||||
|
||||
$map_body.on('mousemove', function(e){
|
||||
if($(this).data('touchMode')){
|
||||
return true;
|
||||
}
|
||||
|
||||
var parentOffset = $map_body.offset();
|
||||
var relX = e.pageX - parentOffset.left;
|
||||
var relY = e.pageY - parentOffset.top;
|
||||
@@ -378,6 +461,10 @@ function reloadWorldMap(option){
|
||||
});
|
||||
|
||||
$objs.on('mouseenter', function(e){
|
||||
if($map_body.data('touchMode')){
|
||||
return true;
|
||||
}
|
||||
|
||||
var $this = $(this);
|
||||
|
||||
$tooltip_city.data('target', $this.data('id'));
|
||||
@@ -398,7 +485,15 @@ function reloadWorldMap(option){
|
||||
});
|
||||
|
||||
$objs.on('click', function(e){
|
||||
return;
|
||||
//xxx: touchend 다음 click 이벤트가 갈 수도 있고, 안 갈 수도 있다.
|
||||
var touchMode = $(this).data('touchMode');
|
||||
if(touchMode === undefined){
|
||||
return;
|
||||
}
|
||||
|
||||
if(touchMode === 1){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -448,6 +543,31 @@ function reloadWorldMap(option){
|
||||
}
|
||||
});
|
||||
|
||||
var $toggleSingleTapBtn = $world_map.find('.map_toggle_single_tap');
|
||||
if(localStorage.getItem('sam.toggleSingleTap') == 'yes'){
|
||||
window.sam_toggleSingleTap = true;
|
||||
$toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true');
|
||||
}
|
||||
else{
|
||||
window.sam_toggleSingleTap = false;
|
||||
}
|
||||
|
||||
var $map_body = $('.world_map .map_body');
|
||||
|
||||
$toggleSingleTapBtn.click(function(){
|
||||
//이전 상태 확인
|
||||
var state = !$toggleSingleTapBtn.hasClass('active');
|
||||
if(state){
|
||||
$map_body.removeData('touchMode');
|
||||
localStorage.setItem('sam.toggleSingleTap', 'yes');
|
||||
window.sam_toggleSingleTap = true;
|
||||
}
|
||||
else{
|
||||
localStorage.setItem('sam.toggleSingleTap', 'no');
|
||||
window.sam_toggleSingleTap = false;
|
||||
}
|
||||
});
|
||||
|
||||
if(isDetailMap){
|
||||
$world_map.addClass('map_detail');
|
||||
}
|
||||
@@ -527,4 +647,8 @@ function reloadWorldMap(option){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
if(is_touch_device()){
|
||||
$('.map_body .map_toggle_single_tap').show();
|
||||
}
|
||||
})
|
||||
+143
-45
@@ -1,31 +1,17 @@
|
||||
|
||||
|
||||
function hexToRgb(hex) {
|
||||
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||
return result ? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
} : null;
|
||||
}
|
||||
|
||||
|
||||
function isBrightColor(color){
|
||||
color = hexToRgb(color);
|
||||
if ((color.r*0.299 + color.g*0.587 + color.b*0.114) > 140){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var messageTemplate = '';
|
||||
var myGeneralID=null;
|
||||
var isChief = false;
|
||||
var sequence =null;
|
||||
var lastSequence = 0;
|
||||
var myNation = null;
|
||||
var lastMsg = null;
|
||||
var minMsgSeq = {
|
||||
'private':0x7fffffff,
|
||||
'public':0x7fffffff,
|
||||
'national':0x7fffffff,
|
||||
'diplomacy':0x7fffffff,
|
||||
}
|
||||
|
||||
var generalList = {};
|
||||
|
||||
@@ -43,32 +29,93 @@ function responseMessage(msgID, response){
|
||||
}).then(refreshMsg);
|
||||
}
|
||||
|
||||
function deleteMessage(msgID){
|
||||
$.ajax({
|
||||
url: 'j_msg_delete.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
msgID:msgID
|
||||
}
|
||||
}).then(refreshMsg);
|
||||
}
|
||||
|
||||
function refreshMsg(result){
|
||||
if(result && !result.result){
|
||||
alert(result.reason);
|
||||
}
|
||||
return redrawMsg(fetchMsg());
|
||||
return redrawMsg(fetchRecentMsg(), true);
|
||||
}
|
||||
|
||||
function fetchMsg(){
|
||||
function fetchRecentMsg(){
|
||||
return $.ajax({
|
||||
url: 'j_msg_get_recent.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
sequence:sequence
|
||||
sequence:lastSequence
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function redrawMsg(deferred){
|
||||
function showOldMsg(msgType){
|
||||
var oldMsg = $.ajax({
|
||||
url: 'j_msg_get_old.php',
|
||||
type: 'post',
|
||||
dataType:'json',
|
||||
data: {
|
||||
to:minMsgSeq[msgType],
|
||||
type:msgType,
|
||||
}
|
||||
});
|
||||
redrawMsg(oldMsg, false);
|
||||
}
|
||||
|
||||
function redrawMsg(deferred, addFront){
|
||||
function checkErasable(obj){
|
||||
|
||||
var now = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
$('.btn-delete-msg').each(function(){
|
||||
var $btn = $(this);
|
||||
var eraseUntil = $btn.data('erase_until');
|
||||
if(eraseUntil < now){
|
||||
$btn.detach();
|
||||
}
|
||||
})
|
||||
return obj;
|
||||
}
|
||||
function checkClear(obj){
|
||||
if(!obj.result){
|
||||
var t = $.Deferred();
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
if(!obj.keepRecent){
|
||||
var t = $.Deferred();
|
||||
$('.msg_plate').detach();
|
||||
lastSequence = null;
|
||||
console.log('refresh!');
|
||||
redrawMsg(fetchRecentMsg(), true);
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function registerSequence(obj){
|
||||
if(!obj.result){
|
||||
deferred.reject();
|
||||
return;
|
||||
var t = $.Deferred();
|
||||
t.reject();
|
||||
return t;
|
||||
}
|
||||
sequence = obj.sequence;
|
||||
lastSequence = Math.max(lastSequence, obj.sequence);
|
||||
$.each(['public', 'private', 'national', 'diplomacy'], function (_, msgType) {
|
||||
var msgList = obj[msgType];
|
||||
if(msgList === undefined || msgList.length == 0){
|
||||
return true;
|
||||
}
|
||||
var lastMsg = msgList[msgList.length - 1];
|
||||
minMsgSeq[msgType] = Math.min(minMsgSeq[msgType], lastMsg.id);
|
||||
});
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -116,14 +163,10 @@ function redrawMsg(deferred){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(msgType == 'diplomacy'){
|
||||
//외교는 항상 새로 그린다
|
||||
$msgBoard.empty();
|
||||
}
|
||||
|
||||
|
||||
var needRefreshLastContact = (msgType == 'private');
|
||||
|
||||
var now = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
//list의 맨 앞이 가장 최신 메시지임.
|
||||
var $msgs = msgSource.map(function(msg){
|
||||
|
||||
@@ -151,11 +194,20 @@ function redrawMsg(deferred){
|
||||
|
||||
msg.defaultIcon = pathConfig.sharedIcon+'/default.jpg';
|
||||
if(msgType == 'diplomacy'){
|
||||
msg.allowButton = myGeneralLevel>4;
|
||||
msg.allowButton = permissionLevel>=4;
|
||||
}
|
||||
else{
|
||||
msg.allowButton = true;
|
||||
}
|
||||
msg.myGeneralID = myGeneralID;
|
||||
msg.last5min = moment(msg.time).add(5, 'minute').format('YYYY-MM-DD HH:mm:ss');
|
||||
msg.now = now;
|
||||
if(msg.option && msg.option.invalid){
|
||||
msg.invalidType = 'msg_invalid';
|
||||
}
|
||||
else{
|
||||
msg.invalidType = 'msg_valid';
|
||||
}
|
||||
var msgHtml = TemplateEngine(messageTemplate, msg);
|
||||
|
||||
|
||||
@@ -169,11 +221,37 @@ function redrawMsg(deferred){
|
||||
$msg = $existMsg;
|
||||
}
|
||||
|
||||
if(msg.option && msg.option.parent){
|
||||
//parent는 삭제.
|
||||
$('#msg_{0}'.format(msg.option.parent)).detach();
|
||||
var hideMsg = false;
|
||||
if(msg.option){
|
||||
if(msg.option.delete !== undefined){
|
||||
//delete는 삭제.
|
||||
$('#msg_{0}'.format(msg.option.delete)).detach();
|
||||
}
|
||||
if(msg.option.overwrite !== undefined){
|
||||
//overwrite는 숨기기.
|
||||
$.map(msg.option.overwrite, function (overwriteID) {
|
||||
var $msg = $('#msg_{0}'.format(overwriteID));
|
||||
$msg.find('.btn-delete-msg').detach();
|
||||
$msg.find('.msg_content').html('삭제된 메시지입니다.').removeClass('msg_valid').addClass('msg_invalid');
|
||||
});
|
||||
|
||||
}
|
||||
if(msg.option.hide){
|
||||
hideMsg = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(hideMsg){
|
||||
return null;
|
||||
}
|
||||
|
||||
$msg.find('.btn-delete-msg').click(function(){
|
||||
if(!confirm("삭제하시겠습니까?")){
|
||||
return false;
|
||||
}
|
||||
deleteMessage(msg.id);
|
||||
});
|
||||
|
||||
$msg.find('button.prompt_yes').click(function(){
|
||||
if(!confirm("수락하시겠습니까?")){
|
||||
return false;
|
||||
@@ -198,12 +276,20 @@ function redrawMsg(deferred){
|
||||
|
||||
});
|
||||
|
||||
$msgBoard.prepend($msgs);
|
||||
if(addFront){
|
||||
$msgBoard.prepend($msgs);
|
||||
}
|
||||
else{
|
||||
$msgBoard.find('.load_old_message').before($msgs);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
deferred
|
||||
.then(checkErasable)
|
||||
.then(checkClear)
|
||||
.then(registerSequence)
|
||||
.then(refineMessageObjs)
|
||||
.then(printTemplate);
|
||||
@@ -272,6 +358,7 @@ function refreshMailboxList(obj){
|
||||
var generalName = this[1];
|
||||
var isNPC = !!(this[2] & 0x2);
|
||||
var isRuler = !!(this[2] & 0x1);
|
||||
var isAmbassador = !!(this[2] & 0x4);
|
||||
|
||||
|
||||
|
||||
@@ -283,6 +370,9 @@ function refreshMailboxList(obj){
|
||||
if(isRuler){
|
||||
textName = '*{0}*'.format(textName);
|
||||
}
|
||||
else if(isAmbassador){
|
||||
textName = '#{0}#'.format(textName);
|
||||
}
|
||||
|
||||
generalList[generalID] = {
|
||||
id:generalID,
|
||||
@@ -294,6 +384,10 @@ function refreshMailboxList(obj){
|
||||
};
|
||||
|
||||
var $item = $('<option value="{0}">{1}</option>'.format(generalID, textName));
|
||||
|
||||
if(permissionLevel == 4 && isAmbassador && myNation.mailbox != nation.mailbox){
|
||||
$item.prop('disabled', true);
|
||||
}
|
||||
$optgroup.append($item);
|
||||
});
|
||||
|
||||
@@ -316,7 +410,7 @@ function refreshMailboxList(obj){
|
||||
$favorite.append($lastContact);
|
||||
//TODO:운영자를 추가하는 코드도 넣을 것.
|
||||
|
||||
if(myGeneralLevel >= 5){
|
||||
if(permissionLevel >= 4){
|
||||
$.each(obj.nation, function(){
|
||||
var nation = this;
|
||||
//console.log(nation);
|
||||
@@ -353,12 +447,10 @@ function registerGlobal(basicInfo){
|
||||
'color':'#000000',
|
||||
'nation':'재야'
|
||||
};
|
||||
window.lastMsg = {
|
||||
id : basicInfo.lastContact
|
||||
};
|
||||
window.myGeneralID = basicInfo.generalID;
|
||||
window.isChief = basicInfo.isChief;
|
||||
window.myGeneralLevel = basicInfo.generalLevel;
|
||||
window.permissionLevel = basicInfo.permission;
|
||||
}
|
||||
|
||||
function activateMessageForm(){
|
||||
@@ -412,7 +504,7 @@ function activateMessageForm(){
|
||||
jQuery(function($){
|
||||
|
||||
//tmp_template.html은 추후 msg.js에 통합될 수 있음
|
||||
var getTemplate = $.get('js/templates/message.html?3',function(obj){
|
||||
var getTemplate = $.get('js/templates/message.html?11',function(obj){
|
||||
messageTemplate = obj;
|
||||
});
|
||||
|
||||
@@ -430,7 +522,7 @@ jQuery(function($){
|
||||
dataType:'json',
|
||||
});
|
||||
|
||||
var MessageList = fetchMsg();
|
||||
var MessageList = fetchRecentMsg();
|
||||
|
||||
senderList = $.when(senderList, basicInfo)
|
||||
.then(refreshMailboxList)
|
||||
@@ -438,6 +530,12 @@ jQuery(function($){
|
||||
|
||||
$.when(MessageList, getTemplate, basicInfo, senderList)
|
||||
.then(function(){
|
||||
redrawMsg(MessageList);
|
||||
redrawMsg(MessageList, true);
|
||||
}).then(function(){
|
||||
$('.load_old_message').click(function(){
|
||||
var $this = $(this);
|
||||
var msgType = $this.data('msg_type');
|
||||
showOldMsg(msgType);
|
||||
})
|
||||
});
|
||||
});
|
||||
@@ -12,6 +12,9 @@
|
||||
</div>
|
||||
<div class="msg_body">
|
||||
<div class="msg_header">
|
||||
<%if(!this.option.action && src.id == myGeneralID && now <= last5min && invalidType == 'msg_valid'){%>
|
||||
<button type="button" data-erase_until="<%last5min%>" class="btn btn btn-outline-warning btn-sm btn-delete-msg" style='float:right'>❌</button>
|
||||
<%}%>
|
||||
<%if(msgType == 'private') {%>
|
||||
<%if(src.name == generalName){%>
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;">나</span
|
||||
@@ -37,9 +40,8 @@
|
||||
<span class="msg_target msg_<%src.colorType%>" style="background-color:<%src.color%>;"><%e(src.name)%>:<%src.nation%></span>
|
||||
<%} %>
|
||||
<span class="msg_time"><<%e(time)%>></span>
|
||||
</div>
|
||||
|
||||
<div class="msg_content"><%e(text)%></div>
|
||||
</div>
|
||||
<div class="msg_content <%invalidType%>"><%linkifyStr(text)%></div>
|
||||
<%if(this.option && this.option.action) {%>
|
||||
<div class="msg_prompt">
|
||||
<button class="prompt_yes btn_prompt" <%allowButton?'':'disabled="disabled"'%>>>수락</button> <button class="prompt_no btn_prompt" <%allowButton?'':'disabled="disabled"'%>>거절</button>
|
||||
|
||||
+2
-3
@@ -26,8 +26,6 @@ define('STEP_LOG', true);
|
||||
define('PROCESS_LOG', true);
|
||||
|
||||
ob_start();
|
||||
session_cache_limiter('nocache');//NOTE: 캐시가 가능하도록 설정해야 할 수도 있음. 주의!
|
||||
//FIXME: 이곳에서 설정하면 안될 듯 하다. 옮기자.
|
||||
|
||||
// 에러 메세지 출력
|
||||
function Error($message='', $url="")
|
||||
@@ -35,7 +33,8 @@ function Error($message='', $url="")
|
||||
if (!$url) {
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
file_put_contents(__dir__."/logs/".UniqueConst::$serverID."/_db_bug.txt", "{\"url\":\"$url\",\"msg\":\"$message\"}\n", FILE_APPEND);
|
||||
$e = new \Exception();
|
||||
logError("aux_err", $message, '', getExceptionTraceAsString($e));
|
||||
|
||||
$templates = new \League\Plates\Engine(__dir__.'/templates');
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ $commandtype = Util::getReq('commandtype', 'int');
|
||||
increaseRefresh("턴입력", 1);
|
||||
|
||||
if(!$turn || $commandtype === null || $sel === null){
|
||||
header('location:commandlist.php');
|
||||
header('location:commandlist.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
+43
-51
@@ -217,7 +217,7 @@ function extractBattleOrder($general){
|
||||
getGeneralIntel($general, false, true, true, true);
|
||||
$totalStat = ($realStat + $fullStat) / 2;
|
||||
|
||||
$totalCrew = $general['crew'] / 10000 * $general['train'] * $general['atmos'];
|
||||
$totalCrew = $general['crew'] / 1000000 * (($general['train'] * $general['atmos']) ** 1.5);
|
||||
return $totalStat + $totalCrew / 100;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$renewFront = true;
|
||||
// 멸망이 아니면
|
||||
} else {
|
||||
// 태수,군사,시중은 일반으로...
|
||||
// 태수,군사,종사은 일반으로...
|
||||
$db->update('general',[
|
||||
'level'=>1
|
||||
], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]);
|
||||
@@ -705,59 +705,47 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
|
||||
$conquerNation = getConquerNation($city);
|
||||
|
||||
if($conquerNation == $general['nation']) {
|
||||
if ($conquerNation == $general['nation']) {
|
||||
// 이동
|
||||
$query = "update general set city='{$city['city']}' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
if($city['level'] > 3) {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=1000,wall=1000,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=def2/2,wall=wall2/2,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//전방설정
|
||||
SetNationFront($nation['nation']);
|
||||
SetNationFront($destnation['nation']);
|
||||
} else {
|
||||
$query = "select name,nation from nation where nation='$conquerNation'";
|
||||
$conquerResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$conquerNationArray = MYDB_fetch_array($conquerResult);
|
||||
$db->update('general', [
|
||||
'city'=>$city['city']
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
else{
|
||||
$conquerNationName = $db->queryFirstField('SELECT `name` FROM nation WHERE nation=%i', $conquerNation);
|
||||
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$josaYi = JosaUtil::pick($conquerNationArray['name'], '이');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationArray['name']}</b></>{$josaYi} 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>{$josaUl} 양도받았습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>{$josaUl} <D><b>{$conquerNationArray['name']}</b></>에 <Y>양도</>");
|
||||
pushNationHistory($conquerNationArray, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>{$josaUl} <S>양도</> 받음");
|
||||
|
||||
$query = [
|
||||
'supply'=>1,
|
||||
'term'=>0,
|
||||
'conflict'=>'{}',
|
||||
'agri'=>$db->sqleval('agri*0.7'),
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'gen1'=>0,
|
||||
'gen2'=>0,
|
||||
'gen3'=>0
|
||||
];
|
||||
if($city['level'] > 3) {
|
||||
$query['def'] = 1000;
|
||||
$query['wall'] = 1000;
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query['def'] = $db->sqleval('def2/2');
|
||||
$query['wall'] = $db->sqleval('wall2/2');
|
||||
}
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
//전방설정
|
||||
SetNationFront($destnation['nation']);
|
||||
SetNationFront($conquerNation);
|
||||
$josaYi = JosaUtil::pick($conquerNationName, '이');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationName}</b></>{$josaYi} 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>{$josaUl} 양도받았습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>{$josaUl} <D><b>{$conquerNationName}</b></>에 <Y>양도</>");
|
||||
pushNationHistory(['nation'=>$conquerNation], "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>{$josaUl} <S>양도</> 받음");
|
||||
}
|
||||
|
||||
|
||||
$query = [
|
||||
'supply'=>1,
|
||||
'term'=>0,
|
||||
'conflict'=>'{}',
|
||||
'agri'=>$db->sqleval('agri*0.7'),
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'gen1'=>0,
|
||||
'gen2'=>0,
|
||||
'gen3'=>0,
|
||||
'gen1set'=>0,
|
||||
'gen2set'=>0,
|
||||
'gen3set'=>0
|
||||
];
|
||||
if($city['level'] > 3) {
|
||||
$query['def'] = 1000;
|
||||
$query['wall'] = 1000;
|
||||
} else {
|
||||
$query['def'] = $db->sqleval('def2/2');
|
||||
$query['wall'] = $db->sqleval('wall2/2');
|
||||
}
|
||||
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
//전방설정
|
||||
if($renewFront){
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['level'] <= 0){
|
||||
@@ -766,6 +754,10 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
SetNationFront($nation['nation']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
SetNationFront($destnation['nation']);
|
||||
SetNationFront($conquerNation);
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
|
||||
+15
-17
@@ -9,7 +9,7 @@ $commandtype = Util::getReq('commandtype', 'int');
|
||||
$turn = Util::getReq('turn', 'array_int');
|
||||
|
||||
if(!$turn || $commandtype === null){
|
||||
header('location:commandlist.php');
|
||||
header('location:commandlist.php', true, 303);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ function command_99($turn) {
|
||||
}
|
||||
}
|
||||
|
||||
header('location:b_chiefcenter.php');
|
||||
header('location:b_chiefcenter.php', true, 303);
|
||||
}
|
||||
|
||||
function command_11($turn, $command, bool $is모병 = false) {
|
||||
@@ -495,7 +495,7 @@ function command_22($turn, $command) {
|
||||
}
|
||||
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
echo "<option style=color:{$nation['color']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']}'>【 {$nation['name']} 】</option>";
|
||||
|
||||
$query = "select no,name,npc from general where nation='{$nation['nation']}' and level!='12' and npc<2 order by npc,binary(name)";
|
||||
$genresult = MYDB_query($query, $connect) or Error("aaa_processing.php ".MYDB_error($connect),"");
|
||||
@@ -1506,9 +1506,9 @@ function command_51($turn, $command) {
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
if($myNation['power'] <= $nation['power'] * 3 || !isNeighbor($me['nation'], $nation['nation'])) {
|
||||
echo "<option style=color:{$nation['color']};background-color:red; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']};background-color:red;' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
} else {
|
||||
echo "<option style=color:{$nation['color']} value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']}' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
@@ -1559,7 +1559,7 @@ function command_52($turn, $command) {
|
||||
|
||||
foreach(getAllNationStaticInfo() as $nation) {
|
||||
|
||||
echo "<option style=color:{$nation['color']} value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']}' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -1650,9 +1650,9 @@ function command_53($turn, $command) {
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
if(($myNation['power']+$nation['power'])/2 > $cond1 || ($myNation['gennum']+$nation['gennum'])/2 > $cond2 || !isNeighbor($me['nation'], $nation['nation'])) {
|
||||
echo "<option style=color:{$nation['color']};background-color:red; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']};background-color:red;' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
} else {
|
||||
echo "<option style=color:{$nation['color']} value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='color:{$nation['color']}' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1739,7 +1739,6 @@ function command_61($turn, $command) {
|
||||
타국에게 불가침을 제의합니다.<br>
|
||||
제의할 국가를 목록에서 선택하세요.<br>
|
||||
배경색은 현재 제의가 불가능한 국가는 <font color=red>붉은색</font>, 현재 불가침중인 국가는 <font color=blue>푸른색</font>으로 표시됩니다.<br>
|
||||
비고는 불가침시 세부 조건등을 지정하는 곳입니다.(최대 45자) <font color=magenta>※유저 편의를 위한 것일뿐 시스템적으로 보장하지는 않습니다.</font><br>
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
대상 국가 <select name=double size=1 style=color:white;background-color:black>";
|
||||
|
||||
@@ -1769,7 +1768,7 @@ function command_61($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -1796,7 +1795,6 @@ function command_61($turn, $command) {
|
||||
<option value=20>20</option>
|
||||
</select>
|
||||
년<br>
|
||||
비고 : <input type=text name=note size=45 maxlength=45 style=text-align:left;color:white;background-color:black>
|
||||
<input type=submit value=불가침>
|
||||
<input type=hidden name=command value=$command>";
|
||||
for($i=0; $i < count($turn); $i++) {
|
||||
@@ -1862,7 +1860,7 @@ function command_62($turn, $command) {
|
||||
case 6: $color = "black"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -1923,7 +1921,7 @@ function command_63($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "red"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -1984,7 +1982,7 @@ function command_64($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -2332,7 +2330,7 @@ function command_75($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -2394,7 +2392,7 @@ function command_77($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
@@ -2456,7 +2454,7 @@ function command_78($turn, $command) {
|
||||
case 6: $color = "red"; break;
|
||||
case 7: $color = "blue"; break;
|
||||
}
|
||||
echo "<option style=background-color:$color;color:{$nation['color']}; value={$nation['nation']}>【 {$nation['name']} 】</option>";
|
||||
echo "<option style='background-color:$color;color:{$nation['color']};' value='{$nation['nation']}'>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
|
||||
@@ -70,7 +70,7 @@ class CityConstBase{
|
||||
[11, '수춘', '대', 5143, 99, 96, 80, 99, 95, '중원', 395, 270, ['서주', '여남', '초', '합비']],
|
||||
[12, '서주', '대', 4853,101, 98, 80,102, 97, '중원', 440, 250, ['수춘', '하비', '초', '패']],
|
||||
[13, '강릉', '대', 4850,105, 96, 80, 95, 96, '초', 245, 335, ['장사', '무릉', '이릉', '장판']],
|
||||
[14, '장사', '대', 4710, 97, 99, 80,100,105, '초', 255, 375, ['강릉', '시상', '계양', '무릉', '영릉']],
|
||||
[14, '장사', '대', 4710, 97, 99, 80,100,105, '초', 255, 375, ['강릉', '시상', '계양', '무릉']],
|
||||
[15, '시상', '대', 5252, 98,100,100, 99, 96, '오월', 360, 360, ['장사', '여강', '고창', '적벽', '파양']],
|
||||
[16, '위례', '대', 4926,100, 93, 80, 98,103, '동이', 620, 145, ['평양', '사비', '계림', '안평', '동황']],
|
||||
[17, '계', '중', 3885, 75, 80, 60, 78, 81, '하북', 365, 35, ['진양', '역경']],
|
||||
@@ -110,7 +110,7 @@ class CityConstBase{
|
||||
[51, '신야', '소', 2786, 60, 62, 40, 58, 55, '초', 250, 260, ['양양', '완', '상용']],
|
||||
[52, '강하', '소', 3074, 55, 56, 40, 57, 60, '초', 315, 295, ['장판', '적벽']],
|
||||
[53, '무릉', '소', 3196, 58, 63, 40, 63, 58, '초', 195, 355, ['강릉', '장사', '영릉']],
|
||||
[54, '영릉', '소', 2849, 62, 58, 40, 62, 62, '초', 190, 395, ['장사', '계양', '남영', '무릉']],
|
||||
[54, '영릉', '소', 2849, 62, 58, 40, 62, 62, '초', 190, 395, ['계양', '남영', '무릉']],
|
||||
[55, '상동', '소', 2767, 58, 59, 40, 62, 58, '초', 210, 435, ['남해', '계양', '고창']],
|
||||
[56, '여강', '소', 2905, 56, 58, 40, 60, 55, '오월', 380, 315, ['시상', '합비', '적벽', '파양']],
|
||||
[57, '회계', '소', 3005, 64, 59, 40, 62, 64, '오월', 480, 395, ['오', '산월']],
|
||||
|
||||
@@ -64,8 +64,10 @@ class DiplomaticMessage extends Message{
|
||||
return [self::INVALID, '송신자가 외교서신을 처리할 수 없습니다.'];
|
||||
}
|
||||
|
||||
if(!$general || $general['level'] < 5){
|
||||
return [self::INVALID, '해당 국가의 수뇌가 아닙니다.'];
|
||||
$permission = checkSecretPermission($general, false);
|
||||
|
||||
if(!$general || $permission < 4){
|
||||
return [self::INVALID, '해당 국가의 외교권자가 아닙니다.'];
|
||||
}
|
||||
|
||||
return [self::ACCEPTED, ''];
|
||||
@@ -73,7 +75,6 @@ class DiplomaticMessage extends Message{
|
||||
|
||||
protected function noAggression(){
|
||||
$year = Util::array_get($this->msgOption['year']);
|
||||
$option = Util::array_get($this->msgOption['option'])??'';
|
||||
if($year < 1 || $year > 30){
|
||||
return [self::INVALID, '올바르지 않은 불가침 서신입니다.'];
|
||||
}
|
||||
@@ -81,7 +82,7 @@ class DiplomaticMessage extends Message{
|
||||
$this->diplomacyDetail = "{$year}년";
|
||||
|
||||
$helper = new Engine\Diplomacy($this->src->nationID, $this->dest->nationID);
|
||||
$chk = $helper->noAggression($year, $option);
|
||||
$chk = $helper->noAggression($year);
|
||||
if($chk[0] !== self::ACCEPTED){
|
||||
return $chk;
|
||||
}
|
||||
@@ -272,7 +273,7 @@ class DiplomaticMessage extends Message{
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
||||
'SELECT `name`, nation, `level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
$receiverID,
|
||||
$this->dest->nationID
|
||||
);
|
||||
@@ -284,13 +285,6 @@ class DiplomaticMessage extends Message{
|
||||
|
||||
|
||||
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){
|
||||
@@ -333,7 +327,6 @@ class DiplomaticMessage extends Message{
|
||||
$this->dest->generalID = $receiverID;
|
||||
$this->dest->generalName = $general['name'];
|
||||
$this->msgOption['used'] = true;
|
||||
$this->invalidate();
|
||||
$this->validDiplomacy = false;
|
||||
|
||||
$josaYi = JosaUtil::pick($this->src->nationName, '이');
|
||||
@@ -345,7 +338,23 @@ class DiplomaticMessage extends Message{
|
||||
new \DateTime(),
|
||||
new \DateTime('9999-12-31'),
|
||||
[
|
||||
'delete'=>$this->id
|
||||
'delete'=>$this->id,
|
||||
'silence'=>true,
|
||||
]
|
||||
);
|
||||
$this->invalidate();
|
||||
$newMsg->send();
|
||||
|
||||
$newMsg = new Message(
|
||||
self::MSGTYPE_DIPLOMACY,
|
||||
$this->dest,
|
||||
$this->src,
|
||||
"【외교】{$year}년 {$month}월: {$this->src->nationName}{$josaYi} {$this->dest->nationName}에게 제안한 {$this->diplomacyDetail}{$this->diplomacyName} 동의.",
|
||||
new \DateTime(),
|
||||
new \DateTime('9999-12-31'),
|
||||
[
|
||||
'delete'=>$this->id,
|
||||
'silence'=>true,
|
||||
]
|
||||
);
|
||||
$newMsg->send();
|
||||
@@ -369,7 +378,7 @@ class DiplomaticMessage extends Message{
|
||||
|
||||
$db = DB::db();
|
||||
$general = $db->queryFirstRow(
|
||||
'SELECT `name`, `level` FROM general WHERE `no`=%i AND nation=%i',
|
||||
'SELECT `name`, nation, `level`, `permission`, `penalty`,belong FROM general WHERE `no`=%i AND nation=%i',
|
||||
$receiverID,
|
||||
$this->dest->nationID
|
||||
);
|
||||
|
||||
@@ -273,7 +273,7 @@ class Diplomacy{
|
||||
return $prev;
|
||||
}
|
||||
|
||||
public function noAggression(int $when, string $option){
|
||||
public function noAggression(int $when){
|
||||
$chk = $this->checkValidNation();
|
||||
$chk = $this->checkNotWar($chk);
|
||||
$chk = $this->checkAlreadyMerging($chk);
|
||||
@@ -286,8 +286,7 @@ class Diplomacy{
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>7,
|
||||
'term'=>$when*12,
|
||||
'fixed'=>$option
|
||||
'term'=>$when*12
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
@@ -308,8 +307,7 @@ class Diplomacy{
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>2,
|
||||
'term'=>0,
|
||||
'fixed'=>''
|
||||
'term'=>0
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
@@ -330,8 +328,7 @@ class Diplomacy{
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>2,
|
||||
'term'=>0,
|
||||
'fixed'=>''
|
||||
'term'=>0
|
||||
],
|
||||
'(me=%i AND you=%i) OR (you=%i AND me=%i)',
|
||||
$this->srcNation['nation'], $this->destNation['nation'],
|
||||
@@ -356,16 +353,14 @@ class Diplomacy{
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>4,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
'term'=>24
|
||||
],
|
||||
'me=%i AND you=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
$db->update('diplomacy',[
|
||||
'state'=>3,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
'term'=>24
|
||||
],
|
||||
'you=%i AND me=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
@@ -389,16 +384,14 @@ class Diplomacy{
|
||||
$db = DB::db();
|
||||
$db->update('diplomacy',[
|
||||
'state'=>6,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
'term'=>24
|
||||
],
|
||||
'me=%i AND you=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
$db->update('diplomacy',[
|
||||
'state'=>5,
|
||||
'term'=>24,
|
||||
'fixed'=>''
|
||||
'term'=>24
|
||||
],
|
||||
'you=%i AND me=%i',
|
||||
$this->srcNation['nation'], $this->destNation['nation']);
|
||||
|
||||
@@ -177,9 +177,9 @@ class Personnel{
|
||||
$setOriginalCityValues['gen3'] = 0;
|
||||
}
|
||||
|
||||
$setValues['betray'] = $db->sqleval('betray + 1');
|
||||
$setValues['experience'] = $db->sqleval('experience * (1 - 0.1 * betray)');//XXX: 상수
|
||||
$setValues['dedication'] = $db->sqleval('dedication * (1 - 0.1 * betray)');//XXX: 상수
|
||||
$setValues['betray'] = $db->sqleval('betray + 1');
|
||||
}
|
||||
else{
|
||||
//재야이면 100 100 증가
|
||||
@@ -191,6 +191,8 @@ class Personnel{
|
||||
$setValues['killturn'] = $this->killturn;
|
||||
}
|
||||
|
||||
$setValues['permission'] = 'normal';
|
||||
|
||||
$db->update('general', $setValues, 'no=%i', $generalID);
|
||||
$db->update('general', $setSenderValues, 'no=%i', $this->senderID);
|
||||
$db->update('nation', $setOriginalNationValues, 'nation=%i', $general['nation']);
|
||||
|
||||
@@ -93,4 +93,5 @@ class GameConstBase
|
||||
public static $maxTurn = 24;
|
||||
|
||||
public static $statGradeLevel = 5;
|
||||
public static $retirementYear = 80;
|
||||
}
|
||||
|
||||
+140
-25
@@ -149,7 +149,7 @@ class Message
|
||||
];
|
||||
|
||||
$action = Util::array_get($option['action'], null);
|
||||
if ($msgType === self::MSGTYPE_DIPLOMACY) {
|
||||
if ($msgType === self::MSGTYPE_DIPLOMACY && $action !== null) {
|
||||
$objMessage = new DiplomaticMessage(...$args);
|
||||
} elseif ($action === 'scout') {
|
||||
$objMessage = new ScoutMessage(...$args);
|
||||
@@ -184,7 +184,7 @@ class Message
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getMessageByID(int $messageID) : Message
|
||||
public static function getMessageByID(int $messageID) : ?Message
|
||||
{
|
||||
$db = DB::db();
|
||||
$now = new \DateTime();
|
||||
@@ -217,7 +217,7 @@ class Message
|
||||
$where->add('type = %s', $msgType);
|
||||
$where->add('valid_until > %s', $date);
|
||||
if ($fromSeq > 0) {
|
||||
$where->add('id > %i', $fromSeq);
|
||||
$where->add('id >= %i', $fromSeq);
|
||||
}
|
||||
|
||||
if ($limit > 0) {
|
||||
@@ -231,6 +231,95 @@ class Message
|
||||
}, $db->query('SELECT * FROM `message` WHERE %l ORDER BY id DESC %? ', $where, $limitSql));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $mailbox 메일 사서함.
|
||||
* @param string $msgType 메일 타입. MSGTYPE 중 하나.
|
||||
* @param int $toSeq 가져오고자 하는 위치. $toSeq보다 '작은' seq만 가져온다.
|
||||
* @param int $limit 가져오고자 하는 수.
|
||||
* @return Message[]
|
||||
*/
|
||||
public static function getMessagesFromMailBoxOld(int $mailbox, string $msgType, int $toSeq, int $limit = 20)
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
if (!static::isValidMsgType($msgType)) {
|
||||
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);
|
||||
$where->add('id < %i', $toSeq);
|
||||
|
||||
if ($limit > 0) {
|
||||
$limitSql = $db->sqleval('LIMIT %i', $limit);
|
||||
} else {
|
||||
$limitSql = new \MeekroDBEval('');
|
||||
}
|
||||
|
||||
return array_map(function ($row) {
|
||||
return static::buildFromArray($row);
|
||||
}, $db->query('SELECT * FROM `message` WHERE %l ORDER BY id DESC %? ', $where, $limitSql));
|
||||
}
|
||||
|
||||
public static function deleteMsg(int $msgID, int $generalID):?string{
|
||||
$msgObj = static::getMessageByID($msgID);
|
||||
if($msgObj=== null){
|
||||
return '메시지가 없습니다';
|
||||
}
|
||||
|
||||
if($msgObj->src->generalID != $generalID){
|
||||
return '본인의 메시지만 삭제할 수 있습니다.';
|
||||
}
|
||||
|
||||
if($msgObj instanceof DiplomaticMessage){
|
||||
return '시스템 외교 메시지는 삭제할 수 없습니다.';
|
||||
}
|
||||
|
||||
$prev5min = new \DateTime();
|
||||
$prev5min->sub(new \DateInterval('PT5M'));
|
||||
|
||||
if($msgObj->date < $prev5min){
|
||||
return '5분 이내의 메시지만 삭제할 수 있습니다.';
|
||||
}
|
||||
|
||||
$msgOption = [
|
||||
'hide'=>true,
|
||||
'silence'=>true,
|
||||
'overwrite'=>[$msgObj->id]
|
||||
];
|
||||
|
||||
if($msgObj->msgType == Message::MSGTYPE_PRIVATE || $msgObj->msgType == Message::MSGTYPE_NATIONAL){
|
||||
$receiveID = $msgObj->msgOption['receiverMessageID']??null;
|
||||
if($receiveID !== null){
|
||||
$msgObj2 = static::getMessageByID($receiveID);
|
||||
if($msgObj2 !== null){
|
||||
$msgObj2->invalidate(null, false);
|
||||
$msgOption['overwrite'][] = [$msgObj2->id];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$in1min = new \DateTime();
|
||||
$in1min->add(new \DateInterval('PT1M'));
|
||||
$newMsg = new Message(
|
||||
$msgObj->msgType,
|
||||
$msgObj->src,
|
||||
$msgObj->dest,
|
||||
"req_del_msg",
|
||||
new \DateTime(),
|
||||
$in1min,
|
||||
$msgOption
|
||||
);
|
||||
$msgObj->invalidate(null, false);
|
||||
$newMsg->send(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function sendRaw(int $mailbox):array{
|
||||
//NOTE:: 여기선 검증하지 않는다.
|
||||
|
||||
@@ -268,7 +357,7 @@ class Message
|
||||
}
|
||||
|
||||
private function sendToSender():array{
|
||||
if($this->sendCnt > 0){
|
||||
if($this->sendCnt > 1){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE && $this->src->generalID !== $this->dest->generalID){
|
||||
@@ -277,23 +366,38 @@ class Message
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL && $this->src->nationID !== $this->dest->nationID){
|
||||
return $this->sendRaw($this->src->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
if($this->msgType === self::MSGTYPE_DIPLOMACY && !key_exists('action', $this->msgOption)){
|
||||
return $this->sendRaw($this->src->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
return [0, 0];
|
||||
}
|
||||
|
||||
private function sendToReceiver() : array{
|
||||
if($this->sendCnt > 1 || $this->isInboxMail){
|
||||
if($this->sendCnt > 0 || $this->isInboxMail){
|
||||
throw new \RuntimeException('이미 전송한 메일입니다.');
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_PRIVATE){
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'no=%i',$this->dest->generalID);
|
||||
if(!($this->msgOption['silence']??false)){
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'no=%i',$this->dest->generalID);
|
||||
}
|
||||
return $this->sendRaw($this->dest->generalID);
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL || $this->msgType === self::MSGTYPE_DIPLOMACY){
|
||||
if($this->msgType === self::MSGTYPE_NATIONAL){
|
||||
return $this->sendRaw($this->dest->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
|
||||
if($this->msgType === self::MSGTYPE_DIPLOMACY){
|
||||
if(!($this->msgOption['silence']??false)){
|
||||
//XXX: 알림을 이런식으로 보내는게 맞는가에 대한 의문 있음
|
||||
DB::db()->update('general', [
|
||||
'newmsg'=>1
|
||||
], 'nation = %i AND (level = 12 OR permission IN (\'ambassador\', \'auditor\')) ',$this->dest->nationID);
|
||||
}
|
||||
return $this->sendRaw($this->dest->nationID + self::MAILBOX_NATIONAL);
|
||||
}
|
||||
|
||||
@@ -305,18 +409,7 @@ class Message
|
||||
}
|
||||
|
||||
public function send(bool $sendDestOnly=false):int{
|
||||
if(!$sendDestOnly){
|
||||
list($senderMailbox, $sendID) = $this->sendToSender();
|
||||
if($sendID){
|
||||
$this->mailbox = $senderMailbox;
|
||||
$this->isInboxMail = false;
|
||||
$this->id = $sendID;
|
||||
$this->msgOption['senderMessageID'] = $sendID;
|
||||
$this->sendCnt = 1;
|
||||
}
|
||||
}
|
||||
|
||||
list($receiverMailbox, $receiveID) = $this->sendToReceiver();
|
||||
[$receiverMailbox, $receiveID] = $this->sendToReceiver();
|
||||
if(!$receiveID && !$sendDestOnly){
|
||||
return $sendID;
|
||||
}
|
||||
@@ -324,17 +417,39 @@ class Message
|
||||
$this->isInboxMail = true;
|
||||
$this->id = $receiveID;
|
||||
$this->msgOption['receiverMessageID'] = $receiveID;
|
||||
$this->sendCnt = 2;
|
||||
$this->sendCnt = 1;
|
||||
|
||||
if(!$sendDestOnly){
|
||||
[$senderMailbox, $sendID] = $this->sendToSender();
|
||||
if($sendID){
|
||||
$this->mailbox = $senderMailbox;
|
||||
$this->isInboxMail = false;
|
||||
$this->id = $sendID;
|
||||
$this->msgOption['senderMessageID'] = $sendID;
|
||||
$this->sendCnt = 2;
|
||||
}
|
||||
}
|
||||
|
||||
return $receiveID;
|
||||
}
|
||||
|
||||
public function invalidate(array $newMsgOption=null){
|
||||
public function invalidate(?array $newMsgOption=null, bool $hideMsg=true){
|
||||
if($newMsgOption !== null){
|
||||
$this->msgOption = $newMsgOption;
|
||||
}
|
||||
|
||||
$this->validUntil = new \DateTime('2000-12-31');
|
||||
$this->msgOption['invalid'] = true;
|
||||
|
||||
if($hideMsg){
|
||||
$this->validUntil = new \DateTime('2000-12-31');
|
||||
}
|
||||
else{
|
||||
if(key_exists('receiverMessageID', $this->msgOption)){
|
||||
$this->msgOption['originalText'] = $this->msg;
|
||||
}
|
||||
$this->msg = '삭제된 메시지입니다.';
|
||||
}
|
||||
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('message', [
|
||||
|
||||
@@ -164,6 +164,8 @@ class ResetHelper{
|
||||
'plock'=>1
|
||||
]);
|
||||
|
||||
$prevWinner = $db->queryFirstField('SELECT l12name FROM emperior ORDER BY `no` DESC LIMIT 1');
|
||||
|
||||
CityConst::build();
|
||||
$cityPositions = [];
|
||||
foreach(CityConst::all() as $city){
|
||||
@@ -235,7 +237,8 @@ class ResetHelper{
|
||||
'npcmode'=>$npcmode,
|
||||
'extended_general'=>$extend,
|
||||
'fiction'=>$fiction,
|
||||
'tnmt_trig'=>$tournament_trig
|
||||
'tnmt_trig'=>$tournament_trig,
|
||||
'prev_winner'=>$prevWinner
|
||||
];
|
||||
|
||||
foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"startYear":181,
|
||||
"life":1,
|
||||
"fiction":0,
|
||||
"const":{
|
||||
"defaultMaxGeneral":600
|
||||
},
|
||||
"nation":[
|
||||
["후한", "#800000", 10000, 10000, "후한왕조", 1500, "유가", 7,[
|
||||
"낙양","계","역경","진양","남피","호관","호로","사곡","함곡","사수","하내","장안","홍농","완"
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"startYear":187,
|
||||
"life":1,
|
||||
"fiction":0,
|
||||
"const":{
|
||||
"defaultMaxGeneral":600
|
||||
},
|
||||
"nation":[
|
||||
["동탁", "#A9A9A9", 10000, 10000, "천하 권력을 노리는 동탁", 1500, "법가", 5, [
|
||||
"낙양", "사곡", "함곡", "호로", "호관", "사수", "안정", "장안", "홍농"
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
"startYear":191,
|
||||
"life":1,
|
||||
"fiction":0,
|
||||
"const":{
|
||||
"defaultMaxGeneral":600
|
||||
},
|
||||
"nation":[
|
||||
["조조", "#000080", 100000, 100000, "여포에게 본거지를 빼앗긴 위기의 조조", 1000, "병가", 2, [
|
||||
"진류", "정도"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user