summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/item.cpp b/src/item.cpp
index b434387e..7a8ccf6d 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -21,12 +21,13 @@
#include "item.h"
-#include "gui/theme.h"
+#include "configuration.h"
+#include "event.h"
#include "resources/image.h"
#include "resources/iteminfo.h"
#include "resources/resourcemanager.h"
-#include "configuration.h"
+#include "resources/theme.h"
Item::Item(int id, int quantity, bool equipment, bool equipped):
mImage(0),
@@ -58,8 +59,9 @@ void Item::setId(int id)
mDrawImage->decRef();
ResourceManager *resman = ResourceManager::getInstance();
- std::string imagePath = paths.getValue("itemIcons", "graphics/items/")
- + getInfo().getImageName();
+ SpriteDisplay display = getInfo().getDisplay();
+ std::string imagePath = paths.getStringValue("itemIcons")
+ + display.image;
mImage = resman->getImage(imagePath);
mDrawImage = resman->getImage(imagePath);
@@ -72,3 +74,18 @@ void Item::setId(int id)
paths.getValue("unknownItemFile",
"unknown-item.png"));
}
+
+void Item::doEvent(const std::string &eventName)
+{
+ Mana::Event event(eventName);
+ event.setItem("item", this);
+ event.trigger("Item");
+}
+
+void Item::doEvent(const std::string &eventName, int amount)
+{
+ Mana::Event event(eventName);
+ event.setItem("item", this);
+ event.setInt("amount", amount);
+ event.trigger("Item");
+}