forked from devsam/core
내부 코드 사용례에서 General 테이블의 column을 일부만 가져오는 경우가 다수 있습니다. 다만 General 클래스에서 각종 iAction에 해당하는 트리거 함수 호출을 위해서는 모든 column을 다 가져와야 정상 동작이 가능한 만큼, iAction interface를 구현한 General 클래스와, 구현하지 않은 GeneralLite 클래스 둘로 나눕니다. 또한 General 클래스에서는 필요한 column을 다 가져오도록 변경합니다. Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/236
76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
namespace sammo;
|
|
|
|
include "lib.php";
|
|
include "func.php";
|
|
|
|
WebUtil::requireAJAX();
|
|
|
|
$session = Session::requireGameLogin([])->setReadOnly();
|
|
$userID = Session::getUserID();
|
|
$generalID = $session->generalID;
|
|
|
|
increaseRefresh("내정보 수정", 0);
|
|
|
|
$action = Util::getPost('action');
|
|
$tnmt = Util::getPost('tnmt', 'int', 1);
|
|
$defence_train = Util::getPost('defence_train', 'int', 80);
|
|
$use_treatment = Util::getPost('use_treatment', 'int', 10);
|
|
$use_auto_nation_turn = Util::getPost('use_auto_nation_turn', 'int', 1);
|
|
//$detachNPC = Util::getPost('detachNPC', 'bool');
|
|
$detachNPC = false;
|
|
|
|
if ($defence_train <= 40) {
|
|
$defence_train = 40;
|
|
}
|
|
|
|
if($defence_train <= 90){
|
|
$defence_train = Util::round($defence_train, -1);
|
|
}
|
|
else{
|
|
$defence_train = 999;
|
|
}
|
|
|
|
if($tnmt < 0 || $tnmt > 1){
|
|
$tnmt = 1;
|
|
}
|
|
|
|
$db = DB::db();
|
|
$me = General::createObjFromDB($generalID);
|
|
|
|
|
|
if($defence_train !== $me->getVar('defence_train')){
|
|
if($defence_train == 999){
|
|
$me->increaseVar('myset', -1);
|
|
$me->setVar('defence_train', $defence_train);
|
|
$me->increaseVarWithLimit('train', -3, 20);
|
|
$me->increaseVarWithLimit('atmos', -6, 20);
|
|
}
|
|
else{
|
|
$me->increaseVar('myset', -1);
|
|
$me->setVar('defence_train', $defence_train);
|
|
}
|
|
}
|
|
|
|
$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100));
|
|
$me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn);
|
|
$me->setVar('tnmt', $tnmt);
|
|
|
|
if($me->getNPCType() == 1 && $detachNPC){
|
|
$turnterm = $gameStor->turnterm;
|
|
|
|
if($turnterm < 10){
|
|
$targetKillTurn = 30 / $turnterm;
|
|
}
|
|
else{
|
|
$targetKillTurn = 60 / $turnterm;
|
|
}
|
|
$me->setVar('killturn', $targetKillTurn);
|
|
}
|
|
|
|
$me->applyDB($db);
|
|
|
|
Json::die([
|
|
'result'=>true,
|
|
'reason'=>'success'
|
|
]); |