diff options
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r-- | src/resources/iteminfo.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index ade20ef0b..56b2e1fe0 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -60,7 +60,9 @@ ItemInfo::ItemInfo() : mSounds(), mTags(), mColorsList(nullptr), + mIconColorsList(nullptr), mColorsListName(), + mIconColorsListName(), mCardColor(ItemColor_zero), mHitEffectId(-1), mCriticalHitEffectId(-1), @@ -202,6 +204,20 @@ void ItemInfo::setColorsList(const std::string &name) } } +void ItemInfo::setIconColorsList(const std::string &name) +{ + if (name.empty()) + { + mIconColorsList = nullptr; + mIconColorsListName.clear(); + } + else + { + mIconColorsList = ColorDB::getColorsList(name); + mIconColorsListName = name; + } +} + std::string ItemInfo::getDyeColorsString(const ItemColor color) const { if (!mColorsList || mColorsListName.empty()) @@ -215,6 +231,19 @@ std::string ItemInfo::getDyeColorsString(const ItemColor color) const return it->second.color; } +std::string ItemInfo::getDyeIconColorsString(const ItemColor color) const +{ + if (!mIconColorsList || mIconColorsListName.empty()) + return ""; + + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator + it = mIconColorsList->find(color); + if (it == mIconColorsList->end()) + return ""; + + return it->second.color; +} + const std::string ItemInfo::getDescription(const ItemColor color) const { return replaceColors(mDescription, color); @@ -393,3 +422,27 @@ std::string ItemInfo::getColor(const ItemColor idx) const return std::string(); return it->second.color; } + +std::string ItemInfo::getIconColorName(const ItemColor idx) const +{ + if (!mIconColorsList) + return std::string(); + + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator + it = mIconColorsList->find(idx); + if (it == mIconColorsList->end()) + return std::string(); + return it->second.name; +} + +std::string ItemInfo::getIconColor(const ItemColor idx) const +{ + if (!mIconColorsList) + return std::string(); + + const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator + it = mIconColorsList->find(idx); + if (it == mIconColorsList->end()) + return std::string(); + return it->second.color; +} |