Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[How To] Increase Upgrade Limits (For Dummies)

Newbie Spellweaver
Joined
Feb 28, 2022
Messages
39
Reaction score
10
Hi everyone! I'm here to try and help out by writing a guide on how to easily update your source files to allow you to define max upgrade levels quickly and efficiently. This code is based off of Ketchups v19 source release. It took me hours upon hours figuring out why specific things were breaking after changing all of the things specified in other tutorials.

If someone wants to edit the formatting for this post to make it better, please, feel free!

Let's dive right into it. We will be adjusting these files: Accessory.h, ItemUpgrade.cpp, MoverParam.cpp, WndField.h and WndField.cpp as well as VersionCommon.h in the WorldServer and Neuz, or in kCommon.h if you are using Ketchups files like myself.

In your commons: (VersionCommon.h / kCommon.h)
Code:
#define __INCREASE_UPGRADE_LIMIT                        //: Allow players to upgrade beyond vanilla values. E.G. Wooden Sword +20 or Vigor Ring +40
#ifdef __INCREASE_UPGRADE_LIMIT
#define __NEW_MAX_LIMIT        40                            // Highest number amongst the new limits.
#define __NEW_RING_LIMIT    40                            // Jewelry
#define __NEW_ITEM_LIMIT    20                            // Weapons and Armor
#define __NEW_PIERCE_LIMIT    10                            // Suit piercing
#define __NEW_PIERCE2_LIMIT    10                            // Weapon piercing
#define __NEW_CARD_LIMIT    25                            // Element 
#endif
These defines will allow you to quickly change the max cap for a specific type of item without digging back through all of the code each time.

Okay... Now let's get into the actual file edits.

Accessory.h
Change #define MAX_AAO 20 to #define MAX_AAO __NEW_RING_LIMIT

================================================

ItemUpgrade.cpp
Inside of: BYTE CItemUpgrade::SmeltSafetyAttribute

FIND:
Code:
        if( IsUsableItem( pItemSmeltScr ) && pItemSmeltScr->GetProp()->dwID == II_SYS_SYS_SCR_SMELTING2 )
        {
            //    속성 제련의 두루마리 사용가능 수치인가
            if( pItemMain->m_nResistAbilityOption < 20 )

CHANGE TO:
Code:
        if( IsUsableItem( pItemSmeltScr ) && pItemSmeltScr->GetProp()->dwID == II_SYS_SYS_SCR_SMELTING2 )
        {
            //    속성 제련의 두루마리 사용가능 수치인가
#ifdef __INCREASE_UPGRADE_LIMIT
            if( pItemMain->m_nResistAbilityOption < __NEW_MAX_LIMIT )
#else
            if( pItemMain->m_nResistAbilityOption < 20 )
#endif

================================================

MoverParam.cpp(_COMMON)
Inside of: void CMover::UpdateItem(

FIND
Code:
            case UI_AO: // 아이템 + 올리기...
                {
#if __VER >= 13 // __EXT_ENCHANT

                    DWORD dwMax = 20;
#else // __EXT_ENCHANT
                    DWORD dwMax    = 10;
#endif // __EXT_ENCHANT
#if __VER >= 11 // __SYS_COLLECTING
                    if (((CItemElem*)pItemBase)->IsAccessory())
                        dwMax    = 20;

CHANGE TO:
Code:
            case UI_AO: // 아이템 + 올리기...
                {
#if __VER >= 13 // __EXT_ENCHANT
#ifdef __INCREASE_UPGRADE_LIMIT
                    DWORD dwMax = __NEW_RING_LIMIT;
#else
                    DWORD dwMax = 20;
#endif
#else // __EXT_ENCHANT
                    DWORD dwMax    = 10;
#endif // __EXT_ENCHANT
#if __VER >= 11 // __SYS_COLLECTING
                    if (((CItemElem*)pItemBase)->IsAccessory())
#ifdef __INCREASE_UPGRADE_LIMIT
                        dwMax = __NEW_RING_LIMIT;
#else
                        dwMax    = 20;
#endif

FIND LOWER:
Code:
            case UI_RAO: // 아이템 속성 + 올리기...
                {
#if __VER >= 13 // __EXT_ENCHANT
                    if( ( (CItemElem*)pItemBase )->m_nResistAbilityOption > 20 )
#else // __EXT_ENCHANT
                    if( ( (CItemElem*)pItemBase )->m_nResistAbilityOption > 10 ) 
#endif // __EXT_ENCHANT
                        return;
#if __VER >= 13 // __EXT_ENCHANT
                    if( dwValue > 20 )
                        dwValue        = 20;

CHANGE TO:
Code:
            case UI_RAO: // 아이템 속성 + 올리기...
                {
#if __VER >= 13 // __EXT_ENCHANT
#ifdef __INCREASE_UPGRADE_LIMIT
                    if( ( (CItemElem*)pItemBase )->m_nResistAbilityOption > __NEW_RING_LIMIT)
#else
                    if( ( (CItemElem*)pItemBase )->m_nResistAbilityOption > 20 )
#endif
#else // __EXT_ENCHANT
                    if( ( (CItemElem*)pItemBase )->m_nResistAbilityOption > 10 ) 
#endif // __EXT_ENCHANT
                        return;
#if __VER >= 13 // __EXT_ENCHANT
#ifdef __INCREASE_UPGRADE_LIMIT
                    if (dwValue > __NEW_RING_LIMIT)
                        dwValue = __NEW_RING_LIMIT;
#else
                    if( dwValue > 20 )
                        dwValue        = 20;
#endif

================================================

WndField.h
I have not found why this needs to be done, but this entire thing did not work for me if I did not do this.

FIND enum { SMELT_MAX = 10 };

REPLACE WITH:
Code:
#ifdef __INCREASE_UPGRADE_LIMIT
    enum { SMELT_MAX = __NEW_MAX_LIMIT };
#else
    enum { SMELT_MAX = 10 };
#endif

================================================

WndField.cpp

FIND EVERY INSTANCE OF:
Code:
    for(int i = 0; i < SMELT_MAX; ++i)
    {
There should be 16 instances.

REPLACE THEM ALL WITH:
Code:
#ifdef __INCREASE_UPGRADE_LIMIT
    // This MUST be < 10. Higher causes errors with safe upgrade windows.
    for(int i = 0; i < 10; ++i)
#else
    for(int i = 0; i < SMELT_MAX; ++i)
#endif
    {


Lower, in the same file, find int CWndSmeltSafety::GetDefaultMaxSmeltValue

REPLACE WHOLE METHOD WITH:
Code:
int CWndSmeltSafety::GetDefaultMaxSmeltValue(void)
{
    assert(m_pItemElem != NULL);
    int nDefaultMaxSmeltValue(0);
    switch(m_eWndMode)
    {
    case WND_NORMAL:
        {
#ifdef __INCREASE_UPGRADE_LIMIT
            nDefaultMaxSmeltValue = __NEW_ITEM_LIMIT;
#else
            nDefaultMaxSmeltValue = 10;
#endif
            break;
        }
    case WND_ACCESSARY:
        {
#ifdef __INCREASE_UPGRADE_LIMIT
        nDefaultMaxSmeltValue = __NEW_RING_LIMIT;
#else
        nDefaultMaxSmeltValue = 20;
#endif
            break;
        }
    case WND_PIERCING:
        {
            if(m_pItemElem->GetProp()->dwItemKind3 == IK3_SUIT)
            {
#ifdef __INCREASE_UPGRADE_LIMIT
                nDefaultMaxSmeltValue = __NEW_PIERCE_LIMIT;
#else
                nDefaultMaxSmeltValue = 4;
#endif
            }
            else
            {
#ifdef __INCREASE_UPGRADE_LIMIT
                nDefaultMaxSmeltValue = __NEW_PIERCE2_LIMIT;
#else
                nDefaultMaxSmeltValue = 10;
#endif
            }
            break;
        }
#if __VER >= 15 // __15_5TH_ELEMENTAL_SMELT_SAFETY
    case WND_ELEMENT:
        {
#ifdef __INCREASE_UPGRADE_LIMIT
        nDefaultMaxSmeltValue = __NEW_CARD_LIMIT;
#else
        nDefaultMaxSmeltValue = 20;
#endif
            break;
        }
#endif // __15_5TH_ELEMENTAL_SMELT_SAFETY
    }
    return nDefaultMaxSmeltValue;
}

And there you go! Your limits should now be increased! The next step is to update your resource files to match the upgrade/piercing limits.
================================================
Setting the upgrade chance:


ItemUpgrade.lua
tSuitProb = { 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 } -- Suit now has 10 piercings
tGeneral = { 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000 }; -- Weapons and Armor now has up to +20

-- I haven't figured out what this does yet, but I think it might be for element upgrading.
-- Add this underneath the other AddAttributes
Code:
AddAttribute(    21,        10000,        3400,            3400,            3800    )
AddAttribute(    22,        10000,        4000,            4000,            4200    )
AddAttribute(    23,        10000,        4500,            4500,            4750    )
AddAttribute(    24,        10000,        5200,            5200,            5700    )
AddAttribute(    25,        10000,        6000,            6000,            6800    )

================================================

Replace the Accessory_Probability block which is at the top of s.txt
Code:
Accessory_Probability    // 1 / 10000 ±âÁØ    
{        
    10000    // 0 - 1
    10000    // 1 - 2
    10000    // 2 - 3
    10000    // 3 - 4
    10000    // 4  - 5
    10000    // 5 - 6
    10000    // 6 - 7
    10000    // 7 - 8
    10000    // 8 - 9
    10000    // 9 - 10
    10000    // 10 - 11
    10000    // 11 - 12
    10000    // 12 - 13
    10000    // 13 - 14
    10000    // 14 - 15
    10000    // 15 - 16
    10000    // 16 - 17
    10000    // 17 - 18
    10000    // 18 - 19
    10000    // 19 - 20
    10000    // 20 - 21
    10000    // 21 - 22
    10000    // 22 - 23
    10000    // 23 - 24
    10000    // 24 - 25
    10000    // 25 - 26
    10000    // 26 - 27
    10000    // 27 - 28
    10000    // 28 - 29
    10000    // 29 - 30
    10000    // 30 - 31
    10000    // 31 - 32
    10000    // 32 - 33
    10000    // 33 - 34
    10000    // 34 - 35
    10000    // 35 - 36
    10000    // 36 - 37
    10000    // 37 - 38
    10000    // 38 - 39
    10000    // 39 - 40
}
================================================
Setting up the set bonuses:

Replace the Setitem block that is almost at the bottom of expTable.inc
Code:
Setitem
{
// 명중률 블럭률 추가HP률 마법공격력 추가스탯
    1    1    0    0    0    // +1
    2    2    0    0    0    // +2
    3    3    3    1    1    // +3
    5    4    4    2    1    // +4
    8    5    5    3    1    // +5
    10    5    5    4    2    // +6
    15    5    5    5    2    // +7
    20    10    10    8    2    // +8
    25    10    10    10    3    // +9
    30    15    20    12    3    // +10
    35    15    20    15    3    // +11
    40    15    20    15    4    // +12
    45    15    20    15    4    // +13
    50    15    20    15    5    // +14
    50    15    20    15    5    // +15
    50    15    20    16    6    // +16
    50    15    20    17    7    // +17
    50    15    20    18    8    // +18
    50    15    20    19    9    // +19
    50    15    20    20    10    // +20
}


Once you have done all of this, you should be all set! Make sure to fix up your resource files every time you increase your upgrade limits!!
 
Last edited:
Back
Top