|
|
|
@ -380,11 +380,11 @@ Item::Item(uint32_t amt,IT item,uint8_t enhancementLevel) |
|
|
|
|
void Inventory::AddItem(IT it,uint32_t amt,bool monsterDrop){ |
|
|
|
|
if(!ITEM_DATA.count(it))ERR("Item "<<std::quoted(it)<<" does not exist in Item Database!"); |
|
|
|
|
|
|
|
|
|
std::shared_ptr<Item>newItem=(*_inventory.insert({it,std::make_shared<Item>(amt,it)})).second; |
|
|
|
|
newItem->RandomizeStats(); |
|
|
|
|
|
|
|
|
|
if(ITEM_DATA[it].IsEquippable()){ //Do not stack equips!
|
|
|
|
|
for(uint32_t i=0;i<amt;i++){ |
|
|
|
|
std::shared_ptr<Item>newItem=(*_inventory.insert({it,std::make_shared<Item>(amt,it)})).second; |
|
|
|
|
newItem->RandomizeStats(); |
|
|
|
|
InsertIntoSortedInv(newItem); |
|
|
|
|
} |
|
|
|
|
goto SkipAddingStackableItem; |
|
|
|
@ -392,7 +392,7 @@ void Inventory::AddItem(IT it,uint32_t amt,bool monsterDrop){ |
|
|
|
|
else |
|
|
|
|
//There are two places to manipulate items in (Both the sorted inventory and the actual inventory)
|
|
|
|
|
if(!_inventory.count(it)){ |
|
|
|
|
InsertIntoSortedInv(newItem); |
|
|
|
|
InsertIntoSortedInv((*_inventory.insert({it,std::make_shared<Item>(amt,it)})).second); |
|
|
|
|
}else{ |
|
|
|
|
auto inventory=_inventory.equal_range(it); |
|
|
|
|
if(std::accumulate(inventory.first,inventory.second,0, |
|
|
|
@ -564,7 +564,11 @@ const bool Item::IsEquippable()const{ |
|
|
|
|
} |
|
|
|
|
const std::string Item::Description(CompactText compact)const{ |
|
|
|
|
std::string description=it->Description(); |
|
|
|
|
if(IsArmor()||IsWeapon()){ |
|
|
|
|
if(IsEquippable()){ |
|
|
|
|
if(HasRandomizedStats()){ |
|
|
|
|
description+='\n'; |
|
|
|
|
description+=randomizedStats.GetStatsString(); |
|
|
|
|
} |
|
|
|
|
description+='\n'; |
|
|
|
|
description+=GetStats().GetStatsString(compact); |
|
|
|
|
if(ItemSet()){ |
|
|
|
@ -791,7 +795,7 @@ void ItemInfo::InitializeSets(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const Stats&ItemInfo::GetStats(int enhancementLevel)const{ |
|
|
|
|
const Stats ItemInfo::GetStats(int enhancementLevel)const{ |
|
|
|
|
if(enhancement.size()<=enhancementLevel){ |
|
|
|
|
return {}; |
|
|
|
|
} |
|
|
|
@ -1074,4 +1078,8 @@ Stats ItemInfo::RandomizeStats(){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return randomRolls; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const bool Item::HasRandomizedStats()const{ |
|
|
|
|
return randomizedStats.size()>0; |
|
|
|
|
} |