Skip to content

Commit b5cbff7

Browse files
committed
this is such a fire update
1 parent ab25ccd commit b5cbff7

5 files changed

Lines changed: 112 additions & 122 deletions

File tree

.github/workflows/relwithdebinfo.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.0.0
2+
- Added auto code Repo (My life and geode mods life is so much easier now)
3+
- Added a tutorial because many people don't know how to use the mod lol
4+
- Added a secret codes mode so you don't know the codes
5+
- Added soggy (i recommend soggy code mod for best experience)
16
# 1.2.1
27
- Added newest code.
38
- Made everything better.

logo.png

1.8 MB
Loading

mod.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"geode": "4.6.3",
2+
"geode": "4.7.0",
33
"gd": {
44
"win": "2.2074",
55
"mac": "2.2074",
@@ -8,7 +8,7 @@
88
},
99
"id": "dulak.wraith-help",
1010
"name": "Wraith Helper",
11-
"version": "1.2.1",
11+
"version": "2.0.0",
1212
"developer": "Dulak",
1313
"description": "Wraith codes tracker",
1414
"links": {
@@ -17,5 +17,22 @@
1717
"dependencies": {
1818
"geode.node-ids": ">=1.21.1"
1919
},
20-
"tags": ["enhancement", "interface", "offline"]
20+
"tags": ["enhancement", "interface", "offline"],
21+
"settings": {
22+
"new-p": {
23+
"name": "tutorial",
24+
"type": "bool",
25+
"default": true
26+
},
27+
"secret": {
28+
"name": "keep the codes secret",
29+
"type": "bool",
30+
"default": false
31+
},
32+
"soggy": {
33+
"name": "soggy? What are you doing here?",
34+
"type": "bool",
35+
"default": false
36+
}
37+
}
2138
}

src/main.cpp

Lines changed: 87 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
21
#include <Geode/Geode.hpp>
32
#include <cocos2d.h>
43
#include <cocos-ext.h>
54
#include <vector>
65
#include <string>
6+
#include <Geode/modify/SecretLayer5.hpp>
7+
#include <Geode/modify/MenuLayer.hpp>
8+
#include <Geode/utils/web.hpp>
9+
#include <Geode/loader/Event.hpp>
10+
#include <regex>
11+
#include <functional>
712

813
using namespace geode::prelude;
914

@@ -17,37 +22,7 @@ class CodesPopup : public geode::Popup<> {
1722
void registerWithTouchDispatcher() override {
1823
CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, -502, true);
1924
}
20-
std::vector<CodeInfo> m_codes = {
21-
{"ravenousbeasts", "UFO 57", "ravenousbeasts_checked"},
22-
{"putyahandsup", "UFO 71", "putyahandsup_checked"},
23-
{"thickofit", "1 Mana Orb", "thickofit_checked"},
24-
{"skibidi", "1 Mana Orb", "skibidi_checked"},
25-
{"fireinthehole", "1 Fire Shard", "fireinthehole_checked"},
26-
{"robtopisnice", "10 Mana Orbs", "robtopisnice_checked"},
27-
{"bussin", "69 Mana Orbs", "bussin_checked"},
28-
{"wellmet", "5 Diamonds", "wellmet_checked"},
29-
{"checksteam", "1 Demon Key", "checksteam_checked"},
30-
{"touchgrass", "1 Earth Shard", "touchgrass_checked"},
31-
{"wateronthehill", "1 Ice Shard", "wateronthehill_checked"},
32-
{"backondash", "Cube 409", "backondash_checked"},
33-
{"key", "1 Demon Key", "key_checked"},
34-
{"geometry", "Ball 90", "geometry_checked"},
35-
{"citadel", "Cube 231", "citadel_checked"},
36-
{"retrospective", "Ship 121", "retrospective_checked"},
37-
{"iaminpain", "10 Diamonds, 100 Mana Orbs", "iaminpain_checked"},
38-
{"ruins", "Ball 91", "ruins_checked"},
39-
{"spacegauntlet", "20 Diamonds, 1 Demon Key, 2 Metal Shards", "spacegauntlet_checked"},
40-
{"cheatcodes", "UFO 138", "cheatcodes_checked"},
41-
{"backstreetboy", "Robot 37", "backstreetboy_checked"},
42-
{"noelelectra", "Swing 17", "noelelectra_checked"},
43-
{"gd2025", "1 Yellow Key, 25 Diamonds, 25 Mana Orbs", "gd2025_checked"},
44-
{"duckstep", "Ship 146", "duckstep_checked"},
45-
{"skylinept2", "Cube 309", "skylinept2_checked"},
46-
{"boogie", "Wave 92", "boogie_checked"},
47-
{"buttonmasher", "UFO 63", "buttonmasher_checked"},
48-
{"ncsalbum", "Jetpack 8", "ncsalbum_checked"},
49-
{"gullible", "1 Mana Orb", "gullible_checked"}
50-
};
25+
std::vector<CodeInfo> m_codes = {};
5126

5227
static constexpr size_t CODES_PER_PAGE = 5;
5328
size_t m_currentPage = 0;
@@ -58,7 +33,7 @@ class CodesPopup : public geode::Popup<> {
5833
CCMenuItemSpriteExtra* m_nextBtn = nullptr;
5934

6035
bool setup() override {
61-
this->setTitle("Wraith Helper");
36+
this->setTitle("Codes");
6237
this->setTouchPriority(-502);
6338

6439
m_contentMenu = CCMenu::create();
@@ -123,11 +98,6 @@ class CodesPopup : public geode::Popup<> {
12398
m_mainLayer->addChild(paginationMenu);
12499

125100
updatePaginationControls();
126-
127-
log::info("Pagination controls created with layout - Prev: {}, Next: {}, Label: {}",
128-
m_prevBtn ? "OK" : "FAIL",
129-
m_nextBtn ? "OK" : "FAIL",
130-
m_pageLabel ? "OK" : "FAIL");
131101
}
132102

133103
void setupProgressDisplay() {
@@ -218,11 +188,11 @@ class CodesPopup : public geode::Popup<> {
218188
m_progressLabel->setString(progressText.c_str());
219189

220190
if (redeemedCount == m_codes.size()) {
221-
m_progressLabel->setColor({255, 215, 0});
191+
m_progressLabel->setColor({ 255, 255, 255 });
222192
} else if (redeemedCount > m_codes.size() / 2) {
223193
m_progressLabel->setColor({100, 255, 100});
224194
} else {
225-
m_progressLabel->setColor({255, 255, 100});
195+
m_progressLabel->setColor({ 255, 255, 255 });
226196
}
227197
}
228198

@@ -240,21 +210,17 @@ class CodesPopup : public geode::Popup<> {
240210
}
241211

242212
void onPrevPage(CCObject*) {
243-
log::info("Previous page button clicked - Current page: {}", m_currentPage);
244213
if (m_currentPage > 0) {
245214
m_currentPage--;
246215
loadCurrentPage();
247-
log::info("Moved to page: {}", m_currentPage);
248216
}
249217
}
250218

251219
void onNextPage(CCObject*) {
252220
size_t totalPages = (m_codes.size() + CODES_PER_PAGE - 1) / CODES_PER_PAGE;
253-
log::info("Next page button clicked - Current page: {}, Total pages: {}", m_currentPage, totalPages);
254221
if (m_currentPage < totalPages - 1) {
255222
m_currentPage++;
256223
loadCurrentPage();
257-
log::info("Moved to page: {}", m_currentPage);
258224
}
259225
}
260226

@@ -266,12 +232,6 @@ class CodesPopup : public geode::Popup<> {
266232

267233
Mod::get()->setSavedValue(m_codes[index].saveKey, !originalValue);
268234
updateProgressDisplay();
269-
270-
log::info("Code {} {} {}",
271-
m_codes[index].code,
272-
isChecked ? "checked" : "unchecked",
273-
m_codes[index].saveKey
274-
);
275235
}
276236

277237
void onCodeClick(CCObject* sender) {
@@ -285,7 +245,6 @@ class CodesPopup : public geode::Popup<> {
285245
if (auto layer = scene->getChildByType<SecretLayer5>(0)) {
286246
if (layer->m_textInput && layer->m_wraithButton) {
287247
layer->m_textInput->setString(code.c_str());
288-
log::info("Auto-inputted code: {}", code);
289248
layer->m_wraithButton->activate();
290249
Mod::get()->setSavedValue(m_codes[index].saveKey, true);
291250
updateProgressDisplay();
@@ -296,8 +255,11 @@ class CodesPopup : public geode::Popup<> {
296255
}
297256

298257
public:
299-
static CodesPopup* create() {
258+
static CodesPopup* create(std::vector<CodeInfo> externalCodes = {}) {
300259
auto ret = new CodesPopup();
260+
if (!externalCodes.empty()) {
261+
ret->m_codes = std::move(externalCodes);
262+
}
301263
if (ret->initAnchored(340.f, 280.f)) {
302264
ret->autorelease();
303265
return ret;
@@ -307,17 +269,71 @@ class CodesPopup : public geode::Popup<> {
307269
}
308270
};
309271

310-
#include <Geode/modify/SecretLayer5.hpp>
272+
class InfoOKDelegate : public CCNode, public FLAlertLayerProtocol {
273+
public:
274+
std::function<void()> onOK;
275+
static InfoOKDelegate* create(std::function<void()> cb) {
276+
auto p = new InfoOKDelegate();
277+
if (p && p->init()) {
278+
p->onOK = std::move(cb);
279+
p->autorelease();
280+
return p;
281+
}
282+
delete p;
283+
return nullptr;
284+
}
285+
void FLAlert_Clicked(FLAlertLayer* layer, bool btn2) override {
286+
if (!btn2 && onOK) onOK();
287+
this->removeFromParent();
288+
}
289+
};
290+
311291
class $modify(MySecretLayer5, SecretLayer5) {
312292
struct Fields {
313293
CCMenuItemSpriteExtra* m_codesButton = nullptr;
294+
EventListener<web::WebTask> m_listener;
295+
std::vector<CodeInfo> m_codes;
296+
bool m_loaded = false;
314297
};
315298

316299
bool init() {
317300
if (!SecretLayer5::init()) {
318301
return false;
319302
}
303+
bool codesSecret = Mod::get()->getSettingValue<bool>("secret");
304+
bool soggy = Mod::get()->getSettingValue<bool>("soggy");
305+
m_fields->m_listener.bind([this] (web::WebTask::Event* e) {
306+
if (web::WebResponse* res = e->getValue()) {
307+
auto body = res->string().unwrapOr("");
308+
try {
309+
std::regex item(R"(\{\s*\"([^\"]*)\"\s*,\s*\"([^\"]*)\"\s*,\s*\"([^\"]*)\"\s*\})");
310+
std::sregex_iterator it(body.begin(), body.end(), item);
311+
std::sregex_iterator end;
312+
std::vector<CodeInfo> parsed;
313+
for (; it != end; ++it) {
314+
CodeInfo ci;
315+
ci.code = (*it)[1].str();
316+
ci.description = (*it)[2].str();
317+
ci.saveKey = (*it)[3].str();
318+
if (ci.saveKey.empty() && !ci.code.empty()) ci.saveKey = ci.code + "_checked";
319+
if (!ci.code.empty()) parsed.push_back(std::move(ci));
320+
}
321+
m_fields->m_codes = std::move(parsed);
322+
m_fields->m_loaded = true;
323+
} catch (std::exception const& ex) {
324+
m_fields->m_loaded = false;
325+
}
326+
}
327+
});
320328

329+
auto req = web::WebRequest();
330+
if (codesSecret == true) {
331+
m_fields->m_listener.setFilter(req.get("https://raw.githubusercontent.com/dulakgg/codes/main/secretcodes.json"));
332+
} else if (soggy) {
333+
m_fields->m_listener.setFilter(req.get("https://raw.githubusercontent.com/dulakgg/codes/main/soggycodes.json"));
334+
} else {
335+
m_fields->m_listener.setFilter(req.get("https://raw.githubusercontent.com/dulakgg/codes/main/codes.json"));
336+
}
321337
auto winSize = CCDirector::sharedDirector()->getWinSize();
322338

323339
auto buttonSprite = ButtonSprite::create("Codes", "goldFont.fnt", "GJ_button_04.png", 1.0f);
@@ -338,14 +354,26 @@ class $modify(MySecretLayer5, SecretLayer5) {
338354
menu->addChild(codesButton);
339355

340356
m_fields->m_codesButton = codesButton;
341-
342-
log::info("Codes button added to top right corner at position ({}, {})", winSize.width - 60.f, winSize.height - 60.f);
343-
log::info("Wraith Helper button successfully added to SecretLayer5");
344-
345357
return true;
346358
}
347359

348360
void onCodesButton(CCObject*) {
349-
CodesPopup::create()->show();
361+
if (m_fields->m_codes.empty()) {
362+
log::error("No codes loaded from remote; not showing popup.");
363+
return;
364+
}
365+
366+
bool isNew = Mod::get()->getSettingValue<bool>("new-p");
367+
if (isNew) {
368+
auto delegate = InfoOKDelegate::create([this]() {
369+
Mod::get()->setSettingValue<bool>("new-p", false);
370+
CodesPopup::create(m_fields->m_codes)->show();
371+
});
372+
this->addChild(delegate);
373+
auto info = FLAlertLayer::create(delegate, "Info", "You can click the codes to auto input them!", "OK", nullptr);
374+
info->show();
375+
} else {
376+
CodesPopup::create(m_fields->m_codes)->show();
377+
}
350378
}
351-
};
379+
};

0 commit comments

Comments
 (0)