summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-20 22:41:22 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-20 22:41:22 +0300
commit1240589615918547fab96a8b9315a66d068e712e (patch)
tree4e361d32b965973e28a70d4c6b8c352fb2cb0a61 /src/resources/iteminfo.cpp
parentf23abf81cd21907117bf4edf0d814d8bef950e13 (diff)
downloadplus-1240589615918547fab96a8b9315a66d068e712e.tar.gz
plus-1240589615918547fab96a8b9315a66d068e712e.tar.bz2
plus-1240589615918547fab96a8b9315a66d068e712e.tar.xz
plus-1240589615918547fab96a8b9315a66d068e712e.zip
Add support for reading iconColors palette field from items.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp53
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;
+}