mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
@@ -421,7 +421,4 @@ namespace asst
|
||||
};
|
||||
|
||||
inline static const std::string UploadDataSource = "MeoAssistant";
|
||||
inline static constexpr std::string_view RoguelikePhantomThemeName = "Phantom";
|
||||
inline static constexpr std::string_view RoguelikeMizukiThemeName = "Mizuki";
|
||||
inline static constexpr std::string_view RoguelikeSamiThemeName = "Sami";
|
||||
} // namespace asst
|
||||
|
||||
@@ -74,13 +74,8 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string theme = params.get("theme", std::string(RoguelikePhantomThemeName));
|
||||
static constexpr std::array all_themes = {
|
||||
RoguelikePhantomThemeName,
|
||||
RoguelikeMizukiThemeName,
|
||||
RoguelikeSamiThemeName,
|
||||
};
|
||||
if (ranges::find(all_themes, theme) == all_themes.end()) {
|
||||
std::string theme = params.get("theme", std::string(RoguelikeTheme::Phantom));
|
||||
if (RoguelikeConfig::is_valid_theme(theme)) {
|
||||
m_roguelike_task_ptr->set_tasks({ "Stop" });
|
||||
Log.error("Unknown roguelike theme", theme);
|
||||
return false;
|
||||
@@ -93,12 +88,7 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
}
|
||||
|
||||
auto mode = static_cast<RoguelikeMode>(params.get("mode", 0));
|
||||
static constexpr std::array all_modes = {
|
||||
RoguelikeMode::Exp,
|
||||
RoguelikeMode::Investment,
|
||||
RoguelikeMode::Collectible,
|
||||
};
|
||||
if (ranges::find(all_modes, mode) == all_modes.end()) {
|
||||
if (RoguelikeConfig::is_valid_mode(mode)) {
|
||||
m_roguelike_task_ptr->set_tasks({ "Stop" });
|
||||
Log.error(__FUNCTION__, "| Unknown mode", static_cast<int>(mode));
|
||||
return false;
|
||||
|
||||
@@ -16,8 +16,27 @@ namespace asst
|
||||
Collectible = 4,
|
||||
};
|
||||
|
||||
class RoguelikeTheme
|
||||
{
|
||||
public:
|
||||
static constexpr std::string_view Phantom = "Phantom";
|
||||
static constexpr std::string_view Mizuki = "Mizuki";
|
||||
static constexpr std::string_view Sami = "Sami";
|
||||
};
|
||||
|
||||
class RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
static constexpr bool is_valid_theme(std::string_view theme)
|
||||
{
|
||||
return theme == RoguelikeTheme::Phantom || theme == RoguelikeTheme::Mizuki || theme == RoguelikeTheme::Sami;
|
||||
}
|
||||
static constexpr bool is_valid_mode(RoguelikeMode mode)
|
||||
{
|
||||
return mode == RoguelikeMode::Exp || mode == RoguelikeMode::Investment ||
|
||||
mode == RoguelikeMode::Collectible;
|
||||
}
|
||||
|
||||
public:
|
||||
// 清理缓存的肉鸽数据
|
||||
void clear();
|
||||
|
||||
@@ -37,7 +37,7 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
|
||||
|
||||
// 当前难度
|
||||
int difficulty = m_config->get_difficulty();
|
||||
if (m_config->get_theme() != "Phantom" && mode == RoguelikeMode::Collectible) {
|
||||
if (m_config->get_theme() != RoguelikeTheme::Phantom && mode == RoguelikeMode::Collectible) {
|
||||
if (difficulty == INT_MAX) {
|
||||
ProcessTask(*this, { m_config->get_theme() + "@Roguelike@ChooseDifficulty_Hardest" }).run();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ bool asst::RoguelikeFoldartalGainTaskPlugin::verify(AsstMsg msg, const json::val
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
if (m_config->get_theme() != "Sami") {
|
||||
if (m_config->get_theme() != RoguelikeTheme::Sami) {
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = m_config->get_theme() + "@";
|
||||
|
||||
@@ -18,7 +18,7 @@ bool asst::RoguelikeFoldartalUseTaskPlugin::verify(AsstMsg msg, const json::valu
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
if (m_config->get_theme() != "Sami") {
|
||||
if (m_config->get_theme() != RoguelikeTheme::Sami) {
|
||||
return false;
|
||||
}
|
||||
auto mode = m_config->get_mode();
|
||||
|
||||
@@ -58,7 +58,7 @@ bool asst::RoguelikeLastRewardTaskPlugin::_run()
|
||||
|
||||
// 需要开局凹直升
|
||||
bool start_with_elite_two = m_config->get_start_with_elite_two();
|
||||
if (m_config->get_theme() != "Phantom" && mode == RoguelikeMode::Collectible) {
|
||||
if (m_config->get_theme() != RoguelikeTheme::Phantom && mode == RoguelikeMode::Collectible) {
|
||||
if (m_is_next_hardest) {
|
||||
m_config->set_difficulty(INT_MAX);
|
||||
// 获得热水壶和演讲时停止肉鸽(凹直升则继续),获得其他奖励时重开
|
||||
|
||||
@@ -105,7 +105,7 @@ bool asst::RoguelikeShoppingTaskPlugin::_run()
|
||||
|
||||
bool bought = false;
|
||||
auto& all_goods = RoguelikeShopping.get_goods(m_config->get_theme());
|
||||
std::vector<std::string> all_foldartal = m_config->get_theme() == "Sami"
|
||||
std::vector<std::string> all_foldartal = m_config->get_theme() == RoguelikeTheme::Sami
|
||||
? Task.get<OcrTaskInfo>("Sami@Roguelike@FoldartalGainOcr")->text
|
||||
: std::vector<std::string>();
|
||||
for (const auto& goods : all_goods) {
|
||||
@@ -170,7 +170,7 @@ bool asst::RoguelikeShoppingTaskPlugin::_run()
|
||||
Log.info("Ready to buy", goods.name);
|
||||
ctrler()->click(find_it->rect);
|
||||
bought = true;
|
||||
if (m_config->get_theme() == "Sami") {
|
||||
if (m_config->get_theme() == RoguelikeTheme::Sami) {
|
||||
|
||||
auto iter = std::find(all_foldartal.begin(), all_foldartal.end(), goods.name);
|
||||
if (iter != all_foldartal.end()) {
|
||||
|
||||
Reference in New Issue
Block a user