11#include < Geode/modify/PauseLayer.hpp>
2+ #include < Geode/modify/RewardsPage.hpp>
3+ #include < Geode/modify/ChallengeNode.hpp>
24#include < Geode/binding/ChallengesPage.hpp>
35#include < Geode/binding/MenuLayer.hpp>
46#include < Geode/binding/CCMenuItemSpriteExtra.hpp>
@@ -35,12 +37,43 @@ class $modify(RewardPause, PauseLayer) {
3537 auto leftMenu = this ->getChildByID (" left-button-menu" );
3638
3739 auto chest = CCSprite::createWithSpriteFrameName (" GJ_dailyRewardBtn_001.png" );
40+ auto gsm = GameStatsManager::get ();
41+ if (gsm->m_rewardItems ->count () == 0 ) {
42+ GameLevelManager::get ()->getGJRewards (0 );
43+ } else if (chest) {
44+ // theres a chance these are backwards
45+ auto big = static_cast <GJRewardItem*>(gsm->m_rewardItems ->objectForKey (1 ));
46+ auto small = static_cast <GJRewardItem*>(gsm->m_rewardItems ->objectForKey (2 ));
47+ if (big && small && (big->m_timeRemaining == 0 || small->m_timeRemaining == 0 )) {
48+ auto alert = CCSprite::createWithSpriteFrameName (" exMark_001.png" );
49+ if (alert) {
50+ alert->setScale (.6f );
51+ alert->setID (" alert" );
52+ alert->setPosition (CCPoint{35 .f , 35 .f });
53+ chest->addChild (alert);
54+ }
55+ }
56+ }
3857 addButton (" chests" , MenuLayer::onDaily, chest, .65f );
58+
3959 auto quest = CCSprite::create (" quests.png" _spr);
60+ for (int i = 1 ; i < 4 ; i++) {
61+ auto c = gsm->getChallenge (i);
62+ if (c && c->m_canClaim ) {
63+ auto alert = CCSprite::createWithSpriteFrameName (" exMark_001.png" );
64+ if (alert) {
65+ alert->setScale (.75f );
66+ alert->setID (" alert" );
67+ alert->setPosition (CCPoint{40 .f , 37 .5f });
68+ quest->addChild (alert);
69+ }
70+ break ;
71+ }
72+ }
4073 addButton (" quests" , RewardPause::onQuests, quest, .575f );
4174 auto treasure = CCSprite::createWithSpriteFrameName (" chest03_small_001.png" );
4275 addButton (" treasure" , RewardPause::onTreasureRoom, treasure, .95 );
43- auto pathId = GameStatsManager::get () ->m_activePath - 29 ;
76+ auto pathId = gsm ->m_activePath - 29 ;
4477 CCSprite *path;
4578 if (pathId > 0 && pathId < 11 ) {
4679 auto p = GJPathSprite::create (pathId);
@@ -86,4 +119,55 @@ class $modify(RewardPause, PauseLayer) {
86119 GameManager::get ()->setUGV (" 5" , true );
87120 }
88121 }
89- };
122+ };
123+
124+ // indent hell
125+ class $modify(RewardsPage) {
126+ void onClose (CCObject* sender) {
127+ RewardsPage::onClose (sender);
128+ if (auto pause = CCScene::get ()->getChildByType <PauseLayer>(0 )) {
129+ if (auto btn = pause->getChildByIDRecursive (" chests-button" _spr)) {
130+ if (auto alert = btn->getChildByIDRecursive (" alert" )) {
131+ auto gsm = GameStatsManager::get ();
132+ if (gsm->m_rewardItems ->count () == 0 ) return ;
133+ // theres a chance these are backwards
134+ auto big = static_cast <GJRewardItem*>(gsm->m_rewardItems ->objectForKey (1 ));
135+ auto small = static_cast <GJRewardItem*>(gsm->m_rewardItems ->objectForKey (2 ));
136+ if (big && small && big->m_timeRemaining > 0 && small->m_timeRemaining > 0 ) {
137+ alert->removeFromParent ();
138+ }
139+ }
140+ }
141+ }
142+ }
143+ };
144+
145+ class $modify(ChallengeNode) {
146+ void onClaimReward (CCObject* sender) {
147+ auto gsm = GameStatsManager::get ();
148+ if (auto pause = CCScene::get ()->getChildByType <PauseLayer>(0 )) {
149+ if (auto btn = pause->getChildByIDRecursive (" quests-button" _spr)) {
150+ if (auto alert = btn->getChildByIDRecursive (" alert" )) {
151+ for (int i = 1 ; i < 4 ; i++) {
152+ auto c = gsm->getChallenge (i);
153+ if (c && c->m_canClaim ) return ;
154+ }
155+ alert->removeFromParent ();
156+ }
157+ }
158+ auto pos = getPosition () + m_unkPoint;
159+ if (this ->m_challengesPage && this ->m_challengeItem ) {
160+ this ->m_challengesPage ->claimItem (this , this ->m_challengeItem , pos);
161+ }
162+
163+ // play sfx here
164+
165+ if (auto node = typeinfo_cast<CCMenuItem*>(sender)) {
166+ node->setVisible (false );
167+ node->setEnabled (false );
168+ }
169+ } else {
170+ ChallengeNode::onClaimReward (sender);
171+ }
172+ }
173+ };
0 commit comments