feat: 禁止插件修改自身 enable

This commit is contained in:
zzyyyl
2024-07-23 19:26:22 +08:00
parent efdcfd7550
commit aa19f7835e
4 changed files with 3 additions and 9 deletions

View File

@@ -15,7 +15,7 @@ namespace asst
virtual void reset_variable() {}
// 传递 task->set_params 进行插件配置设置, 返回参数是否合法
// 根据 params 设置插件专用参数, 返回插件是否适用
virtual bool set_params([[maybe_unused]] const json::value& params) { return true; }
protected:

View File

@@ -100,10 +100,6 @@ bool asst::RoguelikeInvestTaskPlugin::_run()
<< (deposit ? *deposit : -1);
m_invest_count = total;
if (deposit && *deposit == 999) {
Log.info(__FUNCTION__, "存款已满,禁用投资模块");
m_enable = false;
}
if (count_limit - count <= 0) {
Log.info(__FUNCTION__, "投资达到设置上限,", m_maximum);
stop_roguelike();

View File

@@ -14,8 +14,7 @@ bool asst::RoguelikeCollapsalParadigmTaskPlugin::set_params(const json::value& p
{
const std::string& theme = m_config->get_theme();
if (theme != RoguelikeTheme::Sami) {
m_enable = false;
return true;
return false;
}
const RoguelikeMode& mode = m_config->get_mode();

View File

@@ -10,8 +10,7 @@ bool asst::RoguelikeFoldartalGainTaskPlugin::set_params(const json::value& param
{
const std::string& theme = m_config->get_theme();
if (theme != RoguelikeTheme::Sami) {
m_enable = false;
return true;
return false;
}
set_start_floor_foldartal(params.get("first_floor_foldartal", ""));
return true;