Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new augments and update item description (amber items) #2900

Merged
merged 16 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 88 additions & 30 deletions data/items/items.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75124,7 +75124,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75150,9 +75152,11 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
<attribute key="intense wound cleansing" value="cooldown">
<attribute key="value" value="120000" />
<attribute key="value" value="120000"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
Expand All @@ -75179,7 +75183,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75205,7 +75211,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75231,7 +75239,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75257,7 +75267,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75285,7 +75297,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75312,7 +75326,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost sword" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75339,7 +75355,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75366,7 +75384,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost club" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75393,7 +75413,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="strong impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand All @@ -75420,7 +75442,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost axe" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="fierce berserk" value="powerful impact" />
<attribute key="fierce berserk" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75473,7 +75497,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="strong impact" />
<attribute key="divine caldera" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75503,7 +75529,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="powerful impact" />
<attribute key="divine caldera" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75533,7 +75561,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="strong impact" />
<attribute key="divine caldera" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75563,7 +75593,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost distance" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine caldera" value="powerful impact" />
<attribute key="divine caldera" value="base">
<attribute key="value" value="4"/>
phacUFPE marked this conversation as resolved.
Show resolved Hide resolved
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75612,8 +75644,12 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="hell's core" value="strong impact" />
<attribute key="energy wave" value="strong impact" />
<attribute key="hell's core" value="base">
<attribute key="value" value="3"/>
</attribute>
<attribute key="energy wave" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75645,8 +75681,12 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="hell's core" value="powerful impact" />
<attribute key="energy wave" value="powerful impact" />
<attribute key="hell's core" value="base">
<attribute key="value" value="6"/>
</attribute>
<attribute key="energy wave" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75707,8 +75747,12 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="eternal winter" value="strong impact" />
<attribute key="terra wave" value="strong impact" />
<attribute key="eternal winter" value="base">
<attribute key="value" value="3"/>
</attribute>
<attribute key="terra wave" value="base">
<attribute key="value" value="4"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75740,8 +75784,12 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="eternal winter" value="powerful impact" />
<attribute key="terra wave" value="powerful impact" />
<attribute key="eternal winter" value="base">
<attribute key="value" value="6"/>
</attribute>
<attribute key="terra wave" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent;weapon">
<attribute key="level" value="600"/>
Expand Down Expand Up @@ -75938,7 +75986,9 @@ Granted by TibiaGoals.com"/>
<attribute key="elemental protection holy" value="3"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="wrath of nature" value="strong impact" />
<attribute key="wrath of nature" value="base">
<attribute key="value" value="8"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="250"/>
Expand Down Expand Up @@ -76101,7 +76151,9 @@ Granted by TibiaGoals.com"/>
<attribute key="skillboost magic level" value="2"/>
</attribute>
<attribute key="augments" value="1">
<attribute key="divine missile" value="strong impact" />
<attribute key="divine missile" value="base">
<attribute key="value" value="6"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="250"/>
Expand Down Expand Up @@ -76145,7 +76197,9 @@ Granted by TibiaGoals.com"/>
<attribute key="absorbpercentenergy" value="2"/>
<attribute key="weight" value="5100"/>
<attribute key="augments" value="1">
<attribute key="intense wound cleansing" value="strong impact" />
<attribute key="intense wound cleansing" value="base">
<attribute key="value" value="50"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="250"/>
Expand All @@ -76160,8 +76214,12 @@ Granted by TibiaGoals.com"/>
<attribute key="absorbpercentfire" value="6"/>
<attribute key="weight" value="3400"/>
<attribute key="augments" value="1">
<attribute key="great energy beam" value="increased damage" />
<attribute key="great death beam" value="increased damage" />
<attribute key="great energy beam" value="base">
<attribute key="value" value="7"/>
</attribute>
<attribute key="great death beam" value="base">
<attribute key="value" value="7"/>
</attribute>
</attribute>
<attribute key="script" value="moveevent">
<attribute key="level" value="250"/>
Expand Down
4 changes: 3 additions & 1 deletion src/creatures/combat/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,9 @@ void Spell::getCombatDataAugment(std::shared_ptr<Player> player, CombatDamage &d
if (augment->value == 0) {
continue;
}
if (augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact) {
if (
augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base
) {
const float augmentPercent = augment->value / 100.0;
damage.primary.value += static_cast<int32_t>(damage.primary.value * augmentPercent);
damage.secondary.value += static_cast<int32_t>(damage.secondary.value * augmentPercent);
Expand Down
9 changes: 4 additions & 5 deletions src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
}

bool Item::hasImbuementCategoryId(uint16_t categoryId) const {
for (uint8_t slotid = 0; slotid < getImbuementSlot(); slotid++) {

Check warning on line 131 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
ImbuementInfo imbuementInfo;
if (getImbuementInfo(slotid, &imbuementInfo)) {
if (const CategoryImbuement* categoryImbuement = g_imbuements().getCategoryByID(imbuementInfo.imbuement->getCategory());
Expand Down Expand Up @@ -282,7 +282,7 @@
void Item::setDefaultSubtype() {
const ItemType &it = items[id];

setItemCount(1);

Check warning on line 285 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

auto itemCharges = it.charges;
if (itemCharges != 0) {
Expand Down Expand Up @@ -405,11 +405,11 @@
if (it.isFluidContainer() || it.isSplash()) {
setAttribute(ItemAttribute_t::FLUIDTYPE, n);
} else if (it.stackable) {
setItemCount(n);

Check warning on line 408 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (it.charges != 0) {
setAttribute(ItemAttribute_t::CHARGES, n);
} else {
setItemCount(n);

Check warning on line 412 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand Down Expand Up @@ -862,97 +862,97 @@
void Item::serializeAttr(PropWriteStream &propWriteStream) const {
const ItemType &it = items[id];
if (auto timeStamp = getAttribute<int64_t>(ItemAttribute_t::STORE)) {
propWriteStream.write<uint8_t>(ATTR_STORE);

Check warning on line 865 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int64_t>(timeStamp);
}
if (it.stackable || it.isFluidContainer() || it.isSplash()) {
propWriteStream.write<uint8_t>(ATTR_COUNT);

Check warning on line 869 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint8_t>(getSubType());

Check warning on line 870 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (auto charges = getAttribute<uint16_t>(ItemAttribute_t::CHARGES)) {
propWriteStream.write<uint8_t>(ATTR_CHARGES);

Check warning on line 874 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint16_t>(charges);
}

if (it.movable) {
if (auto actionId = getAttribute<uint16_t>(ItemAttribute_t::ACTIONID)) {
propWriteStream.write<uint8_t>(ATTR_ACTION_ID);

Check warning on line 880 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint16_t>(actionId);
}
}

if (const std::string &text = getString(ItemAttribute_t::TEXT);
!text.empty()) {
propWriteStream.write<uint8_t>(ATTR_TEXT);

Check warning on line 887 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(text);
}

if (const uint64_t writtenDate = getAttribute<uint64_t>(ItemAttribute_t::DATE)) {
propWriteStream.write<uint8_t>(ATTR_WRITTENDATE);

Check warning on line 892 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint64_t>(writtenDate);
}

const std::string &writer = getString(ItemAttribute_t::WRITER);
if (!writer.empty()) {
propWriteStream.write<uint8_t>(ATTR_WRITTENBY);

Check warning on line 898 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(writer);
}

const std::string &specialDesc = getString(ItemAttribute_t::DESCRIPTION);
if (!specialDesc.empty()) {
propWriteStream.write<uint8_t>(ATTR_DESC);

Check warning on line 904 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(specialDesc);
}

if (hasAttribute(ItemAttribute_t::DURATION)) {
propWriteStream.write<uint8_t>(ATTR_DURATION);

Check warning on line 909 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getDuration());
}

if (auto decayState = getDecaying();
decayState == DECAYING_TRUE || decayState == DECAYING_PENDING) {
propWriteStream.write<uint8_t>(ATTR_DECAYING_STATE);

Check warning on line 915 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint8_t>(decayState);

Check warning on line 916 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (hasAttribute(ItemAttribute_t::NAME)) {
propWriteStream.write<uint8_t>(ATTR_NAME);

Check warning on line 920 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(getString(ItemAttribute_t::NAME));
}

if (hasAttribute(ItemAttribute_t::ARTICLE)) {
propWriteStream.write<uint8_t>(ATTR_ARTICLE);

Check warning on line 925 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(getString(ItemAttribute_t::ARTICLE));
}

if (hasAttribute(ItemAttribute_t::PLURALNAME)) {
propWriteStream.write<uint8_t>(ATTR_PLURALNAME);

Check warning on line 930 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(getString(ItemAttribute_t::PLURALNAME));
}

if (hasAttribute(ItemAttribute_t::WEIGHT)) {
propWriteStream.write<uint8_t>(ATTR_WEIGHT);

Check warning on line 935 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint32_t>(getAttribute<uint32_t>(ItemAttribute_t::WEIGHT));
}

if (hasAttribute(ItemAttribute_t::ATTACK)) {
propWriteStream.write<uint8_t>(ATTR_ATTACK);

Check warning on line 940 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getAttribute<int32_t>(ItemAttribute_t::ATTACK));
}

if (hasAttribute(ItemAttribute_t::DEFENSE)) {
propWriteStream.write<uint8_t>(ATTR_DEFENSE);

Check warning on line 945 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getAttribute<int32_t>(ItemAttribute_t::DEFENSE));
}

if (hasAttribute(ItemAttribute_t::EXTRADEFENSE)) {
propWriteStream.write<uint8_t>(ATTR_EXTRADEFENSE);

Check warning on line 950 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getAttribute<int32_t>(ItemAttribute_t::EXTRADEFENSE));
}

if (hasAttribute(ItemAttribute_t::IMBUEMENT_SLOT)) {
propWriteStream.write<uint8_t>(ATTR_IMBUEMENT_SLOT);

Check warning on line 955 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getAttribute<int32_t>(ItemAttribute_t::IMBUEMENT_SLOT));
}

Expand All @@ -962,54 +962,54 @@
}

if (hasAttribute(ItemAttribute_t::ARMOR)) {
propWriteStream.write<uint8_t>(ATTR_ARMOR);

Check warning on line 965 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int32_t>(getAttribute<int32_t>(ItemAttribute_t::ARMOR));
}

if (hasAttribute(ItemAttribute_t::HITCHANCE)) {
propWriteStream.write<uint8_t>(ATTR_HITCHANCE);

Check warning on line 970 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<int8_t>(getAttribute<int8_t>(ItemAttribute_t::HITCHANCE));
}

if (hasAttribute(ItemAttribute_t::SHOOTRANGE)) {
propWriteStream.write<uint8_t>(ATTR_SHOOTRANGE);

Check warning on line 975 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint8_t>(getAttribute<uint8_t>(ItemAttribute_t::SHOOTRANGE));
}

if (hasAttribute(ItemAttribute_t::SPECIAL)) {
propWriteStream.write<uint8_t>(ATTR_SPECIAL);

Check warning on line 980 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(getString(ItemAttribute_t::SPECIAL));
}

if (hasAttribute(ItemAttribute_t::QUICKLOOTCONTAINER)) {
propWriteStream.write<uint8_t>(ATTR_QUICKLOOTCONTAINER);

Check warning on line 985 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint32_t>(getAttribute<uint32_t>(ItemAttribute_t::QUICKLOOTCONTAINER));
}

if (hasAttribute(ItemAttribute_t::TIER)) {
propWriteStream.write<uint8_t>(ATTR_TIER);

Check warning on line 990 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint8_t>(getTier());
}

if (hasAttribute(AMOUNT)) {
propWriteStream.write<uint8_t>(ATTR_AMOUNT);

Check warning on line 995 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint16_t>(getAttribute<uint16_t>(AMOUNT));
}

if (hasAttribute(STORE_INBOX_CATEGORY)) {
propWriteStream.write<uint8_t>(ATTR_STORE_INBOX_CATEGORY);

Check warning on line 1000 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.writeString(getString(ItemAttribute_t::STORE_INBOX_CATEGORY));
}

if (hasAttribute(OWNER)) {
propWriteStream.write<uint8_t>(ATTR_OWNER);

Check warning on line 1005 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint32_t>(getAttribute<uint32_t>(ItemAttribute_t::OWNER));
}

// Serialize custom attributes, only serialize if the map not is empty
if (hasCustomAttribute()) {
auto customAttributeMap = getCustomAttributeMap();
propWriteStream.write<uint8_t>(ATTR_CUSTOM);

Check warning on line 1012 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
propWriteStream.write<uint64_t>(customAttributeMap.size());
for (const auto &[attributeKey, customAttribute] : customAttributeMap) {
// Serializing custom attribute key type
Expand All @@ -1020,7 +1020,7 @@
}

if (hasAttribute(ItemAttribute_t::OBTAINCONTAINER)) {
propWriteStream.write<uint8_t>(ATTR_OBTAINCONTAINER);

Check warning on line 1023 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto flags = getAttribute<uint32_t>(ItemAttribute_t::OBTAINCONTAINER);
g_logger().debug("Reading flag {}, to item id {}", flags, getID());
propWriteStream.write<uint32_t>(flags);
Expand Down Expand Up @@ -1240,7 +1240,7 @@
skillBoost = true;
}

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 1243 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -1293,13 +1293,13 @@
descriptions.emplace_back("Magic Level", ss.str());
}

for (uint8_t i = 1; i <= 11; i++) {

Check warning on line 1296 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (it.abilities->specializedMagicLevel[i]) {
ss.str("");

ss << std::showpos << it.abilities->specializedMagicLevel[i] << std::noshowpos;
std::string combatName = getCombatName(indexToCombatType(i));
combatName[0] = toupper(combatName[0]);

Check warning on line 1302 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
descriptions.emplace_back(combatName + " Magic Level", ss.str());
}
}
Expand Down Expand Up @@ -1648,7 +1648,7 @@
skillBoost = true;
}

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 1651 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -1702,7 +1702,7 @@

ss << std::showpos << it.abilities->specializedMagicLevel[i] << std::noshowpos;
std::string combatName = getCombatName(indexToCombatType(i));
combatName[0] = toupper(combatName[0]);

Check warning on line 1705 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
descriptions.emplace_back(combatName + " Magic Level", ss.str());
}
}
Expand Down Expand Up @@ -1913,7 +1913,7 @@
s << std::endl
<< "Imbuements: (";

for (uint8_t slotid = 0; slotid < item->getImbuementSlot(); slotid++) {

Check warning on line 1916 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (slotid >= 1) {
s << ", ";
}
Expand Down Expand Up @@ -2100,7 +2100,7 @@
}

if (itemType.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 2103 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!itemType.abilities->skills[i]) {
continue;
}
Expand All @@ -2115,7 +2115,7 @@
itemDescription << getSkillName(i) << ' ' << std::showpos << itemType.abilities->skills[i] << std::noshowpos;
}

for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; i++) {

Check warning on line 2118 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto skill = item ? item->getSkill(static_cast<skills_t>(i)) : itemType.getSkill(static_cast<skills_t>(i));
if (!skill) {
continue;
Expand Down Expand Up @@ -2150,7 +2150,7 @@
itemDescription << "magic level " << std::showpos << itemType.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos;
}

for (uint8_t i = 1; i <= 11; i++) {

Check warning on line 2153 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (itemType.abilities->specializedMagicLevel[i]) {
if (begin) {
begin = false;
Expand Down Expand Up @@ -2310,7 +2310,7 @@
return itemDescription.str();
}

std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std::shared_ptr<Item> item /*= nullptr*/, int32_t subType /*= -1*/, bool addArticle /*= true*/) {

Check warning on line 2313 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

function-cognitive-complexity

function 'getDescription' has cognitive complexity of 731 (threshold 25)
std::string text = "";

std::ostringstream s;
Expand Down Expand Up @@ -2398,7 +2398,7 @@
}

if (it.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 2401 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!it.abilities->skills[i]) {
continue;
}
Expand All @@ -2413,7 +2413,7 @@
s << getSkillName(i) << ' ' << std::showpos << it.abilities->skills[i] << std::noshowpos;
}

for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; i++) {

Check warning on line 2416 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto skill = item ? item->getSkill(static_cast<skills_t>(i)) : it.getSkill(static_cast<skills_t>(i));
if (!skill) {
continue;
Expand Down Expand Up @@ -2448,7 +2448,7 @@
s << "magic level " << std::showpos << it.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos;
}

for (uint8_t i = 1; i <= 11; i++) {

Check warning on line 2451 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (it.abilities->specializedMagicLevel[i]) {
if (begin) {
begin = false;
Expand Down Expand Up @@ -2642,13 +2642,12 @@
s << "Vol:" << volume;
}
}
if (attack != 0) {
if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) {
phacUFPE marked this conversation as resolved.
Show resolved Hide resolved
begin = false;
s << " (Atk:" << attack << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType);
} else if (attack != 0) {
begin = false;
s << " (Atk:" << attack;

if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) {
s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType);
}
}

if (defense != 0 || extraDefense != 0 || it.isMissile()) {
Expand All @@ -2666,7 +2665,7 @@
}

if (it.abilities) {
for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 2668 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!it.abilities->skills[i]) {
continue;
}
Expand All @@ -2681,7 +2680,7 @@
s << getSkillName(i) << ' ' << std::showpos << it.abilities->skills[i] << std::noshowpos;
}

for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; i++) {

Check warning on line 2683 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto skill = item ? item->getSkill(static_cast<skills_t>(i)) : it.getSkill(static_cast<skills_t>(i));
if (!skill) {
continue;
Expand Down Expand Up @@ -2716,7 +2715,7 @@
s << "magic level " << std::showpos << it.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos;
}

for (uint8_t i = 1; i <= 11; i++) {

Check warning on line 2718 in src/items/item.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (it.abilities->specializedMagicLevel[i]) {
if (begin) {
begin = false;
Expand Down
7 changes: 6 additions & 1 deletion src/items/items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "lua/creature/movement.hpp"
#include "game/game.hpp"
#include "utils/pugicast.hpp"
#include "creatures/combat/spells.hpp"

#include <appearances.pb.h>

Expand Down Expand Up @@ -94,7 +95,7 @@
}

std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr<AugmentInfo> &augmentInfo) const {
const std::string augmentName = Items::getAugmentNameByType(augmentInfo->type);
const auto &augmentName = Items::getAugmentNameByType(augmentInfo->type);
std::string augmentSpellNameCapitalized = augmentInfo->spellName;
capitalizeWordsIgnoringString(augmentSpellNameCapitalized, " of ");

Expand All @@ -104,7 +105,11 @@
return fmt::format("{} -> {}", augmentSpellNameCapitalized, augmentName);
} else if (augmentInfo->type == Augment_t::Cooldown) {
return fmt::format("{} -> {}{}s {}", augmentSpellNameCapitalized, signal, augmentInfo->value / 1000, augmentName);
} else if (augmentInfo->type == Augment_t::Base) {
const auto &spell = g_spells().getSpellByName(augmentInfo->spellName);
return fmt::format("{} -> {:+}% {} {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName, spell->getGroup() == SPELLGROUP_HEALING ? "healing" : "damage");
}

return fmt::format("{} -> {:+}% {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName);
}

Expand Down Expand Up @@ -154,7 +159,7 @@

// This attribute is only used on 10x protocol, so we should not waste our time iterating it when it's disabled.
if (supportAnimation) {
for (uint32_t frame_it = 0; frame_it < object.frame_group_size(); ++frame_it) {

Check warning on line 162 in src/items/items.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

id-dependent-backward-branch

backward branch (for loop) is ID-dependent due to variable reference to 'object' and may cause performance degradation
FrameGroup objectFrame = object.frame_group(frame_it);
if (!objectFrame.has_sprite_info()) {
continue;
Expand All @@ -173,11 +178,11 @@
}

if (object.flags().clip()) {
iType.alwaysOnTopOrder = 1;

Check warning on line 181 in src/items/items.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (object.flags().top()) {
iType.alwaysOnTopOrder = 3;

Check warning on line 183 in src/items/items.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (object.flags().bottom()) {
iType.alwaysOnTopOrder = 2;

Check warning on line 185 in src/items/items.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (object.flags().has_clothes()) {
Expand Down
1 change: 1 addition & 0 deletions src/items/items_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ enum ImbuementTypes_t : int64_t {

enum class Augment_t : uint8_t {
None,
Base,
PowerfulImpact,
StrongImpact,
IncreasedDamage,
Expand Down
Loading