//
// GJEffectManager::timeForItem from 0x8a598c to 0x8a5a1c (144 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::getItemValue @ 0x8654b8
// > GJBaseGameLayer::updateTimerLabels @ 0x88fe14
// > ??> @ 0x7aec8
//
// 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
//
double GJEffectManager::timeForItem(GJEffectManager *a1, int a2)
{
unsigned __int64 v2; // x7
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::size_type M_bucket_count; // x4
unsigned __int64 v4; // x7
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::__bucket_type v5; // x6
std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_base *M_nxt; // x3
int v7; // w5
std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_base v8; // x0
if ( a2 > 9998 )
{
v2 = 9999;
a2 = 9999;
}
else
{
if ( a2 < 0 )
a2 = 0;
v2 = a2;
}
M_bucket_count = a1->m_timerItemMap._M_h._M_bucket_count;
v4 = v2 % M_bucket_count;
v5 = a1->m_timerItemMap._M_h._M_buckets[v4];
if ( !v5 )
return 0.0;
M_nxt = v5->_M_nxt;
v7 = (int)v5->_M_nxt[1]._M_nxt;
while ( a2 != v7 )
{
v8._M_nxt = M_nxt->_M_nxt;
v5 = M_nxt;
M_nxt = v8._M_nxt;
if ( v8._M_nxt )
{
v7 = (int)v8._M_nxt[1]._M_nxt;
if ( v4 == v7 % M_bucket_count )
continue;
}
return 0.0;
}
if ( v5->_M_nxt )
return *(double *)&v5->_M_nxt[3]._M_nxt;
else
return 0.0;
}