forked from devsam/core
feat: BlockScoutAction Action 추가
- 모든 국가의 임관 설정을 임의 설정하는 이벤트 액션
This commit is contained in:
@@ -47,6 +47,11 @@ class SetBlockScout extends \sammo\BaseAPI
|
||||
return "권한이 부족합니다.";
|
||||
}
|
||||
|
||||
$gameStor = new KVStorage($db, 'game_env');
|
||||
$blockChangeScout = $gameStor->getValue('block_change_scout')??false;
|
||||
if ($blockChangeScout){
|
||||
return "임관 설정을 바꿀 수 없도록 설정되어 있습니다.";
|
||||
}
|
||||
|
||||
$nationID = $me['nation'];
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace sammo\Event\Action;
|
||||
use sammo\Util;
|
||||
use sammo\DB;
|
||||
use sammo\KVStorage;
|
||||
|
||||
class BlockScoutAction extends \sammo\Event\Action{
|
||||
public function __construct(private ?bool $blockChangeScout = null){
|
||||
|
||||
}
|
||||
|
||||
public function run(array $env){
|
||||
$db = DB::db();
|
||||
$db->update('nation', [
|
||||
'scout'=>1
|
||||
], true);
|
||||
if($this->blockChangeScout !== null){
|
||||
$gameStor = new KVStorage($db, 'game_env');
|
||||
$gameStor->setValue('block_change_scout', $this->blockChangeScout);
|
||||
}
|
||||
|
||||
return [__CLASS__, $db->affectedRows()];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -252,6 +252,8 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
$logger->pushGlobalHistoryLog("<L><b>【이벤트】</b></>이민족의 기세는 그 누구도 막을 수 없을듯 합니다!");
|
||||
$logger->flush();
|
||||
|
||||
$gameStor->setValue('block_change_scout', false);
|
||||
|
||||
$db->update('plock', [
|
||||
'plock' => 0
|
||||
], true);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace sammo\Event\Action;
|
||||
use sammo\Util;
|
||||
use sammo\DB;
|
||||
use sammo\KVStorage;
|
||||
|
||||
class UnblockScoutAction extends \sammo\Event\Action{
|
||||
public function __construct(private ?bool $blockChangeScout = null){
|
||||
|
||||
}
|
||||
|
||||
public function run(array $env){
|
||||
$db = DB::db();
|
||||
$db->update('nation', [
|
||||
'scout'=>0
|
||||
]);
|
||||
|
||||
if($this->blockChangeScout !== null){
|
||||
$gameStor = new KVStorage($db, 'game_env');
|
||||
$gameStor->setValue('block_change_scout', $this->blockChangeScout);
|
||||
}
|
||||
|
||||
return [__CLASS__, $db->affectedRows()];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user