Compare commits

..
24 Commits
Author SHA1 Message Date
Hide_D 70b1f23a49 빙의 해제용 삭턴 세팅.
- 10분 미만은 30분
- 10분 이하는 60분 대기 필요
2018-05-05 23:25:21 +09:00
Hide_D 5e4493b49a 빙의 목록을 종능 순으로 정렬해서 표현 2018-05-05 23:03:10 +09:00
Hide_D dec24e09cf 빙의시 장수명 빼먹는 버그 수정 2018-05-05 22:52:53 +09:00
Hide_D 95445d8f8a 빙의창에서 만료 후 다른 장수 보기 시 안보이는 문제 해결 2018-05-05 22:46:56 +09:00
Hide_D 683a844a08 빙의 코드 개선
- 유효 기간 관련 늘림.
- 유효 기간 가까워지면 색으로 표시. 만료 표기도 추가
- 다른 장수 보기를 남은 초 기준으로 수정
2018-05-05 22:39:21 +09:00
Hide_D a75eb5b74e 장수 선택 테이블을 schema에 추가 2018-05-05 21:44:15 +09:00
Hide_D 5dfb844c7e 빙의 재선택 시간을 빠르게 2018-05-05 21:40:59 +09:00
Hide_D 20f991a205 빙의시 오래된 데이터 삭제 2018-05-05 21:22:38 +09:00
Hide_D 3c1c339498 장수 빙의 코드 변경 2018-05-05 21:20:15 +09:00
Hide_D 5974028c4d 빙의 장수 기능 추가(선택은 미완) 2018-05-05 19:51:56 +09:00
Hide_D a534b8f812 시나리오 30번 수정 2018-05-05 19:49:22 +09:00
Hide_D cb2fbf1a32 common.js에 iconpath 연산 코드 추가 2018-05-05 19:49:07 +09:00
Hide_D a1392652ae config.css에서 div, button에 적용되던 전역 style 제거
모바일 화면에서 입구 햄버거 버튼 동작
2018-05-05 19:48:38 +09:00
Hide_D 69af23b60a Session에서 requireLogin 인자 이름을 직관적으로 변경 2018-05-05 19:45:10 +09:00
Hide_D 063b3d37a6 exception이 trace 수정하도록 임시 수정 2018-05-05 19:44:22 +09:00
Hide_D ebf9b4b75d 가상 상성인 경우 새 장수는 재야임. 2018-04-30 00:15:43 +09:00
Hide_D 45fd06c195 성인으로 등장시 월이 제대로 로그로 남지 않는 버그 수정 2018-04-30 00:01:11 +09:00
Hide_D 7db3675e71 성인 등장이 꼭 1월이 아니어도 되도록 변경 2018-04-29 23:31:21 +09:00
Hide_D a19661199e Date의 비교 대상 lhs, rhs가 바뀐 버그 수정 2018-04-29 23:13:49 +09:00
Hide_D 953196ec78 예약 오픈 시 데이터를 바로 날리진 않도록 설정 2018-04-29 12:55:16 +09:00
Hide_D d5be6e3e08 내 정보에서 숙련도를 수치로 표기 2018-04-29 04:29:46 +09:00
Hide_D 551b79d8c2 관리자 패널 접속 허용, 접속 제한 쿼리 버그 수정 2018-04-29 04:02:23 +09:00
Hide_D a242b9a20e 주요 메뉴에 상단 바 추가 2018-04-29 03:08:30 +09:00
Hide_D 19e91b2de0 입구 코드 추가 2018-04-29 02:44:09 +09:00
31 changed files with 839 additions and 464 deletions
+19 -24
View File
@@ -1,8 +1,10 @@
@charset "utf-8";
* { margin: 0px; padding: 0px; }
body { color:white; background-color:black; border-width:1px; border-color:gray; }
table {
body {
color:white; background-color:black; font-family: '맑은 고딕';
}
table {
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black;
padding: 0px;
font-size: 13px;
@@ -23,14 +25,8 @@ a.just_link {
text-decoration: none;
}
div {
margin:0px;
padding: 0px;
word-break: break-all;
font-family: '맑은 고딕';
}
.with_border{
margin:0;
border: solid 1px;
border-spacing: 0px;
border-collapse: separate;
@@ -45,6 +41,8 @@ div {
line-height:50px;
font-size: 30px; font-weight: bold;
text-align: center;
color:white;
padding:0;
}
.legacy_layout div {
@@ -56,8 +54,6 @@ div {
font-family: '맑은 고딕';;
}
font { font-family: '맑은 고딕';}
.obj_fill{
display:block;
width:100%;
@@ -70,23 +66,18 @@ button.with_skin {
font-size: 13px;
}
button.with_skin:disabled {
background-color:#333333;
}
input.with_skin {
background-color: black; color: white;
font-family: '맑은 고딕';
font-size: 13px;
}
select {
width: 100px; height: 18px;
background-color: black; color: white;
font-family: '맑은 고딕';
font-size: 13px;
}
button {
width: 100px; height: 20px;
background-color: black; color: white;
font-family: '맑은 고딕';
font-size: 13px;
input.with_skin:disabled {
background-color: #333333;
}
.font0 { font-size: 10px; }
@@ -94,4 +85,8 @@ button {
.font2 { font-size: 15px; }
.font3 { font-size: 20px; }
.font4 { font-size: 30px; }
.font5 { font-size: 50px; }
.font5 { font-size: 50px; }
caption.section_title {
caption-side:top;
}
+5 -93
View File
@@ -1,5 +1,9 @@
@charset "utf-8";
body{
line-height: 1.3;
}
#server_notice {
margin:10px 0;
border: none;
@@ -55,77 +59,6 @@
text-align:center;
}
/*Legacy*/
#Entrance_00 {
width: 800px;
position: absolute; top: 50px; left: 50%;
margin-left: -400px;
border: none;
}
#Entrance_0004 {
width: 52px; height: 52px;
position: absolute; top: 0px; left: -62px;
border: 1px solid white;
}
#Entrance_0005 {
width: 160px; height: 600px;
position: absolute; top: 62px; left: -170px;
}
#Entrance_0006 {
width: 160px; height: 600px;
position: absolute; top: 62px; left: 810px;
}
#Entrance_0000 {
width: 800px; height: 134px;
position: absolute; top: 0px; left: 0px;
}
#Entrance_000000 {
width: 798px; height: 50px;
position: absolute; top: 0px; left: 0px;
font-size: 30px; font-weight: bold;
}
#Entrance_000001 {
width: 798px; height: 20px;
position: absolute; top: 52px; left: 0px;
border: none;
}
#Entrance_00000000 {
width: 98px; height: 20px;
position: absolute; top: 0px; left: 0px;
}
#Entrance_00000001 {
width: 398px; height: 20px;
position: absolute; top: 0px; left: 100px;
}
#Entrance_00000002 {
width: 178px; height: 20px;
position: absolute; top: 0px; left: 500px;
}
#Entrance_00000003 {
width: 118px; height: 20px;
position: absolute; top: 0px; left: 680px;
}
#Entrance_000002 {
width: 798px; height: 64px;
position: absolute; top: 74px; left: 0px;
border: none;
}
.Entrance_ServerList {
width: 800px; height: 64px;
border: none;
@@ -197,25 +130,4 @@
.Entrance_Hwe {
color: red; font-size: 15px; font-weight: bold;
}
#Entrance_0001 {
width: 800px; height: 130px;
position: absolute; top: 154px; left: 0px;
}
#Entrance_000100 {
width: 798px; height: 50px;
position: absolute; top: 0px; left: 0px;
font-size: 30px; font-weight: bold;
}
#Entrance_000101 {
width: 200px; height: 50px;
position: absolute; top: 65px; left: 150px;
}
#Entrance_000102 {
width: 200px; height: 50px;
position: absolute; top: 65px; left: 450px;
}
}
+6 -8
View File
@@ -21,6 +21,7 @@
right: 6px;
margin:6px;
height:40px;
line-height:40px;
}
#btn_delete_me{
@@ -37,15 +38,15 @@
#image_upload_filename{
position:absolute;
height:16px;
height:20px;
left:10px;
width:130px;
top:16px;
top:12px;
}
#image_upload_fake_btn{
top:16px;
height:20px;
top:12px;
height:22px;
right:10px;
position:absolute;
}
@@ -53,8 +54,7 @@
#image_upload{
opacity: 0;
position:absolute;
top:16px;
height:22px;
top:12px;
left:0;
height:20px;
width:100%;
@@ -70,7 +70,6 @@
bottom:0;
left:0;
width:50%;
height:20px;
}
#btn_remove_icon{
@@ -78,7 +77,6 @@
bottom:0;
right:0;
width:50%;
height:20px;
}
#third_use_disallow{
+1
View File
@@ -82,6 +82,7 @@ function logExceptionByCustomHandler(\Throwable $e){
], Json::PRETTY);
file_put_contents(ROOT.'/d_log/err_log.txt',"$data\n", FILE_APPEND);
echo $e->getTraceAsString();
throw $e;
}
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
+7
View File
@@ -216,6 +216,13 @@ $result = Util::generateFileUsingSimpleTemplate(
true
);
$result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/menu.orig.js',
ROOT.'/d_shared/menu.js',
[],
true
);
if ($result !== true) {
Json::die([
'result'=>false,
+8
View File
@@ -0,0 +1,8 @@
window.sammo_menu = [
['/bbs/board', '삼모게시판', '_blank'],
['/bbs/tip', '팁/강좌', '_blank'],
['/bbs/news', '삼국 일보', '_blank'],
['/bbs/history2', '개인 열전', '_blank'],
['/bbs/history3', '국가 열전', '_blank'],
['/bbs/patch', '패치 내역', '_blank']
];
+2 -2
View File
@@ -191,12 +191,12 @@ switch($btn) {
], '`no` IN %li', $genlist);
break;
case "접속 허용":
$db->update('genera',[
$db->update('general',[
'con'=>0
], '`no` IN %li', $genlist);
break;
case "접속 제한":
$db->update('genera',[
$db->update('general',[
'con'=>1000
], '`no` IN %li', $genlist);
break;
+32 -21
View File
@@ -7,6 +7,7 @@ include "func.php";
$btn = Util::getReq('btn');
$mode = Util::getReq('mode', 'int', 2);
$tnmt = Util::getReq('tnmt', 'int', 1);
$detachNPC = Util::getReq('detachNPC', 'bool');
extractMissingPostToGlobals();
@@ -27,33 +28,48 @@ $connect=$db->get();
increaseRefresh("내정보", 1);
$query = "select myset from general where owner='{$userID}'";
$query = "select no,npc,mode,tnmt,myset from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result);
if ($me['myset'] > 0) {
$submit = 'submit';
} else {
$submit = 'hidden';
}
if ($btn == "설정저장" && $me['myset'] > 0) {
if (($btn == "설정저장" || $detachNPC) && $me['myset'] > 0) {
if ($me['myset'] > 1) {
$submit = 'submit';
} else {
$submit = 'hidden';
}
$me['myset'] -= 1;
$db->update('general', [
'myset'=>$db->sqleval('myset-1'),
'mode'=>$mode,
'tnmt'=>$tnmt
], 'owner=%i', $userID);
}
$query = "select no,mode,tnmt,myset from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result);
if($me['npc'] == 1 && $detachNPC){
$turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1');
if($turnterm < 10){
$targetKillTurn = 30 / $turnterm;
}
else{
$targetKillTurn = 60 / $turnterm;
}
$db->update('general', [
'killturn'=>$targetKillTurn
], 'owner=%i AND npc=1', $userID);
$me['killturn']=$targetKillTurn;
}
}
?>
<!DOCTYPE html>
@@ -63,13 +79,6 @@ $me = MYDB_fetch_array($result);
<title><?=UniqueConst::$serverName?>: 내정보</title>
<link href="../d_shared/common.css" rel="stylesheet">
<link rel=stylesheet href="css/common.css">
<script type="text/javascript">
function go(type) {
if(type == 0){
location.replace('c_vacation.php');
}
}
</script>
</head>
@@ -83,23 +92,25 @@ function go(type) {
<?php myInfo(); ?>
<?php myInfo2(); ?>
</td>
<td width=50% valign=top>
<td width=50% valign=top style="padding-left:4ch;">
<form name=form1 action=b_myPage.php method=post>
&nbsp;&nbsp;&nbsp;&nbsp;토너먼트 【
토너먼트 【
<input type=radio name=tnmt value=0 <?=$me['tnmt']==0?"checked":""; ?>>수동참여
<input type=radio name=tnmt value=1 <?=$me['tnmt']==1?"checked":""; ?>>자동참여
】<br>
&nbsp;&nbsp;&nbsp;&nbsp;∞<font color=orange>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</font><br><br>
&nbsp;&nbsp;&nbsp;&nbsp;수비 【
∞<font color=orange>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</font><br><br>
수비 【
<input type=radio name=mode value=2 <?=$me['mode']==2?"checked":""; ?>>◎(훈사80)
<input type=radio name=mode value=1 <?=$me['mode']==1?"checked":""; ?>>○(훈사60)
<input type=radio name=mode value=0 <?=$me['mode']==0?"checked":""; ?>>×
】<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;<input type=<?=$submit?> name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
&nbsp;&nbsp;&nbsp;&nbsp;∞<font color=orange>설정저장은 이달중 <?=$me['myset']?>회 남았습니다.</font><br><br>
<input type=<?=$submit?> name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
∞<font color=orange>설정저장은 이달중 <?=$me['myset']?>회 남았습니다.</font><br><br>
</form>
&nbsp;&nbsp;&nbsp;&nbsp;휴 가 신 청<br>
&nbsp;&nbsp;&nbsp;&nbsp;<input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=휴가신청 onclick='go(0)'>
휴 가 신 청<br>
<a href="c_vacation.php"><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>휴가 신청</button></a><br><br>
빙의 해제용 삭턴 조절<br>
<a href="b_myPage.php?detachNPC=1"><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>빙의 해체 요청</button></a>
</td>
</tr>
<tr>
+2 -1
View File
@@ -3,11 +3,12 @@
html, body{
background-color:black;
color:white;
line-height:1.3;
}
table { font-family:'맑은 고딕'; }
font { font-family:'맑은 고딕'; }
input { font-family:'맑은 고딕'; height:20px }
input { font-family:'맑은 고딕'; font-size:13px; }
select { font-family:'굴림'; line-height:100%; }
/* */
+48
View File
@@ -0,0 +1,48 @@
.container{
width:1000px;
margin:0 auto;
}
.card_holder{
text-align:center;
}
.general_card{
width:100px;
display:inline-block;
}
.general_card h4 {
margin:0;
}
.general_card p {
margin:0;
}
.general_card .select_btn {
width:100%;
}
.general_card label {
display: block;
padding-left: 15px;
text-indent: -15px;
}
.general_card input {
width: 13px;
height: 13px;
padding: 0;
margin:0;
vertical-align: bottom;
position: relative;
top: -1px;
*overflow: hidden;
}
#outdate_token{
color:red;
display:none;
}
+23 -12
View File
@@ -1002,11 +1002,17 @@ function generalInfo2($no) {
if($dex30 > 100) { $dex30 = 100; }
if($dex40 > 100) { $dex40 = 100; }
$general['dex0'] = getDexCall($general['dex0']);
$general['dex10'] = getDexCall($general['dex10']);
$general['dex20'] = getDexCall($general['dex20']);
$general['dex30'] = getDexCall($general['dex30']);
$general['dex40'] = getDexCall($general['dex40']);
$general['dex0_text'] = getDexCall($general['dex0']);
$general['dex10_text'] = getDexCall($general['dex10']);
$general['dex20_text'] = getDexCall($general['dex20']);
$general['dex30_text'] = getDexCall($general['dex30']);
$general['dex40_text'] = getDexCall($general['dex40']);
$general['dex0_short'] = sprintf('%.1fK', $general['dex0']/1000);
$general['dex10_short'] = sprintf('%.1fK', $general['dex10']/1000);
$general['dex20_short'] = sprintf('%.1fK', $general['dex20']/1000);
$general['dex30_short'] = sprintf('%.1fK', $general['dex30']/1000);
$general['dex40_short'] = sprintf('%.1fK', $general['dex40']/1000);
echo "<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr><td align=center colspan=6 id=bg1><b>추 가 정 보</b></td></tr>
@@ -1042,30 +1048,35 @@ function generalInfo2($no) {
</tr>
</table>
<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr><td align=center colspan=3 id=bg1><b>숙 련 도</b></td></tr>
<tr><td align=center colspan=4 id=bg1><b>숙 련 도</b></td></tr>
<tr height=16>
<td width=64 align=center id=bg1><b>보병</b></td>
<td width=64>  {$general['dex0']}</td>
<td width=366 align=center>".bar($dex0, 16)."</td>
<td width=40> {$general['dex0_text']}</td>
<td width=60 align=right>{$general['dex0_short']}&nbsp;</td>
<td width=330 align=center>".bar($dex0, 16)."</td>
</tr>
<tr height=16>
<td align=center id=bg1><b>궁병</b></td>
<td>  {$general['dex10']}</td>
<td> {$general['dex10_text']}</td>
<td align=right>{$general['dex10_short']}&nbsp;</td>
<td align=center>".bar($dex10, 16)."</td>
</tr>
<tr height=16>
<td align=center id=bg1><b>기병</b></td>
<td>  {$general['dex20']}</td>
<td> {$general['dex20_text']}</td>
<td align=right>{$general['dex20_short']}&nbsp;</td>
<td align=center>".bar($dex20, 16)."</td>
</tr>
<tr height=16>
<td align=center id=bg1><b>귀병</b></td>
<td>  {$general['dex30']}</td>
<td> {$general['dex30_text']}</td>
<td align=right>{$general['dex30_short']}&nbsp;</td>
<td align=center>".bar($dex30, 16)."</td>
</tr>
<tr height=16>
<td align=center id=bg1><b>차병</b></td>
<td>  {$general['dex40']}</td>
<td> {$general['dex40_text']}</td>
<td align=right>{$general['dex40_short']}&nbsp;</td>
<td align=center>".bar($dex40, 16)."</td>
</tr>
</table>";
+57 -5
View File
@@ -6,15 +6,67 @@ include "func.php";
$db = DB::db();
$reserved = $db->queryFirstRow(
'SELECT * FROM reserved_open WHERE `date` <= %s LIMIT 1',
(new \DateTime())->format('Y-m-d H:i:s')
);
$reserved = $db->queryFirstRow('SELECT `date`, options FROM reserved_open ORDER BY `date` ASC LIMIT 1');
if(!$reserved){
Json::die([
'result'=>true,
'affected'=>0
'affected'=>0,
'status'=>'no_reserved'
]);
}
$reservedDate = new \DateTime($reserved['date']);
$now = new \DateTime();
$status = 'not_yet';
if ($db->queryFirstField("SHOW TABLES LIKE 'game'")) {
list($isUnited, $lastTurn) = $db->queryFirstList('SELECT isUnited, turntime FROM game LIMIT 1');
}
else{
$isUnited = 2;
$lastTurn = '2000-01-01';
}
if($lastTurn !== null){
$lastTurn = new \DateTime($lastTurn);
}
if($lastTurn === null){
//이미 리셋된 상태임
}
else if(file_exists(__dir__.'/.htaccess')){
//일단 서버는 닫혀 있음
}
else if(
$isUnited == 2 &&
$now->getTimestamp() - $lastTurn->getTimestamp() > $reservedDate->getTimestamp() - $now->getTimestamp()
){
//정지 상태 & 중간 넘음
AppConf::getList()[DB::prefix()]->closeServer();
$status = 'closed';
}
else if(
$isUnited > 0 &&
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
){
//천통 & 비정지 상태 & 2/3 넘음
AppConf::getList()[DB::prefix()]->closeServer();
$status = 'closed';
}
else if($reservedDate->getTimestamp() - $now->getTimestamp() <= 60*10){
//어쨌든 간에 10분 남았다면.
AppConf::getList()[DB::prefix()]->closeServer();
$status = 'closed';
}
if($now < $reservedDate){
Json::die([
'result'=>true,
'affected'=>0,
'status'=>$status
]);
}
+169
View File
@@ -0,0 +1,169 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
const VALID_SECOND = 90;
const PICK_MORE_SECOND = 10;
const KEEP_CNT = 3;
$refresh = Util::getReq('refresh', 'bool', false);
$keepResult = Util::getReq('keep', 'array_int', []);
$session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID();
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$db = DB::db();
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
if($oldGeneral !== null){
Json::die([
'result'=>false,
'reason'=>'이미 장수가 생성되었습니다'
]);
}
list(
$maxgeneral,
$turnterm,
$npcmode
) = $db->queryFirstList('SELECT maxgeneral,turnterm,npcmode from game limit 1');
if(!$npcmode){
Json::die([
'result'=>false,
'reason'=>'빙의 가능한 서버가 아닙니다'
]);
}
$token = $db->queryFirstRow('SELECT * FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
$pickResult = [];
if($token && $refresh){
$pickMoreFrom = (new \DateTime($token['pick_more_from']))->getTimestamp();
$nowT = $oNow->getTimestamp();
if($nowT >= $pickMoreFrom){
$oldPickResult = Json::decode($token['pick_result']);
foreach($keepResult as $keepId){
if(\key_exists($keepId, $oldPickResult) && $oldPickResult[$keepId]['keepCnt'] > 0){
$pickResult[$keepId] = $oldPickResult[$keepId];
$pickResult[$keepId]['keepCnt']-=1;
}
}
if(count($pickResult) == count($oldPickResult)){
$refresh = false;
}
}
else{
Json::die([
'result'=>false,
'reason'=>'아직 다시 뽑을 수 없습니다',
]);
}
}
if($token && !$refresh){
$pickMoreFrom = (new \DateTime($token['pick_more_from']))->getTimestamp();
$nowT = $oNow->getTimestamp();
Json::die([
'result'=>true,
'pick'=>Json::decode($token['pick_result']),
'pickMoreFrom'=>$token['pick_more_from'],
'pickMoreSeconds'=>$pickMoreFrom-$nowT,
'validUntil'=>$token['valid_until']
]);
}
$candidates = [];
$weight = [];
foreach($db->query('SELECT `no`, `name`, leader, power, intel, imgsvr, picture, special, special2 FROM general WHERE npc=2') as $general){
$general['special'] = \sammo\SpecialityConst::DOMESTIC[$general['special']][0]??'-';
$general['special2'] = \sammo\SpecialityConst::WAR[$general['special2']][0]??'-';
$candidates[$general['no']] = $general + ['keepCnt'=>KEEP_CNT];
$allStat = $general['leader'] + $general['power'] + $general['intel'];
$weight[$general['no']] = pow($allStat, 1.5);
}
foreach($db->queryFirstColumn('SELECT pick_result FROM select_npc_token WHERE `owner`!=%i AND valid_until >=%s', $userID, $now) as $reserved){
$reserved = Json::decode($reserved);
foreach(array_keys($reserved) as $reservedNPC){
if(key_exists($reservedNPC, $weight)){
unset($candidates[$reservedNPC]);
unset($weight[$reservedNPC]);
}
}
}
$pickLimit = min(count($candidates), 5);
while(count($pickResult) < $pickLimit){
$generalID = Util::choiceRandomUsingWeight($weight);
if(!key_exists($generalID, $pickResult)){
$pickResult[$generalID] = $candidates[$generalID];
}
}
$newNonce = mt_rand(0, 0xfffffff);
$validSecond = max(VALID_SECOND, $turnterm*40);
$pickMoreSecond = max(PICK_MORE_SECOND, $turnterm*10);
$validUntil = $oNow->add(new \DateInterval(sprintf('PT%dS', $validSecond)));
$pickMoreFrom = $oNow->add(new \DateInterval(sprintf('PT%dS', $pickMoreSecond)));
$db->delete('select_npc_token', 'valid_until < %s', $now);
$inserted = 0;
if($token){
$db->update('select_npc_token', [
'valid_until'=>$validUntil->format('Y-m-d H:i:s'),
'pick_more_from'=>$pickMoreFrom->format('Y-m-d H:i:s'),
'pick_result'=>Json::encode($pickResult),
'nonce'=>$newNonce
], 'owner = %i AND nonce = %i', $userID, $token['nonce']);
if($db->affectedRows()){
$inserted = -1;
}
}
else{
$db->insertIgnore('select_npc_token', [
'owner'=>$userID,
'valid_until'=>$validUntil->format('Y-m-d H:i:s'),
'pick_more_from'=>'2000-01-01 01:00:00',
'pick_result'=>Json::encode($pickResult),
'nonce'=>$newNonce
]);
if($db->affectedRows()){
$inserted = 1;
}
}
if($inserted === 0){
Json::die([
'result'=>false,
'reason'=>'중복 요청, 다시 랜덤 토큰을 확인해주세요'
]);
}
Json::die([
'result'=>true,
'pick'=>$pickResult,
'pickMoreFrom'=>($inserted===-1)?$pickMoreFrom->format('Y-m-d H:i:s'):'2000-01-01 01:00:00',
'pickMoreSeconds'=>($inserted===-1)?$pickMoreSecond:0,
'validUntil'=>$validUntil->format('Y-m-d H:i:s')
]);
+12 -3
View File
@@ -52,9 +52,18 @@ if($reserve_open){
$reserve_open = new \DateTime($reserve_open);
$db = DB::db();
$clearResult = ResetHelper::clearDB();
if(!$clearResult['result']){
Json::die($clearResult);
if (!$db->queryFirstField("SHOW TABLES LIKE 'game'")) {
$clearResult = ResetHelper::clearDB();
if(!$clearResult['result']){
Json::die($clearResult);
}
}
if (!$db->queryFirstField("SHOW TABLES LIKE 'reserved_open'")) {
Json::die([
'result'=>false,
'reason'=>'예약 테이블이 없음!'
]);
}
$scenarioObj = new Scenario($scenario, true);
+112
View File
@@ -0,0 +1,112 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$pick = Util::getReq('pick', 'int');
if(!$pick){
Json::die([
'result'=>false,
'reason'=>'장수를 선택하지 않았습니다'
]);
}
$session = Session::requireLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$rootDB = RootDB::db();
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$userNick = RootDB::db()->queryFirstField('SELECT `NAME` FROM member WHERE `NO`=%i',$userID);
if(!$userNick){
Json::die([
'result'=>false,
'reason'=>'멤버 정보를 가져오지 못했습니다.'
]);
}
$pickResult = $db->queryFirstField('SELECT pick_result FROM select_npc_token WHERE `owner`=%i AND `valid_until`>=%s', $userID, $now);
if(!$pickResult){
Json::die([
'result'=>false,
'reason'=>'유효한 장수 목록이 없습니다.'
]);
}
$pickResult = Json::decode($pickResult);
if(!key_exists($pick, $pickResult)){
Json::die([
'result'=>false,
'reason'=>'선택한 장수가 목록에 없습니다.'
]);
}
$pickedNPC = $pickResult[$pick];
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
list(
$year,
$month,
$maxgeneral,
$npcmode
) = $db->queryFirstList('SELECT year,month,maxgeneral,npcmode from game limit 1');
if(!$npcmode){
Json::die([
'result'=>false,
'reason'=>'빙의 가능한 서버가 아닙니다'
]);
}
if ($gencount >= $maxgeneral) {
Json::die([
'result'=>false,
'reason'=>'더 이상 등록 할 수 없습니다.'
]);
}
//등록 시작
$db->update('general', [
'name2'=>$userNick,
'npc'=>1,
'killturn'=>6,
'mode'=>2,
'owner'=>$userID,
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
if(!$db->affectedRows()){
Json::die([
'result'=>false,
'reason'=>'장수 등록에 실패했습니다.'
]);
}
$db->delete('select_npc_token', 'owner=%i or valid_until < %s', $userID, $now);
pushGeneralHistory($pickedNPC, "<C>●</>{$year}{$month}월:<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>(이)가 빙의되다.");
//pushGenLog($me, $mylog);
pushGeneralPublicRecord(["<C>●</>{$month}월:<Y>{$pickedNPC['name']}</>의 육체에 <Y>{$userNick}</>(이)가 <S>빙의</>됩니다!"], $year, $month);
pushAdminLog(["가입 : {$userID} // {$session->userName} // {$pick} // ".getenv("REMOTE_ADDR")]);
$rootDB->insert('member_log', [
'member_no' => $userID,
'date'=>date('Y-m-d H:i:s'),
'action_type'=>'make_general',
'action'=>Json::encode([
'server'=>DB::prefix(),
'type'=>'npc',
'generalID'=>$npc['no'],
'generalName'=>$npc['name']
])
]);
Json::die([
'result'=>true,
'reason'=>'success'
]);
+10
View File
@@ -118,4 +118,14 @@ var TemplateEngine = function (html, options) {
try { result = new Function('obj', code).apply(options, [options]); }
catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
return result;
}
function getIconPath(imgsvr, picture){
// ../d_shared/common_path.js 필요
if(!imgsvr){
return pathConfig.sharedIcon+'/'+picture;
}
else{
return pathConfig.root+'/d_pic/'+picture;
}
}
+134
View File
@@ -0,0 +1,134 @@
var templateGeneralCard =
'<div class="general_card">\
<h4 class="bg1 with_border"><%name%></h4>\
<h4><img src="<%iconPath%>" height=64 width=64></h4>\
<p><%leader%> / <%power%> / <%intel%><br>\
<%special%> / <%special2%></p>\
<button type="subject" class="with_skin with_border select_btn" value="<%no%>" name="pick">빙의하기</button>\
<label><input <%keepCnt?"":disabled="disabled"%> type="checkbox" value="<%no%>" name="keep[]" class="keep_select">보관(<%keepCnt%>회)</label>\
</div>';
function pickGeneral(){
$btn = $(this);
$.post({
url:'j_select_npc.php',
dataType:'json',
data:{
pick:$btn.val()
}
}).then(function(result){
if(!result.result){
alert(result.reason);
location.refresh();
}
alert('빙의에 성공했습니다.');
location.href = './';
});
return false;
}
function updateOutdateTimer(){
var $validUntilText = $('#valid_until_text');
var now = Date.now();
var validUntil = $validUntilText.data('until');
if(validUntil <= 0){
return;
}
else if(validUntil < now){
$validUntilText.data('until',0);
$('#valid_until').hide();
$('#outdate_token').show();
return;
}
else if(validUntil - now <= 30000){
$validUntilText.css('color', "rgb(255, {0}, {0})".format(255*(validUntil - now)/30000));
}
setTimeout(updateOutdateTimer, 1000);
}
function updatePickMoreTimer(){
var $btn = $('#btn_pick_more');
var now = Date.now();
var remain = ($btn.data('available') - now) / 1000;
if(remain <= 0){
$btn.prop('disabled', false)
$btn.html('다른 장수 보기');
return;
}
$btn.html('다른 장수 보기({0}초)'.format(Math.ceil(remain)));
setTimeout(updatePickMoreTimer, 250);
}
function printGenerals(value){
$('.card_holder').empty();
$('#valid_until').show();
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color','white');
$('#outdate_token').hide();
var time = Date.now() + value.pickMoreSeconds*1000;
$('#btn_pick_more').data('available', time).prop('disabled',true);
var pick = $.map(value.pick, function(value, key) {
return value;
});
pick.sort(function(lhs, rhs){
var lsum = lhs.leader+lhs.power+lhs.intel;
var rsum = rhs.leader+rhs.power+rhs.intel;
return lsum - rsum;
});
$.each(pick, function(idx, cardData){
cardData.iconPath = getIconPath(cardData.imgsvr, cardData.picture);
var $card = $(TemplateEngine(templateGeneralCard, cardData));
console.log($card);
$('.card_holder').append($card);
$card.find('.select_btn').click(pickGeneral);
});
updatePickMoreTimer();
updateOutdateTimer();
}
$(function($){
$.post('j_get_select_npc_token.php').then(function(value){
if(!value.result){
alert(value.reason);
return;
}
console.log(value);
printGenerals(value);
});
$('#btn_pick_more').click(function(){
var generals = $.map($('.keep_select:checked'), function(value){
return $(value).val();
});
console.log(generals);
$.post({
url:'j_get_select_npc_token.php',
dataType:'json',
data:{
refresh:true,
keep:generals
}
}).then(function(result){
if(!result.result){
alert(result.reason);
location.refresh();
}
console.log(result);
printGenerals(result);
});
});
});
+6 -4
View File
@@ -50,13 +50,15 @@ class Date extends \sammo\Event\Condition{
}
$lhs = [
$this->year,
$this->month
];
$rhs = [
$this->year!==null?(int)$env['year']:null,
$this->month!==null?(int)$env['month']:null
];
$rhs = [
$this->year,
$this->month
];
$value = false;
switch($this->cmp){
+14 -6
View File
@@ -86,10 +86,6 @@ class NPC{
public function build($env=[]){
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
$nationID = $this->nationID;
if(!\sammo\getNationStaticInfo($nationID)){
$nationID = 0;
};
$isFictionMode = (Util::array_get($env['fiction'], 0)!=0);
@@ -105,10 +101,22 @@ class NPC{
return false; //예약.
}
$isNewGeneral = ($age == \sammo\GameConst::$adultAge);
$nationID = $this->nationID;
if($isFictionMode && $isNewGeneral){
$nationID = 0;
}
if(!\sammo\getNationStaticInfo($nationID)){
$nationID = 0;
};
$db = DB::db();
if($age == \sammo\GameConst::$adultAge && $month == 1){
\sammo\pushWorldHistory(["<C>●</>1월:<Y>$name</>(이)가 성인이 되어 <S>등장</>했습니다."], $year, $month);
if($isNewGeneral){
\sammo\pushWorldHistory(["<C>●</>{$month}월:<Y>{$name}</>(이)가 성인이 되어 <S>등장</>했습니다."], $year, $month);
}
if($this->ego == null || $isFictionMode){
+5 -5
View File
@@ -47,7 +47,7 @@
[0, "강영식", -1, 0, null, 63, 69, 60, 0, 160, 300, null, null],
[0, "김사율", -1, 0, null, 74, 66, 67, 0, 160, 300, null, null],
[0, "배장호", -1, 0, null, 62, 48, 60, 0, 160, 300, null, null],
[0, "손민한", -1, 0, null, 85, 84, 94, 0, 160, 300, null, null, "팝콘이 먹고싶다"],
[0, "손민한", -1, 0, null, 85, 84, 94, 0, 160, 300, null, "환술", "팝콘이 먹고싶다"],
[0, "송승준", -1, 0, null, 65, 84, 67, 0, 160, 300, null, null],
[0, "이용훈", -1, 0, null, 48, 58, 63, 0, 160, 300, null, null],
[0, "임경완", -1, 0, null, 68, 57, 39, 0, 160, 300, null, null],
@@ -70,7 +70,7 @@
[0, "정보명", -1, 0, null, 69, 31, 39, 0, 160, 300, null, null],
[0, "이재곤", -1, 0, null, 40, 41, 39, 0, 160, 300, null, null],
[0, "염종석", -1, 0, null, 83, 90, 93, 0, 160, 300, null, null],
[0, "황재균", -1, 0, null, 79, 77, 83, 0, 160, 300, null, null, "안녕하세요 섹머입니다"],
[0, "황재균", -1, 0, null, 79, 77, 83, 0, 160, 300, null, "집중", "안녕하세요 섹머입니다"],
[0, "윤학길", -1, 0, null, 81, 76, 82, 0, 160, 300, null, null],
[0, "가득염", -1, 0, null, 60, 67, 61, 0, 160, 300, null, null],
[0, "조경환", -1, 0, null, 57, 78, 20, 0, 160, 300, null, null],
@@ -84,7 +84,7 @@
[0, "금광옥", -1, 0, null, 31, 30, 39, 0, 160, 300, null, null],
[0, "김무관", -1, 0, null, 20, 7, 43, 0, 160, 300, null, null],
[0, "양승관", -1, 0, null, 46, 44, 22, 0, 160, 300, null, null],
[0, "박철순", -1, 0, null, 89, 82, 80, 0, 160, 300, null, "무쌍"],
[0, "박철순", -1, 0, null, 89, 82, 80, 0, 160, 300, null, "필살"],
[0, "하기룡", -1, 0, null, 82, 58, 64, 0, 160, 300, null, null],
[0, "황규봉", -1, 0, null, 83, 48, 72, 0, 160, 300, null, null],
[0, "계형철", -1, 0, null, 74, 75, 70, 0, 160, 300, null, null],
@@ -133,8 +133,8 @@
[0, "최정", -1, 0, null, 89, 91, 88, 0, 160, 300, null, "무쌍"],
[0, "조동화", -1, 0, null, 48, 11, 83, 0, 160, 300, null, null],
[0, "김강민", -1, 0, null, 77, 77, 82, 0, 160, 300, null, null],
[0, "박용택", -1, 0, null, 92, 90, 92, 0, 160, 300, null, "신중", "팬 여러분 올해는 유광잠바 준비하셔야 될 겁니다"],
[0, "이병규", -1, 0, null, 93, 90, 89, 0, 160, 300, null, "필살"],
[0, "박용택", -1, 0, null, 92, 90, 92, 0, 160, 300, null, "환술", "팬 여러분 올해는 유광잠바 준비하셔야 될 겁니다"],
[0, "이병규", -1, 0, null, 93, 90, 89, 0, 160, 300, null, "위압"],
[0, "조인성", -1, 0, null, 49, 86, 25, 0, 160, 300, null, null],
[0, "김동수", -1, 0, null, 65, 86, 65, 0, 160, 300, null, null],
[0, "유지현", -1, 0, null, 76, 57, 87, 0, 160, 300, null, null],
+65 -118
View File
@@ -6,141 +6,88 @@ include "func.php";
$session = Session::requireLogin()->setReadOnly();
$userID = Session::getUserID();
$rootDB = RootDB::db();
$db = DB::db();
//회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('select no,name,picture,grade from member where no=%i', $userID);
list($npcmode, $maxgeneral) = $db->queryFirstList('SELECT npcmode,maxgeneral FROM game LIMIT 1');
if(!$member) {
MessageBox("잘못된 접근입니다!!!");
echo "<script>history.go(-1);</script>";
exit(1);
}
$admin = $db->queryFirstRow('select npcmode,maxgeneral,show_img_level from game limit 1');
if($admin['npcmode'] != 1) {
header('Location:join.php');
if(!$npcmode) {
header('location:..');
die();
}
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
$connect=$db->get();
$nations = $db->queryAllLists('SELECT `name`, scoutmsg, color FROM nation');
?>
<!DOCTYPE html>
<html>
<head>
<title><?=UniqueConst::$serverName?>: NPC선택</title>
<title><?=UniqueConst::$serverName?>: NPC빙의</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<link rel='stylesheet' href='css/normalize.css?180505_2' type='text/css'>
<link rel='stylesheet' href='../d_shared/common.css?180505_2' type='text/css'>
<link rel='stylesheet' href='../css/config.css?180505_2' type='text/css'>
<link rel='stylesheet' href='css/common.css?180505_2' type='text/css'>
<link rel='stylesheet' href='css/select_npc.css?180505_2' type='text/css'>
<script type="text/javascript" src="../d_shared/common_path.js"></script>
<script type="text/javascript" src="../e_lib/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../js/common.js?180505_2"></script>
<script src="js/select_npc.js?180505_4"></script>
</head>
<body onLoad='changeGen()'>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td>장 수 선 택<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center><?=info(0)?></td></tr>
</table>
<?php
$query = "select no from general where npc<2";
$result = MYDB_query($query, $connect) or Error("join ".MYDB_error($connect),"");
$gencount = MYDB_num_rows($result);
if($gencount >= $admin['maxgeneral']) {
echo "<script>alert('더 이상 등록할 수 없습니다.');</script>";
echo "<script>history.go(-1);</script>";
exit();
}
<?php
if ($gencount >= $maxgeneral) {
?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center colspan=2 id=bg1>임관 권유 메세지</td></tr>
<?php
$query = "select name,scoutmsg,color from nation";
$nationresult = MYDB_query($query, $connect) or Error("join ".MYDB_error($connect),"");
$nationcount = MYDB_num_rows($nationresult);
for($i=0; $i < $nationcount; $i++) {
$nation = MYDB_fetch_array($nationresult);
if($nation['scoutmsg'] == "") {
echo "
<tr><td align=center width=98 style=color:".newColor($nation['color']).";background-color:{$nation['color']}>{$nation['name']}</td><td width=898 style=color:".newColor($nation['color']).";background-color:{$nation['color']}>-</td></tr>";
} else {
echo "
<tr><td align=center width=98 style=color:".newColor($nation['color']).";background-color:{$nation['color']}>{$nation['name']}</td><td width=898 style=color:".newColor($nation['color']).";background-color:{$nation['color']}>{$nation['scoutmsg']}</td></tr>";
}
}
?>
</table>
<form name=form1 method=post action=select_npc_post.php>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr>
<td colspan=2 align=center id=bg1>장수 선택</td>
</tr>
<?php
if($admin['show_img_level'] >= 3) {
?>
<tr>
<td width=498 align=right rowspan=2 height=64 id=bg1>장수</td>
<td width=498><img src=<?=ServConfig::$sharedIconPath?>/1001.jpg border=0 name=picture width=64 height=64></td>
</tr>
<?php
}
?>
<tr>
<td align=left colspan=2>
<select name=face size=1 style=color:white;background-color:black; value=1001 disabled>
<?php
$query = "select no,name,leader,power,intel from general where npc=2";
$result = MYDB_query($query,$connect);
$count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) {
$npc = MYDB_fetch_array($result);
$call = "{$npc['leader']} / {$npc['power']} / {$npc['intel']}";
echo "
<option value={$npc['no']}>{$npc['name']} 【{$call}】</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td align=center colspan=2>
컴퓨터가 조작중이던 NPC장수를 조종하게 됩니다.<br>
80시간동안 휴식을 취하면 다시 컴퓨터가 조종하게 되고 장수의 소유권을 잃습니다.
</td>
</tr>
<tr>
<td align=center colspan=2><input type=button name=sel value=다른장수 onclick='changeGen()'><input type=submit name=join value=장수선택 onclick='return selectGen()'></td>
</tr>
</table>
</form>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
</body>
<script type="text/javascript">
function changeGen() {
sel = Math.floor(Math.random() * <?=$count?>);
document.form1.face.selectedIndex = sel;
num = document.form1.face.value;
document.form1.picture.src="<?=ServConfig::$sharedIconPath?>" + "/"+ num +".jpg";
}
function selectGen() {
document.form1.face.disabled = false;
return true;
}
<body>
<script>
alert('더 이상 등록할 수 없습니다.');
history.go(-1);
</script>
</body>
</html>
<?php
die();
}
?>
<body>
<div class="container">
<div class="bg0 with_border legacy_layout">장 수 선 택<br><?=backButton()?></div>
<table style="width:100%;" class="bg0 with_border">
<tr><td><?=info(0)?></td></tr>
</table>
<table style="width:100%;" class="bg0 with_border">
<thead>
<tr><th colspan=2 class="bg1">임관 권유 메세지</th></tr>
</thead>
<tbody>
<?php foreach($nations as list($name, $scoutmsg, $color)): ?>
<tr>
<td style='width:98px;color:<?=newColor($color)?>;background-color:<?=$color?>'><?=$name?></td>
<td style='color:<?=newColor($color)?>;background-color:<?=$color?>'><?=$scoutmsg?:'-'?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="bg0">
<div class="bg1 with_border legacy_layout font1" style="text-align:center;font-weight:bold;">장수 빙의</div>
<div class="with_border legacy_layout" style="text-align:center;">
<small id="valid_until">(<span id="valid_until_text"></span>까지 유효)</small><small id="outdate_token">- 만료 -</small><br>
<form class="card_holder">
</form>
</div>
<div class="with_border legacy_layout" style="text-align:center">
<button id="btn_pick_more" disabled="disabled" class="with_skin with_border">다른 장수 보기</button><br>
</div>
<div class="with_border legacy_layout"><?=backButton()?></div>
<div class="with_border legacy_layout"><?=banner()?></div>
</div>
</div>
</body>
</html>
-144
View File
@@ -1,144 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$v = new Validator($_POST);
$v
->rule('required', 'face')
->rule('integer', 'face');
if(!$v->validate()){
MessageBox($v->errorStr());
echo "<script>history.go(-1);</script>";
exit(1);
}
$session = Session::requireLogin()->setReadOnly();
$userID = Session::getUserID();
$face = (int)$_POST['face'];
$rootDB = RootDB::db();
//회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name` FROM member WHERE no=%i', $userID);
if(!$member) {
MessageBox("잘못된 접근입니다!!!");
echo "<script>history.go(-1);</script>";
exit(1);
}
$db = DB::db();
$npc = $db->queryFirstRow('SELECT `no`, `name`, `npc`, `level` FROM general WHERE `no`=%i', $face);
if(!$npc){
echo "<script>alert('선택한 장수가 없습니다!');</script>";
echo "<script>history.go(-1);</script>";
exit();
}
########## 동일 정보 존재여부 확인. ##########
list(
$year,
$month,
$maxgeneral,
$turnterm,
$genius,
$npcmode
) = $db->queryFirstList('SELECT year,month,maxgeneral,turnterm,genius,npcmode from game limit 1');
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
if($npcmode != 1) {
echo "<script>alert('잘못된 접근입니다!');</script>";
echo "<script>history.go(-1);</script>";
exit();
}
if($oldGeneral) {
echo("<script>
window.alert('이미 등록하셨습니다!')
history.go(-1)
</script>");
exit;
}
if($maxgeneral <= $gencount) {
echo("<script>
window.alert('더이상 등록할 수 없습니다!')
history.go(-1)
</script>");
exit;
}
if($npc['npc'] < 2) {
echo("<script>
window.alert('이미 선택된 장수입니다!')
history.go(-1)
</script>");
exit;
}
if($npc['npc'] != 2) {
echo("<script>
window.alert('선택할 수 없는 NPC입니다!')
history.go(-1)
</script>");
exit;
}
/*if($npc['level'] >= 5) {
echo("<script>
window.alert('수뇌부는 선택할 수 없습니다!')
history.go(-1)
</script>");
exit;
} */
$userNick = RootDB::db()->queryFirstField('SELECT `NAME` FROM member WHERE `NO`=%i',Session::getUserID());
$npcID = $npc['no'];
$db->update('general', [
'name2'=>$userNick,
'npc'=>1,
'killturn'=>6,
'mode'=>2,
'owner'=>$userID
], 'no=%i and npc=2', $npcID);
$affected = $db->affectedRows();
if(!$affected){
echo("<script>
window.alert('이미 선택된 장수입니다!')
history.go(-1)
</script>");
exit;
}
$me = [
'no'=>$npcID
];
pushGeneralHistory($me, "<C>●</>{$year}{$month}월:<Y>{$npc['name']}</>의 육체에 <Y>{$userNick}</>(이)가 빙의되다.");
//pushGenLog($me, $mylog);
pushGeneralPublicRecord(["<C>●</>{$month}월:<Y>{$npc['name']}</>의 육체에 <Y>{$userNick}</>(이)가 <S>빙의</>됩니다!"], $year, $month);
pushAdminLog(["가입 : {$userID} // {$session->userName} // {$npcID} // ".getenv("REMOTE_ADDR")]);
$rootDB->insert('member_log', [
'member_no' => $userID,
'date'=>date('Y-m-d H:i:s'),
'action_type'=>'make_general',
'action'=>Json::encode([
'server'=>DB::prefix(),
'type'=>'npc',
'generalID'=>$npc['no'],
'generalName'=>$npc['name']
])
]);
?>
<script>
window.alert('정상적으로 회원 가입되었습니다. 장수명 : <?=$npc['name']?>');
window.open('../i_other/help.php');
location.href = './';
</script>
+3 -1
View File
@@ -46,4 +46,6 @@ DROP TABLE IF EXISTS world_history;
# ( ?)
DROP TABLE IF EXISTS general_public_record;
DROP TABLE IF EXISTS reserved_open;
DROP TABLE IF EXISTS reserved_open;
DROP TABLE IF EXISTS select_npc_token;
+16
View File
@@ -656,3 +656,19 @@ CREATE TABLE `reserved_open` (
)
DEFAULT CHARSET=utf8mb4
ENGINE=MyISAM;
######
#
CREATE TABLE `select_npc_token` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`owner` INT(11) NOT NULL,
`valid_until` DATETIME NOT NULL,
`pick_more_from` DATETIME NOT NULL,
`pick_result` TEXT NOT NULL COMMENT 'json',
`nonce` INT(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `owner` (`owner`),
INDEX `valid_until` (`valid_until`)
)
DEFAULT CHARSET=utf8mb4
ENGINE=MyISAM;
+15 -1
View File
@@ -20,16 +20,19 @@ $userGrade = $session->userGrade;
<title>서버목록</title>
<!-- 스타일 -->
<link type="text/css" rel="stylesheet" href="../e_lib/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href='../d_shared/common.css'>
<link type="text/css" rel="stylesheet" href='../css/config.css'>
<link type="text/css" rel="stylesheet" href='../css/entrance.css'>
<!-- 액션 -->
<script type="text/javascript" src='../js/common.js'></script>
<script type="text/javascript" src='../e_lib/jquery-3.2.1.min.js'></script>
<script type="text/javascript" src='../e_lib/bootstrap.bundle.min.js'></script>
<script type="text/javascript" src='../js/func.js'></script>
<script type="text/javascript" src='../js/entrance.js'></script>
<script src="../d_shared/menu.js"></script>
<script src="../js/title.js"></script>
<?php if ($userGrade >= 5): ?>
<!-- 운영자 -->
@@ -40,6 +43,17 @@ $userGrade = $session->userGrade;
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="../">삼국지 모의전투 HiDCHe</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
</ul>
</div>
</nav>
<div id="server_list_container">
<?php
+15 -1
View File
@@ -6,6 +6,7 @@
<title>계정 관리</title>
<!-- 스타일 -->
<link type="text/css" rel="stylesheet" href="../e_lib/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href='../d_shared/common.css'>
<link type="text/css" rel="stylesheet" href='../css/config.css'>
<link type="text/css" rel="stylesheet" href='../css/user_info.css'>
@@ -14,16 +15,29 @@
<script src='../d_shared/common_path.js'></script>
<script type="text/javascript" src='../js/common.js'></script>
<script type="text/javascript" src='../e_lib/jquery-3.2.1.min.js'></script>
<script type="text/javascript" src='../e_lib/bootstrap.bundle.min.js'></script>
<script type="text/javascript" src='../e_lib/sha512.min.js'></script>
<script type="text/javascript" src='../js/func.js'></script>
<script type="text/javascript" src='../js/user_info.js'></script>
<script src="../d_shared/menu.js"></script>
<script src="../js/title.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="../">삼국지 모의전투 HiDCHe</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
</ul>
</div>
</nav>
<div id="user_info_container">
<table class="bg0" id="user_info_table">
<caption class="bg2 section_title with_border">
계 정 관 리
<a href="entrance.php"><button id="btn_back1" >돌아가기</button></a>
<a href="entrance.php"><button id="btn_back1" class="with_skin">돌아가기</button></a>
</caption>
<colgroup>
<col style="width:80px;" />
+13
View File
@@ -29,7 +29,10 @@ if ($session->isLoggedIn()) {
<script src="e_lib/bootstrap.bundle.min.js"></script>
<script src="e_lib/jquery.validate.min.js"></script>
<script src="e_lib/sha512.min.js"></script>
<script src="d_shared/menu.js"></script>
<script src="js/common.js"></script>
<script src="js/login.js"></script>
<script src="js/title.js"></script>
<link type="text/css" rel="stylesheet" href="e_lib/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="css/login.css">
<script>
@@ -106,6 +109,16 @@ function postOAuthResult(result){
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg fixed-top navbar-light bg-light">
<a class="navbar-brand" href=".">삼국지 모의전투 HiDCHe</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
</ul>
</div>
</nav>
<div class="vertical-center">
<div class="container">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe</h1>
+10 -10
View File
@@ -4,13 +4,13 @@ var serverAdminTemplate = '\
<th style="color:<%color%>;"><%korName%>(<%name%>)</th>\
<td><%status%></td>\
<td><%version%></td>\
<td><button class="valid_if_set with_border obj_fill" onclick="modifyServerStatus(this, \'close\');">폐쇄</button></td>\
<td><button class="valid_if_set with_border obj_fill" onclick="modifyServerStatus(this, \'open\');">오픈</button></td>\
<td><a class="just_link" href="../<%name%>/install.php"><button class="valid_if_set with_border obj_fill">리셋</button></a></td>\
<td><a class="just_link" href="../<%name%>/install_db.php"><button class="valid_if_installed only_admin with_border obj_fill">하드리셋</button></a></td>\
<td><button class="valid_if_set with_border obj_fill" onclick="Entrance_AdminClosedLogin(this);">폐쇄중 로그인</button></td>\
<td><button class="valid_if_set with_border obj_fill" onclick="Entrance_AdminOpen119(this);">서버119</button></td>\
<td><button class="only_admin with_border obj_fill" onclick="serverUpdate(this);">업데이트</button></td>\
<td><button class="with_skin valid_if_set with_border obj_fill" onclick="modifyServerStatus(this, \'close\');">폐쇄</button></td>\
<td><button class="with_skin valid_if_set with_border obj_fill" onclick="modifyServerStatus(this, \'open\');">오픈</button></td>\
<td><a class="just_link" href="../<%name%>/install.php"><button class="with_skin valid_if_set with_border obj_fill">리셋</button></a></td>\
<td><a class="just_link" href="../<%name%>/install_db.php"><button class="with_skin valid_if_installed only_admin with_border obj_fill">하드리셋</button></a></td>\
<td><button class="with_skin valid_if_set with_border obj_fill" onclick="Entrance_AdminClosedLogin(this);">폐쇄중 로그인</button></td>\
<td><button class="with_skin valid_if_set with_border obj_fill" onclick="Entrance_AdminOpen119(this);">서버119</button></td>\
<td><button class="with_skin only_admin with_border obj_fill" onclick="serverUpdate(this);">업데이트</button></td>\
</tr>\
';
@@ -77,14 +77,14 @@ function drawServerAdminList(serverList){
var $tr = $(TemplateEngine(serverAdminTemplate, server));
$table.append($tr);
if(!server.valid){
$tr.find('.valid_if_set').css('background','#333333').prop('disabled', true);
$tr.find('.valid_if_set').prop('disabled', true);
}
if(!server.installed){
$tr.find('.valid_if_installed').css('background','#333333').prop('disabled', true);
$tr.find('.valid_if_installed').prop('disabled', true);
}
});
if(serverList.grade == 5){
$table.find('.only_admin').css('background','#333333').prop('disabled', true);
$table.find('.only_admin').prop('disabled', true);
}
}
+10
View File
@@ -118,4 +118,14 @@ var TemplateEngine = function (html, options) {
try { result = new Function('obj', code).apply(options, [options]); }
catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
return result;
}
function getIconPath(imgsvr, picture){
// ../d_shared/common_path.js 필요
if(!imgsvr){
return pathConfig.sharedIcon+'/'+picture;
}
else{
return pathConfig.root+'/d_pic/'+picture;
}
}
+15
View File
@@ -0,0 +1,15 @@
jQuery(function($){
$.each(window.sammo_menu, function(idx){
var href = this[0];
var name = this[1];
var target = (this.length > 2)?this[2]:null;
var $a = $('<a class="nav-link" href="{0}">{1}</a>'.format(href, name));
if(target){
$a.attr('target', target);
}
var $li = $('<li class="nav-item"></li>').append($a);
$('#navbarNav .navbar-nav').append($li);
console.log(this);
});
});
+5 -5
View File
@@ -72,25 +72,25 @@ class Session
Json::die($result + $jsonResult);
}
public static function requireLogin($result = '..'): Session
public static function requireLogin($actionOnError = '..'): Session
{
$session = Session::getInstance();
if ($session->isLoggedIn()) {
return $session;
}
static::die($result);
static::die($actionOnError);
}
public static function requireGameLogin($result = '..'): Session
public static function requireGameLogin($actionOnError = '..'): Session
{
$session = Session::requireLogin($result)->loginGame();
$session = Session::requireLogin($actionOnError)->loginGame();
if ($session->generalID) {
return $session;
}
static::die($result);
static::die($actionOnError);
}
public function __construct()