diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-27 18:08:34 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-27 23:26:17 +0200 |
commit | df5c7ae83a80db63ab90142df9e3a93f5ee630d0 (patch) | |
tree | 465991eb7785c1d17e1b15f6798efa67951a0c83 /src/net/tmwa | |
parent | 41e84157e0eca3a494cd6d44eec96dfbde0f5626 (diff) | |
download | manaverse-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.gz manaverse-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.bz2 manaverse-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.tar.xz manaverse-df5c7ae83a80db63ab90142df9e3a93f5ee630d0.zip |
First part of implimintation item colors.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 29 | ||||
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 20 | ||||
-rw-r--r-- | src/net/tmwa/itemhandler.cpp | 6 |
4 files changed, 35 insertions, 22 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index b6589e260..15792cf3a 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -620,15 +620,18 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) int type = msg.readInt8(); int id = 0; int id2 = 0; + std::string color; if (msg.getId() == SMSG_BEING_CHANGE_LOOKS) { id = msg.readInt8(); + id2 = 1; // default color } else { // SMSG_BEING_CHANGE_LOOKS2 id = msg.readInt16(); id2 = msg.readInt16(); + color = ""; } if (dstBeing->getType() == Being::PLAYER) @@ -646,21 +649,21 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) dstBeing->setSpriteID(SPRITE_HAIR, id *-1); break; case 2: // Weapon ID in id, Shield ID in id2 - dstBeing->setSprite(SPRITE_WEAPON, id, "", true); + dstBeing->setSprite(SPRITE_WEAPON, id, "", 1, true); if (!config.getBoolValue("hideShield")) dstBeing->setSprite(SPRITE_SHIELD, id2); player_node->imitateOutfit(dstBeing, SPRITE_SHIELD); break; case 3: // Change lower headgear for eAthena, pants for us - dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, id); + dstBeing->setSprite(SPRITE_BOTTOMCLOTHES, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_BOTTOMCLOTHES); break; case 4: // Change upper headgear for eAthena, hat for us - dstBeing->setSprite(SPRITE_HAT, id); + dstBeing->setSprite(SPRITE_HAT, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_HAT); break; case 5: // Change middle headgear for eathena, armor for us - dstBeing->setSprite(SPRITE_TOPCLOTHES, id); + dstBeing->setSprite(SPRITE_TOPCLOTHES, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_TOPCLOTHES); break; case 6: // eAthena LOOK_HAIR_COLOR @@ -668,35 +671,35 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; case 8: // eAthena LOOK_SHIELD if (!config.getBoolValue("hideShield")) - dstBeing->setSprite(SPRITE_SHIELD, id); + dstBeing->setSprite(SPRITE_SHIELD, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_SHIELD); break; case 9: // eAthena LOOK_SHOES - dstBeing->setSprite(SPRITE_SHOE, id); + dstBeing->setSprite(SPRITE_SHOE, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_SHOE); break; case 10: // LOOK_GLOVES - dstBeing->setSprite(SPRITE_GLOVES, id); + dstBeing->setSprite(SPRITE_GLOVES, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_GLOVES); break; case 11: // LOOK_CAPE - dstBeing->setSprite(SPRITE_CAPE, id); + dstBeing->setSprite(SPRITE_CAPE, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_CAPE); break; case 12: - dstBeing->setSprite(SPRITE_MISC1, id); + dstBeing->setSprite(SPRITE_MISC1, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_MISC1); break; case 13: - dstBeing->setSprite(SPRITE_MISC2, id); + dstBeing->setSprite(SPRITE_MISC2, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_MISC2); break; case 14: - dstBeing->setSprite(SPRITE_EVOL1, id); + dstBeing->setSprite(SPRITE_EVOL1, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_EVOL1); break; case 15: - dstBeing->setSprite(SPRITE_EVOL2, id); + dstBeing->setSprite(SPRITE_EVOL2, id, color, id2); player_node->imitateOutfit(dstBeing, SPRITE_EVOL2); break; default: @@ -890,7 +893,7 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) ? GENDER_FEMALE : GENDER_MALE); // Set these after the gender, as the sprites may be gender-specific - dstBeing->setSprite(SPRITE_WEAPON, weapon, "", true); + dstBeing->setSprite(SPRITE_WEAPON, weapon, "", 1, true); if (!config.getBoolValue("hideShield")) dstBeing->setSprite(SPRITE_SHIELD, shield); //dstBeing->setSprite(SPRITE_SHOE, shoes); diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 5e2efbdd5..ec61b4be2 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -273,7 +273,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, tempPlayer->setSubtype(msg.readInt16()); // class (used for race) int hairStyle = msg.readInt16(); Uint16 weapon = msg.readInt16(); - tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", true); + tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true); character->data.mAttributes[LEVEL] = msg.readInt16(); diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 340f0c4b2..fc32c3ec3 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -217,7 +217,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) if (inventory) { inventory->setItem(index, itemId, amount, - 0, isEquipment); + 0, identified, isEquipment); } } else @@ -300,7 +300,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) amount += inventory->getItem(index)->getQuantity(); inventory->setItem(index, itemId, amount, refine, - equipType != 0); + identified, equipType != 0); } } } break; @@ -458,19 +458,29 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) { index = msg.readInt16() - INVENTORY_OFFSET; itemId = msg.readInt16(); - msg.readInt8(); // type - msg.readInt8(); // identify flag + if (itemId == 1172) + logger->log("step1"); + int itemType = msg.readInt8(); // type + identified = msg.readInt8(); // identify flag msg.readInt16(); // equip type equipType = msg.readInt16(); msg.readInt8(); // attribute refine = msg.readInt8(); msg.skip(8); // card + if (itemId == 1172) + logger->log("step2"); if (inventory) - inventory->setItem(index, itemId, 1, refine, true); + inventory->setItem(index, itemId, 1, refine, identified, true); if (equipType) mEquips.setEquipment(getSlot(equipType), index); + + if (debugInventory) + { + logger->log("Index: %d, ID: %d, Type: %d, Identified: %d", + index, itemId, itemType, identified); + } } break; diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp index 5840d99b2..897ed1fb5 100644 --- a/src/net/tmwa/itemhandler.cpp +++ b/src/net/tmwa/itemhandler.cpp @@ -52,7 +52,7 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) { int id = msg.readInt32(); int itemId = msg.readInt16(); - msg.readInt8(); // identify flag + unsigned char identify = msg.readInt8(); // identify flag int x = msg.readInt16(); int y = msg.readInt16(); // msg.skip(4); // amount,subX,subY / subX,subY,amount @@ -64,12 +64,12 @@ void ItemHandler::handleMessage(Net::MessageIn &msg) if (msg.getId() == SMSG_ITEM_VISIBLE) { actorSpriteManager->createItem(id, itemId, - x, y, amount1); + x, y, amount1, identify); } else { actorSpriteManager->createItem(id, itemId, - x, y, amount2); + x, y, amount2, identify); } } } |