NPC 생성시 버그 수정
서버 리셋되었을 때 세션 값 안정을 위해 serverID 개념을 추가.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
class UniqueConst{
|
||||
public static $serverID = '_tK_serverID_';
|
||||
|
||||
private function __construct(){}
|
||||
|
||||
}
|
||||
@@ -1567,6 +1567,7 @@ function cutDay($date, int $turnterm) {
|
||||
}
|
||||
|
||||
function increaseRefresh($type="", $cnt=1) {
|
||||
$generalID = Session::
|
||||
$date = date('Y-m-d H:i:s');
|
||||
|
||||
DB::db()->query('UPDATE game set refresh=refresh+%i where `no`=1', $cnt);
|
||||
|
||||
+18
-4
@@ -80,12 +80,19 @@ if(!is_writable(__dir__.'/data')){
|
||||
]);
|
||||
}
|
||||
|
||||
if(!file_exists(ROOT.'/logs/.htaccess')){
|
||||
@file_put_contents(ROOT.'/logs/.htaccess', 'Deny from all');
|
||||
if(!is_writable(__dir__.'/d_setting')){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'d_setting 디렉토리의 쓰기 권한이 없습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!file_exists(ROOT.'/data/.htaccess')){
|
||||
@file_put_contents(ROOT.'/data/.htaccess', 'Deny from all');
|
||||
if(!file_exists(__dir__.'/logs/.htaccess')){
|
||||
@file_put_contents(__dir__.'/logs/.htaccess', 'Deny from all');
|
||||
}
|
||||
|
||||
if(!file_exists(__dir__.'/data/.htaccess')){
|
||||
@file_put_contents(__dir__.'/data/.htaccess', 'Deny from all');
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +106,13 @@ $startyear = $scenarioObj->getYear();
|
||||
FileUtil::delInDir("logs");
|
||||
FileUtil::delInDir("data");
|
||||
|
||||
$result = Util::generateFileUsingSimpleTemplate(
|
||||
__DIR__.'/d_setting/UniqueConst.orig.php',
|
||||
__DIR__.'/d_setting/UniqueConst.php',[
|
||||
'serverID'=>DB::prefix().'_'.Util::randomStr(8)
|
||||
], true
|
||||
);
|
||||
|
||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
||||
while(true){
|
||||
if (!$mysqli_obj->more_results()) {
|
||||
|
||||
@@ -43,6 +43,12 @@ if($fullReset && class_exists('\\sammo\\DB')){
|
||||
if($fullReset){
|
||||
FileUtil::delInDir(__dir__."/logs");
|
||||
FileUtil::delInDir(__dir__."/data");
|
||||
if(file_exists(__dir__.'/d_setting/DB.php')){
|
||||
@unlink(__dir__.'/d_setting/DB.php');
|
||||
}
|
||||
if(file_exists(__dir__.'/d_setting/UniqueConst.php')){
|
||||
@unlink(__dir__.'/d_setting/UniqueConst.php');
|
||||
}
|
||||
}
|
||||
|
||||
function dbConnFail($params){
|
||||
|
||||
@@ -25,21 +25,16 @@ $game['userCnt'] = $genCnt;
|
||||
$game['npcCnt'] = $npcCnt;
|
||||
$game['nationCnt'] = $nationCnt;
|
||||
|
||||
$generalID = getGeneralID(false, false);
|
||||
$userGrade = $session->userGrade;
|
||||
$me = [
|
||||
];
|
||||
$me = [];
|
||||
|
||||
if($generalID){
|
||||
$general = $db->queryFirstRow('SELECT name, picture, imgsvr from general where no=%i', $generalID);
|
||||
if($general){
|
||||
$me['name'] = $general['name'];
|
||||
$general = $db->queryFirstRow('SELECT name, picture, imgsvr from general where owner=%i', $session->userID);
|
||||
if($general){
|
||||
$me['name'] = $general['name'];
|
||||
|
||||
if($general['imgsvr'] == 0) {
|
||||
$me['picture'] = '../../image/'.$general['picture'];
|
||||
} else {
|
||||
$me['picture'] = '../d_pic/'.$general['picture'];
|
||||
}
|
||||
if($general['imgsvr'] == 0) {
|
||||
$me['picture'] = '../../image/'.$general['picture'];
|
||||
} else {
|
||||
$me['picture'] = '../d_pic/'.$general['picture'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Deny from all
|
||||
@@ -73,6 +73,7 @@ class NPC{
|
||||
$year = $env['year'];
|
||||
$month = $env['month'];
|
||||
$age = $year - $this->birth;
|
||||
$name = $this->name;
|
||||
|
||||
if($this->death < $year){
|
||||
return true; //죽었으니 넘어간다.
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
CREATE TABLE `general` (
|
||||
`no` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`owner` INT(11) NOT NULL DEFAULT '-1',
|
||||
`owner` INT(11) NOT NULL DEFAULT '0',
|
||||
`conmsg` CHAR(255) NOT NULL DEFAULT '',
|
||||
`npcmsg` CHAR(255) NULL DEFAULT '',
|
||||
`npcid` INT(5) NULL DEFAULT NULL,
|
||||
|
||||
Reference in New Issue
Block a user