Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chore/upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanhoare committed Jan 17, 2025
1 parent 684ea07 commit 7545408
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 111 deletions.
110 changes: 0 additions & 110 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,23 +700,6 @@ Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream& propStream)
break;
}

case ATTR_IMBUEMENTS: {
uint16_t size;
if (!propStream.read<uint16_t>(size)) {
return ATTR_READ_ERROR;
}

for (uint16_t i = 0; i < size; ++i) {
std::shared_ptr<Imbuement> imb = std::make_shared<Imbuement>();
if (!imb->unserialize(propStream)) {
return ATTR_READ_ERROR;
}

addImbuement(imb, false);
}
break;
}

//12+ compatibility
case ATTR_OPENCONTAINER:
case ATTR_PODIUMOUTFIT: {
Expand Down Expand Up @@ -1984,7 +1967,6 @@ void Item::decayImbuements(bool infight) {
}
}


void handleRuneDescription(std::ostringstream& s, const ItemType& it, const Item* item, int32_t& subType) {
if (RuneSpell* rune = g_spells->getRuneSpell(it.id)) {
int32_t tmpSubType = subType;
Expand Down Expand Up @@ -2188,102 +2170,10 @@ void handleMiscDescription(std::ostringstream& s, const ItemType& it, bool& begi
}
}


void handleReflectPercentDescription(std::ostringstream& s, const ItemType& it, bool& begin) {
int16_t show = it.abilities->reflect[0].percent;
if (show != 0) {
for (size_t i = 1; i < COMBAT_COUNT; ++i) {
if (it.abilities->reflect[i].percent != show) {
show = 0;
break;
}
}
}

if (show == 0) {
bool tmp = true;

for (size_t i = 0; i < COMBAT_COUNT; ++i) {
if (it.abilities->reflect[i].percent == 0) {
continue;
}

if (tmp) {
tmp = false;

if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
}

s << "reflect ";
} else {
s << ", ";
}

s << getCombatName(indexToCombatType(i)) << ' ' << std::showpos << it.abilities->reflect[i].percent << std::noshowpos << '%';
}
} else {
if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
}

s << "reflect all " << std::showpos << show << std::noshowpos << '%';
}
}


void handleAbilitiesDescription(std::ostringstream& s, const ItemType& it, bool& begin) {
handleSkillsDescription(s, it, begin);
handleStatsDescription(s, it, begin);
handleStatsPercentDescription(s, it, begin);
handleMiscDescription(s, it, begin);
}

LootCategory_t Item::getLootCategoryId() const
{
uint16_t category = items[id].lootType;

if (!(category & (LOOT_CATEGORY_NONE | LOOT_CATEGORY_GOLD | LOOT_CATEGORY_VALUABLES | LOOT_CATEGORY_EQUIPMENT |
LOOT_CATEGORY_POTIONS | LOOT_CATEGORY_AMMUNITION | LOOT_CATEGORY_CREATURE_PRODUCTS |
LOOT_CATEGORY_FOOD | LOOT_CATEGORY_SPECIAL | LOOT_CATEGORY_MISC))) {
return LOOT_CATEGORY_NONE; // Default to NONE if invalid or unset
}

return static_cast<LootCategory_t>(category);
}

s << "reflect ";
} else {
s << ", ";
}

s << getCombatName(indexToCombatType(i)) << ' ' << std::showpos << it.abilities->reflect[i].percent << std::noshowpos << '%';
}
} else {
if (begin) {
begin = false;
s << " (";
} else {
s << ", ";
}

s << "reflect all " << std::showpos << show << std::noshowpos << '%';
}
}

void handleAbilitiesDescription(std::ostringstream& s, const ItemType& it, bool& begin) {
handleSkillsDescription(s, it, begin);
handleStatsDescription(s, it, begin);
handleStatsPercentDescription(s, it, begin);
handleReflectPercentDescription(s, it, begin);
handleAbsorbsPercentDescription(s, it, begin);
handleAbsorbsFieldsPercentDescription(s, it, begin);
handleMiscDescription(s, it, begin);
}

Expand Down
1 change: 0 additions & 1 deletion src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ enum AttrTypes_t {
ATTR_OPENCONTAINER = 46,
ATTR_PODIUMOUTFIT = 47,
ATTR_IMBUEMENTS = 48,
ATTR_IMBUEMENTS,
};

enum Attr_ReadValue {
Expand Down

0 comments on commit 7545408

Please sign in to comment.