Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall CMob__GiveMoney(CMob *this, CUser *pUser, ATTACKINFO *attackinfo_2, int nAttackCount)
- {
- int pickpocket_skill_level; // eax@1
- Reward *v5; // edx@3
- int v6; // ecx@3
- ATTACKINFO *attackinfo; // esi@3
- int somerand; // edi@4
- unsigned int rand_num; // edx@5
- double v10; // st7@5
- CMobTemplate *mobinfo; // ecx@9
- double v12; // st7@9
- double v13; // st7@13
- unsigned int final_meso_drop_amount; // eax@16
- int v16; // eax@22
- int v17; // edi@24
- Reward *v18; // [sp+Ch] [bp-20h]@9
- CDropPool *v19; // [sp+Ch] [bp-20h]@21
- unsigned int v20; // [sp+10h] [bp-1Ch]@15
- int v21; // [sp+10h] [bp-1Ch]@24
- ZArray<Reward> array_reward; // [sp+14h] [bp-18h]@3
- CMob *monster; // [sp+18h] [bp-14h]@1
- SKILLENTRY *ppSkillEntry; // [sp+1Ch] [bp-10h]@1
- int v25; // [sp+28h] [bp-4h]@3
- int v26; // [sp+38h] [bp+Ch]@4
- int v27; // [sp+38h] [bp+Ch]@24
- char *damage_calculated_byserver; // [sp+3Ch] [bp+10h]@4
- unsigned int v29; // [sp+3Ch] [bp+10h]@24
- monster = this;
- ppSkillEntry = 0;
- pickpocket_skill_level = CSkillInfo__GetSkillLevel(
- TSingleton_CSkillInfo___ms_pInstance,
- &pUser->m_character,
- (int)loc_40413B,
- &ppSkillEntry);
- if ( ppSkillEntry )
- {
- if ( pickpocket_skill_level ) // Check if it's level over zero? Despite there's checking if it's above zero before use? silly nexon
- {
- v5 = 0;
- array_reward.a = 0;
- v6 = nAttackCount;
- attackinfo = attackinfo_2;
- v25 = 0;
- if ( nAttackCount > 0 )
- {
- somerand = 156 * pickpocket_skill_level;// Probably a rand huh? pickpocket lvl * 156
- damage_calculated_byserver = (char *)attackinfo_2->aDamageSvr;// Getting the damage dealt, which is calculated by server
- v26 = v6; // This is the number of attack count, which is decrease by 1 after its done with each code
- do // Keep on looping through while there's more monster hit, and add it to an array
- {
- rand_num = CRand32__Random(&g_rand) % 0x64;// Get a random number of range 0 ~ 100
- v10 = (double)pUser->m_basicStat.nLevel / (double)monster->m_pTemplate->nLevel;// User Level divide by monster level
- if ( v10 >= 1.0 ) // If User level is higher than mob level, covert it to 1
- v10 = 1.0;
- if ( (double)*(signed int *)((char *)ppSkillEntry->aLevelData.a + somerand - 76) * v10 >= (double)rand_num )// Check if the rand num == passes, within 100% scale
- {
- if ( *(_DWORD *)damage_calculated_byserver > 0 )// Check if the damage calculated by server is over zero.
- {
- v18 = ZArray_Reward___InsertBefore(&array_reward, -1);// Insert the object "array_reward" into the array, that'll be used later
- mobinfo = monster->m_pTemplate;
- v12 = (double)*(signed int *)damage_calculated_byserver / (double)mobinfo->nMaxHP;// Damage calculated by server divide by monster max HP
- if ( v12 >= 1.0 ) // If the division result is over 1.0, convert to 1,0
- v12 = 1.0;
- if ( v12 <= 0.5 ) // If the division result is below 0.5, convert to 0.5
- v12 = 0.5;
- v13 = (double)(mobinfo->nLevel * *(_DWORD *)((char *)ppSkillEntry->aLevelData.a + somerand - 52))
- * v12
- * 0.006666666666666667;
- if ( v13 <= 1.0 ) // If v13 below or equal to 1.0, set 1.0
- v13 = 1.0;
- v20 = (signed __int64)v13; // Set v20 to v13's value
- if ( v20 ) // This is probably checking if v20 > 0, IDA decompiler got f*ed up here
- final_meso_drop_amount = CRand32__Random(&g_rand) % v20 + 1;// Get a random value of range (0 ~ v20) + 1 and it'll be used as the drop amount
- else
- final_meso_drop_amount = CRand32__Random(&g_rand);// I'm not sure about this, CRand32__Random(&g_rand) generates an unsigned int of value 0 ~ 4 billion, are Nexon that stupid?
- v18->nMoney = final_meso_drop_amount;
- v18->nType = 0;
- }
- }
- damage_calculated_byserver += 4;
- }
- while ( v26-- != 1 );
- v5 = array_reward.a;
- }
- v19 = &monster->baseclass_10.m_pField->m_dropPool;
- if ( v5 )
- v16 = *((_DWORD *)v5 - 1);
- else
- v16 = 0;
- v17 = attackinfo->ptHit.x - 10 * v16 + 10;
- v29 = 0;
- v21 = 0;
- v27 = 0;
- while ( v5 && v29 < *((_DWORD *)v5 - 1) ) // Loop on the array created just now and drop it, ignore this if you just wanted formula
- {
- CDropPool__Create(
- v19,
- (Reward *)((char *)v5 + v21),
- pUser->m_dwCharacterID,
- 0,
- 0,
- monster->baseclass_0.baseclass_0.m_dwId,
- attackinfo->ptHit.x,
- attackinfo->ptHit.y,
- v17,
- 0,
- v27 + attackinfo->tDelay, // Drop the meso at the delay of the attack with an increase of 120 after each meso
- 0,
- 0,
- 0);
- ++v29; // Increasing the loop :D
- v27 += 120; // Here's where it's increasing (delay) :D
- v21 += 24; // This might be the x position that it's dropping, which increase by 24 after each drop
- v5 = array_reward.a;
- v17 += 20;
- }
- v25 = -1;
- ZArray_Reward___RemoveAll(&array_reward); // Cleanup of array
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment