From a70bf667a4e44642147c658d3c87089e4fe3184f Mon Sep 17 00:00:00 2001 From: hide_d Date: Sun, 1 Apr 2018 23:31:37 +0900 Subject: [PATCH] =?UTF-8?q?history=20=ED=83=80=EC=9E=85=EB=93=A4=EC=9D=84?= =?UTF-8?q?=20text=EC=97=90=EC=84=9C=20mediumtext=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EC=8B=9C=EB=82=98=EB=A6=AC=EC=98=A4=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20=EC=9E=A5=EC=88=98=EC=88=98=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/func_history.php | 3 +++ hwe/j_server_basic_info.php | 1 - hwe/sammo/Scenario.php | 14 ++++++++++++++ hwe/sammo/Scenario/NPC.php | 5 ++++- hwe/sammo/Scenario/Nation.php | 10 +++++++--- hwe/sql/schema.sql | 8 ++++---- 6 files changed, 32 insertions(+), 9 deletions(-) diff --git a/hwe/func_history.php b/hwe/func_history.php index 96067e02..cee5a418 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -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'); diff --git a/hwe/j_server_basic_info.php b/hwe/j_server_basic_info.php index 4ff1fcf3..46b5e266 100644 --- a/hwe/j_server_basic_info.php +++ b/hwe/j_server_basic_info.php @@ -2,7 +2,6 @@ namespace sammo; include "lib.php"; -include "func.php"; $session = Session::Instance()->setReadOnly(); if(!$session->userID){ diff --git a/hwe/sammo/Scenario.php b/hwe/sammo/Scenario.php index db31517f..1019d4eb 100644 --- a/hwe/sammo/Scenario.php +++ b/hwe/sammo/Scenario.php @@ -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){ diff --git a/hwe/sammo/Scenario/NPC.php b/hwe/sammo/Scenario/NPC.php index bbb42c29..abb68a11 100644 --- a/hwe/sammo/Scenario/NPC.php +++ b/hwe/sammo/Scenario/NPC.php @@ -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']); diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php index c071016e..d6a3231f 100644 --- a/hwe/sammo/Scenario/Nation.php +++ b/hwe/sammo/Scenario/Nation.php @@ -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 diff --git a/hwe/sql/schema.sql b/hwe/sql/schema.sql index 12b4266c..d0511349 100644 --- a/hwe/sql/schema.sql +++ b/hwe/sql/schema.sql @@ -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 '',