Eeee bize yok mu çözümü
@CMDK hocamın dediklerini yerine getirince çözümü gerçekleşti Ellerine sağlık Tekrardan Teşekkür ediyorum <3
void CUser::ItemWoreOut(int type, int damage)
{
static uint8 weaponsTypes[] = { RIGHTHAND, LEFTHAND };
static uint8 armourTypes[] = { HEAD, BREAST, LEG, GLOVE, FOOT };
static uint8 repairTypes[] = { RIGHTHAND, LEFTHAND, HEAD, BREAST, LEG, GLOVE, FOOT };
int8 totalSlots = -1;
int worerate;
if (type == ACID_ALL
|| type == UTC_ATTACK
|| type == UTC_DEFENCE)
worerate = damage;
else
worerate = myrand(2, 5);
if (worerate == 0) return;
if (type != ATTACK
&& type != DEFENCE
&& type != REPAIR_ALL
&& type != ACID_ALL
&& type != UTC_ATTACK
&& type != UTC_DEFENCE)
return;
if (type == ATTACK)
totalSlots = sizeof(weaponsTypes) / sizeof(*weaponsTypes);
else if (type == DEFENCE)
totalSlots = sizeof(armourTypes) / sizeof(*armourTypes);
else if (type == REPAIR_ALL)
totalSlots = sizeof(repairTypes) / sizeof(*repairTypes);
else if (type == ACID_ALL)
totalSlots = sizeof(armourTypes) / sizeof(*armourTypes);
else if (type == UTC_ATTACK)
totalSlots = sizeof(weaponsTypes) / sizeof(*weaponsTypes);
else if (type == UTC_DEFENCE)
totalSlots = sizeof(armourTypes) / sizeof(*armourTypes);
if (totalSlots == -1)
return;
for (uint8 i = 0; i < totalSlots; i++)
{
uint8 slot;
if (type == ATTACK)
slot = weaponsTypes
;
else if (type == DEFENCE)
slot = armourTypes;
else if (type == REPAIR_ALL)
slot = repairTypes;
else if (type == UTC_ATTACK)
slot = weaponsTypes;
else if (type == UTC_DEFENCE)
slot = armourTypes;
else
slot = armourTypes;
_ITEM_DATA* pItem = GetItem(slot);
if (!pItem || pItem->nNum == 0)
continue;
_ITEM_TABLE pTable = g_pMain->GetItemPtr(pItem->nNum);
if (pTable.isnull())
continue;
// Is a non-broken item equipped?
if (pItem == nullptr
|| (pItem->sDuration <= 0 && type != REPAIR_ALL)
// Does the item exist?
// If it's in the left or righthand slot, is it a shield? (this doesn't apply to weapons)
|| ((type == ATTACK
|| type == UTC_ATTACK)
&& ((slot == LEFTHAND
|| slot == RIGHTHAND)
&& pTable.m_bSlot == ItemSlot1HLeftHand)))
continue;
if (type == REPAIR_ALL)
{
pItem->sDuration = pTable.m_sDuration;
SendDurability(slot, pItem->sDuration);
UserLookChange(slot, pItem->nNum, pItem->sDuration);
SetUserAbility(true);
continue;
}
int beforepercent = (int)((pItem->sDuration / (double)pTable.m_sDuration) * 100);
int curpercent;
if (worerate > pItem->sDuration)
pItem->sDuration = 0;
else
pItem->sDuration -= worerate;
if (m_sItemArray[slot].sDuration <= 0)
m_sItemArray[slot].sDuration = 0;
if (m_sItemArray[slot].sDuration == 0)
{
SendDurability(slot, 0);
SetUserAbility(false);
SendItemMove(1, 1);
continue;
}
SendDurability(slot, pItem->sDuration);
curpercent = (int)((pItem->sDuration / (double)pTable.m_sDuration) * 100);
if ((curpercent / 5) != (beforepercent / 5))
{
if (curpercent >= 65 && curpercent < 70
|| curpercent >= 25 && curpercent < 30)
UserLookChange(slot, pItem->nNum, pItem->sDuration);
}
}
}