Skip to content

Commit

Permalink
working icon hack
Browse files Browse the repository at this point in the history
  • Loading branch information
0mgRod committed Jul 7, 2024
1 parent deaed2b commit 9f19cc2
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 38 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# v2.0.0

- Removed Creator Points error messages - check console for errors
- Added Shop Shortcuts
- Added Demons to garage
- Updated Feedback API (again)
- Added new tags: "content" and "offline"
- No longer uses Geode nightly
- Added Demon Keys to garage
- Added Icon + Color Hack - Enable in settings
- Added [Ko-Fi](https://ko-fi.com/omgrod) button (please support the creation of this mod)
- Bugfixes:
- Separate Dual Icons mod - Moved down hitboxes and arrows
Expand Down
32 changes: 0 additions & 32 deletions deprecated.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
# DEMONS code

mod.json

```
"demons": {
"name": "Demons",
"description": "Demons show up in the garage.",
"type": "bool",
"default": true
},
```

main.cpp

```
if (demons) {
// Credits to Capeling for this code (Demons in Garage)
// Deprecated stuff (sorry!)
// auto statMenu = this->getChildByID("capeling.garage-stats-menu/stats-menu");
// auto myStatItem = StatsDisplayAPI::getNewItem("demons"_spr, CCSprite::create("GaragePlus_demonIcon.png"_spr), GameStatsManager::sharedState()->getStat("5"), 1.f);
// if (statMenu) {
// statMenu->addChild(myStatItem);
// statMenu->updateLayout();
// }
}
```

# Advanced Stats

mod.json
Expand Down
14 changes: 13 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "3.2.0",
"version": "v2.0.0-alpha.4",
"version": "v2.0.0-alpha.3",
"gd": {
"win": "2.206",
"android": "2.206"
Expand All @@ -16,6 +16,12 @@
"description": "Creator Points show up in the garage. Click the CP icon to refresh. (Only available to people logged in)",
"type": "bool",
"default": true
},
"demons": {
"name": "Demons",
"description": "Demons show up in the garage.",
"type": "bool",
"default": true
},
"no-lock-hint": {
"name": "Remove Lock Hint",
Expand Down Expand Up @@ -46,6 +52,12 @@
"description": "Percentage of completed Achievements show up in the garage.",
"type": "bool",
"default": true
},
"icon-hack": {
"name": "Icon + Color Hack",
"description": "You can use every icon and color in the game.",
"type": "bool",
"default": false
},
"shops-shortcut": {
"name": "Shops Shortcut",
Expand Down
21 changes: 16 additions & 5 deletions src/IconHack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ using namespace geode::prelude;

class $modify(GameManager) {
bool isIconUnlocked(int _id, IconType _type) {
if (GameManager::isIconUnlocked(_id, _type)) return true;
if (_id <= 0) return false;
return true;
if (Mod::get()->getSettingValue<bool>("icon-hack")) {
if (GameManager::isIconUnlocked(_id, _type)) return true;
if (_id <= 0) return false;
return true;
} else {
// Call the original GameManager method
return GameManager::isIconUnlocked(_id, _type);
}
}

bool isColorUnlocked(int _id, UnlockType _type) {
if (GameManager::isColorUnlocked(_id, _type)) return true;
return true;
if (Mod::get()->getSettingValue<bool>("icon-hack")) {
if (GameManager::isColorUnlocked(_id, _type)) return true;
return true;
} else {
// Call the original GameManager method
return GameManager::isColorUnlocked(_id, _type);
}
}
};
14 changes: 14 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class $modify(GJGarageLayerModified, GJGarageLayer) {
auto topBtns = Mod::get()->getSettingValue<bool>("top-buttons");
auto feedback = Mod::get()->getSettingValue<bool>("feedback");
auto demonKeys = Mod::get()->getSettingValue<bool>("demon-keys");
auto demons = Mod::get()->getSettingValue<bool>("demons");
auto achCount = Mod::get()->getSettingValue<bool>("achievement-count----------------------------------------------------do-after");
auto shopsShortcut = Mod::get()->getSettingValue<bool>("shops-shortcut");

Expand All @@ -46,6 +47,19 @@ class $modify(GJGarageLayerModified, GJGarageLayer) {
GJGarageLayerModified::refreshCP(nullptr, false);
}

if (demons) {
// Credits to Capeling for this code (Demons in Garage)

auto statMenu = this->getChildByID("capeling.garage-stats-menu/stats-menu");

auto myStatItem = StatsDisplayAPI::getNewItem("demons"_spr, CCSprite::create("GaragePlus_demonIcon.png"_spr), GameStatsManager::sharedState()->getStat("5"), 1.f);

if (statMenu) {
statMenu->addChild(myStatItem);
statMenu->updateLayout();
}
}

if (shopsShortcut) {
auto topLeftMenu = this->getChildByID("top-left-menu");
auto oldShopRope = topLeftMenu->getChildByID("shop-button");
Expand Down

0 comments on commit 9f19cc2

Please sign in to comment.