Skip to content

Commit 42e8cf8

Browse files
authored
1.2.0 jumpscare (maybe)
1 parent 93e2036 commit 42e8cf8

File tree

3 files changed

+84
-5
lines changed

3 files changed

+84
-5
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.2.0
2+
- Added the ability to rate demon difficulties on demon levels.
3+
14
# 1.1.0
25
- Added option to change the rate mode when the current rate mode's difficulty is NA.
36
- Changed the way the mod rates levels (now uses correct functions).

mod.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"id": "sweep.auto-rater",
1010
"name": "Auto Rater",
11-
"version": "v1.1.0",
11+
"version": "v1.2.0",
1212
"developer": "Sweep",
1313
"description": "Automatically rates the stars of levels.",
1414
"links": {
@@ -18,6 +18,12 @@
1818
"info": "You can report issues by either creating a new issue on the GitHub, or messaging me on Discord: @sweepsweep2",
1919
"url": "https://github.com/SweepSweep2/gd-auto-rater/issues"
2020
},
21+
"incompatibilities": {
22+
"hbg1010.autorate": {
23+
"version": ">=1.0.0",
24+
"importance": "breaking"
25+
}
26+
},
2127
"settings": {
2228
"enable-auto-rater": {
2329
"type": "bool",
@@ -54,6 +60,25 @@
5460
"default": "Requested Difficulty",
5561
"one-of": ["Requested Difficulty", "Current Difficulty", "Override"],
5662
"enable-if": "setting:enable-auto-rater"
63+
},
64+
"demon-separator": {
65+
"type": "title",
66+
"name": "Demon Rate Settings"
67+
},
68+
"override-demon-rate": {
69+
"type": "bool",
70+
"name": "Override Demon Rate",
71+
"description": "Toggles whether the mod should rate using the demon difficulty you set in Override Demon Difficulty Rate.",
72+
"default": false,
73+
"enable-if": "setting:enable-auto-rater"
74+
},
75+
"override-difficulty-demon-rate": {
76+
"type": "string",
77+
"name": "Override Demon Difficulty Rate",
78+
"description": "If Override Demon Rate is on, the mod will rate all demons with this difficulty.",
79+
"one-of": ["Easy Demon", "Medium Demon", "Hard Demon", "Insane Demon", "Extreme Demon"],
80+
"default": "Hard Demon",
81+
"enable-if": "setting:enable-auto-rater"
5782
}
5883
},
5984
"tags": [

src/main.cpp

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,68 @@ using namespace geode::prelude;
1212
class $modify(AutoLevelRate, LevelInfoLayer) {
1313
void levelDownloadFinished(GJGameLevel* p0) {
1414
LevelInfoLayer::levelDownloadFinished(p0); // Run the original levelDownloadFinished code before running our custom code.
15-
16-
// Make sure we haven't rated the level yet.
17-
if (!m_starRateBtn) return;
18-
if (!m_starRateBtn->isEnabled()) return;
1915

2016
// Make sure the user has the feature enabled.
2117
if (!Mod::get()->getSettingValue<bool>("enable-auto-rater")) return;
2218

2319
std::string rateMode = Mod::get()->getSettingValue<std::string>("rate-mode-selection");
2420
int overrideDifficultyRate = Mod::get()->getSettingValue<int>("override-difficulty-rate");
2521
std::string naOverride = Mod::get()->getSettingValue<std::string>("na-override");
22+
bool overrideDemonRate = Mod::get()->getSettingValue<bool>("override-demon-rate");
23+
std::string overrideDifficultyDemonRate = Mod::get()->getSettingValue<std::string>("override-difficulty-demon-rate");
24+
25+
// Rate demon difficulty if it is available.
26+
if (m_demonRateBtn && m_demonRateBtn->isEnabled()) {
27+
// no comments here because screw you :troll:
28+
std::string demonRated = "";
29+
RateDemonLayer* rateDemonLayer = RateDemonLayer::create(m_level->m_levelID);
30+
31+
if (overrideDemonRate) {
32+
demonRated = overrideDifficultyDemonRate;
33+
if (overrideDifficultyDemonRate == "Easy Demon") {
34+
rateDemonLayer->m_demonRate = 1;
35+
} else if (overrideDifficultyDemonRate == "Medium Demon") {
36+
rateDemonLayer->m_demonRate = 2;
37+
} else if (overrideDifficultyDemonRate == "Hard Demon") {
38+
rateDemonLayer->m_demonRate = 3;
39+
} else if (overrideDifficultyDemonRate == "Insane Demon") {
40+
rateDemonLayer->m_demonRate = 4;
41+
} else {
42+
rateDemonLayer->m_demonRate = 5;
43+
}
44+
} else {
45+
switch (m_level->m_demonDifficulty) {
46+
case 3:
47+
rateDemonLayer->m_demonRate = 1;
48+
demonRated = "Easy Demon";
49+
break;
50+
case 4:
51+
rateDemonLayer->m_demonRate = 2;
52+
demonRated = "Medium Demon";
53+
break;
54+
case 0:
55+
rateDemonLayer->m_demonRate = 3;
56+
demonRated = "Hard Demon";
57+
break;
58+
case 5:
59+
rateDemonLayer->m_demonRate = 4;
60+
demonRated = "Insane Demon";
61+
break;
62+
case 6:
63+
rateDemonLayer->m_demonRate = 5;
64+
demonRated = "Extreme Demon";
65+
break;
66+
}
67+
}
68+
69+
rateDemonLayer->onRate(rateDemonLayer->m_submitButton);
70+
71+
log::info("Successfully rated the level {}!", demonRated);
72+
}
73+
74+
// Make sure we haven't rated the level yet.
75+
if (!m_starRateBtn) return;
76+
if (!m_starRateBtn->isEnabled()) return;
2677

2778
RateStarsLayer* rateStarsLayer = RateStarsLayer::create(m_level->m_levelID, p0->isPlatformer(), false);
2879

0 commit comments

Comments
 (0)