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