Yardım Npc de dönüştürülen itemlerin efsunları kayboluyor

Konu sahibi bu konuda soru soruyor. Sorusu ile ilgili bilgisi olanların yanıtlamasını bekliyor.

Heradot

Çaylak Üye
Üye
Mesaj
7
Beğeni
1
Puan
20
Cube dosyasındaki dönüşüm npclerinde +9 zodyak +0 mega zodyağa mesela orağa dönüştürünce atıyorum 40 ort varsa random ortalama geliyor bunun efsun sabitleme yöntemi varmı
 
Linkleri görebilmek için giriş yap veya kayıt ol.

Kod:
### Cube.cpp

//Search :
    this->gold = 0;

//Add after :
#ifdef ENABLE_CUBE_RENEWAL
    this->allowCopyAttr = false;
#endif


//Search:
        else TOKEN("gold")
        {
            cube_data->gold = value1;
        }


//Add after :

#ifdef ENABLE_CUBE_RENEWAL
        else TOKEN("allow_copy")
        {
            cube_data->allowCopyAttr = (value1 == 1 ? true : false);
        }
#endif

//Search in : bool Cube_make (LPCHARACTER ch)
    LPITEM    new_item;

Add after :

#ifdef ENABLE_CUBE_RENEWAL
    DWORD copyAttr[ITEM_ATTRIBUTE_MAX_NUM][2];
#endif

//Search :
CUBE_VALUE    *reward_value = cube_proto->reward_value();

//Add after:
#ifdef ENABLE_CUBE_RENEWAL
    for (int i=0; i<CUBE_MAX_NUM; ++i)
    {
        if (NULL==items[i])    continue;

        if (items[i]->GetType() == ITEM_WEAPON || items[i]->GetType() == ITEM_ARMOR)
        {
            bool hasElement = false;
            for (int j = 0; j < cube_proto->item.size(); ++j)
            {
                if(cube_proto->item[j].vnum == items[i]->GetVnum())
                {
                    hasElement = true;
                    break;
                }
            }
            
            if(hasElement == false)
                continue;
            
            for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
            {
                copyAttr[a][0] = items[i]->GetAttributeType(a);
                copyAttr[a][1] = items[i]->GetAttributeValue(a);
            }

            break;
        }
        
        continue;
    }
#endif

//Search:
new_item = ch->AutoGiveItem(reward_value->vnum, reward_value->count);

//Add after:

#ifdef ENABLE_CUBE_RENEWAL
        if (cube_proto->allowCopyAttr == true && copyAttr != NULL)
        {
            new_item->ClearAttribute();
            
            for (int a = 0; a < ITEM_ATTRIBUTE_MAX_NUM; a++)
            {
                new_item->SetForceAttribute(a, copyAttr[a][0], copyAttr[a][1]);
            }
        }
#endif



###cube.h

//Search in : struct CUBE_DATA

    int                        percent;
    unsigned int            gold;

//Add after :

#ifdef ENABLE_CUBE_RENEWAL
    bool                    allowCopyAttr;
#endif


###service.h
/Add:

#define ENABLE_CUBE_RENEWAL


Example in cube.txt
section       
npc    20378   
item    11299    1
item    30509    10
item    30516    10
item    30514    10
allow_copy    1
reward    20000    1
gold    100000   
percent    60   
end
 
Geri
Üst