summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-02-20 11:32:50 +0000
commit3135c725cc37251943271cd8f939e646c9164259 (patch)
tree159ae31b1c0518d37f5bb21344fe3c72bf5cc382 /src/game.cpp
parent54a359f67da79d97df667299ea4d91cef79c08f2 (diff)
downloadmana-3135c725cc37251943271cd8f939e646c9164259.tar.gz
mana-3135c725cc37251943271cd8f939e646c9164259.tar.bz2
mana-3135c725cc37251943271cd8f939e646c9164259.tar.xz
mana-3135c725cc37251943271cd8f939e646c9164259.zip
Finally equipment! Sometimes it works :P
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 82842504..b372518a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -415,7 +415,7 @@ void do_parse() {
}
fclose(file);
*/
-#ifdef DEBUG
+#ifdef __DEBUG
FILE *file = fopen("./docs/packet.list", "a");
fprintf(file, "%x\n", RFIFOW(0));
fclose(file);
@@ -598,7 +598,8 @@ void do_parse() {
case 0x01ee:
for (int loop = 0; loop < (RFIFOW(2) - 4) / 18; loop++) {
inventoryWindow->addItem(RFIFOW(4 + loop * 18),
- RFIFOW(4 + loop * 18 + 2), RFIFOW(4 + loop * 18 + 6), false);
+ RFIFOW(4 + loop * 18 + 2),
+ RFIFOW(4 + loop * 18 + 6), false);
}
break;
// Get the equipments
@@ -971,16 +972,33 @@ void do_parse() {
being->hair_style = RFIFOB(7);
}
break;
- // Answer to equip items
+ // Answer to equip item
case 0x00aa:
if (RFIFOB(6) == 0)
- chatBox->chat_log("Unable to equip.", BY_SERVER);
+ chatBox->chat_log("Unable to equip.", BY_SERVER);
+ else
+ inventoryWindow->items->setEquipped(
+ inventoryWindow->items->getIndex(), true);
break;
// Equipment related
case 0x01d7:
- char content[40];
- sprintf(content, "%i %i", RFIFOW(7), RFIFOW(9));
- chatBox->chat_log(content, BY_SERVER);
+ /*char content[40];
+ sprintf(content, "%i %i %i", RFIFOB(6), RFIFOW(7), RFIFOW(9));
+ chatBox->chat_log(content, BY_SERVER);*/
+ equipmentWindow->addEquipment(RFIFOB(6), RFIFOW(7));
+ if(inventoryWindow->items->getIndex(RFIFOW(7)));
+ inventoryWindow->items->setEquipped(
+ inventoryWindow->items->getIndex(RFIFOW(7)), true);
+ break;
+ // Answer to unequip item
+ case 0x00ac:
+ if (RFIFOB(6) == 0)
+ chatBox->chat_log("Unable to unequip.", BY_SERVER);
+ else {
+ equipmentWindow->removeEquipment(RFIFOW(2));
+ inventoryWindow->items->setEquipped(
+ inventoryWindow->items->getIndex(), false);
+ }
break;
// Manage non implemented packets
default: