공백지 생성은 가능. 추가 버그 확인 중
This commit is contained in:
+17
-15
@@ -60,6 +60,7 @@ $mysqli_obj = $db->get();
|
|||||||
|
|
||||||
|
|
||||||
$scenarioObj = new Scenario($scenario);
|
$scenarioObj = new Scenario($scenario);
|
||||||
|
$startyear = $scenarioObj->getYear();
|
||||||
|
|
||||||
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
||||||
while (@$mysqli_obj->next_result()) {;}
|
while (@$mysqli_obj->next_result()) {;}
|
||||||
@@ -74,21 +75,11 @@ $db->insert('plock', [
|
|||||||
'plock'=>1
|
'plock'=>1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){
|
|
||||||
$db->insert('general', [
|
|
||||||
'owner'=>$admin['no'],
|
|
||||||
'name'=>$admin['name'],
|
|
||||||
'picture'=>$admin['picture'],
|
|
||||||
'imgsvr'=>$admin['imgsvr'],
|
|
||||||
'turntime'=>$turntime,
|
|
||||||
'killturn'=>null
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
CityConst::build();
|
CityConst::build();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$turntime = date('Y-m-d H:i:s');
|
$turntime = date('Y-m-d H:i:s');
|
||||||
$time = substr($turntime, 11, 2);
|
$time = substr($turntime, 11, 2);
|
||||||
if($sync == 0) {
|
if($sync == 0) {
|
||||||
@@ -111,6 +102,8 @@ $killturn = 4800 / $turnterm;
|
|||||||
if($npcmode == 1) { $killturn = floor($killturn / 3); }
|
if($npcmode == 1) { $killturn = floor($killturn / 3); }
|
||||||
|
|
||||||
$env = [
|
$env = [
|
||||||
|
'scenario'=>$scenario,
|
||||||
|
'startyear'=>$startyear,
|
||||||
'year'=> $year,
|
'year'=> $year,
|
||||||
'month'=> $month,
|
'month'=> $month,
|
||||||
'msg'=>'공지사항',//TODO:공지사항
|
'msg'=>'공지사항',//TODO:공지사항
|
||||||
@@ -125,17 +118,26 @@ $env = [
|
|||||||
'turnterm'=>$turnterm,
|
'turnterm'=>$turnterm,
|
||||||
'killturn'=>$killturn,
|
'killturn'=>$killturn,
|
||||||
'genius'=>5,
|
'genius'=>5,
|
||||||
'startyear'=>$startyear,
|
|
||||||
'scenario'=>$scenario,
|
|
||||||
'show_img_level'=>$show_img_level,
|
'show_img_level'=>$show_img_level,
|
||||||
'npcmode'=>$npcmode,
|
'npcmode'=>$npcmode,
|
||||||
'extend'=>$extend,
|
'extended_general'=>$extend,
|
||||||
'fiction'=>$fiction
|
'fiction'=>$fiction
|
||||||
];
|
];
|
||||||
|
|
||||||
|
foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){
|
||||||
|
$db->insert('general', [
|
||||||
|
'owner'=>$admin['no'],
|
||||||
|
'name'=>$admin['name'],
|
||||||
|
'picture'=>$admin['picture'],
|
||||||
|
'imgsvr'=>$admin['imgsvr'],
|
||||||
|
'turntime'=>$turntime,
|
||||||
|
'killturn'=>null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$db->insert('game', $env);
|
$db->insert('game', $env);
|
||||||
|
|
||||||
$scenario->build($env);
|
$scenarioObj->build($env);
|
||||||
|
|
||||||
$db->update('plock', [
|
$db->update('plock', [
|
||||||
'plock'=>0
|
'plock'=>0
|
||||||
|
|||||||
+2
-2
@@ -159,13 +159,13 @@ function formSetup(){
|
|||||||
deferred.reject('fail');
|
deferred.reject('fail');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
alert('DB.php가 생성되었습니다.');
|
alert('게임이 리셋되었습니다.');
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}).then(function(){
|
}).then(function(){
|
||||||
location.href = 'install.php';
|
//location.href = 'install.php';
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class CityConst{
|
|||||||
];
|
];
|
||||||
|
|
||||||
private static function _generate(){
|
private static function _generate(){
|
||||||
if(static::$constID || static::$constName || static::$constCity || static::$constRegion){
|
if(static::$constID || static::$constName || static::$constRegion){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ class CityConst{
|
|||||||
'wall2'=>$city->wall,
|
'wall2'=>$city->wall,
|
||||||
'region'=>$city->region
|
'region'=>$city->region
|
||||||
]);
|
]);
|
||||||
}, static::$constID);
|
}, array_values(static::$constID));
|
||||||
|
|
||||||
DB::db()->insert('city', $queries);
|
DB::db()->insert('city', $queries);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class CityInitialDetail{
|
|||||||
int $defence,
|
int $defence,
|
||||||
int $wall,
|
int $wall,
|
||||||
int $region,
|
int $region,
|
||||||
int $path
|
array $path
|
||||||
){
|
){
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
|||||||
+25
-14
@@ -59,7 +59,7 @@ class Scenario{
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->displomacy = Util::array_get($data['diplomacy'], []);
|
$this->diplomacy = Util::array_get($data['diplomacy'], []);
|
||||||
|
|
||||||
|
|
||||||
$this->generals = array_map(function($rawGeneral){
|
$this->generals = array_map(function($rawGeneral){
|
||||||
@@ -132,14 +132,21 @@ class Scenario{
|
|||||||
}, Util::array_get($data['generalEx'], []));
|
}, Util::array_get($data['generalEx'], []));
|
||||||
|
|
||||||
$this->initialEvents = array_map(function($rawEvent){
|
$this->initialEvents = array_map(function($rawEvent){
|
||||||
return new \sammo\Event\EventHandler($rawEvent[0], array_slice($rawEvent, 1));
|
$cond = $rawEvent[0];
|
||||||
|
$action = array_slice($rawEvent, 1);
|
||||||
|
return new \sammo\Event\EventHandler($cond, $action);
|
||||||
}, Util::array_get($data['initialEvents'], []));
|
}, Util::array_get($data['initialEvents'], []));
|
||||||
|
|
||||||
$this->events = array_map(function($rawEvent){
|
$this->events = array_map(function($rawEvent){
|
||||||
//event는 여기서 풀지 않는다.
|
//event는 여기서 풀지 않는다. 평가만 한다.
|
||||||
|
$cond = $rawEvent[0];
|
||||||
|
$action = array_slice($rawEvent, 1);
|
||||||
|
|
||||||
|
new \sammo\Event\EventHandler($cond, $action);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'cond' => $rawEvent[0],
|
'cond' => $cond,
|
||||||
'action' => array_slice($rawEvent, 1)
|
'action' => $action
|
||||||
];
|
];
|
||||||
}, Util::array_get($data['events'], []));
|
}, Util::array_get($data['events'], []));
|
||||||
|
|
||||||
@@ -282,19 +289,19 @@ class Scenario{
|
|||||||
$remainGenerals[$birth][] = array_merge(['RegNPC'], $rawGeneral);
|
$remainGenerals[$birth][] = array_merge(['RegNPC'], $rawGeneral);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($env['useExtentedGeneral']){
|
if($env['extended_general']){
|
||||||
foreach($this->generalsEx as $general){
|
foreach($this->generalsEx as $general){
|
||||||
if($general->build($env)){
|
if($general->build($env)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$rawGeneral = $this->tmpGeneralQueue[$general->$name];
|
$rawGeneral = $this->tmpGeneralQueue[$general->$name];
|
||||||
$birth = $general->birth;
|
$birth = $general->birth;
|
||||||
if(!key_exists($birth, $remainGenerals)){
|
if(!key_exists($birth, $remainGenerals)){
|
||||||
$remainGenerals[$birth] = [];
|
$remainGenerals[$birth] = [];
|
||||||
|
}
|
||||||
|
$remainGenerals[$birth][] = array_merge(['RegNPC'], $rawGeneral);
|
||||||
}
|
}
|
||||||
$remainGenerals[$birth][] = array_merge(['RegNPC'], $rawGeneral);
|
|
||||||
}
|
}
|
||||||
return $remainGenerals;
|
return $remainGenerals;
|
||||||
}
|
}
|
||||||
@@ -313,7 +320,7 @@ class Scenario{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildGame($env=[]){
|
public function build($env=[]){
|
||||||
//NOTE: 초기화가 되어있다고 가정함.
|
//NOTE: 초기화가 되어있다고 가정함.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -361,7 +368,11 @@ class Scenario{
|
|||||||
];
|
];
|
||||||
}, $this->events);
|
}, $this->events);
|
||||||
|
|
||||||
$db->insert('event', $this->events);
|
if(count($events) > 0){
|
||||||
|
$db->insert('event', $events);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pushHistory($this->history);
|
pushHistory($this->history);
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class Nation{
|
|||||||
|
|
||||||
public function postBuild($env=[]){
|
public function postBuild($env=[]){
|
||||||
$npc_cnt = count($this->generals);
|
$npc_cnt = count($this->generals);
|
||||||
if($env['useExtentedGeneral']){
|
if($env['extended_general']){
|
||||||
$npc_cnt += count($this->generalsEx);
|
$npc_cnt += count($this->generalsEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"title":"【공백지】 공백지",
|
"title":"【공백지】 공백지",
|
||||||
|
"startYear":180,
|
||||||
"history":[
|
"history":[
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+2
-2
@@ -383,8 +383,8 @@ create table game (
|
|||||||
starttime datetime,
|
starttime datetime,
|
||||||
isUnited int(1) default 0,
|
isUnited int(1) default 0,
|
||||||
scenario int(2) default 0,
|
scenario int(2) default 0,
|
||||||
img int(1) default 0,
|
show_img_level int(2) default 0,
|
||||||
extend int(1) default 0,
|
extended_general int(1) default 0,
|
||||||
fiction int(1) default 0,
|
fiction int(1) default 0,
|
||||||
npcmode int(1) default 0,
|
npcmode int(1) default 0,
|
||||||
tnmt_auto int(2) default 0, tnmt_time datetime default '2100-01-01 00:00:00',
|
tnmt_auto int(2) default 0, tnmt_time datetime default '2100-01-01 00:00:00',
|
||||||
|
|||||||
Reference in New Issue
Block a user