Hi everyone
The first item creates the first and second bonus
The second item creates the third and fourth bonus
But (GetAttributeCount) the two item cannot be made compatible
So are there any other ideas for bonus
Here is the code so you can better understand what I mean
The first item creates the first and second bonus
The second item creates the third and fourth bonus
But (GetAttributeCount) the two item cannot be made compatible
So are there any other ideas for bonus
Here is the code so you can better understand what I mean
Kod:
case USE_ADD_COSTUME_ARMOR:
{
LPITEM item2;
if ((!IsValidItemPosition(DestCell)) || (!(item2 = GetItem(DestCell))))
return false;
if (item2->IsEquipped())
BuffOnAttr_RemoveBuffsFromItem(item2);
if ((item2->IsExchanging()) || (item2->IsEquipped()))
return false;
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot carry out the operation!"));
return false;
}
if ((item2->GetSubType() != COSTUME_BODY)){
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot carry out the operation!"));
return false;
}
const BYTE applyType = item->GetValue(0);
const long applyValue = item->GetValue(1);
if (applyType == APPLY_NONE)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("UPS! Something has gone wrong. Get in touch with an administrator."));
return false;
}
const BYTE subTypeFlag = item2->GetBonusFlag();
if (item->GetValue(2) != 0 && subTypeFlag != 0)
{
if (!IS_SET(item->GetValue(2), 1 << subTypeFlag))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot use this object in this item."));
return false;
}
}
const BYTE maxAttrCount = item2->GetBonusMaxAttr();
if (item2->GetAttributeCount() >= maxAttrCount)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't add more bonus to this object!"));
return false;
}
else if(item2->HasAttr(applyType))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This bonus is already added to the object."));
return false;
}
if (item2->GetAttributeCount() < 2){
item2->AddAttribute(applyType, applyValue);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have added a successful bonus!"));
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("you cant add more bonus by this item"));
return false;
}
item->SetCount(item->GetCount() - 1);
return true;
}
break;
case USE_ADD_COSTUME_ARMOR2:
{
LPITEM item2;
if ((!IsValidItemPosition(DestCell)) || (!(item2 = GetItem(DestCell))))
return false;
if (item2->IsEquipped())
BuffOnAttr_RemoveBuffsFromItem(item2);
if ((item2->IsExchanging()) || (item2->IsEquipped()))
return false;
if (item2->GetAttributeSetIndex() == -1)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot carry out the operation!"));
return false;
}
if ((item2->GetSubType() != COSTUME_BODY)){
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot carry out the operation!"));
return false;
}
const BYTE applyType = item->GetValue(0);
const long applyValue = item->GetValue(1);
if (applyType == APPLY_NONE)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("UPS! Something has gone wrong. Get in touch with an administrator."));
return false;
}
const BYTE subTypeFlag = item2->GetBonusFlag();
if (item->GetValue(2) != 0 && subTypeFlag != 0)
{
if (!IS_SET(item->GetValue(2), 1 << subTypeFlag))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You cannot use this object in this item."));
return false;
}
}
const BYTE maxAttrCount = item2->GetBonusMaxAttr();
if (item2->GetAttributeCount() >= maxAttrCount)
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't add more bonus to this object!"));
return false;
}
else if(item2->HasAttr(applyType))
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("This bonus is already added to the object."));
return false;
}
if (item2->GetAttributeCount() < 2){
item2->AddAttribute(applyType, applyValue);
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You have added a successful bonus!"));
}
else
{
ChatPacket(CHAT_TYPE_INFO, LC_TEXT("you cant add more bonus by this item"));
return false;
}
item->SetCount(item->GetCount() - 1);
return true;
}
break;