From e36c735ce6569cd9c0e668632e59bcbe3280d507 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 11 Jul 2013 20:49:20 +0300 Subject: Add chat command for gms for creating items. New command: /createitems It will open creation window. --- src/commands.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/commands.cpp') diff --git a/src/commands.cpp b/src/commands.cpp index c83001cc1..e0bb195d0 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -33,6 +33,7 @@ #include "nullopenglgraphics.h" #include "party.h" +#include "gui/buydialog.h" #include "gui/chatwindow.h" #include "gui/helpwindow.h" #include "gui/gui.h" @@ -64,6 +65,8 @@ #include "resources/subimage.h" #endif +#include "resources/itemdb.h" +#include "resources/iteminfo.h" #include "resources/resourcemanager.h" #include "utils/gettext.h" @@ -1198,6 +1201,33 @@ impHandler1(testParticle) player_node->setTestParticle(args); } +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 <= 0) + continue; + + const int colors = info->getColorsSize(); + if (!colors || serverVersion < 1) + { + dialog->addItem(id, 1, 100, 0); + } + else + { + for (int f = 0; f < colors; f ++) + { + if (!info->getColor(f).empty()) + dialog->addItem(id, f, 100, 0); + } + } + } +} + impHandler0(testsdlfont) { #if defined USE_OPENGL && defined DEBUG_SDLFONT -- cgit v1.2.3-60-g2f50