summaryrefslogtreecommitdiff
path: root/src/gui/windows/npcdialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-12-19 15:15:44 +0300
committerAndrei Karas <akaras@inbox.ru>2013-12-19 15:15:44 +0300
commitf0315000bcf20685471966d2f25cd8e9f35e8230 (patch)
treeb5b51e2880191696d6217181d5aa4d5c5341265f /src/gui/windows/npcdialog.cpp
parent5615f8dde421e8d44c5e49a5a44ab7e69cb543a5 (diff)
downloadmv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.gz
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.bz2
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.tar.xz
mv-f0315000bcf20685471966d2f25cd8e9f35e8230.zip
add ability to give more than one item to npc. (evol only)
Diffstat (limited to 'src/gui/windows/npcdialog.cpp')
-rw-r--r--src/gui/windows/npcdialog.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 1c2a6cc1d..36f7bedc8 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -360,16 +360,38 @@ void NpcDialog::action(const gcn::ActionEvent &event)
if (!client->limitPackets(PACKET_NPC_INPUT))
return;
- const Item *const item = mInventory->getItem(0);
std::string str;
- if (item)
+ const int sz = mInventory->getNumberOfSlotsUsed();
+ if (sz == 0)
{
- str = strprintf("%d,%d", item->getId(),
- item->getColor());
+ str = "0,0";
}
else
{
- str = "0,0";
+ const Item *item = mInventory->getItem(0);
+ if (item)
+ {
+ str = strprintf("%d,%d", item->getId(),
+ item->getColor());
+ }
+ else
+ {
+ str = "0,0";
+ }
+ for (int f = 1; f < sz; f ++)
+ {
+ str.append(";");
+ item = mInventory->getItem(f);
+ if (item)
+ {
+ str.append(strprintf("%d,%d", item->getId(),
+ item->getColor()));
+ }
+ else
+ {
+ str.append("0,0");
+ }
+ }
}
// need send selected item
@@ -597,11 +619,11 @@ void NpcDialog::integerRequest(const int defaultValue, const int min,
buildLayout();
}
-void NpcDialog::itemRequest()
+void NpcDialog::itemRequest(const int size)
{
mActionState = NPC_ACTION_INPUT;
mInputState = NPC_INPUT_ITEM;
-
+ mInventory->resize(size);
buildLayout();
}