diff options
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/beinghandler.cpp | 25 | ||||
-rw-r--r-- | src/net/ea/charserverhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/generalhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/inventoryhandler.cpp | 29 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/network.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/partyhandler.cpp | 6 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 9 | ||||
-rw-r--r-- | src/net/ea/tradehandler.cpp | 5 |
9 files changed, 55 insertions, 37 deletions
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index cba1c984..6c943454 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -245,7 +245,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) * we'll just pretend the packet didn't happen */ - if (dstBeing) { + if (dstBeing) + { dstBeing->setAction(Being::STAND); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); @@ -406,14 +407,18 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) int id = 0; int id2 = 0; - if (msg.getId() == SMSG_BEING_CHANGE_LOOKS) { + if (msg.getId() == SMSG_BEING_CHANGE_LOOKS) + { id = msg.readInt8(); - } else { // SMSG_BEING_CHANGE_LOOKS2 + } + else + { // SMSG_BEING_CHANGE_LOOKS2 id = msg.readInt16(); id2 = msg.readInt16(); } - switch (type) { + switch (type) + { case 1: // eAthena LOOK_HAIR player->setSpriteID(Player::HAIR_SPRITE, id *-1); break; @@ -606,14 +611,17 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) */ id = msg.readInt32(); - if (mSync || id != player_node->getId()) { + if (mSync || id != player_node->getId()) + { dstBeing = beingManager->findBeing(id); - if (dstBeing) { + if (dstBeing) + { Uint16 x, y; x = msg.readInt16(); y = msg.readInt16(); dstBeing->setTileCoords(x, y); - if (dstBeing->mAction == Being::WALK) { + if (dstBeing->mAction == Being::WALK) + { dstBeing->mFrame = 0; dstBeing->setAction(Being::STAND); } @@ -639,7 +647,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) statusEffects |= ((Uint32) msg.readInt16()) << 16; msg.readInt8(); - if (dstBeing) { + if (dstBeing) + { dstBeing->setStunMode(stunMode); dstBeing->setStatusEffectBlock(0, (statusEffects >> 16) & 0xffff); dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff); diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 8dacb06f..cda839bb 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -96,7 +96,8 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_CHAR_LOGIN_ERROR: - switch (msg.readInt8()) { + switch (msg.readInt8()) + { case 0: errorMessage = _("Access denied."); break; @@ -216,9 +217,8 @@ LocalPlayer *CharServerHandler::readPlayerData(Net::MessageIn &msg, int &slot) tempPlayer->setSprite(Player::HAIR_SPRITE, hairStyle * -1, ColorDB::get(msg.readInt16())); tempPlayer->setSprite(Player::MISC2_SPRITE, msg.readInt16()); tempPlayer->setName(msg.readString(24)); - for (int i = 0; i < 6; i++) { + for (int i = 0; i < 6; i++) tempPlayer->setAttributeBase(i + STR, msg.readInt8()); - } slot = msg.readInt8(); // character slot msg.readInt8(); // unknown diff --git a/src/net/ea/generalhandler.cpp b/src/net/ea/generalhandler.cpp index 44542ddc..5c7c5036 100644 --- a/src/net/ea/generalhandler.cpp +++ b/src/net/ea/generalhandler.cpp @@ -118,7 +118,8 @@ void GeneralHandler::handleMessage(Net::MessageIn &msg) code = msg.readInt8(); logger->log("Connection problem: %i", code); - switch (code) { + switch (code) + { case 0: errorMessage = _("Authentication failed."); break; diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index c616464a..c7080c2d 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -155,17 +155,21 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) cards[0], cards[1], cards[2], cards[3]); } - if (msg.getId() == SMSG_PLAYER_INVENTORY) { + if (msg.getId() == SMSG_PLAYER_INVENTORY) + { inventory->setItem(index, itemId, amount, false); // Trick because arrows are not considered equipment - if (arrow & 0x8000) { + if (arrow & 0x8000) + { if (Item *item = inventory->getItem(index)) item->setEquipment(true); } //const Item *item = inventory->getItem(index); - } else { + } + else + { storage->setItem(index, itemId, amount, false); } } @@ -175,7 +179,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) msg.readInt16(); // length number = (msg.getLength() - 4) / 20; - for (int loop = 0; loop < number; loop++) { + for (int loop = 0; loop < number; loop++) + { index = msg.readInt16() - STORAGE_OFFSET; itemId = msg.readInt16(); itemType = msg.readInt8(); @@ -258,9 +263,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) index = msg.readInt16() - INVENTORY_OFFSET; amount = msg.readInt16(); - if (msg.readInt8() == 0) { + if (msg.readInt8() == 0) + { localChatTab->chatLog(_("Failed to use item."), BY_SERVER); - } else { + } + else + { if (Item *item = inventory->getItem(index)) item->setQuantity(amount); } @@ -354,13 +362,9 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) flag = msg.readInt8(); if (!flag) - { localChatTab->chatLog(_("Unable to equip."), BY_SERVER); - } else - { mEquips.setEquipment(getSlot(equipType), index); - } break; case SMSG_PLAYER_UNEQUIP: @@ -368,13 +372,10 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) equipType = msg.readInt16(); flag = msg.readInt8(); - if (!flag) { + if (!flag) localChatTab->chatLog(_("Unable to unequip."), BY_SERVER); - } else - { mEquips.setEquipment(getSlot(equipType), -1); - } break; case SMSG_PLAYER_ATTACK_RANGE: diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index e27eccf8..07caa325 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -73,7 +73,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) // pass change failed else { - switch (errMsg) { + switch (errMsg) + { case 0: errorMessage = _("Account was not found. Please re-login."); break; @@ -142,7 +143,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) code = msg.readInt8(); logger->log("Login::error code: %i", code); - switch (code) { + switch (code) + { case 0: errorMessage = _("Unregistered ID."); break; diff --git a/src/net/ea/network.cpp b/src/net/ea/network.cpp index c12e1bb9..a93d6cfd 100644 --- a/src/net/ea/network.cpp +++ b/src/net/ea/network.cpp @@ -411,7 +411,8 @@ void Network::receive() setError(_("Connection to server terminated. ") + std::string(SDLNet_GetError())); } - else { + else + { mInSize += ret; if (mToSkip) { diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index de17855f..af842c11 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -162,7 +162,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) short exp = msg.readInt16(); short item = msg.readInt16(); - switch (exp) { + switch (exp) + { case PARTY_SHARE: if (mShareExp == PARTY_SHARE) break; @@ -185,7 +186,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg) logger->log("Unknown party exp option: %d\n", exp); } - switch (item) { + switch (item) + { case PARTY_SHARE: if (mShareItems == PARTY_SHARE) break; diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 0592bb55..14907300 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -309,7 +309,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_PLAYER_STAT_UPDATE_2: - switch (msg.readInt16()) { + switch (msg.readInt16()) + { case 0x0001: player_node->setExp(msg.readInt32()); break; @@ -490,7 +491,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) break; case SMSG_PLAYER_STAT_UPDATE_6: - switch (msg.readInt16()) { + switch (msg.readInt16()) + { case 0x0020: statusWindow->setPointsNeeded(STR, msg.readInt8()); break; @@ -516,7 +518,8 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) { int type = msg.readInt16(); - switch (type) { + switch (type) + { case 0: localChatTab->chatLog(_("Equip arrows first."), BY_SERVER); diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 2f5186df..b02bb900 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -161,11 +161,10 @@ void TradeHandler::handleMessage(Net::MessageIn &msg) msg.skip(8); // card (4 shorts) // TODO: handle also identified, etc - if (type == 0) { + if (type == 0) tradeWindow->setMoney(amount); - } else { + else tradeWindow->addItem(type, false, amount, false); - } } break; |