[How To] Make Cheer Affect Upgrade Chance

Results 1 to 3 of 3
  1. #1
    Enthusiast cognitivedesign is offline
    MemberRank
    Feb 2022 Join Date
    39Posts

    [How To] Make Cheer Affect Upgrade Chance

    This isn't much but hopefully it helps some of you.

    credits to Kiasti on GitHub for the original idea.

    First, open up your versionCommon.h in Nuez and WorldServer OR your kCommon.h and add #define __CHEER_UPGRADE somewhere.

    UPDATE: also, if you would like, add
    #define __CHEER_UPGRADE_RATE 0.05f; // This lets you define the % of extra chance without changing all instances each time you change it.
    If you add this, instead of the 0.05f you see lower in the code snippets, put __CHEER_UPGRADE_RATE

    Next, open up ItemUpgrade.cpp


    STEP ONE
    Find the CItemUpgrade::SmeltSafetyGeneral method.

    find int nPercent = GetGeneralEnchantProb( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    STEP TWO
    Find the CItemUpgrade::SmeltSafetyAccessory method.

    find DWORD dwProbability = CAccessoryProperty::GetInstance()->GetProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(dwProbability * 0.05f);
    
            if (temp < 1000)
                dwProbability += temp; // add 5% of original roll
        }
    #endif
    STEP THREE
    Find the CItemUpgrade::SmeltSafetyPiercingSize method

    find int nPercent = GetSizeProb( pItemMain );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    STEP FOUR
    Find the CItemUpgrade::RefineAccessory method.

    find DWORD dwProbability = CAccessoryProperty::GetInstance()->GetProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(dwProbability * 0.05f);
    
            if (temp < 1000)
                dwProbability += temp; // add 5% of original roll
        }
    #endif
    STEP FIVE
    Find the CItemUpgrade::RefineCollector method

    find int nProb = pProperty->GetEnchantProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nProb * 0.05f);
    
            if (temp < 1000)
                nProb += temp; // add 5% of original roll
        }
    #endif
    STEP SIX (FINAL STEP)
    Find the CItemUpgrade::SmeltSafetyAttribute method

    find int nPercent = GetAttributeEnchantProb( pItemMain->m_nResistAbilityOption );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    Last edited by cognitivedesign; 23-10-22 at 07:47 PM.


  2. #2
    Member Tratox is offline
    MemberRank
    Feb 2021 Join Date
    65Posts
    Quote Originally Posted by cognitivedesign View Post
    This isn't much but hopefully it helps some of you.

    credits to Kiasti on GitHub for the original idea.

    First, open up your versionCommon.h in Nuez and WorldServer OR your kCommon.h and add #define __CHEER_UPGRADE somewhere.

    UPDATE: also, if you would like, add
    #define __CHEER_UPGRADE_RATE 0.05f; // This lets you define the % of extra chance without changing all instances each time you change it.
    If you add this, instead of the 0.05f you see lower in the code snippets, put __CHEER_UPGRADE_RATE

    Next, open up ItemUpgrade.cpp


    STEP ONE
    Find the CItemUpgrade::SmeltSafetyGeneral method.

    find int nPercent = GetGeneralEnchantProb( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    STEP TWO
    Find the CItemUpgrade::SmeltSafetyAccessory method.

    find DWORD dwProbability = CAccessoryProperty::GetInstance()->GetProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(dwProbability * 0.05f);
    
            if (temp < 1000)
                dwProbability += temp; // add 5% of original roll
        }
    #endif
    STEP THREE
    Find the CItemUpgrade::SmeltSafetyPiercingSize method

    find int nPercent = GetSizeProb( pItemMain );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    STEP FOUR
    Find the CItemUpgrade::RefineAccessory method.

    find DWORD dwProbability = CAccessoryProperty::GetInstance()->GetProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(dwProbability * 0.05f);
    
            if (temp < 1000)
                dwProbability += temp; // add 5% of original roll
        }
    #endif
    STEP FIVE
    Find the CItemUpgrade::RefineCollector method

    find int nProb = pProperty->GetEnchantProbability( pItemMain->GetAbilityOption() );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nProb * 0.05f);
    
            if (temp < 1000)
                nProb += temp; // add 5% of original roll
        }
    #endif
    STEP SIX (FINAL STEP)
    Find the CItemUpgrade::SmeltSafetyAttribute method

    find int nPercent = GetAttributeEnchantProb( pItemMain->m_nResistAbilityOption );

    Under that, add
    Code:
    #ifdef __CHEER_UPGRADE
        if (pUser->HasBuff(BUFF_ITEM, II_CHEERUP))
        {
            float temp = static_cast<int>(nPercent * 0.05f);
    
            if (temp < 1000)
                nPercent += temp; // add 5% of original roll
        }
    #endif
    Hello ! would you have an overview of what it gives ? or explain what it is used for

  3. #3
    Enthusiast cognitivedesign is offline
    MemberRank
    Feb 2022 Join Date
    39Posts
    Um... it says it right in the title... Make Cheer Affect Upgrade Chance



Advertisement