Quote:
Originally Posted by trevius
Tonight, I finally got around to looking into why food stats weren't adding to actual stats (shown in #showstats). It turns out that all of the code to calculate food was already there, but the code for calculating item bonuses wasn't allowing food/drink to work.
In bonuses.cpp around line 182, after this:
Code:
if (!inst->IsEquipable(GetBaseRace(),GetClass()))
{
Add this line:
Code:
if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))
And that whole IF should look like this when you are done adding it:
Code:
if (!inst->IsEquipable(GetBaseRace(),GetClass()))
{
if ((!inst->GetItem()->ItemType == ItemTypeFood) && (!inst->GetItem()->ItemType == ItemTypeFood))
return;
}
If anyone has any issues with this or thinks it may cause a problem or open possible exploits, let me know. I can't think of any. Also, if someone knows of a better way to write it that might be easier on the CPU, feel free to post it. Otherwise, I will get this added to SVN very soon. And, just in time for Thanksgiving too *WINK*
|
I think I would recommend moving that part below where we convert the item instance (inst) to an item (item), that way we basically don't have to convert multiple times:
Code:
void Client::AddItemBonuses(const ItemInst *inst, StatBonuses* newbon, bool isAug) {
if(!inst || !inst->IsType(ItemClassCommon))
{
return;
}
if(inst->GetAugmentType()==0 && isAug == true)
{
return;
}
const Item_Struct *item = inst->GetItem();
if (GetLevel() < item->ReqLevel)
{
return;
}
if (!inst->IsEquipable(GetBaseRace(),GetClass()) && item->ItemType != ItemTypeFood && item->ItemType != ItemTypeFood)
{
return;
}