history 타입들을 text에서 mediumtext로 변경
시나리오 생성 시 장수수 처리 수정
This commit is contained in:
@@ -176,6 +176,9 @@ function getWorldHistoryWithDate($year, $month) {
|
||||
|
||||
|
||||
function pushGeneralPublicRecord(array $history, $year=null, $month=null) {
|
||||
if(!$history){
|
||||
return;
|
||||
}
|
||||
$db = DB::db();
|
||||
if($year === null || $month === null){
|
||||
$game = $db->queryFirstRow('SELECT year, month FROM game LIMIT 1');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
namespace sammo;
|
||||
|
||||
include "lib.php";
|
||||
include "func.php";
|
||||
|
||||
$session = Session::Instance()->setReadOnly();
|
||||
if(!$session->userID){
|
||||
|
||||
@@ -242,6 +242,9 @@ class Scenario{
|
||||
$remainGenerals = [];
|
||||
foreach($this->generals as $general){
|
||||
if($general->build($env)){
|
||||
if($general->nationID){
|
||||
$this->nations[$general->nationID]->addGeneral($general);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -256,6 +259,9 @@ class Scenario{
|
||||
if($env['extended_general']){
|
||||
foreach($this->generalsEx as $general){
|
||||
if($general->build($env)){
|
||||
if($general->nationID){
|
||||
$this->nations[$general->nationID]->addGeneral($general);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -320,6 +326,14 @@ class Scenario{
|
||||
];
|
||||
}
|
||||
|
||||
foreach($this->nations as $id=>$nation){
|
||||
if($id == 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$nation->postBuild($env);
|
||||
}
|
||||
|
||||
$this->buildDiplomacy($env);
|
||||
|
||||
foreach($this->initialEvents as $event){
|
||||
|
||||
@@ -116,7 +116,10 @@ class NPC{
|
||||
|
||||
$experience = $age * 100;
|
||||
$dedication = $age * 100;
|
||||
$level = $nationID?1:$this->level;
|
||||
$level = $this->level;
|
||||
if(!$level){
|
||||
$level = $nationID?1:0;
|
||||
}
|
||||
|
||||
$turntime = \sammo\getRandTurn($env['turnterm']);
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@ class Nation{
|
||||
|
||||
private $cities = [];
|
||||
|
||||
private $generals = [];
|
||||
|
||||
public function __construct(
|
||||
int $id = null,
|
||||
string $name = '국가',
|
||||
@@ -118,12 +120,14 @@ class Nation{
|
||||
|
||||
}
|
||||
|
||||
public function addGeneral(NPC $general){
|
||||
$this->generals[] = $general;
|
||||
}
|
||||
|
||||
public function postBuild($env=[]){
|
||||
$npc_cnt = count($this->generals);
|
||||
if($env['extended_general']){
|
||||
$npc_cnt += count($this->generalsEx);
|
||||
}
|
||||
|
||||
$db = DB::db();
|
||||
$db->update('nation', [
|
||||
'gennum'=>$npc_cnt,
|
||||
'totaltech'=>$this->tech*$npc_cnt
|
||||
|
||||
+4
-4
@@ -70,7 +70,7 @@ CREATE TABLE `general` (
|
||||
`deathcrew` INT(7) NULL DEFAULT '0',
|
||||
`age` INT(3) NULL DEFAULT '20',
|
||||
`startage` INT(3) NULL DEFAULT '20',
|
||||
`history` TEXT NULL DEFAULT '',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`belong` INT(2) NULL DEFAULT '1',
|
||||
`betray` INT(2) NULL DEFAULT '0',
|
||||
`personal` INT(2) NULL DEFAULT '0',
|
||||
@@ -202,7 +202,7 @@ create table nation (
|
||||
level int(1) default 0,
|
||||
type int(2) default 0,
|
||||
rule text default '',
|
||||
history text default '',
|
||||
history mediumtext default '',
|
||||
dip0 char(150) default '', dip0_type int(4) default 0, dip0_who int(9) default 0, dip0_when datetime,
|
||||
dip1 char(150) default '', dip1_type int(4) default 0, dip1_who int(9) default 0, dip1_when datetime,
|
||||
dip2 char(150) default '', dip2_type int(4) default 0, dip2_who int(9) default 0, dip2_when datetime,
|
||||
@@ -487,7 +487,7 @@ create table if not exists emperior (
|
||||
tiger char(64) default '',
|
||||
eagle char(64) default '',
|
||||
gen text default '',
|
||||
history text default '',
|
||||
history mediumtext default '',
|
||||
|
||||
PRIMARY KEY (no)
|
||||
) ENGINE=INNODB ROW_FORMAT=COMPRESSED DEFAULT CHARSET=utf8mb4;
|
||||
@@ -582,7 +582,7 @@ create table history (
|
||||
no int(6) not null auto_increment,
|
||||
year int(4) default 0,
|
||||
month int(2) default 0,
|
||||
map longtext default '',
|
||||
map mediumtext default '',
|
||||
log text default '',
|
||||
genlog text default '',
|
||||
nation text default '',
|
||||
|
||||
Reference in New Issue
Block a user