Пример #1
0
uint32 Item::RepairItemCost()
{
    uint32 ilevel = m_itemProto->ItemLevel;
    if(ilevel <= 0)
        ilevel = 1;
    DurabilityCostsEntry* dcosts = dbcDurabilityCosts.LookupEntryForced(ilevel);
    if(dcosts == NULL)
    {
        //dcosts->itemlevel = 1;
        LOG_ERROR("Repair: Unknown item level (%u)", dcosts);
        return 0;
    }

    DurabilityQualityEntry* dquality = dbcDurabilityQuality.LookupEntryForced((m_itemProto->Quality + 1) * 2);
    if(dquality == NULL)
    {
        //dquality->quality_modifier = 4;
        LOG_ERROR("Repair: Unknown item quality (%u)", dquality);
        return 0;
    }

    uint32 dmodifier = dcosts->modifier[ m_itemProto->Class == ITEM_CLASS_WEAPON ? m_itemProto->SubClass : m_itemProto->SubClass + 21 ];
    uint32 cost = long2int32((GetDurabilityMax() - GetDurability()) * dmodifier * double(dquality->quality_modifier));
    return cost * 4;
}
Пример #2
0
uint32 Item::RepairItemCost()
{
	DurabilityCostsEntry * dcosts = dbcDurabilityCosts.LookupEntry( m_itemProto->ItemLevel );
	if( dcosts == NULL )
	{
		sLog.outError("Repair: Unknown item level (%u)", dcosts);
		return 0;
	}

	DurabilityQualityEntry * dquality = dbcDurabilityQuality.LookupEntry( ( m_itemProto->Quality + 1 ) * 2);
	if( dquality == NULL )
	{
		sLog.outError("Repair: Unknown item quality (%u)", dquality);
		return 0;
	}

	uint32 dmodifier = dcosts->modifier[ m_itemProto->Class == ITEM_CLASS_WEAPON ? m_itemProto->SubClass : m_itemProto->SubClass + 21 ];
	uint32 cost = long2int32( ( GetDurabilityMax() - GetDurability() ) * dmodifier * double( dquality->quality_modifier ) );
	return cost;
}