Jump to content

[Help] Add normal Bonus for Sash system


Recommended Posts

mysql-player-item_proto table

111072.jpg.88c70018b31580f6bab57297cf830a10.jpg

Set up, save,
GM in the game, "/RELOAD P" command, then equip your weapon, the bonus will take effect
If you want to see these bonuses, you must epk - locale_xx

 

Bonus code:

1 MAX_HP
2    MAX_SP
3 CON
4    INT
5 STR
6 DEX
   

。。。。。。。。。。。。。。。。。。。。。

  • Love 1
Link to comment
Share on other sites

24 minutes ago, Torres said:

mysql-player-item_proto table

111072.jpg.88c70018b31580f6bab57297cf830a10.jpg

Set up, save,
GM in the game, "/RELOAD P" command, then equip your weapon, the bonus will take effect
If you want to see these bonuses, you must epk - locale_xx

 

Bonus code:

1 MAX_HP
2    MAX_SP
3 CON
4    INT
5 STR
6 DEX
   

。。。。。。。。。。。。。。。。。。。。。

This works for normal item like weapon, armor, etc.. I would like to do this for ACCE items, instead of absorbing bonus I want to add normal bonus too

Link to comment
Share on other sites

absorbing is also a bonus, why should hp etc. not work on sash?

just do it like that:

85001	¸íÀåÀÇ ¾×¼¼¼­¸®(È­·Á)	ITEM_COSTUME	COSTUME_ACCE	1	ANTI_DROP | ANTI_GIVE | ANTI_PKDROP | ANTI_MYSHOP	LOG	NONE	NONE	100000	0	85002	409	0	LIMIT_NONE	0	LIMIT_NONE	0	APPLY_ACCEDRAIN_RATE	1	APPLY_MAX_HP	10000	APPLY_NONE	0	0	0	0	0	0	0	100	0	0

 

Link to comment
Share on other sites

15 minutes ago, DrTurk said:

absorbing is also a bonus, why should hp etc. not work on sash?

just do it like that:


85001	¸íÀåÀÇ ¾×¼¼¼­¸®(È­·Á)	ITEM_COSTUME	COSTUME_ACCE	1	ANTI_DROP | ANTI_GIVE | ANTI_PKDROP | ANTI_MYSHOP	LOG	NONE	NONE	100000	0	85002	409	0	LIMIT_NONE	0	LIMIT_NONE	0	APPLY_ACCEDRAIN_RATE	1	APPLY_MAX_HP	10000	APPLY_NONE	0	0	0	0	0	0	0	100	0	0

 

Yea exactly, I don't understand why it doesn't work.. :(

I did this but when i equip it i don't receive the HP Bonus, could you maybe try it too and see if it works for you?

Link to comment
Share on other sites

4 minutes ago, Cripplez said:

Could you send me your item.cpp ? So i will check if there are some difference in CItem::ModifyPoints(bool bAdd) and in the ENABLE_ACCE_SYSTEM

thank you

I can't upload files or images, i don't know why, but here's my function: if you need the whole code from the file i'll put it on pastebin

 

Spoiler


void CItem::ModifyPoints(bool bAdd)
{
    int accessoryGrade;

    // ¹«±â¿Í °©¿Ê¸¸ ¼ÒÄÏÀ» Àû¿ë½ÃŲ´Ù.
    if (false == IsAccessoryForSocket())
    {
        if (m_pProto->bType == ITEM_WEAPON || m_pProto->bType == ITEM_ARMOR)
        {
            // ¼ÒÄÏÀÌ ¼Ó¼º°­È­¿¡ »ç¿ëµÇ´Â °æ¿ì Àû¿ëÇÏÁö ¾Ê´Â´Ù (ARMOR_WRIST ARMOR_NECK ARMOR_EAR)
            for (int i = 0; i < ITEM_SOCKET_MAX_NUM; ++i)
            {
                DWORD dwVnum;

                if ((dwVnum = GetSocket(i)) <= 2)
                    continue;

                TItemTable * p = ITEM_MANAGER::instance().GetTable(dwVnum);

                if (!p)
                {
                    sys_err("cannot find table by vnum %u", dwVnum);
                    continue;
                }

                if (ITEM_METIN == p->bType)
                {
                    //m_pOwner->ApplyPoint(p->alValues[0], bAdd ? p->alValues[1] : -p->alValues[1]);
                    for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i)
                    {
                        if (p->aApplies.bType == APPLY_NONE)
                            continue;

                        if (p->aApplies.bType == APPLY_SKILL)
                            m_pOwner->ApplyPoint(p->aApplies.bType, bAdd ? p->aApplies.lValue : p->aApplies.lValue ^ 0x00800000);
                        else
                            m_pOwner->ApplyPoint(p->aApplies.bType, bAdd ? p->aApplies.lValue : -p->aApplies.lValue);
                    }
                }
            }
        }

        accessoryGrade = 0;
    }
    else
    {
        accessoryGrade = MIN(GetAccessorySocketGrade(), ITEM_ACCESSORY_SOCKET_MAX_NUM);
    }
    #ifdef __SASH_SYSTEM__
    if ((GetType() == ITEM_COSTUME) && (GetSubType() == COSTUME_SASH) && (GetSocket(SASH_ABSORBED_SOCKET)))
    {
        TItemTable * pkItemAbsorbed = ITEM_MANAGER::instance().GetTable(GetSocket(SASH_ABSORBED_SOCKET));
        if (pkItemAbsorbed)
        {
            if ((pkItemAbsorbed->bType == ITEM_ARMOR) && (pkItemAbsorbed->bSubType == ARMOR_BODY))
            {
                long lDefGrade = pkItemAbsorbed->alValues[1] + long(pkItemAbsorbed->alValues[5] * 2);
                double dValue = lDefGrade * GetSocket(SASH_ABSORPTION_SOCKET);
                dValue = (double)dValue / 100;
                dValue = (double)dValue + .5;
                lDefGrade = (long) dValue;
                if ((pkItemAbsorbed->alValues[1] > 0) && (lDefGrade <= 0) || (pkItemAbsorbed->alValues[5] > 0) && (lDefGrade < 1))
                    lDefGrade += 1;
                else if ((pkItemAbsorbed->alValues[1] > 0) || (pkItemAbsorbed->alValues[5] > 0))
                    lDefGrade += 1;
                
                m_pOwner->ApplyPoint(APPLY_DEF_GRADE_BONUS, bAdd ? lDefGrade : -lDefGrade);
                
                long lDefMagicBonus = pkItemAbsorbed->alValues[0];
                dValue = lDefMagicBonus * GetSocket(SASH_ABSORPTION_SOCKET);
                dValue = (double)dValue / 100;
                dValue = (double)dValue + .5;
                lDefMagicBonus = (long) dValue;
                if ((pkItemAbsorbed->alValues[0] > 0) && (lDefMagicBonus < 1))
                    lDefMagicBonus += 1;
                else if (pkItemAbsorbed->alValues[0] > 0)
                    lDefMagicBonus += 1;
                
                m_pOwner->ApplyPoint(APPLY_MAGIC_DEF_GRADE, bAdd ? lDefMagicBonus : -lDefMagicBonus);
            }
            else if (pkItemAbsorbed->bType == ITEM_WEAPON)
            {
                long lAttGrade = pkItemAbsorbed->alValues[4] + pkItemAbsorbed->alValues[5];
                if (pkItemAbsorbed->alValues[3] > pkItemAbsorbed->alValues[4])
                    lAttGrade = pkItemAbsorbed->alValues[3] + pkItemAbsorbed->alValues[5];
                
                double dValue = lAttGrade * GetSocket(SASH_ABSORPTION_SOCKET);
                dValue = (double)dValue / 100;
                dValue = (double)dValue + .5;
                lAttGrade = (long) dValue;
                if (((pkItemAbsorbed->alValues[3] > 0) && (lAttGrade < 1)) || ((pkItemAbsorbed->alValues[4] > 0) && (lAttGrade < 1)))
                    lAttGrade += 1;
                else if ((pkItemAbsorbed->alValues[3] > 0) || (pkItemAbsorbed->alValues[4] > 0))
                    lAttGrade += 1;
                
                m_pOwner->ApplyPoint(APPLY_ATT_GRADE_BONUS, bAdd ? lAttGrade : -lAttGrade);
                
                long lAttMagicGrade = pkItemAbsorbed->alValues[2] + pkItemAbsorbed->alValues[5];
                if (pkItemAbsorbed->alValues[1] > pkItemAbsorbed->alValues[2])
                    lAttMagicGrade = pkItemAbsorbed->alValues[1] + pkItemAbsorbed->alValues[5];
                
                dValue = lAttMagicGrade * GetSocket(SASH_ABSORPTION_SOCKET);
                dValue = (double)dValue / 100;
                dValue = (double)dValue + .5;
                lAttMagicGrade = (long) dValue;
                if (((pkItemAbsorbed->alValues[1] > 0) && (lAttMagicGrade < 1)) || ((pkItemAbsorbed->alValues[2] > 0) && (lAttMagicGrade < 1)))
                    lAttMagicGrade += 1;
                else if ((pkItemAbsorbed->alValues[1] > 0) || (pkItemAbsorbed->alValues[2] > 0))
                    lAttMagicGrade += 1;
                
                m_pOwner->ApplyPoint(APPLY_MAGIC_ATT_GRADE, bAdd ? lAttMagicGrade : -lAttMagicGrade);
            }
        }
    }
    #endif

    for (int i = 0; i < ITEM_APPLY_MAX_NUM; ++i)
    {
        #ifdef __SASH_SYSTEM__
        if ((m_pProto->aApplies.bType == APPLY_NONE) && (GetType() != ITEM_COSTUME) && (GetSubType() != COSTUME_SASH))
        #else
        if (m_pProto->aApplies.bType == APPLY_NONE)
        #endif
            continue;

#ifdef ENABLE_MOUNT_LIKE_HORSE_SYSTEM
        if(IsMountItem())
            continue;
#endif
        
        BYTE bType = m_pProto->aApplies.bType;
        long value = m_pProto->aApplies.lValue;
        #ifdef __SASH_SYSTEM__
        if ((GetType() == ITEM_COSTUME) && (GetSubType() == COSTUME_SASH))
        {
            TItemTable * pkItemAbsorbed = ITEM_MANAGER::instance().GetTable(GetSocket(SASH_ABSORBED_SOCKET));
            if (pkItemAbsorbed)
            {
                if (pkItemAbsorbed->aApplies.bType == APPLY_NONE)
                    continue;
                
                bType = pkItemAbsorbed->aApplies.bType;
                value = pkItemAbsorbed->aApplies.lValue;
                if (value < 0)
                    continue;
                
                double dValue = value * GetSocket(SASH_ABSORPTION_SOCKET);
                dValue = (double)dValue / 100;
                dValue = (double)dValue + .5;
                value = (long) dValue;
                if ((pkItemAbsorbed->aApplies.lValue > 0) && (value <= 0))
                    value += 1;
            }
            else
                continue;
        }
        #endif
        
        if (bType != APPLY_SKILL)
        {
            if (accessoryGrade != 0)
                value += MAX(accessoryGrade, value * aiAccessorySocketEffectivePct[accessoryGrade] / 100);
            
            m_pOwner->ApplyPoint(bType, bAdd ? value : -value);
        }
        else
            m_pOwner->ApplyPoint(bType, bAdd ? value : value ^ 0x00800000);
    }
    // Ãʽ´ÞÀÇ ¹ÝÁö, ÇÒ·ÎÀ© »çÅÁ, ÇູÀÇ ¹ÝÁö, ¿µ¿øÇÑ »ç¶ûÀÇ Ææ´øÆ®ÀÇ °æ¿ì
    // ±âÁ¸ÀÇ Çϵå ÄÚµùÀ¸·Î °­Á¦·Î ¼Ó¼ºÀ» ºÎ¿©ÇßÁö¸¸,
    // ±× ºÎºÐÀ» Á¦°ÅÇÏ°í special item group Å×ÀÌºí¿¡¼­ ¼Ó¼ºÀ» ºÎ¿©Çϵµ·Ï º¯°æÇÏ¿´´Ù.
    // ÇÏÁö¸¸ Çϵå ÄÚµùµÇ¾îÀÖÀ» ¶§ »ý¼ºµÈ ¾ÆÀÌÅÛÀÌ ³²¾ÆÀÖÀ» ¼öµµ À־ Ư¼öó¸® Çسõ´Â´Ù.
    // ÀÌ ¾ÆÀÌÅÛµéÀÇ °æ¿ì, ¹Ø¿¡ ITEM_UNIQUEÀÏ ¶§ÀÇ Ã³¸®·Î ¼Ó¼ºÀÌ ºÎ¿©µÇ±â ¶§¹®¿¡,
    // ¾ÆÀÌÅÛ¿¡ ¹ÚÇôÀÖ´Â attribute´Â Àû¿ëÇÏÁö ¾Ê°í ³Ñ¾î°£´Ù.
    if (true == CItemVnumHelper::IsRamadanMoonRing(GetVnum()) || true == CItemVnumHelper::IsHalloweenCandy(GetVnum())
        || true == CItemVnumHelper::IsHappinessRing(GetVnum()) || true == CItemVnumHelper::IsLovePendant(GetVnum()))
    {
        // Do not anything.
    }
    else
    {
        for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; ++i)
        {
            if (GetAttributeType(i))
            {
                const TPlayerItemAttribute& ia = GetAttribute(i);
                long sValue = ia.sValue;
                #ifdef __SASH_SYSTEM__
                if ((GetType() == ITEM_COSTUME) && (GetSubType() == COSTUME_SASH))
                {
                    double dValue = sValue * GetSocket(SASH_ABSORPTION_SOCKET);
                    dValue = (double)dValue / 100;
                    dValue = (double)dValue + .5;
                    sValue = (long) dValue;
                    if ((ia.sValue > 0) && (sValue <= 0))
                        sValue += 1;
                }
                #endif
                
                if (ia.bType == APPLY_SKILL)
                    m_pOwner->ApplyPoint(ia.bType, bAdd ? sValue : sValue ^ 0x00800000);
                else
                    m_pOwner->ApplyPoint(ia.bType, bAdd ? sValue : -sValue);
            }
        }
    }

    switch (m_pProto->bType)
    {
        case ITEM_PICK:
        case ITEM_ROD:
            {
                if (bAdd)
                {
                    if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON)
                    {
#ifdef __CHANGELOOK_SYSTEM__
                        DWORD dwRes = GetTransmutation() != 0 ? GetTransmutation() : GetVnum();
                        m_pOwner->SetPart(PART_WEAPON, dwRes);
#else
                        m_pOwner->SetPart(PART_WEAPON, GetVnum());
#endif
                    }
                }
                else
                {
                    if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON)
#ifdef __WEAPON_COSTUME_SYSTEM__
                        m_pOwner->SetPart(PART_WEAPON, 0);
#else
                        m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON));
#endif
                }
            }
            break;

        case ITEM_WEAPON:
            {
#ifdef __WEAPON_COSTUME_SYSTEM__
                if (m_pOwner->GetWear(WEAR_COSTUME_WEAPON) != 0)
                    break;
#endif
                if (bAdd)
                {
                    if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON)
                    {
#ifdef __CHANGELOOK_SYSTEM__
                        DWORD dwRes = GetTransmutation() != 0 ? GetTransmutation() : GetVnum();
                        m_pOwner->SetPart(PART_WEAPON, dwRes);
#else
                        m_pOwner->SetPart(PART_WEAPON, GetVnum());
#endif
                    }
                }
                else
                {
                    if (m_wCell == INVENTORY_MAX_NUM + WEAR_WEAPON)
#ifdef __WEAPON_COSTUME_SYSTEM__
                        m_pOwner->SetPart(PART_WEAPON, 0);
#else
                        m_pOwner->SetPart(PART_WEAPON, m_pOwner->GetOriginalPart(PART_WEAPON));
#endif
                }
            }
            break;

        case ITEM_ARMOR:
            {
                // ÄÚ½ºÃõ body¸¦ ÀÔ°íÀÖ´Ù¸é armor´Â ¹þ´ø ÀÔ´ø »ó°ü ¾øÀÌ ºñÁÖ¾ó¿¡ ¿µÇâÀ» ÁÖ¸é ¾È µÊ.
                if (0 != m_pOwner->GetWear(WEAR_COSTUME_BODY))
                    break;

                if (GetSubType() == ARMOR_BODY || GetSubType() == ARMOR_HEAD || GetSubType() == ARMOR_FOOTS || GetSubType() == ARMOR_SHIELD)
                {
                    if (bAdd)
                    {
                        if (GetProto()->bSubType == ARMOR_BODY)
#ifdef __CHANGELOOK_SYSTEM__
                        {
                            DWORD dwRes = GetTransmutation() != 0 ? GetTransmutation() : GetVnum();
                            m_pOwner->SetPart(PART_MAIN, dwRes);
                        }
#else
                            m_pOwner->SetPart(PART_MAIN, GetVnum());
#endif
                    }
                    else
                    {
                        if (GetProto()->bSubType == ARMOR_BODY)
                            m_pOwner->SetPart(PART_MAIN, m_pOwner->GetOriginalPart(PART_MAIN));
                    }
                }
            }
            break;

        // ÄÚ½ºÃõ ¾ÆÀÌÅÛ ÀÔ¾úÀ» ¶§ ij¸¯ÅÍ parts Á¤º¸ ¼¼ÆÃ. ±âÁ¸ ½ºÅ¸ÀÏ´ë·Î Ãß°¡ÇÔ..
        case ITEM_COSTUME:
            {
                DWORD toSetValue = this->GetVnum();
                EParts toSetPart = PART_MAX_NUM;

                // °©¿Ê ÄÚ½ºÃõ
                if (GetSubType() == COSTUME_BODY)
                {
                    toSetPart = PART_MAIN;
                    if (false == bAdd)
                    {
                        const CItem* pArmor = m_pOwner->GetWear(WEAR_BODY);
                        toSetValue = (NULL != pArmor) ? pArmor->GetVnum() : m_pOwner->GetOriginalPart(PART_MAIN);
#ifdef __CHANGELOOK_SYSTEM__
                        if (pArmor)
                            toSetValue = pArmor->GetTransmutation() != 0 ? pArmor->GetTransmutation() : pArmor->GetVnum();
#endif
                    }
#ifdef __CHANGELOOK_SYSTEM__
                    else
                        toSetValue = GetTransmutation() != 0 ? GetTransmutation() : GetVnum();
#endif
                }

                // Çì¾î ÄÚ½ºÃõ
                else if (GetSubType() == COSTUME_HAIR)
                {
                    toSetPart = PART_HAIR;
                    if (!bAdd)
                        toSetValue = 0;
                    else
                    {
#ifdef __CHANGELOOK_SYSTEM__
                        DWORD dwTransmutation = GetTransmutation();
                        if (dwTransmutation != 0)
                        {
                            TItemTable* pItemTable = ITEM_MANAGER::instance().GetTable(dwTransmutation);
                            toSetValue = (pItemTable != NULL) ? pItemTable->alValues[3] : GetValue(3);
                        }
                        else
                            toSetValue = GetValue(3);
#else
                        toSetValue = GetValue(3);
#endif
                    }
                }
                #ifdef __SASH_SYSTEM__
                else if (GetSubType() == COSTUME_SASH)
                {
                    toSetValue -= 85000;
                    if (GetSocket(SASH_ABSORPTION_SOCKET) >= SASH_EFFECT_FROM_ABS)
                        toSetValue += 1000;
                    
                    toSetValue = (bAdd == true) ? toSetValue : 0;
                    toSetPart = PART_SASH;
                }
                #endif
#ifdef __WEAPON_COSTUME_SYSTEM__
                else if (GetSubType() == COSTUME_WEAPON)
                {
                    toSetPart = PART_WEAPON;
                    if (!bAdd)
                    {
                        const CItem* pWeapon = m_pOwner->GetWear(WEAR_WEAPON);
                        toSetValue = (NULL != pWeapon) ? pWeapon->GetVnum() : m_pOwner->GetPart(PART_WEAPON);                        
                    }
                }
#endif

                if (PART_MAX_NUM != toSetPart)
                {
                    m_pOwner->SetPart((BYTE)toSetPart, toSetValue);
                    m_pOwner->UpdatePacket();
                }
            }
            break;
        case ITEM_UNIQUE:
            {
                if (0 != GetSIGVnum())
                {
                    const CSpecialItemGroup* pItemGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(GetSIGVnum());
                    if (NULL == pItemGroup)
                        break;
                    DWORD dwAttrVnum = pItemGroup->GetAttrVnum(GetVnum());
                    const CSpecialAttrGroup* pAttrGroup = ITEM_MANAGER::instance().GetSpecialAttrGroup(dwAttrVnum);
                    if (NULL == pAttrGroup)
                        break;
                    for (itertype (pAttrGroup->m_vecAttrs) it = pAttrGroup->m_vecAttrs.begin(); it != pAttrGroup->m_vecAttrs.end(); it++)
                    {
                        m_pOwner->ApplyPoint(it->apply_type, bAdd ? it->apply_value : -it->apply_value);
                    }
                }
            }
            break;
    }
}

 

 

Hope this helps

It's all lies

Link to comment
Share on other sites

4 hours ago, displayjokes said:

I can't upload files or images, i don't know why, but here's my function: if you need the whole code from the file i'll put it on pastebin

Hope this helps

Thank you, the code is almost the same, I tried 1/2 changes but it still doesn't work :(

Aug 30 00:30:15 :: QUERY_FLUSH: REPLACE INTO item (id, owner_id, `window`, pos, count, vnum, socket0, socket1, socket2) VALUES(10000052, 6, 1, 17, 1, 85006, 1, 0, 0)

Even in Item of my Mysql doesn't create the apply_max_hp  10000

Link to comment
Share on other sites

On 8/29/2019 at 9:35 PM, Cripplez said:

Thank you, the code is almost the same, I tried 1/2 changes but it still doesn't work :(

Aug 30 00:30:15 :: QUERY_FLUSH: REPLACE INTO item (id, owner_id, `window`, pos, count, vnum, socket0, socket1, socket2) VALUES(10000052, 6, 1, 17, 1, 85006, 1, 0, 0)

Even in Item of my Mysql doesn't create the apply_max_hp  10000

Huh, ir night vê the system that came incomplete, that's out of my range xb

It's all lies

Link to comment
Share on other sites

  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.