diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-11 20:49:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-11 20:52:50 +0300 |
commit | e36c735ce6569cd9c0e668632e59bcbe3280d507 (patch) | |
tree | eb8fa3f8800d95bcd0c6b3c1ea314567f56debb4 /src/commands.cpp | |
parent | ffd452cd1ee7d252355c259ca2bae1d40c0e97e9 (diff) | |
download | manaplus-e36c735ce6569cd9c0e668632e59bcbe3280d507.tar.gz manaplus-e36c735ce6569cd9c0e668632e59bcbe3280d507.tar.bz2 manaplus-e36c735ce6569cd9c0e668632e59bcbe3280d507.tar.xz manaplus-e36c735ce6569cd9c0e668632e59bcbe3280d507.zip |
Add chat command for gms for creating items.
New command: /createitems
It will open creation window.
Diffstat (limited to 'src/commands.cpp')
-rw-r--r-- | src/commands.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
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 |