Jump to content

Problem costume weapon bonus


Recommended Posts

Hello, I have problem with adding bonuses to costume weapon. I am trying to add item, which will set 3 bonuses to costume weapon. Costume body and hair are working fine.
This is the problem: https://metin2.download/picture/5802sSMsSYtv3ny9DZ16XND1iHs5QRz7/.gif

Code:

                                    else if(item->GetVnum() == 70070)
                                    {
                                        if (item2->GetAttributeCount() != 0)
                                        {
                                            ChatPacket(CHAT_TYPE_INFO, "Bonuses are already in this item.");
                                            return false;
                                        }
                                        else
                                        {
                                            if (number(1, 100) <= 25) //Chance to add bonuses
                                            {
                                                if (item2->GetType() == ITEM_COSTUME && item2->GetSubType() == COSTUME_WEAPON_SWORD && item->GetVnum() == 70070)
                                                {
                                                    item2->SetForceAttribute(0, 1, 2000);
                                                    item2->SetForceAttribute(1, 63, 10);
                                                    item2->SetForceAttribute(2, 43, 10);
                                                }
                                            }
                                        }
                                        item->SetCount(item->GetCount() - 1);
                                        return true;
                                    }

Thanks for any advice.
Best Regards,
mustafaxddd

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
Link to comment
Share on other sites

6 minutes ago, mustafaxddd said:

Hi, here it is: 

This is the hidden content, please

Try:

Find in uiinventory.py:

Spoiler

elif "USE_ADD_ATTRIBUTE" == useType:

Add:

Spoiler

            elif "USE_COSTUME_CHANGE_ATTRIBUTE" == useType:
                if self.__CanChangeCostumeAttrList(dstSlotPos):
                    return True
            elif "USE_COSTUME_ADD_ATTRIBUTE" == useType:
                if self.__CanResetCostumeAttr(dstSlotPos):
                    return True

Find:

Spoiler

__CanChangeItemAttrList

Add under function:

Spoiler

    def __CanChangeCostumeAttrList(self, dstSlotPos):
        dstItemVNum = player.GetItemIndex(dstSlotPos)
        if dstItemVNum == 0:
            return False

        item.SelectItem(dstItemVNum)

        if item.GetItemType() != item.ITEM_TYPE_COSTUME:
            return False

        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            if player.GetItemAttribute(dstSlotPos, i) != 0:
                return True

        return False

    def __CanResetCostumeAttr(self, dstSlotPos):
        dstItemVNum = player.GetItemIndex(dstSlotPos)
        if dstItemVNum == 0:
            return False

        item.SelectItem(dstItemVNum)

        if item.GetItemType() != item.ITEM_TYPE_COSTUME:
            return False

        for i in xrange(player.METIN_SOCKET_MAX_NUM):
            if player.GetItemAttribute(dstSlotPos, i) != 0:
                return True

        return False

 

Hope I helped.
iBeast

Link to comment
Share on other sites

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.