Scenario build 1차 완료
- NPC 생성 로직 수정 - 생성 안된 장수는 event로 넘김 - 완료된 event 삭제하는 action 추가
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace sammo\Event\Action;
|
||||
|
||||
//1회용 event임을 의미함
|
||||
class DeleteEvent extends \sammo\Event\Action{
|
||||
|
||||
public function __construct(){
|
||||
}
|
||||
|
||||
public function run($env){
|
||||
|
||||
$eventID = \sammo\Util::array_get($env['currentEventID']);
|
||||
if(!$eventID){
|
||||
throw new \RuntimeException('currentEventID가 지정되지 않았습니다.');
|
||||
//NOTE: 이걸 에러 내야할지 아닐지는 아직 판단 필요
|
||||
}
|
||||
$db = \sammo\DB::db();
|
||||
$db->delete('event', 'id = %i', $eventID);
|
||||
return [__CLASS__, $db->affectedRows()];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace sammo\Event\Action;
|
||||
|
||||
//이전 RegNPC 함수를 EventAction으로 재구성
|
||||
class RegNPC extends \sammo\Event\Action{
|
||||
|
||||
private $npc;
|
||||
|
||||
public function __construct(
|
||||
int $affinity,
|
||||
string $name,
|
||||
int $pictureID,
|
||||
int $nationID,
|
||||
string $locatedCity,
|
||||
int $leadership,
|
||||
int $power,
|
||||
int $intel,
|
||||
int $birth = 160,
|
||||
int $death = 300,
|
||||
string $ego = null,
|
||||
string $char = null,
|
||||
string $text = null
|
||||
){
|
||||
$this->npc = new \sammo\Scenario\NPC(
|
||||
$affinity,
|
||||
$name,
|
||||
$pictureID,
|
||||
$nationID,
|
||||
$locatedCity,
|
||||
$leadership,
|
||||
$power,
|
||||
$intel,
|
||||
$birth,
|
||||
$death,
|
||||
$ego,
|
||||
$char,
|
||||
$text
|
||||
);
|
||||
}
|
||||
|
||||
public function run($env=null){
|
||||
$result = $this->npc->build($env);
|
||||
return [__CLASS__, $result];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user