-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathPokemonSwSh_MaxLair_Options_BossAction.cpp
More file actions
110 lines (91 loc) · 3.26 KB
/
PokemonSwSh_MaxLair_Options_BossAction.cpp
File metadata and controls
110 lines (91 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* Max Lair Boss Action
*
* From: https://github.com/PokemonAutomation/
*
*/
#include <vector>
#include <memory>
//#include "Common/Compiler.h"
//#include "Common/Cpp/Json/JsonValue.h"
//#include "Common/Cpp/Json/JsonArray.h"
//#include "Common/Cpp/Json/JsonObject.h"
#include "Common/Cpp/Options/BooleanCheckBoxOption.h"
#include "Common/Cpp/Options/ConfigOption.h"
//#include "CommonFramework/Globals.h"
#include "Pokemon/Pokemon_Strings.h"
#include "Pokemon/Resources/Pokemon_PokemonNames.h"
//#include "Pokemon/Resources/Pokemon_PokeballNames.h"
#include "PokemonSwSh/Resources/PokemonSwSh_PokemonSprites.h"
#include "PokemonSwSh/Resources/PokemonSwSh_MaxLairDatabase.h"
#include "PokemonSwSh_MaxLair_Options_BossAction.h"
//#include <iostream>
//using std::cout;
//using std::endl;
namespace PokemonAutomation{
namespace NintendoSwitch{
namespace PokemonSwSh{
namespace MaxLairInternal{
const EnumDropdownDatabase<BossAction>& BossAction_Database(){
static const EnumDropdownDatabase<BossAction> database({
{BossAction::CATCH_AND_STOP_PROGRAM, "always-stop", "Always stop program."},
{BossAction::CATCH_AND_STOP_IF_SHINY, "stop-if-shiny", "Stop if shiny."},
});
return database;
}
BossActionRow::BossActionRow(std::string slug, const std::string& name_slug, const std::string& sprite_slug)
: StaticTableRow(std::move(slug))
, pokemon(
LockMode::UNLOCK_WHILE_RUNNING,
get_pokemon_name(name_slug).display_name(),
ALL_POKEMON_SPRITES().get_throw(sprite_slug).icon
)
, action(
BossAction_Database(),
LockMode::UNLOCK_WHILE_RUNNING,
BossAction::CATCH_AND_STOP_IF_SHINY
)
, ball(LockMode::UNLOCK_WHILE_RUNNING, "poke-ball")
, save_on_the_go(LockMode::UNLOCK_WHILE_RUNNING, false)
{
PA_ADD_STATIC(pokemon);
add_option(action, "Action");
add_option(ball, "Ball");
add_option(save_on_the_go, "Save Path");
save_on_the_go.set_visibility(
action == BossAction::CATCH_AND_STOP_IF_SHINY ? ConfigOptionState::ENABLED : ConfigOptionState::DISABLED
);
action.add_listener(*this);
}
void BossActionRow::on_config_value_changed(void* object) {
if (action != BossAction::CATCH_AND_STOP_IF_SHINY) {
save_on_the_go = false;
}
save_on_the_go.set_visibility(
action == BossAction::CATCH_AND_STOP_IF_SHINY ? ConfigOptionState::ENABLED : ConfigOptionState::DISABLED
);
}
BossActionTable::BossActionTable()
: StaticTableOption("<b>Boss Actions:</b>", LockMode::UNLOCK_WHILE_RUNNING)
{
for (const auto& item : all_bosses_by_dex()){
// cout << item.second << endl;
const MaxLairSlugs& slugs = get_maxlair_slugs(item.second);
const std::string& sprite_slug = *slugs.sprite_slugs.begin();
const std::string& name_slug = slugs.name_slug;
add_row(std::make_unique<BossActionRow>(item.second, name_slug, sprite_slug));
}
finish_construction();
}
std::vector<std::string> BossActionTable::make_header() const{
std::vector<std::string> ret{
STRING_POKEMON,
"Action",
STRING_POKEBALL,
"Save Path"
};
return ret;
}
}
}
}
}