mirror of
https://github.com/zebrajr/SamRewritten.git
synced 2025-12-06 12:19:51 +01:00
Merge pull request #137 from PaulCombal/dev
Fixed cli timed unlocks/locks + added one more spacing option (#136)
This commit is contained in:
commit
0361fb314a
|
|
@ -53,7 +53,7 @@ bool go_cli_mode(int argc, char* argv[], AppId_t *return_app_id) {
|
|||
("timed", "Do a timed achievement modification. Arguments that affect this are --amount, --units, --spacing, and --order")
|
||||
("amount", "Control the amount of time spent for --timed modifications. Specify units with --units. Default is 1000", cxxopts::value<uint64_t>())
|
||||
("units", "Control the units of time spent for --timed modifications. Set to 'seconds', 'minutes', 'hours', or 'days'. Default is seconds", cxxopts::value<std::string>())
|
||||
("spacing", "Control the spacing between appying each modification for --timed modifications. Set to 'even' or 'random'. Default is even", cxxopts::value<std::string>())
|
||||
("spacing", "Control the spacing between appying each modification for --timed modifications. Set to 'even', 'evenish' or 'random'. Default is even", cxxopts::value<std::string>())
|
||||
("order", "Control the order --timed achievement modifications are applied in. Set to 'selection' or 'random'. Default is selection", cxxopts::value<std::string>())
|
||||
("statnames", "Change stats for an AppId. Separate stat names by a comma. Use with statvalues to name the values in order", cxxopts::value<std::vector<std::string>>())
|
||||
("statvalues", "Change stats for an AppId. Separate stat values by a comma. Use with statnames to name the values in order", cxxopts::value<std::vector<std::string>>())
|
||||
|
|
@ -261,6 +261,8 @@ bool go_cli_mode(int argc, char* argv[], AppId_t *return_app_id) {
|
|||
spacing = EVEN_SPACING;
|
||||
} else if (spacing_input == "random") {
|
||||
spacing = RANDOM_SPACING;
|
||||
} else if (spacing_input == "evenish") {
|
||||
spacing = EVEN_FREE_SPACING;
|
||||
} else {
|
||||
std::cerr << "invalid spacing: " << spacing_input << std::endl;
|
||||
return true;
|
||||
|
|
@ -288,6 +290,7 @@ bool go_cli_mode(int argc, char* argv[], AppId_t *return_app_id) {
|
|||
<< " (or " << (((double)times[0]) / 60) << " minutes or "
|
||||
<< ((((double)times[0]) / 60) / 60) << " hours)" << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::seconds(times[0]));
|
||||
g_steam->commit_next_timed_modification();
|
||||
times.erase(times.begin());
|
||||
}
|
||||
g_steam->quit_game();
|
||||
|
|
|
|||
|
|
@ -347,6 +347,13 @@ MySteam::setup_timed_modifications(uint64_t seconds, MODIFICATION_SPACING spacin
|
|||
{
|
||||
if (spacing == EVEN_SPACING) {
|
||||
times.push_back((i + 1) * (seconds / size));
|
||||
} else if (spacing == EVEN_FREE_SPACING) {
|
||||
uint64_t time = (i + 1) * (seconds / size);
|
||||
bool positive = rand() % 2;
|
||||
int sign = 1;
|
||||
if (!positive)
|
||||
sign = -1;
|
||||
times.push_back(time + sign*(((((double)rand()) / RAND_MAX))*time*0.1));
|
||||
} else {
|
||||
times.push_back(seconds * (((double)rand()) / RAND_MAX));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
enum MODIFICATION_SPACING {
|
||||
EVEN_SPACING = 0,
|
||||
RANDOM_SPACING = 1,
|
||||
EVEN_FREE_SPACING = 2,
|
||||
};
|
||||
|
||||
enum MODIFICATION_ORDER {
|
||||
|
|
@ -210,4 +211,4 @@ private:
|
|||
|
||||
std::vector<AchievementChange_t> m_achievement_changes;
|
||||
std::vector<StatChange_t> m_stat_changes;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user