// // GameStatsManager::recountSpecialStats from 0x41d13c to 0x41d6e2 (1446 bytes) // // 1 xrefs: // > GameManager::dataLoaded @ 0x3289b6 // // This function is hookable on this platform! // // Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA // Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings // void GameStatsManager::recountSpecialStats(GameStatsManager *a1) { int TotalCollectedCurrency; // r9 GameStatsManager *v3; // r0 GameStatsManager *v4; // r0 int v5; // r6 int TotalCollectedDiamonds; // r10 cocos2d::CCDictionary *m_miscChests; // r3 cocos2d::CCDictionary *m_worldAdvertChests; // r3 cocos2d::CCDictElement *v9; // r3 cocos2d::CCDictElement *v10; // r5 int v11; // r0 cocos2d::CCDictElement *v12; // r2 cocos2d::CCArray *v13; // r0 cocos2d::ccArray *data; // r2 cocos2d::CCObject **arr; // r5 cocos2d::CCObject **v16; // r11 cocos2d::CCString *v17; // r0 cocos2d::CCString *v18; // t1 cocos2d::CCArray *v19; // r0 cocos2d::ccArray *v20; // r3 cocos2d::CCObject **v21; // r7 int v22; // r6 cocos2d::CCString *v23; // r0 cocos2d::CCString *v24; // t1 AchievementManager *v25; // r0 bool m_skipIncrementChallenge; // r5 bool m_dontNotify; // r7 int v28; // r2 int v29; // r6 GameStatsManager *v30; // r0 cocos2d::CCString *v31; // r0 char *v32; // r0 GameManager *v33; // r0 int v34; // r6 int v35; // r8 GameStatsManager *v36; // r0 GameStatsManager *v37; // r0 unsigned int v38; // r6 GameStatsManager *v39; // r0 GameManager *v40; // r0 cocos2d::CCDictElement *m_pElements; // r3 cocos2d::CCDictElement *next; // r7 GJRewardItem *m_pObject; // r5 cocos2d::CCDictElement *v44; // r2 char *CString; // r0 int v46; // r7 int v47; // r0 cocos2d::CCArray *v48; // r8 unsigned int i; // r7 int v50; // r0 char *v51; // r0 cocos2d::CCObject *StoreItem; // r11 cocos2d::CCString *v53; // r0 int v54; // r5 int v55; // [sp+0h] [bp-54h] int v56; // [sp+4h] [bp-50h] int v57; // [sp+8h] [bp-4Ch] int v58; // [sp+Ch] [bp-48h] int v59; // [sp+10h] [bp-44h] int v60; // [sp+14h] [bp-40h] int v61; // [sp+18h] [bp-3Ch] int v62; // [sp+1Ch] [bp-38h] int v63; // [sp+20h] [bp-34h] int v64; // [sp+24h] [bp-30h] int v65; // [sp+28h] [bp-2Ch] int v66; // [sp+2Ch] [bp-28h] intptr_t v67; // [sp+30h] [bp-24h] cocos2d::CCObject **v68; // [sp+34h] [bp-20h] char *v69; // [sp+48h] [bp-Ch] BYREF TotalCollectedCurrency = GameStatsManager::getTotalCollectedCurrency(a1); v3 = GameStatsManager::sharedState(); if ( GameStatsManager::getStat(v3, "22") != TotalCollectedCurrency ) { v4 = GameStatsManager::sharedState(); GameStatsManager::setStat(v4, "22", TotalCollectedCurrency); } v5 = 0; TotalCollectedDiamonds = GameStatsManager::getTotalCollectedDiamonds(a1); v55 = (int)floorf((float)TotalCollectedCurrency / 500.0); GameStatsManager::setAwardedBonusKeys(a1, v55); GameStatsManager::removeErrorFromSpecialChests(a1); v56 = 0; v66 = 0; v65 = 0; v64 = 0; v63 = 0; v62 = 0; v61 = 0; v60 = 0; v59 = 0; v58 = 0; v57 = 0; while ( v5 != 3 ) { if ( v5 == 1 ) { m_miscChests = a1->m_miscChests; } else if ( v5 == 2 ) { m_miscChests = a1->m_weeklyChest; } else { m_miscChests = a1->m_dailyChests; } if ( m_miscChests ) { m_pElements = m_miscChests->m_pElements; if ( m_pElements ) next = (cocos2d::CCDictElement *)m_pElements->hh.next; else next = nullptr; while ( m_pElements ) { m_pObject = (GJRewardItem *)m_pElements->m_pObject; TotalCollectedCurrency += GJRewardItem::getRewardCount(m_pObject, BonusKey|FireShard); TotalCollectedDiamonds += GJRewardItem::getRewardCount(m_pObject, Diamonds); v57 += GJRewardItem::getRewardCount(m_pObject, FireShard); v58 += GJRewardItem::getRewardCount(m_pObject, IceShard); v59 += GJRewardItem::getRewardCount(m_pObject, PoisonShard); v60 += GJRewardItem::getRewardCount(m_pObject, ShadowShard); v61 += GJRewardItem::getRewardCount(m_pObject, LavaShard); v62 += GJRewardItem::getRewardCount(m_pObject, EarthShard); v63 += GJRewardItem::getRewardCount(m_pObject, BloodShard); v64 += GJRewardItem::getRewardCount(m_pObject, MetalShard); v65 += GJRewardItem::getRewardCount(m_pObject, LightShard); v66 += GJRewardItem::getRewardCount(m_pObject, SoulShard); v55 += GJRewardItem::getRewardCount(m_pObject, BonusKey); v56 += GJRewardItem::getRewardCount(m_pObject, GoldKey); if ( next ) v44 = (cocos2d::CCDictElement *)next->hh.next; else v44 = nullptr; m_pElements = next; next = v44; } } ++v5; } m_worldAdvertChests = a1->m_worldAdvertChests; if ( m_worldAdvertChests ) { v9 = m_worldAdvertChests->m_pElements; if ( v9 ) v10 = (cocos2d::CCDictElement *)v9->hh.next; else v10 = nullptr; while ( v9 ) { v11 = cocos2d::CCString::intValue((cocos2d::CCString *)v9->m_pObject); if ( v11 > 200 ) TotalCollectedCurrency += 200; else TotalCollectedCurrency += v11; if ( v10 ) v12 = (cocos2d::CCDictElement *)v10->hh.next; else v12 = nullptr; v9 = v10; v10 = v12; } } v13 = cocos2d::CCDictionary::allKeys(a1->m_treasureRoomChests); if ( v13 ) { data = v13->data; if ( data->num ) { arr = data->arr; v16 = &arr[data->num] + 0x3FFFFFFF; while ( arr <= v16 ) { v18 = (cocos2d::CCString *)*arr++; v17 = v18; if ( !v18 ) break; CString = (char *)cocos2d::CCString::getCString(v17); sub_776584((int)&v69, CString); v46 = atoi(v69); v47 = GameStatsManager::keyCostForSecretChest(a1, v46); if ( v46 <= 6000 ) { if ( v55 < v47 ) { LABEL_77: cocos2d::CCDictionary::removeObjectForKey(a1->m_treasureRoomChests); goto LABEL_78; } v55 -= v47; } else { if ( v56 < v47 ) goto LABEL_77; v56 -= v47; } v48 = *(cocos2d::CCArray **)(cocos2d::CCDictionary::objectForKey( a1->m_treasureRoomChests, (const std::string *)&v69) + 64); if ( v48 ) { for ( i = 0; i < cocos2d::CCArray::count(v48); ++i ) { v50 = cocos2d::CCArray::objectAtIndex(v48, i); switch ( *(_DWORD *)(v50 + 52) ) { case 1: v57 += *(_DWORD *)(v50 + 64); break; case 2: v58 += *(_DWORD *)(v50 + 64); break; case 3: v59 += *(_DWORD *)(v50 + 64); break; case 4: v60 += *(_DWORD *)(v50 + 64); break; case 5: v61 += *(_DWORD *)(v50 + 64); break; case 7: TotalCollectedCurrency += *(_DWORD *)(v50 + 64); break; case 8: TotalCollectedDiamonds += *(_DWORD *)(v50 + 64); break; case 0xA: v62 += *(_DWORD *)(v50 + 64); break; case 0xB: v63 += *(_DWORD *)(v50 + 64); break; case 0xC: v64 += *(_DWORD *)(v50 + 64); break; case 0xD: v65 += *(_DWORD *)(v50 + 64); break; case 0xE: v66 += *(_DWORD *)(v50 + 64); break; default: continue; } } } LABEL_78: sub_774008(&v69); } } } v19 = cocos2d::CCDictionary::allKeys(a1->m_purchasedItems); if ( v19 ) { v20 = v19->data; if ( v20->num ) { v21 = v20->arr; v22 = TotalCollectedDiamonds; v68 = &v21[v20->num] + 0x3FFFFFFF; while ( 1 ) { if ( v21 > v68 ) goto LABEL_35; v24 = (cocos2d::CCString *)*v21++; v23 = v24; if ( !v24 ) goto LABEL_35; v51 = (char *)cocos2d::CCString::getCString(v23); sub_776584((int)&v69, v51); v67 = atoi(v69); StoreItem = GameStatsManager::getStoreItem(a1, v67); v53 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(a1->m_purchasedItems, (const std::string *)&v69); v54 = cocos2d::CCString::intValue(v53); if ( v54 > 0 ) { if ( StoreItem ) v54 = StoreItem[5].m_nZOrder - StoreItem[5].m_uOrderOfArrival; if ( GameStatsManager::shopTypeForItemID(a1, v67) == Diamond ) { if ( v22 >= v54 ) { v22 -= v54; goto LABEL_87; } } else if ( TotalCollectedCurrency >= v54 ) { TotalCollectedCurrency -= v54; goto LABEL_87; } } cocos2d::CCDictionary::removeObjectForKey(a1->m_purchasedItems); LABEL_87: sub_774008(&v69); } } } v22 = TotalCollectedDiamonds; LABEL_35: v25 = AchievementManager::sharedState(); m_skipIncrementChallenge = a1->m_skipIncrementChallenge; m_dontNotify = v25->m_dontNotify; AchievementManager::sharedState()->m_dontNotify = 1; a1->m_skipIncrementChallenge = 1; GameStatsManager::resetSpecialStatAchievements(a1); GameStatsManager::setStat(a1, "14", TotalCollectedCurrency); GameStatsManager::setStat(a1, "13", TotalCollectedDiamonds); v28 = v22; v29 = 6; GameStatsManager::setStat(a1, "29", v28); GameStatsManager::setStat(a1, "21", v55); GameStatsManager::setStat(a1, "43", v56); GameStatsManager::setStat(a1, "18", v57); GameStatsManager::setStat(a1, "19", v58); GameStatsManager::setStat(a1, "17", v59); GameStatsManager::setStat(a1, "16", v60); GameStatsManager::setStat(a1, "20", v61); GameStatsManager::setStat(a1, "23", v62); GameStatsManager::setStat(a1, "24", v63); GameStatsManager::setStat(a1, "25", v64); GameStatsManager::setStat(a1, "26", v65); GameStatsManager::setStat(a1, "27", v66); do { v30 = GameStatsManager::sharedState(); if ( GameStatsManager::isItemUnlocked(v30, GJItem, v29) ) { v31 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat( (cocos2d::CCString *)"geometry.ach.path%02d.00", (const char *)(v29 - 5)); v32 = (char *)cocos2d::CCString::getCString(v31); sub_776584((int)&v69, v32); v33 = GameManager::sharedState(); GameManager::reportAchievementWithID(v33, v69, 100, 0); sub_774008(&v69); } ++v29; } while ( v29 != 16 ); v34 = 1; v35 = 0; do { v36 = GameStatsManager::sharedState(); if ( GameStatsManager::isGauntletChestUnlocked(v36, v34) ) ++v35; ++v34; } while ( v34 != 61 ); v37 = GameStatsManager::sharedState(); GameStatsManager::setStat(v37, "40", v35); v38 = cocos2d::CCDictionary::count(a1->m_completedLists); v39 = GameStatsManager::sharedState(); GameStatsManager::setStat(v39, "41", v38); v40 = GameManager::sharedState(); GameManager::checkUsedIcons(v40); AchievementManager::sharedState()->m_dontNotify = m_dontNotify; a1->m_skipIncrementChallenge = m_skipIncrementChallenge; }
GD Web Decomp Icon

GD Web Decomp

Raw Source