summaryrefslogtreecommitdiff
path: root/src/actions/actions.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 16:02:54 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 16:02:54 +0300
commitfc2514926927b709dd59325e83b7da9fd10fa36e (patch)
tree97acbd471a5780177495f006e4e87ca94fe087a9 /src/actions/actions.cpp
parentfda230f1a8a6399c2507c7e39cd714d8aefc712d (diff)
downloadmv-fc2514926927b709dd59325e83b7da9fd10fa36e.tar.gz
mv-fc2514926927b709dd59325e83b7da9fd10fa36e.tar.bz2
mv-fc2514926927b709dd59325e83b7da9fd10fa36e.tar.xz
mv-fc2514926927b709dd59325e83b7da9fd10fa36e.zip
Move chat command /createitems into actions.
Diffstat (limited to 'src/actions/actions.cpp')
-rw-r--r--src/actions/actions.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index 9198b474b..90429bc5b 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -46,6 +46,7 @@
#include "gui/popups/popupmenu.h"
+#include "gui/windows/buydialog.h"
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/statuswindow.h"
@@ -89,8 +90,11 @@
#include "listeners/updatestatuslistener.h"
+#include "resources/iteminfo.h"
#include "resources/resourcemanager.h"
+#include "resources/db/itemdb.h"
+
#include "resources/map/map.h"
#include "utils/chatutils.h"
@@ -1037,4 +1041,36 @@ impHandler0(testSdlFont)
}
#endif
+impHandler0(createItems)
+{
+ BuyDialog *const dialog = new BuyDialog();
+ const ItemDB::ItemInfos &items = ItemDB::getItemInfos();
+ FOR_EACH (ItemDB::ItemInfos::const_iterator, it, items)
+ {
+ const ItemInfo *const info = (*it).second;
+ const int id = info->getId();
+ if (id <= 500)
+ continue;
+
+ int colors = info->getColorsSize();
+ if (colors >= 255)
+ colors = 254;
+
+ if (!colors)
+ {
+ dialog->addItem(id, 1, 100, 0);
+ }
+ else
+ {
+ for (unsigned char f = 0; f < colors; f ++)
+ {
+ if (!info->getColor(f).empty())
+ dialog->addItem(id, f, 100, 0);
+ }
+ }
+ }
+ dialog->sort();
+ return true;
+}
+
} // namespace Actions