summaryrefslogtreecommitdiff
path: root/src/resources/equipmentdb.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2007-07-11 12:58:11 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2007-07-11 12:58:11 +0000
commit84aafd27dad40f4033561052164c21fe68cf78ad (patch)
tree77fb9224634f95b1ede62c6605976feb4ee9455b /src/resources/equipmentdb.cpp
parent8dd7eef0402cc6e22642f045e3cfde7f5b011d5b (diff)
downloadmana-84aafd27dad40f4033561052164c21fe68cf78ad.tar.gz
mana-84aafd27dad40f4033561052164c21fe68cf78ad.tar.bz2
mana-84aafd27dad40f4033561052164c21fe68cf78ad.tar.xz
mana-84aafd27dad40f4033561052164c21fe68cf78ad.zip
Weapon sprites are now (almost) threated like other equipment sprites through the equipment sprite database. (use -u to ignore updates)
Diffstat (limited to 'src/resources/equipmentdb.cpp')
-rw-r--r--src/resources/equipmentdb.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/src/resources/equipmentdb.cpp b/src/resources/equipmentdb.cpp
index 64982ce3..9b963720 100644
--- a/src/resources/equipmentdb.cpp
+++ b/src/resources/equipmentdb.cpp
@@ -81,26 +81,46 @@ EquipmentDB::load()
EquipmentInfo *currentInfo = new EquipmentInfo();
currentInfo->setSlot (XML::getProperty(equipmentNode, "slot", 0));
+ currentInfo->setAttackType (XML::getProperty(equipmentNode, "attacktype", ""));
- //iterate <sprite>s
+ //iterate <sprite>s and <sound>s
for_each_xml_child_node(spriteNode, equipmentNode)
{
- if (!xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
+ if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
{
- continue;
+ std::string gender = XML::getProperty(spriteNode, "gender", "unisex");
+ std::string filename = (const char*) spriteNode->xmlChildrenNode->content;
+
+ if (gender == "male" || gender == "unisex")
+ {
+ currentInfo->setSprite(filename, 0);
+ }
+
+ if (gender == "female" || gender == "unisex")
+ {
+ currentInfo->setSprite(filename, 1);
+ }
}
- std::string gender = XML::getProperty(spriteNode, "gender", "unisex");
- std::string filename = (const char*) spriteNode->xmlChildrenNode->content;
-
- if (gender == "male" || gender == "unisex")
- {
- currentInfo->setSprite(filename, 0);
- }
-
- if (gender == "female" || gender == "unisex")
+ if (xmlStrEqual(spriteNode->name, BAD_CAST "sound"))
{
- currentInfo->setSprite(filename, 1);
+ std::string event = XML::getProperty(spriteNode, "event", "");
+ const char *filename;
+ filename = (const char*) spriteNode->xmlChildrenNode->content;
+
+ if (event == "hit")
+ {
+ currentInfo->addSound(EQUIP_EVENT_HIT, filename);
+ }
+ else if (event == "strike")
+ {
+ currentInfo->addSound(EQUIP_EVENT_STRIKE, filename);
+ }
+ else
+ {
+ logger->log("EquipmentDB: Warning, sound effect %s for unknown event %s",
+ filename, event.c_str());
+ }
}
}