From d055bee5e6b45737ab89b3f8c70c6d0db7a22eb3 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Mon, 24 Jan 2011 22:10:02 +0100 Subject: Refactored the item loading in a more extensible and per protocol way. This will greatly help into upgrading the need of each protocol separately. This is the first step to a new item and equipment system for manaserv. A subclassing of the EquipmentWindow will be done in the next commit, as requested by Thorbjorn. Reviewed-by: Thorbjorn. --- src/net/manaserv/attributes.cpp | 6 +++--- src/net/tmwa/generalhandler.cpp | 18 +++++++++--------- src/net/tmwa/inventoryhandler.cpp | 32 ++++++++++++++++---------------- 3 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/net') diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index a65dc01f..e57c6278 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -377,14 +377,14 @@ namespace Attributes { void informItemDB() { - std::list dbStats; + std::list dbStats; TagMap::const_iterator it, it_end; for (it = tags.begin(), it_end = tags.end(); it != it_end; ++it) - dbStats.push_back(ItemDB::Stat(it->first, + dbStats.push_back(ItemStat(it->first, it->second)); - itemDb->setStatsList(dbStats); + setStatsList(dbStats); } void informStatusWindow() diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index b4327d47..1935ad72 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -98,15 +98,15 @@ GeneralHandler::GeneralHandler(): handledMessages = _messages; generalHandler = this; - std::list stats; - stats.push_back(ItemDB::Stat("str", _("Strength %+d"))); - stats.push_back(ItemDB::Stat("agi", _("Agility %+d"))); - stats.push_back(ItemDB::Stat("vit", _("Vitality %+d"))); - stats.push_back(ItemDB::Stat("int", _("Intelligence %+d"))); - stats.push_back(ItemDB::Stat("dex", _("Dexterity %+d"))); - stats.push_back(ItemDB::Stat("luck", _("Luck %+d"))); - - itemDb->setStatsList(stats); + std::list stats; + stats.push_back(ItemStat("str", _("Strength %+d"))); + stats.push_back(ItemStat("agi", _("Agility %+d"))); + stats.push_back(ItemStat("vit", _("Vitality %+d"))); + stats.push_back(ItemStat("int", _("Intelligence %+d"))); + stats.push_back(ItemStat("dex", _("Dexterity %+d"))); + stats.push_back(ItemStat("luck", _("Luck %+d"))); + + setStatsList(stats); listen(CHANNEL_GAME); } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 3a0a93e3..4aedd9f2 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -46,30 +46,30 @@ extern Net::InventoryHandler *inventoryHandler; -const Equipment::Slot EQUIP_POINTS[Equipment::EQUIP_VECTOREND] = { - Equipment::EQUIP_LEGS_SLOT, - Equipment::EQUIP_FIGHT1_SLOT, - Equipment::EQUIP_GLOVES_SLOT, - Equipment::EQUIP_RING2_SLOT, - Equipment::EQUIP_RING1_SLOT, - Equipment::EQUIP_FIGHT2_SLOT, - Equipment::EQUIP_FEET_SLOT, - Equipment::EQUIP_NECK_SLOT, - Equipment::EQUIP_HEAD_SLOT, - Equipment::EQUIP_TORSO_SLOT, - Equipment::EQUIP_PROJECTILE_SLOT}; - namespace TmwAthena { +const EquipmentSlot EQUIP_POINTS[EQUIP_VECTOR_END] = { + EQUIP_LEGS_SLOT, + EQUIP_FIGHT1_SLOT, + EQUIP_ARMS_SLOT, + EQUIP_RING2_SLOT, + EQUIP_RING1_SLOT, + EQUIP_FIGHT2_SLOT, + EQUIP_FEET_SLOT, + EQUIP_NECKLACE_SLOT, + EQUIP_HEAD_SLOT, + EQUIP_TORSO_SLOT, + EQUIP_PROJECTILE_SLOT}; + int getSlot(int eAthenaSlot) { if (eAthenaSlot == 0) { - return Equipment::EQUIP_VECTOREND; + return EQUIP_VECTOR_END; } if (eAthenaSlot & 0x8000) - return Equipment::EQUIP_PROJECTILE_SLOT; + return EQUIP_PROJECTILE_SLOT; int mask = 1; int position = 0; @@ -425,7 +425,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) index -= INVENTORY_OFFSET; logger->log("Arrows equipped: %i", index); - mEquips.setEquipment(Equipment::EQUIP_PROJECTILE_SLOT, index); + mEquips.setEquipment(EQUIP_PROJECTILE_SLOT, index); break; } } -- cgit v1.2.3-70-g09d2