버그 수정
This commit is contained in:
@@ -1982,6 +1982,9 @@ function getRandTurn($term, ?\DateTimeInterface $baseDateTime = null) {
|
|||||||
else if($baseDateTime instanceof \DateTime){
|
else if($baseDateTime instanceof \DateTime){
|
||||||
$baseDateTime = \DateTimeImmutable::createFromMutable($baseDateTime);
|
$baseDateTime = \DateTimeImmutable::createFromMutable($baseDateTime);
|
||||||
}
|
}
|
||||||
|
else if($baseDateTime instanceof \DateTimeImmutable){
|
||||||
|
//do Nothing
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
throw new MustNotBeReachedException();
|
throw new MustNotBeReachedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ function preUpdateMonthly() {
|
|||||||
//계략, 전쟁표시 해제
|
//계략, 전쟁표시 해제
|
||||||
$db->update('city', [
|
$db->update('city', [
|
||||||
'state'=>$db->sqleval(<<<EOD
|
'state'=>$db->sqleval(<<<EOD
|
||||||
CASE
|
(CASE
|
||||||
WHEN state=31 THEN 0
|
WHEN state=31 THEN 0
|
||||||
WHEN state=32 THEN 31
|
WHEN state=32 THEN 31
|
||||||
WHEN state=33 THEN 0
|
WHEN state=33 THEN 0
|
||||||
@@ -352,9 +352,9 @@ WHEN state=34 THEN 33
|
|||||||
WHEN state=41 THEN 0
|
WHEN state=41 THEN 0
|
||||||
WHEN state=42 THEN 41
|
WHEN state=42 THEN 41
|
||||||
WHEN state=43 THEN 42
|
WHEN state=43 THEN 42
|
||||||
ELSE state END
|
ELSE state END)
|
||||||
EOD),
|
EOD),
|
||||||
'term'=>$db->sqleval('greatest(0, term - 1'),
|
'term'=>$db->sqleval('greatest(0, term - 1)'),
|
||||||
'conflict'=>$db->sqleval('if(term = 0,%s,conflict)', '{}'),
|
'conflict'=>$db->sqleval('if(term = 0,%s,conflict)', '{}'),
|
||||||
], true);
|
], true);
|
||||||
|
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ function getGeneralPublicRecordWithDate(int $year, int $month):array {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if(!$texts){
|
if(!$texts){
|
||||||
return "<C>●</>{$month}월: 기록 없음";
|
return ["<C>●</>{$month}월: 기록 없음"];
|
||||||
}
|
}
|
||||||
return $texts;
|
return $texts;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -162,17 +162,17 @@ echo "
|
|||||||
<td align=center>
|
<td align=center>
|
||||||
";
|
";
|
||||||
|
|
||||||
switch ($gameStor->tnmt_type) {
|
|
||||||
case 0: $str = "전력전"; break;
|
|
||||||
case 1: $str = "통솔전"; break;
|
|
||||||
case 2: $str = "일기토"; break;
|
|
||||||
case 3: $str = "설전"; break;
|
|
||||||
}
|
|
||||||
$str2 = getTournament($gameStor->tournament);
|
|
||||||
$str3 = getTournamentTime();
|
|
||||||
if ($gameStor->tournament == 0) {
|
if ($gameStor->tournament == 0) {
|
||||||
echo "<font color=magenta>현재 토너먼트 경기 없음</font>";
|
echo "<font color=magenta>현재 토너먼트 경기 없음</font>";
|
||||||
} else {
|
} else {
|
||||||
|
switch ($gameStor->tnmt_type) {
|
||||||
|
case 0: $str = "전력전"; break;
|
||||||
|
case 1: $str = "통솔전"; break;
|
||||||
|
case 2: $str = "일기토"; break;
|
||||||
|
case 3: $str = "설전"; break;
|
||||||
|
}
|
||||||
|
$str2 = getTournament($gameStor->tournament);
|
||||||
|
$str3 = getTournamentTime();
|
||||||
echo "<marquee scrollamount=2>↑<font color=cyan>{$str}</font> {$str2} {$str3}↑</marquee>";
|
echo "<marquee scrollamount=2>↑<font color=cyan>{$str}</font> {$str2} {$str3}↑</marquee>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -265,7 +265,7 @@ foreach(Util::range(GameConst::$maxTurn) as $turnIdx){
|
|||||||
}
|
}
|
||||||
$db->insert('general_turn', $turnRows);
|
$db->insert('general_turn', $turnRows);
|
||||||
|
|
||||||
foreach(General::RANK_COLUMN as $rankColumn){
|
foreach(array_keys(General::RANK_COLUMN) as $rankColumn){
|
||||||
$db->insert('rank_data', [
|
$db->insert('rank_data', [
|
||||||
'general_id'=>$generalID,
|
'general_id'=>$generalID,
|
||||||
'nation_id'=>0,
|
'nation_id'=>0,
|
||||||
|
|||||||
@@ -105,6 +105,22 @@ function scenarioPreview(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formSetup(){
|
function formSetup(){
|
||||||
|
$.validator.addMethod("autorun_user", function(value,element){
|
||||||
|
var parent = $(element).parent('.input-group');
|
||||||
|
var checkCnt = parent.find('input:checked').length;
|
||||||
|
if(value <= 0){
|
||||||
|
if(checkCnt > 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(checkCnt == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}, "유효 시간과 옵션은 동시에 설정해야합니다.");
|
||||||
$('#game_form').validate({
|
$('#game_form').validate({
|
||||||
rules:{
|
rules:{
|
||||||
turnterm:"required",
|
turnterm:"required",
|
||||||
@@ -116,6 +132,7 @@ function formSetup(){
|
|||||||
show_img_level:"required",
|
show_img_level:"required",
|
||||||
tournament_trig:"required",
|
tournament_trig:"required",
|
||||||
join_mode:'required',
|
join_mode:'required',
|
||||||
|
autorun_user_minutes:{required: true, autorun_user: true, min:0}
|
||||||
},
|
},
|
||||||
errorElement: "div",
|
errorElement: "div",
|
||||||
errorPlacement: function ( error, element ) {
|
errorPlacement: function ( error, element ) {
|
||||||
@@ -140,6 +157,15 @@ function formSetup(){
|
|||||||
if(!$("#game_form").valid()){
|
if(!$("#game_form").valid()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var autorun_user_minutes = parseInt($('#autorun_user_minutes').val());
|
||||||
|
var autorun_user = [];
|
||||||
|
if(autorun_user_minutes > 0){
|
||||||
|
$('.autorun_user_chk:checked').each(function(){
|
||||||
|
autorun_user.push($(this).data('key'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
cache:false,
|
cache:false,
|
||||||
type:'post',
|
type:'post',
|
||||||
@@ -157,6 +183,8 @@ function formSetup(){
|
|||||||
reserve_open:$('#reserve_open').val(),
|
reserve_open:$('#reserve_open').val(),
|
||||||
pre_reserve_open:$('#pre_reserve_open').val(),
|
pre_reserve_open:$('#pre_reserve_open').val(),
|
||||||
join_mode:$('#join_mode input:radio:checked').val(),
|
join_mode:$('#join_mode input:radio:checked').val(),
|
||||||
|
autorun_user_minutes:autorun_user_minutes,
|
||||||
|
autorun_user:autorun_user
|
||||||
}
|
}
|
||||||
}).then(function(result){
|
}).then(function(result){
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
|
|||||||
@@ -234,7 +234,10 @@ abstract class BaseCommand{
|
|||||||
return static::getName();
|
return static::getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRawClassName():string{
|
public function getRawClassName(bool $shortName=true):string{
|
||||||
|
if($shortName){
|
||||||
|
return Util::getClassNameFromObj($this);
|
||||||
|
}
|
||||||
return static::class;
|
return static::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use \sammo\{
|
|||||||
|
|
||||||
|
|
||||||
use function \sammo\{
|
use function \sammo\{
|
||||||
function getNationStaticInfo,
|
getNationStaticInfo,
|
||||||
tryUniqueItemLottery
|
tryUniqueItemLottery
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class GameUnitConstBase{
|
|||||||
const T_SIEGE = 5;
|
const T_SIEGE = 5;
|
||||||
const T_MISC = 6;
|
const T_MISC = 6;
|
||||||
|
|
||||||
const DEFAULT_CREWTYPE = 0;
|
const DEFAULT_CREWTYPE = 1100;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -886,7 +886,7 @@ class General implements iAction{
|
|||||||
];
|
];
|
||||||
|
|
||||||
if($reqColumns === null){
|
if($reqColumns === null){
|
||||||
return [$fullColumn, static::RANK_COLUMN];
|
return [$fullColumn, array_keys(static::RANK_COLUMN)];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rankColumn = [];
|
$rankColumn = [];
|
||||||
@@ -933,14 +933,14 @@ class General implements iAction{
|
|||||||
|
|
||||||
if($generalIDList === null){
|
if($generalIDList === null){
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
$rawGenerals = Util::convertArrayToDict(
|
||||||
$db->queryFirstRow('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
$db->query('SELECT %l FROM general WHERE 1', Util::formatListOfBackticks($column)),
|
||||||
'no'
|
'no'
|
||||||
);
|
);
|
||||||
$generalIDList = array_keys($rawGenerals);
|
$generalIDList = array_keys($rawGenerals);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$rawGenerals = Util::convertArrayToDict(
|
$rawGenerals = Util::convertArrayToDict(
|
||||||
$db->queryFirstRow('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
$db->query('SELECT %l FROM general WHERE no IN %li', Util::formatListOfBackticks($column), $generalIDList),
|
||||||
'no'
|
'no'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -109,6 +109,13 @@ class GeneralAI
|
|||||||
'color' => '#000000',
|
'color' => '#000000',
|
||||||
'name' => '재야',
|
'name' => '재야',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$serverPolicy = KVStorage::getStorage($db, 'autorun_nation_policy_0');
|
||||||
|
$nationPolicy = KVStorage::getStorage($db, "autorun_nation_policy_{$this->nation['nation']}");
|
||||||
|
|
||||||
|
$this->nationPolicy = new AutorunNationPolicy($general, $nationPolicy->getAll(), $serverPolicy->getAll());
|
||||||
|
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[]);
|
||||||
|
|
||||||
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
|
$this->nation['aux'] = Json::decode($this->nation['aux']??'{}');
|
||||||
|
|
||||||
$this->leadership = $general->getLeadership();
|
$this->leadership = $general->getLeadership();
|
||||||
@@ -119,15 +126,10 @@ class GeneralAI
|
|||||||
$this->fullStrength = $general->getStrength(false);
|
$this->fullStrength = $general->getStrength(false);
|
||||||
$this->fullIntel = $general->getIntel(false);
|
$this->fullIntel = $general->getIntel(false);
|
||||||
|
|
||||||
$this->genType = $this::calcGenType($general);
|
|
||||||
|
$this->genType = $this->calcGenType($general);
|
||||||
|
|
||||||
$this->calcDiplomacyState();
|
$this->calcDiplomacyState();
|
||||||
|
|
||||||
$serverPolicy = KVStorage::getStorage($db, 'autorun_nation_policy_0');
|
|
||||||
$nationPolicy = KVStorage::getStorage($db, "autorun_nation_policy_{$this->nation['nation']}");
|
|
||||||
|
|
||||||
$this->nationPolicy = new AutorunNationPolicy($general, $nationPolicy->getAll(), $serverPolicy->getAll());
|
|
||||||
$this->generalPolicy = new AutorunGeneralPolicy($general, $this->env['autorun_user']['options']??[]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGeneralObj(): General
|
public function getGeneralObj(): General
|
||||||
@@ -135,7 +137,7 @@ class GeneralAI
|
|||||||
return $this->general;
|
return $this->general;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function calcGenType(General $general)
|
protected function calcGenType(General $general)
|
||||||
{
|
{
|
||||||
$leadership = $general->getLeadership();
|
$leadership = $general->getLeadership();
|
||||||
$strength = Util::valueFit($general->getStrength(), 1);
|
$strength = Util::valueFit($general->getStrength(), 1);
|
||||||
|
|||||||
@@ -257,7 +257,8 @@ class ResetHelper{
|
|||||||
'fiction'=>$fiction,
|
'fiction'=>$fiction,
|
||||||
'tnmt_trig'=>$tournament_trig,
|
'tnmt_trig'=>$tournament_trig,
|
||||||
'prev_winner'=>$prevWinner,
|
'prev_winner'=>$prevWinner,
|
||||||
'autorun_user'=>$autorun_user
|
'autorun_user'=>$autorun_user,
|
||||||
|
'tournament'=>0,
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){
|
foreach(RootDB::db()->query('SELECT `no`, `name`, `picture`, `imgsvr` FROM member WHERE grade >= 5') as $admin){
|
||||||
@@ -283,14 +284,17 @@ class ResetHelper{
|
|||||||
}
|
}
|
||||||
$db->insert('general_turn', $turnRows);
|
$db->insert('general_turn', $turnRows);
|
||||||
|
|
||||||
foreach(General::RANK_COLUMN as $rankColumn){
|
|
||||||
$db->insert('rank_data', [
|
$rank_data = [];
|
||||||
|
foreach(array_keys(General::RANK_COLUMN) as $rankColumn){
|
||||||
|
$rank_data[] = [
|
||||||
'general_id'=>$generalID,
|
'general_id'=>$generalID,
|
||||||
'nation_id'=>0,
|
'nation_id'=>0,
|
||||||
'type'=>$rankColumn,
|
'type'=>$rankColumn,
|
||||||
'value'=>0
|
'value'=>0
|
||||||
]);
|
];
|
||||||
}
|
}
|
||||||
|
$db->insert('rank_data', $rank_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($env as $key=>$value){
|
foreach($env as $key=>$value){
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ class NPC{
|
|||||||
}
|
}
|
||||||
$db->insert('general_turn', $turnRows);
|
$db->insert('general_turn', $turnRows);
|
||||||
|
|
||||||
foreach(\sammo\General::RANK_COLUMN as $rankColumn){
|
foreach(array_keys(\sammo\General::RANK_COLUMN) as $rankColumn){
|
||||||
$db->insert('rank_data', [
|
$db->insert('rank_data', [
|
||||||
'general_id'=>$this->generalID,
|
'general_id'=>$this->generalID,
|
||||||
'nation_id'=>0,
|
'nation_id'=>0,
|
||||||
|
|||||||
+1
-1
@@ -97,7 +97,7 @@ CREATE TABLE `general_turn` (
|
|||||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
`general_id` INT(11) NOT NULL,
|
`general_id` INT(11) NOT NULL,
|
||||||
`turn_idx` INT(4) NOT NULL,
|
`turn_idx` INT(4) NOT NULL,
|
||||||
`action` VARCHAR(16) NOT NULL,
|
`action` VARCHAR(20) NOT NULL,
|
||||||
`arg` TEXT NULL DEFAULT NULL,
|
`arg` TEXT NULL DEFAULT NULL,
|
||||||
`brief` TEXT NULL DEFAULT NULL,
|
`brief` TEXT NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
|||||||
Reference in New Issue
Block a user