diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-25 22:50:59 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-25 22:50:59 +0100 |
commit | cc79f0fe21e1a2ef73cbe987d54e848b9a47142d (patch) | |
tree | edd316eb6094f0c02d6d014385865dcd88a2bc56 /src/net | |
parent | b0df784f1be44a657ca8092069488602270629b7 (diff) | |
parent | 99e8a3fd77b63a029fe02dcf771b6af1aad252ed (diff) | |
download | mana-cc79f0fe21e1a2ef73cbe987d54e848b9a47142d.tar.gz mana-cc79f0fe21e1a2ef73cbe987d54e848b9a47142d.tar.bz2 mana-cc79f0fe21e1a2ef73cbe987d54e848b9a47142d.tar.xz mana-cc79f0fe21e1a2ef73cbe987d54e848b9a47142d.zip |
Merge branch 'eathena/master'
Conflicts:
A lot of files.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 40 | ||||
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 40 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 2 | ||||
-rw-r--r-- | src/net/ea/equipmenthandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 105 | ||||
-rw-r--r-- | src/net/ea/npchandler.cpp | 43 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 45 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 18 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 6 | ||||
-rw-r--r-- | src/net/tmwserv/beinghandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwserv/buysellhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwserv/npchandler.cpp | 2 | ||||
-rw-r--r-- | src/net/tmwserv/playerhandler.cpp | 2 |
14 files changed, 188 insertions, 133 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 1edc6079..3629b075 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -35,6 +35,10 @@ #include "../../npc.h" #include "../../player_relations.h" +#include "../../gui/npc_text.h" + +extern NpcTextDialog *npcTextDialog; + const int EMOTION_TIME = 150; /**< Duration of emotion icon */ BeingHandler::BeingHandler(bool enableSync): @@ -65,16 +69,16 @@ BeingHandler::BeingHandler(bool enableSync): void BeingHandler::handleMessage(MessageIn &msg) { - Uint32 id; + int id; Uint16 job, speed; Uint16 headTop, headMid, headBottom; Uint16 shoes, gloves; Uint16 weapon, shield; Uint16 gmstatus; - Sint16 param1; + int param1; int stunMode; Uint32 statusEffects; - Sint8 type; + int type; Uint16 status; Being *srcBeing, *dstBeing; int hairStyle, hairColor, flag; @@ -204,7 +208,12 @@ void BeingHandler::handleMessage(MessageIn &msg) case SMSG_BEING_REMOVE: // A being should be removed or has died - dstBeing = beingManager->findBeing(msg.readInt32()); + id = msg.readInt32(); + + if (id == current_npc) + npcTextDialog->showCloseButton(); + + dstBeing = beingManager->findBeing(id); if (!dstBeing) break; @@ -213,9 +222,6 @@ void BeingHandler::handleMessage(MessageIn &msg) if (dstBeing == player_node->getTarget()) player_node->stopAttack(); - if (dstBeing == current_npc) - current_npc->handleDeath(); - if (msg.readInt8() == 1) dstBeing->setAction(Being::DEAD); else @@ -236,14 +242,17 @@ void BeingHandler::handleMessage(MessageIn &msg) switch (type) { - case 0x0a: // Critical Damage - if (dstBeing) - dstBeing->showCrit(); - case 0x00: // Damage + case Being::HIT: // Damage + case Being::CRITICAL: // Critical Damage + case Being::MULTI: // Critical Damage + case Being::REFLECT: // Reflected Damage + case Being::FLEE: // Lucky Dodge if (dstBeing) - dstBeing->takeDamage(param1); + dstBeing->takeDamage(srcBeing, param1, + (Being::AttackType)type); if (srcBeing) - srcBeing->handleAttack(dstBeing, param1); + srcBeing->handleAttack(dstBeing, param1, + (Being::AttackType)type); break; case 0x02: // Sit @@ -450,11 +459,6 @@ void BeingHandler::handleMessage(MessageIn &msg) { switch (msg.readInt8()) { - case 1: - if (dstBeing->getType() != Being::NPC) - dstBeing->setAction(Being::DEAD); - break; - case 2: dstBeing->setAction(Being::SIT); break; diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 480c71b8..8dbc2953 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -32,15 +32,12 @@ #include "../../npc.h" #include "../../gui/buy.h" +#include "../../gui/buysell.h" #include "../../gui/chat.h" #include "../../gui/sell.h" #include "../../utils/gettext.h" -extern BuyDialog *buyDialog; -extern Window *buySellDialog; -extern SellDialog *sellDialog; - BuySellHandler::BuySellHandler() { static const Uint16 _messages[] = { @@ -64,8 +61,8 @@ void BuySellHandler::handleMessage(MessageIn &msg) buyDialog->reset(); sellDialog->setVisible(false); sellDialog->reset(); + current_npc = msg.readInt32(); buySellDialog->setVisible(true); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg.readInt32())); break; case SMSG_NPC_BUY: @@ -77,10 +74,10 @@ void BuySellHandler::handleMessage(MessageIn &msg) for (int k = 0; k < n_items; k++) { - Sint32 value = msg.readInt32(); + int value = msg.readInt32(); msg.readInt32(); // DCvalue msg.readInt8(); // type - Sint16 itemId = msg.readInt16(); + int itemId = msg.readInt16(); buyDialog->addItem(itemId, 0, value); } break; @@ -88,33 +85,38 @@ void BuySellHandler::handleMessage(MessageIn &msg) case SMSG_NPC_SELL: msg.readInt16(); // length n_items = (msg.getLength() - 4) / 10; - if (n_items > 0) { + if (n_items > 0) + { sellDialog->setMoney(player_node->getMoney()); sellDialog->reset(); sellDialog->setVisible(true); for (int k = 0; k < n_items; k++) { - Sint16 index = msg.readInt16(); - Sint32 value = msg.readInt32(); + int index = msg.readInt16(); + int value = msg.readInt32(); msg.readInt32(); // OCvalue Item *item = player_node->getInventory()->getItem(index); - if (item && !(item->isEquipped())) { + + if (item && !(item->isEquipped())) sellDialog->addItem(item, value); - } } } - else { + else + { chatWindow->chatLog(_("Nothing to sell"), BY_SERVER); - if (current_npc) current_npc->handleDeath(); + current_npc = 0; } break; case SMSG_NPC_BUY_RESPONSE: - if (msg.readInt8() == 0) { + if (msg.readInt8() == 0) + { chatWindow->chatLog(_("Thanks for buying"), BY_SERVER); - } else { + } + else + { // Reset player money since buy dialog already assumed purchase // would go fine buyDialog->setMoney(player_node->getMoney()); @@ -123,11 +125,11 @@ void BuySellHandler::handleMessage(MessageIn &msg) break; case SMSG_NPC_SELL_RESPONSE: - if (msg.readInt8() == 0) { + if (msg.readInt8() == 0) chatWindow->chatLog(_("Thanks for selling"), BY_SERVER); - } else { + else chatWindow->chatLog(_("Unable to sell"), BY_SERVER); - } + break; } } diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 0293f987..4842c86f 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -60,7 +60,7 @@ void ChatHandler::handleMessage(MessageIn &msg) Being *being; std::string chatMsg; std::string nick; - Sint16 chatMsgLength; + int chatMsgLength; switch (msg.getId()) { diff --git a/src/net/ea/equipmenthandler.cpp b/src/net/ea/equipmenthandler.cpp index 19063daf..f5377cf2 100644 --- a/src/net/ea/equipmenthandler.cpp +++ b/src/net/ea/equipmenthandler.cpp @@ -48,9 +48,9 @@ EquipmentHandler::EquipmentHandler() void EquipmentHandler::handleMessage(MessageIn &msg) { - Sint32 itemCount; - Sint16 index, equipPoint, itemId; - Sint8 type; + int itemCount; + int index, equipPoint, itemId; + int type; int mask, position; Item *item; Inventory *inventory = player_node->getInventory(); diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 71eee291..addcb06f 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -25,6 +25,7 @@ #include "../messagein.h" #include "protocol.h" +#include "../../configuration.h" #include "../../inventory.h" #include "../../item.h" #include "../../itemshortcut.h" @@ -32,6 +33,7 @@ #include "../../log.h" #include "../../gui/chat.h" +#include "../../gui/storagewindow.h" #include "../../resources/iteminfo.h" @@ -60,9 +62,9 @@ InventoryHandler::InventoryHandler() void InventoryHandler::handleMessage(MessageIn &msg) { - Sint32 number; - Sint16 index, amount, itemId, equipType, arrow; - Sint16 identified, cards[4], itemType; + int number; + int index, amount, itemId, equipType, arrow; + int identified, cards[4], itemType; Inventory *inventory = player_node->getInventory(); Inventory *storage = player_node->getStorage(); @@ -70,7 +72,6 @@ void InventoryHandler::handleMessage(MessageIn &msg) { case SMSG_PLAYER_INVENTORY: case SMSG_PLAYER_STORAGE_ITEMS: - case SMSG_PLAYER_STORAGE_EQUIP: switch (msg.getId()) { case SMSG_PLAYER_INVENTORY: // Clear inventory - this will be a complete refresh @@ -84,11 +85,10 @@ void InventoryHandler::handleMessage(MessageIn &msg) * clear storage here */ storage->clear(); - logger->log("Received SMSG_PLAYER_STORAGE_ITEMS"); break; default: - logger->log("Received SMSG_PLAYER_STORAGE_EQUIP"); - break; + logger->log("HOW DID WE GET HERE?"); + return; } msg.readInt16(); // length number = (msg.getLength() - 4) / 18; @@ -98,17 +98,8 @@ void InventoryHandler::handleMessage(MessageIn &msg) itemId = msg.readInt16(); itemType = msg.readInt8(); identified = msg.readInt8(); - if (msg.getId() == SMSG_PLAYER_STORAGE_EQUIP) { - amount = 1; - msg.readInt16(); // Equip Point? - } else { - amount = msg.readInt16(); - } + amount = msg.readInt16(); arrow = msg.readInt16(); - if (msg.getId() == SMSG_PLAYER_STORAGE_EQUIP) { - msg.readInt8(); // Attribute (broken) - msg.readInt8(); // Refine level - } for (int i = 0; i < 4; i++) cards[i] = msg.readInt16(); @@ -128,6 +119,29 @@ void InventoryHandler::handleMessage(MessageIn &msg) } break; + case SMSG_PLAYER_STORAGE_EQUIP: + msg.readInt16(); // length + number = (msg.getLength() - 4) / 20; + + for (int loop = 0; loop < number; loop++) { + index = msg.readInt16(); + itemId = msg.readInt16(); + itemType = msg.readInt8(); + identified = msg.readInt8(); + amount = 1; + msg.readInt16(); // Equip Point? + msg.readInt16(); // Another Equip Point? + msg.readInt8(); // Attribute (broken) + msg.readInt8(); // Refine level + for (int i = 0; i < 4; i++) + cards[i] = msg.readInt16(); + + logger->log("Index:%d, ID:%d, Type:%d, Identified:%d, Qty:%d, Cards:%d, %d, %d, %d", + index, itemId, itemType, identified, amount, cards[0], cards[1], cards[2], cards[3]); + storage->setItem(index, itemId, amount, false); + } + break; + case SMSG_PLAYER_INVENTORY_ADD: index = msg.readInt16(); amount = msg.readInt16(); @@ -141,13 +155,21 @@ void InventoryHandler::handleMessage(MessageIn &msg) itemType = msg.readInt8(); if (msg.readInt8() > 0) { - chatWindow->chatLog(_("Unable to pick up item"), BY_SERVER); + if (config.getValue("showpickupchat", true)) { + chatWindow->chatLog(_("Unable to pick up item"), BY_SERVER); + } } else { const ItemInfo &itemInfo = ItemDB::get(itemId); const std::string amountStr = (amount > 1) ? toString(amount) : "a"; - chatWindow->chatLog(strprintf(_("You picked up %s %s"), - amountStr.c_str(), itemInfo.getName().c_str()), BY_SERVER); + if (config.getValue("showpickupchat", true)) { + chatWindow->chatLog(strprintf(_("You picked up %s [%s]"), + amountStr.c_str(), itemInfo.getName().c_str()), + BY_SERVER); + } + if (config.getValue("showpickupparticle", false)) { + player_node->pickedUp(itemInfo.getName()); + } if (Item *item = inventory->getItem(index)) { item->setId(itemId); @@ -193,35 +215,54 @@ void InventoryHandler::handleMessage(MessageIn &msg) case SMSG_PLAYER_STORAGE_STATUS: /* - * Basic slots used vs total slots info - * We don't really need this information, but this is - * the closest we get to an "Open Storage" packet - * from the server. It always comes after the two - * SMSG_PLAYER_STORAGE_... packets that update - * storage contents. + * This is the closest we get to an "Open Storage" packet from the + * server. It always comes after the two SMSG_PLAYER_STORAGE_... + * packets that update storage contents. */ - logger->log("Received SMSG_PLAYER_STORAGE_STATUS"); player_node->setInStorage(true); + msg.readInt16(); // Storage capacity + msg.readInt16(); // Used count break; case SMSG_PLAYER_STORAGE_ADD: /* * Move an item into storage */ + index = msg.readInt16(); + amount = msg.readInt32(); + itemId = msg.readInt16(); + identified = msg.readInt8(); + msg.readInt8(); // attribute + msg.readInt8(); // refine + for (int i = 0; i < 4; i++) + cards[i] = msg.readInt16(); + + if (Item *item = storage->getItem(index)) { + item->setId(itemId); + item->increaseQuantity(amount); + } else { + storage->setItem(index, itemId, amount, false); + } break; case SMSG_PLAYER_STORAGE_REMOVE: /* - * Move an item out of storage - */ + * Move an item out of storage + */ + index = msg.readInt16(); + amount = msg.readInt16(); + if (Item *item = storage->getItem(index)) { + item->increaseQuantity(-amount); + if (item->getQuantity() == 0) + storage->removeItemAt(index); + } break; case SMSG_PLAYER_STORAGE_CLOSE: /* - * Storage access has been closed - */ + * Storage access has been closed + */ player_node->setInStorage(false); - logger->log("Received SMSG_PLAYER_STORAGE_CLOSE"); break; } } diff --git a/src/net/ea/npchandler.cpp b/src/net/ea/npchandler.cpp index 068a3be6..7bd23135 100644 --- a/src/net/ea/npchandler.cpp +++ b/src/net/ea/npchandler.cpp @@ -19,6 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <SDL_types.h> + #include "../messagein.h" #include "npchandler.h" #include "protocol.h" @@ -32,11 +34,6 @@ #include "../../gui/npclistdialog.h" #include "../../gui/npcstringdialog.h" -extern NpcIntegerDialog *npcIntegerDialog; -extern NpcListDialog *npcListDialog; -extern NpcTextDialog *npcTextDialog; -extern NpcStringDialog *npcStringDialog; - NPCHandler::NPCHandler() { static const Uint16 _messages[] = { @@ -59,40 +56,44 @@ void NPCHandler::handleMessage(MessageIn &msg) { case SMSG_NPC_CHOICE: msg.readInt16(); // length - id = msg.readInt32(); + current_npc = msg.readInt32(); player_node->setAction(LocalPlayer::STAND); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); npcListDialog->parseItems(msg.readString(msg.getLength() - 8)); - npcListDialog->setVisible(true); + npcListDialog->requestFocus(); break; case SMSG_NPC_MESSAGE: msg.readInt16(); // length - id = msg.readInt32(); + current_npc = msg.readInt32(); player_node->setAction(LocalPlayer::STAND); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); npcTextDialog->addText(msg.readString(msg.getLength() - 8)); - npcListDialog->setVisible(false); - npcTextDialog->setVisible(true); + npcTextDialog->requestFocus(); break; case SMSG_NPC_CLOSE: id = msg.readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); - npcTextDialog->showCloseButton(); + // If we're talking to that NPC, show the close button + if (id == current_npc) + npcTextDialog->showCloseButton(); + // Otherwise, move on as an empty dialog doesn't help + else + npcTextDialog->closeDialog(id); break; case SMSG_NPC_NEXT: - // Next button in NPC dialog, currently unused id = msg.readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); - npcTextDialog->showNextButton(); + // If we're talking to that NPC, show the next button + if (id == current_npc) + npcTextDialog->showNextButton(); + // Otherwise, move on as an empty dialog doesn't help + else + npcTextDialog->nextDialog(id); break; case SMSG_NPC_INT_INPUT: // Request for an integer - id = msg.readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); + current_npc = msg.readInt32(); + player_node->setAction(LocalPlayer::STAND); npcIntegerDialog->setRange(0, 2147483647); npcIntegerDialog->setDefaultValue(0); npcIntegerDialog->setVisible(true); @@ -101,8 +102,8 @@ void NPCHandler::handleMessage(MessageIn &msg) case SMSG_NPC_STR_INPUT: // Request for a string - id = msg.readInt32(); - current_npc = dynamic_cast<NPC*>(beingManager->findBeing(id)); + current_npc = msg.readInt32(); + player_node->setAction(LocalPlayer::STAND); npcStringDialog->setValue(""); npcStringDialog->setVisible(true); npcStringDialog->requestFocus(); diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 9f0acbb3..fcc44cb0 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -30,13 +30,17 @@ #include "../../units.h" #include "../../gui/buy.h" +#include "../../gui/buysell.h" #include "../../gui/chat.h" #include "../../gui/gui.h" -#include "../../gui/npclistdialog.h" #include "../../gui/npc_text.h" +#include "../../gui/npcintegerdialog.h" +#include "../../gui/npclistdialog.h" +#include "../../gui/npcstringdialog.h" #include "../../gui/ok_dialog.h" #include "../../gui/sell.h" #include "../../gui/skill.h" +#include "../../gui/storagewindow.h" #include "../../gui/viewport.h" #include "../../utils/stringutils.h" @@ -46,12 +50,6 @@ OkDialog *weightNotice = NULL; OkDialog *deathNotice = NULL; -extern NpcListDialog *npcListDialog; -extern NpcTextDialog *npcTextDialog; -extern BuyDialog *buyDialog; -extern SellDialog *sellDialog; -extern Window *buySellDialog; - // Max. distance we are willing to scroll after a teleport; // everything beyond will reset the port hard. static const int MAP_TELEPORT_SCROLL_DISTANCE = 8; @@ -81,12 +79,19 @@ namespace { { player_node->revive(); deathNotice = NULL; + npcIntegerDialog->reset(); + npcIntegerDialog->setVisible(false); + npcListDialog->reset(); npcListDialog->setVisible(false); + npcStringDialog->setValue(""); + npcStringDialog->setVisible(false); + npcTextDialog->clearText(); npcTextDialog->setVisible(false); buyDialog->setVisible(false); sellDialog->setVisible(false); buySellDialog->setVisible(false); - if (current_npc) current_npc->handleDeath(); + + if (storageWindow->isVisible()) storageWindow->close(); } } deathListener; } @@ -140,8 +145,6 @@ void PlayerHandler::handleMessage(MessageIn &msg) // Switch the actual map, deleting the previous one if necessary engine->changeMap(mapPath); - if (current_npc) current_npc->handleDeath(); - float scrollOffsetX = 0.0f; float scrollOffsetY = 0.0f; @@ -160,8 +163,8 @@ void PlayerHandler::handleMessage(MessageIn &msg) player_node->mY = y; logger->log("Adjust scrolling by %d:%d", - (int)scrollOffsetX, - (int)scrollOffsetY); + (int) scrollOffsetX, + (int) scrollOffsetY); viewport->scrollBy(scrollOffsetX, scrollOffsetY); } @@ -169,7 +172,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) case SMSG_PLAYER_STAT_UPDATE_1: { - Sint16 type = msg.readInt16(); + int type = msg.readInt16(); Uint32 value = msg.readInt32(); switch (type) @@ -297,10 +300,10 @@ void PlayerHandler::handleMessage(MessageIn &msg) case SMSG_PLAYER_STAT_UPDATE_3: { - Sint32 type = msg.readInt32(); - Sint32 base = msg.readInt32(); - Sint32 bonus = msg.readInt32(); - Sint32 total = base + bonus; + int type = msg.readInt32(); + int base = msg.readInt32(); + int bonus = msg.readInt32(); + int total = base + bonus; switch (type) { case 0x000d: player_node->mAttr[LocalPlayer::STR] = total; @@ -321,9 +324,9 @@ void PlayerHandler::handleMessage(MessageIn &msg) case SMSG_PLAYER_STAT_UPDATE_4: { - Sint16 type = msg.readInt16(); - Sint8 fail = msg.readInt8(); - Sint8 value = msg.readInt8(); + int type = msg.readInt16(); + int fail = msg.readInt8(); + int value = msg.readInt8(); if (fail != 1) break; @@ -400,7 +403,7 @@ void PlayerHandler::handleMessage(MessageIn &msg) case SMSG_PLAYER_ARROW_MESSAGE: { - Sint16 type = msg.readInt16(); + int type = msg.readInt16(); switch (type) { case 0: diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h index 55c0d8b6..b806b13b 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -121,30 +121,32 @@ #define CMSG_TRADE_RESPONSE 0x00e6 #define CMSG_ITEM_PICKUP 0x009f #define CMSG_MAP_LOADED 0x007d -#define CMSG_NPC_BUY_REQUEST 0x00c8 -#define CMSG_NPC_BUY_SELL_REQUEST 0x00c5 #define CMSG_CHAT_MESSAGE 0x008c #define CMSG_CHAT_WHISPER 0x0096 #define CMSG_CHAT_ANNOUNCE 0x0099 #define CMSG_CHAT_WHO 0x00c1 -#define CMSG_NPC_LIST_CHOICE 0x00b8 -#define CMSG_NPC_NEXT_REQUEST 0x00b9 -#define CMSG_NPC_SELL_REQUEST 0x00c9 -#define CMSG_NPC_INT_RESPONSE 0x0143 -#define CMSG_NPC_STR_RESPONSE 0x01d5 #define CMSG_SKILL_LEVELUP_REQUEST 0x0112 #define CMSG_STAT_UPDATE_REQUEST 0x00bb #define CMSG_TRADE_ITEM_ADD_REQUEST 0x00e8 #define CMSG_TRADE_CANCEL_REQUEST 0x00ed #define CMSG_TRADE_ADD_COMPLETE 0x00eb #define CMSG_TRADE_OK 0x00ef -#define CMSG_NPC_TALK 0x0090 #define CMSG_TRADE_REQUEST 0x00e4 #define CMSG_PLAYER_INVENTORY_USE 0x00a7 #define CMSG_PLAYER_INVENTORY_DROP 0x00a2 #define CMSG_PLAYER_EQUIP 0x00a9 #define CMSG_PLAYER_UNEQUIP 0x00ab +#define CMSG_NPC_TALK 0x0090 +#define CMSG_NPC_NEXT_REQUEST 0x00b9 +#define CMSG_NPC_CLOSE 0x0146 +#define CMSG_NPC_LIST_CHOICE 0x00b8 +#define CMSG_NPC_INT_RESPONSE 0x0143 +#define CMSG_NPC_STR_RESPONSE 0x01d5 +#define CMSG_NPC_BUY_SELL_REQUEST 0x00c5 +#define CMSG_NPC_BUY_REQUEST 0x00c8 +#define CMSG_NPC_SELL_REQUEST 0x00c9 + #define CMSG_PARTY_CREATE 0x00f9 #define CMSG_PARTY_INVITE 0x00fc #define CMSG_PARTY_INVITED 0x00ff diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index 4361b147..12c38aaa 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -85,14 +85,14 @@ void SkillHandler::handleMessage(MessageIn &msg) for (int k = 0; k < skillCount; k++) { - Sint16 skillId = msg.readInt16(); + int skillId = msg.readInt16(); msg.readInt16(); // target type msg.readInt16(); // unknown - Sint16 level = msg.readInt16(); - Sint16 sp = msg.readInt16(); + int level = msg.readInt16(); + int sp = msg.readInt16(); msg.readInt16(); // range std::string skillName = msg.readString(24); - Sint8 up = msg.readInt8(); + int up = msg.readInt8(); if (level != 0 || up != 0) { diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 6c953a11..78472083 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -140,8 +140,8 @@ void TradeHandler::handleMessage(MessageIn &msg) case SMSG_TRADE_ITEM_ADD: { - Sint32 amount = msg.readInt32(); - Sint16 type = msg.readInt16(); + int amount = msg.readInt32(); + int type = msg.readInt16(); msg.readInt8(); // identified flag msg.readInt8(); // attribute msg.readInt8(); // refine @@ -166,7 +166,7 @@ void TradeHandler::handleMessage(MessageIn &msg) tradeWindow->receivedOk(true); return; } - Sint16 quantity = msg.readInt16(); + int quantity = msg.readInt16(); switch (msg.readInt8()) { diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp index ac33b6fe..947d6b80 100644 --- a/src/net/tmwserv/beinghandler.cpp +++ b/src/net/tmwserv/beinghandler.cpp @@ -289,7 +289,7 @@ void BeingHandler::handleBeingsDamageMessage(MessageIn &msg) int damage = msg.readInt16(); if (being) { - being->takeDamage(damage); + being->takeDamage(0, damage, Being::HIT); } } } diff --git a/src/net/tmwserv/buysellhandler.cpp b/src/net/tmwserv/buysellhandler.cpp index 54750cbb..6e4b9d56 100644 --- a/src/net/tmwserv/buysellhandler.cpp +++ b/src/net/tmwserv/buysellhandler.cpp @@ -57,7 +57,7 @@ void BuySellHandler::handleMessage(MessageIn &msg) return; } - current_npc = static_cast< NPC * >(being); + current_npc = being->getId(); switch (msg.getId()) { diff --git a/src/net/tmwserv/npchandler.cpp b/src/net/tmwserv/npchandler.cpp index 53f3c7b2..b3e36749 100644 --- a/src/net/tmwserv/npchandler.cpp +++ b/src/net/tmwserv/npchandler.cpp @@ -55,7 +55,7 @@ void NPCHandler::handleMessage(MessageIn &msg) return; } - current_npc = static_cast< NPC * >(being); + current_npc = being->getId(); switch (msg.getId()) { diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp index d4850f43..f4cc4b23 100644 --- a/src/net/tmwserv/playerhandler.cpp +++ b/src/net/tmwserv/playerhandler.cpp @@ -84,7 +84,9 @@ namespace { npcTextDialog->setVisible(false); buyDialog->setVisible(false); sellDialog->setVisible(false); +#ifdef EATHENA_SUPPORT buySellDialog->setVisible(false); +#endif current_npc = 0; } } deathListener; |