diff --git a/hwe/sammo/Event/Action/InvaderEnding.php b/hwe/sammo/Event/Action/InvaderEnding.php new file mode 100644 index 00000000..7c0db69a --- /dev/null +++ b/hwe/sammo/Event/Action/InvaderEnding.php @@ -0,0 +1,64 @@ +isunited; + if(in_array($isunited, [0, 2])){ + return [__CLASS__, "No Invader"]; + } + + $nationCnt = $db->queryFirstField('SELECT count(*) FROM nation'); + if($nationCnt >= 2){ + return [__CLASS__, "On Event"]; + } + + $gameStor = KVStorage::getStorage($db, 'game_env'); + + $logger = new ActionLogger(0, 0, $env['year'], $env['month']); + + $cityCnt = $db->queryFirstField('SELECT count(*) FROM city WHERE nation = 0'); + if($cityCnt == 0){ + //천통 엔딩 + $logger->pushGlobalHistoryLog("【이벤트】이민족을 모두 소탕했습니다!"); + $logger->pushGlobalHistoryLog("【이벤트】중원은 당분간 태평성대를 누릴 것입니다."); + } + else if($cityCnt == count(CityConst::all())){ + //이민족 엔딩 + $logger->pushGlobalHistoryLog("【이벤트】중원은 이민족에 의해 혼란에 빠졌습니다."); + $logger->pushGlobalHistoryLog("【이벤트】백성은 언젠가 영웅이 나타나길 기다립니다."); + } + else{ + return [__CLASS__, "On Event"]; + } + $gameStor->setValue('isunited', 3); + $logger->flush(); + + $gameStor->conlimit = $gameStor->conlimit * 100; + $db->update('plock', [ + 'plock' => 1 + ], true); + + $eventID = Util::array_get($env['currentEventID']); + $db->delete('event', 'id = %i', $eventID); + + return [__CLASS__, 'Deleted']; + } + +} \ No newline at end of file diff --git a/hwe/sammo/Event/Action/RaiseInvader.php b/hwe/sammo/Event/Action/RaiseInvader.php index 30ed30d7..538560d2 100644 --- a/hwe/sammo/Event/Action/RaiseInvader.php +++ b/hwe/sammo/Event/Action/RaiseInvader.php @@ -204,7 +204,12 @@ class RaiseInvader extends \sammo\Event\Action 'condition' => Json::encode(true), 'action' => Json::encode([["AutoDeleteInvader", $invaderNationID]]), ]); + } + $db->insert('event', [ + 'condition' => Json::encode(true), + 'action' => Json::encode([["InvaderEnding"]]), + ]); $db->update('nation', [ 'scout' => 1 diff --git a/js/entrance.js b/js/entrance.js index 414214b0..5fd46a28 100644 --- a/js/entrance.js +++ b/js/entrance.js @@ -84,7 +84,7 @@ var serverReservedTemplate = "\ \ "; -$(function() { +$(function () { $("#btn_logout").click(Entrance_Logout); Entrance_UpdateServer(); }); @@ -94,7 +94,7 @@ function Entrance_UpdateServer() { type: 'post', url: "j_server_get_status.php", dataType: 'json', - }).then(function(response) { + }).then(function (response) { if (response.result == "SUCCESS") { Entrance_drawServerList(response.server); } @@ -104,7 +104,7 @@ function Entrance_UpdateServer() { function Entrance_drawServerList(serverInfos) { var $serverList = $('#server_list'); var now = moment().format('YYYY-MM-DD HH:mm:ss'); - $.each(serverInfos, function(idx, serverInfo) { + $.each(serverInfos, function (idx, serverInfo) { var $serverHtml = $(TemplateEngine(serverListTemplate, serverInfo)); $serverList.append($serverHtml); if (!serverInfo.exists) { @@ -114,7 +114,7 @@ function Entrance_drawServerList(serverInfos) { var serverPath = "../" + serverInfo.name; - $.getJSON("../" + serverInfo.name + '/j_server_basic_info.php', {}, function(result) { + $.getJSON("../" + serverInfo.name + '/j_server_basic_info.php', {}, function (result) { if (result.reserved) { $serverHtml.find('.server_down').detach(); $serverHtml.append( @@ -134,7 +134,13 @@ function Entrance_drawServerList(serverInfos) { $serverHtml.find('.server_down').detach(); var serverTime = '%s ~ %s'.format(game.startFrom) - if (game.isUnited == 2) { + if (game.isUnited == 3) { + $serverHtml.find('.n_country').html('§이벤트 종료§'); + $serverHtml.find('.server_date').html('{0}
~ {1}'.format(game.starttime, game.turntime)); + } else if (game.isUnited == 1) { + $serverHtml.find('.n_country').html('§이벤트 진행중§'); + $serverHtml.find('.server_date').html('{0} ~'.format(game.starttime)); + } else if (game.isUnited == 2) { $serverHtml.find('.n_country').html('§천하통일§'); $serverHtml.find('.server_date').html('{0}
~ {1}'.format(game.starttime, game.turntime)); } else if (game.opentime <= now) { @@ -187,7 +193,7 @@ function Entrance_Logout() { type: 'post', url: "j_logout.php", dataType: 'json', - }).then(function(response) { + }).then(function (response) { if (response.result) { location.href = "../"; } else {