scenario 이름은 build시에 db에 넣을 수 있으므로, getScenario() 삭제

This commit is contained in:
2018-03-31 18:33:53 +09:00
parent d09c71c729
commit 8dc7f3bad5
4 changed files with 69 additions and 87 deletions
-34
View File
@@ -8,40 +8,6 @@ namespace sammo;
* Side effect 없이 값의 변환만을 수행하는 함수들의 모음. * Side effect 없이 값의 변환만을 수행하는 함수들의 모음.
*/ */
function getScenario() {
//FIXME: 정말로 side effect가 없으려면 query는 밖으로 이동해야함.
$scenario = DB::db()->queryFirstColumn('select `scenario` from `game` where no=1');
switch($scenario) {
case 0: $str = '공백지모드'; break;
case 1: $str = '역사모드1 : 184년 황건적의 난'; break;
case 2: $str = '역사모드2 : 190년 반동탁연합'; break;
case 3: $str = '역사모드3 : 194년 군웅할거'; break;
case 4: $str = '역사모드4 : 196년 황제는 허도로'; break;
case 5: $str = '역사모드5 : 200년 관도대전'; break;
case 6: $str = '역사모드6 : 202년 원가의 분열'; break;
case 7: $str = '역사모드7 : 207년 적벽대전'; break;
case 8: $str = '역사모드8 : 213년 익주 공방전'; break;
case 9: $str = '역사모드9 : 219년 삼국정립'; break;
case 10: $str = '역사모드10 : 225년 칠종칠금'; break;
case 11: $str = '역사모드11 : 228년 출사표'; break;
case 12: $str = 'IF모드1 : 191년 백마장군의 위세'; break;
case 20: $str = '가상모드1 : 180년 영웅 난무'; break;
case 21: $str = '가상모드1 : 180년 영웅 집결'; break;
case 22: $str = '가상모드2 : 179년 훼신 집결'; break;
case 23: $str = '가상모드3 : 180년 영웅 시대'; break;
case 24: $str = '가상모드4 : 180년 결사항전'; break;
case 25: $str = '가상모드5 : 180년 영웅독존'; break;
case 26: $str = '가상모드6 : 180년 무풍지대'; break;
case 27: $str = '가상모드7 : 180년 가요대잔치'; break;
case 28: $str = '가상모드8 : 180년 확산성 밀리언 아서'; break;
default: $str = '시나리오?'; break;
}
return $str;
}
function NationCharCall($call) { function NationCharCall($call) {
switch($call) { switch($call) {
+5 -4
View File
@@ -43,7 +43,7 @@ if($me['newmsg'] == 1 && $me['newvote'] == 1) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,extend,fiction,npcmode,vote from game where no=1"; $query = "select develcost,online,conlimit,tournament,tnmt_type,turnterm,scenario,scenario_text,extend,fiction,npcmode,vote from game where no=1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -54,7 +54,7 @@ $plock = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
$scenario = getScenario(); $scenario = $admin['scenario_text'];
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -293,9 +293,10 @@ echo banner();
</table> </table>
<?php PrintElapsedTime(); ?> <?php PrintElapsedTime(); ?>
</div> </div>
</body>
</html>
<?php <?php
if($con == 1) { MessageBox("접속제한이 얼마 남지 않았습니다!"); } if($con == 1) { MessageBox("접속제한이 얼마 남지 않았습니다!"); }
if($me['newmsg'] == 1) { MessageBox("개인 서신이 도착했습니다!"); } if($me['newmsg'] == 1) { MessageBox("개인 서신이 도착했습니다!"); }
if($me['newvote'] == 1) { $develcost = $admin['develcost']*5; MessageBox("설문조사에 참여하시면 금{$develcost}과 유니크템을 드립니다! (우측 상단 설문조사 메뉴)"); } if($me['newvote'] == 1) { $develcost = $admin['develcost']*5; MessageBox("설문조사에 참여하시면 금{$develcost}과 유니크템을 드립니다! (우측 상단 설문조사 메뉴)"); }
?>
</body>
</html>
+2 -1
View File
@@ -59,7 +59,7 @@ $db = DB::db();
$mysqli_obj = $db->get(); $mysqli_obj = $db->get();
$scenarioObj = new Scenario($scenario); $scenarioObj = new Scenario($scenario, false);
$startyear = $scenarioObj->getYear(); $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'))){
@@ -118,6 +118,7 @@ if($npcmode == 1) { $killturn = floor($killturn / 3); }
$env = [ $env = [
'scenario'=>$scenario, 'scenario'=>$scenario,
'scenario_text'=>$scenarioObj->getTitle(),
'startyear'=>$startyear, 'startyear'=>$startyear,
'year'=> $year, 'year'=> $year,
'month'=> $month, 'month'=> $month,
+62 -48
View File
@@ -355,54 +355,68 @@ create table plock (
## ##
########################################################################## ##########################################################################
create table game ( CREATE TABLE `game` (
no int(11) not null auto_increment, `no` INT(11) NOT NULL AUTO_INCREMENT,
startyear int(3) not null, `startyear` INT(3) NOT NULL,
year int(3) not null, `year` INT(3) NOT NULL,
month int(3) not null, `month` INT(3) NOT NULL,
refresh int(9) default 0, `refresh` INT(9) NULL DEFAULT '0',
maxonline int(9) default 1, `maxonline` INT(9) NULL DEFAULT '1',
maxrefresh int(9) default 1, `maxrefresh` INT(9) NULL DEFAULT '1',
conlimit int(9) default 5, `conlimit` INT(9) NULL DEFAULT '5',
conweight int(3) default 100, `conweight` INT(3) NULL DEFAULT '100',
develcost int(4) default 20, `develcost` INT(4) NULL DEFAULT '20',
online int(9) default 0, `online` INT(9) NULL DEFAULT '0',
onlinenation varchar(256) default '', `onlinenation` VARCHAR(256) NULL DEFAULT '',
onlinegen varchar(1024) default '', `onlinegen` VARCHAR(1024) NULL DEFAULT '',
msg text default '', `msg` TEXT NULL DEFAULT '',
maxgeneral int(3) default 100, `maxgeneral` INT(3) NULL DEFAULT '100',
genius int(2) default 3, `genius` INT(2) NULL DEFAULT '3',
normgeneral int(3) default 100, `normgeneral` INT(3) NULL DEFAULT '100',
maxnation int(3) default 50, `maxnation` INT(3) NULL DEFAULT '50',
gold_rate int(3) default 100, `gold_rate` INT(3) NULL DEFAULT '100',
rice_rate int(3) default 100, `rice_rate` INT(3) NULL DEFAULT '100',
city_rate int(3) default 50, `city_rate` INT(3) NULL DEFAULT '50',
turnterm int(3) default 60, `turnterm` INT(3) NULL DEFAULT '60',
killturn int(6) default 80, `killturn` INT(6) NULL DEFAULT '80',
turntime datetime, `turntime` DATETIME NULL DEFAULT NULL,
starttime datetime, `starttime` DATETIME NULL DEFAULT NULL,
isUnited int(1) default 0, `isUnited` INT(1) NULL DEFAULT '0',
scenario int(2) default 0, `scenario` INT(4) NULL DEFAULT '0',
show_img_level int(2) default 0, `scenario_text` VARCHAR(80) NULL DEFAULT '0',
extended_general int(1) default 0, `show_img_level` INT(2) NULL DEFAULT '0',
fiction int(1) default 0, `extended_general` INT(1) NULL DEFAULT '0',
npcmode int(1) default 0, `fiction` INT(1) NULL DEFAULT '0',
tnmt_auto int(2) default 0, tnmt_time datetime default '2100-01-01 00:00:00', `npcmode` INT(1) NULL DEFAULT '0',
tournament int(2) default 0, phase int(2) default 0, `tnmt_auto` INT(2) NULL DEFAULT '0',
tnmt_type int(2) default 0, tnmt_msg char(255) default '', `tnmt_time` DATETIME NULL DEFAULT '2100-01-01 00:00:00',
tnmt_trig int(2) default 0, `tournament` INT(2) NULL DEFAULT '0',
voteopen int(1) default 1, `phase` INT(2) NULL DEFAULT '0',
vote text default '', `tnmt_type` INT(2) NULL DEFAULT '0',
votecomment text default '', `tnmt_msg` CHAR(255) NULL DEFAULT '',
npccount int(4) default 0, `tnmt_trig` INT(2) NULL DEFAULT '0',
`voteopen` INT(1) NULL DEFAULT '1',
bet0 int(8) default 0, bet1 int(8) default 0, bet2 int(8) default 0, bet3 int(8) default 0, `vote` TEXT NULL DEFAULT '',
bet4 int(8) default 0, bet5 int(8) default 0, bet6 int(8) default 0, bet7 int(8) default 0, `votecomment` TEXT NULL DEFAULT '',
bet8 int(8) default 0, bet9 int(8) default 0, bet10 int(8) default 0, bet11 int(8) default 0, `npccount` INT(4) NULL DEFAULT '0',
bet12 int(8) default 0, bet13 int(8) default 0, bet14 int(8) default 0, bet15 int(8) default 0, `bet0` INT(8) NULL DEFAULT '0',
`bet1` INT(8) NULL DEFAULT '0',
PRIMARY KEY (no) `bet2` INT(8) NULL DEFAULT '0',
) ENGINE=INNODB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4; `bet3` INT(8) NULL DEFAULT '0',
`bet4` INT(8) NULL DEFAULT '0',
`bet5` INT(8) NULL DEFAULT '0',
`bet6` INT(8) NULL DEFAULT '0',
`bet7` INT(8) NULL DEFAULT '0',
`bet8` INT(8) NULL DEFAULT '0',
`bet9` INT(8) NULL DEFAULT '0',
`bet10` INT(8) NULL DEFAULT '0',
`bet11` INT(8) NULL DEFAULT '0',
`bet12` INT(8) NULL DEFAULT '0',
`bet13` INT(8) NULL DEFAULT '0',
`bet14` INT(8) NULL DEFAULT '0',
`bet15` INT(8) NULL DEFAULT '0',
PRIMARY KEY (`no`)
) ENGINE=INNODB ROW_FORMAT=DYNAMIC DEFAULT CHARSET=utf8mb4;
########################################################################### ###########################################################################
## ##