summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-17 15:57:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-17 19:19:57 +0300
commit261a118937d8b1cd41cf16d983f880e5957f84b1 (patch)
treed7b44426193cc31d309bebd801068b3960cdce60 /src/actions/commands.cpp
parent41141188d70dd7d6e0b8667bda9d0f6569c0b97b (diff)
downloadmv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.gz
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.bz2
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.xz
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.zip
Extend addchat command with support for cards.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index bb43e2a9d..2cfe01720 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -284,22 +284,20 @@ impHandler(chatAdd)
if (event.args.empty())
return true;
- const int id = atoi(event.args.c_str());
- if (id == 0)
+ std::vector<int> str;
+ splitToIntVector(str, event.args, ',');
+ if (str.empty())
return true;
- Inventory *const inv = PlayerInfo::getInventory();
- const Item *item = nullptr;
- if (inv)
- {
- // +++ need add also color here
- item = inv->findItem(id, ItemColor_one);
- }
+ int id = str[0];
+ if (id == 0)
+ return true;
- if (item)
+ if (ItemDB::exists(id))
{
- // +++ need add also color here
- chatWindow->addItemText(item->getInfo().getName());
+ const std::string names = ItemDB::getNamesStr(str);
+ if (!names.empty())
+ chatWindow->addItemText(names);
return true;
}
@@ -308,8 +306,10 @@ impHandler(chatAdd)
if (floorItem)
{
- // +++ need add also color here
- chatWindow->addItemText(floorItem->getInfo().getName());
+ str[0] = floorItem->getItemId();
+ logger->log("parts: %d", (int)str.size());
+ const std::string names = ItemDB::getNamesStr(str);
+ chatWindow->addItemText(names);
}
return true;
}