summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-11-04 20:19:53 +0300
committerAndrei Karas <akaras@inbox.ru>2016-11-04 21:16:31 +0300
commitc5a5274c86201b74325a8b84ab4543c73959c5d5 (patch)
treedfc3e7a8e584a2f42e1dcd70a8ce9837ac448549 /src/net/eathena
parentcb6572ebd60ecc525c5a236a26eefc673841f056 (diff)
downloadmanaplus-c5a5274c86201b74325a8b84ab4543c73959c5d5.tar.gz
manaplus-c5a5274c86201b74325a8b84ab4543c73959c5d5.tar.bz2
manaplus-c5a5274c86201b74325a8b84ab4543c73959c5d5.tar.xz
manaplus-c5a5274c86201b74325a8b84ab4543c73959c5d5.zip
Dont send some packets with unsupported server versions.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/battlegroundhandler.cpp9
-rw-r--r--src/net/eathena/buyingstorehandler.cpp8
-rw-r--r--src/net/eathena/cashshophandler.cpp11
-rw-r--r--src/net/eathena/homunculushandler.cpp5
-rw-r--r--src/net/eathena/inventoryhandler.cpp8
-rw-r--r--src/net/eathena/packetsout.inc25
-rw-r--r--src/net/eathena/partyhandler.cpp3
-rw-r--r--src/net/eathena/playerhandler.cpp7
8 files changed, 64 insertions, 12 deletions
diff --git a/src/net/eathena/battlegroundhandler.cpp b/src/net/eathena/battlegroundhandler.cpp
index 723ab3bfe..0f92afe84 100644
--- a/src/net/eathena/battlegroundhandler.cpp
+++ b/src/net/eathena/battlegroundhandler.cpp
@@ -26,6 +26,7 @@
#include "debug.h"
extern Net::BattleGroundHandler *battleGroundHandler;
+extern int packetVersion;
namespace EAthena
{
@@ -38,6 +39,8 @@ BattleGroundHandler::BattleGroundHandler()
void BattleGroundHandler::registerBg(const BattleGroundTypeT &type,
const std::string &name) const
{
+ if (packetVersion < 20111005)
+ return;
createOutPacket(CMSG_BATTLE_REGISTER);
outMsg.writeInt16(CAST_S16(type), "type");
outMsg.writeString(name, 24, "bg name");
@@ -45,6 +48,8 @@ void BattleGroundHandler::registerBg(const BattleGroundTypeT &type,
void BattleGroundHandler::rekoveRequest(const std::string &name) const
{
+ if (packetVersion < 20111005)
+ return;
createOutPacket(CMSG_BATTLE_REVOKE);
outMsg.writeString(name, 24, "bg name");
}
@@ -53,6 +58,8 @@ void BattleGroundHandler::beginAck(const bool result,
const std::string &bgName,
const std::string &gameName) const
{
+ if (packetVersion < 20111005)
+ return;
createOutPacket(CMSG_BATTLE_BEGIN_ACK);
outMsg.writeInt8(CAST_S8(result ? 1 : 0), "result");
outMsg.writeString(bgName, 24, "bg name");
@@ -61,6 +68,8 @@ void BattleGroundHandler::beginAck(const bool result,
void BattleGroundHandler::checkState(const std::string &name) const
{
+ if (packetVersion < 20111005)
+ return;
createOutPacket(CMSG_BATTLE_CHECK_STATE);
outMsg.writeString(name, 24, "bg name");
}
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index 010a4a969..0540f8eec 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -48,6 +48,8 @@ void BuyingStoreHandler::create(const std::string &name,
const bool flag,
const std::vector<ShopItem*> &items) const
{
+ if (packetVersion < 20100303)
+ return;
createOutPacket(CMSG_BUYINGSTORE_CREATE);
outMsg.writeInt16(CAST_S16(89 + items.size() * 8), "len");
outMsg.writeInt32(maxMoney, "limit money");
@@ -74,6 +76,8 @@ void BuyingStoreHandler::open(const Being *const being) const
{
if (!being)
return;
+ if (packetVersion < 20100420)
+ return;
createOutPacket(CMSG_BUYINGSTORE_OPEN);
outMsg.writeBeingId(being->getId(), "account id");
}
@@ -83,7 +87,9 @@ void BuyingStoreHandler::sell(const Being *const being,
const Item *const item,
const int amount) const
{
- if (!being || !item || packetVersion < 20100420)
+ if (!being || !item)
+ return;
+ if (packetVersion < 20100420)
return;
createOutPacket(CMSG_BUYINGSTORE_SELL);
diff --git a/src/net/eathena/cashshophandler.cpp b/src/net/eathena/cashshophandler.cpp
index 56b6b3fbf..a25fa310a 100644
--- a/src/net/eathena/cashshophandler.cpp
+++ b/src/net/eathena/cashshophandler.cpp
@@ -27,6 +27,7 @@
#include "debug.h"
extern Net::CashShopHandler *cashShopHandler;
+extern int packetVersion;
namespace EAthena
{
@@ -42,6 +43,8 @@ void CashShopHandler::buyItem(const int points,
const ItemColor color A_UNUSED,
const int amount) const
{
+ if (packetVersion < 20101124)
+ return;
createOutPacket(CMSG_NPC_CASH_SHOP_BUY);
outMsg.writeInt16(10 + 4, "len");
outMsg.writeInt32(points, "points");
@@ -58,22 +61,30 @@ void CashShopHandler::buyItems(const std::vector<ShopItem*> &items A_UNUSED)
void CashShopHandler::close() const
{
+ if (packetVersion < 20110718)
+ return;
createOutPacket(CMSG_NPC_CASH_SHOP_CLOSE);
}
void CashShopHandler::requestPoints() const
{
+ if (packetVersion < 20110718)
+ return;
createOutPacket(CMSG_NPC_CASH_SHOP_OPEN);
}
void CashShopHandler::requestTab(const int tab) const
{
+ if (packetVersion < 20110718)
+ return;
createOutPacket(CMSG_NPC_CASH_SHOP_REQUEST_TAB);
outMsg.writeInt16(CAST_S16(tab), "tab");
}
void CashShopHandler::schedule() const
{
+ if (packetVersion < 20110614)
+ return;
createOutPacket(CMSG_NPC_CASH_SHOP_SCHEDULE);
}
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp
index 9de5a29ea..1c3a724f5 100644
--- a/src/net/eathena/homunculushandler.cpp
+++ b/src/net/eathena/homunculushandler.cpp
@@ -30,6 +30,7 @@
#include "debug.h"
extern Net::HomunculusHandler *homunculusHandler;
+extern int packetVersion;
namespace EAthena
{
@@ -80,6 +81,8 @@ void HomunculusHandler::attack(const BeingId targetId,
void HomunculusHandler::feed() const
{
+ if (packetVersion < 20050425)
+ return;
createOutPacket(CMSG_HOMUNCULUS_MENU);
outMsg.writeInt16(0, "type");
outMsg.writeInt8(1, "command"); // feed
@@ -87,6 +90,8 @@ void HomunculusHandler::feed() const
void HomunculusHandler::fire() const
{
+ if (packetVersion < 20050425)
+ return;
createOutPacket(CMSG_HOMUNCULUS_MENU);
outMsg.writeInt16(0, "type");
outMsg.writeInt8(2, "command"); // delete
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 062587996..342868c17 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -509,7 +509,9 @@ void InventoryHandler::insertCard(const int cardIndex,
void InventoryHandler::favoriteItem(const Item *const item,
const bool favorite) const
{
- if (!item || packetVersion < 20120410)
+ if (!item)
+ return;
+ if (packetVersion < 20120410)
return;
createOutPacket(CMSG_PLAYER_FAVORITE_ITEM);
outMsg.writeInt16(CAST_S16(item->getInvIndex()
@@ -539,6 +541,8 @@ int InventoryHandler::convertFromServerSlot(const int serverSlot) const
void InventoryHandler::selectCart(const BeingId accountId,
const int type) const
{
+ if (packetVersion < 20150805)
+ return;
createOutPacket(CMSG_SELECT_CART);
outMsg.writeBeingId(accountId, "account id");
outMsg.writeInt8(CAST_S8(type), "type");
@@ -546,6 +550,8 @@ void InventoryHandler::selectCart(const BeingId accountId,
void InventoryHandler::identifyItem(const Item *const item) const
{
+ if (packetVersion < 20150513)
+ return;
createOutPacket(CMSG_QUICK_IDENTIFY_ITEM);
outMsg.writeInt16(CAST_S16(item->getInvIndex()),
"item index");
diff --git a/src/net/eathena/packetsout.inc b/src/net/eathena/packetsout.inc
index 64416615f..e7a4dd2ae 100644
--- a/src/net/eathena/packetsout.inc
+++ b/src/net/eathena/packetsout.inc
@@ -248,9 +248,6 @@ packet(CMSG_SET_STATUS, 0x0b0e, 0, nullptr);
packet(CMSG_ONLINE_LIST, 0x0b0f, 0, nullptr);
-// 20150805
-packet(CMSG_SELECT_CART, 0x0980, 7, clif->pSelectCart);
-
#ifndef PACKETS_UPDATE
// 0
packet(CMSG_ALCHEMIST_RANKS, 0x0000, 0, nullptr);
@@ -293,6 +290,7 @@ packet(CMSG_NPC_CASH_SHOP_SCHEDULE, 0x0000, 0, nullptr);
packet(CMSG_GUILD_INVITE2, 0x0000, 0, nullptr);
packet(CMSG_STORAGE_PASSWORD, 0x0000, 0, nullptr);
packet(CMSG_ITEM_LIST_WINDOW_SELECT, 0x0000, 0, nullptr);
+packet(CMSG_SELECT_CART, 0x0000, 0, nullptr);
#else
// 20040713
if (packetVersion >= 20040713)
@@ -489,6 +487,12 @@ if (packetVersion >= 20070212)
packet(CMSG_MOVE_TO_STORAGE, 0x0094, 14, clif->pMoveToKafra);
}
+// 20070227
+if (packetVersion >= 20070227)
+{
+ packet(CMSG_PARTY_INVITE2, 0x02c4, 26, clif->pPartyInvite2);
+}
+
// 20080827
if (packetVersion >= 20080827)
{
@@ -561,16 +565,21 @@ if (packetVersion >= 20101124)
packet(CMSG_SOLVE_CHAR_NAME, 0x0369, 6, clif->pSolveCharName);
packet(CMSG_MOVE_FROM_STORAGE, 0x0365, 8, clif->pMoveFromKafra);
packet(CMSG_MAP_SERVER_CONNECT, 0x0436, 19, clif->pWantToConnection);
+ packet(CMSG_NPC_CASH_SHOP_BUY, 0x0288, -1, clif->pcashshop_buy);
+}
+
+// 20110614
+if (packetVersion >= 20110614)
+{
+ packet(CMSG_NPC_CASH_SHOP_SCHEDULE, 0x08c9, 2, clif->pCashShopSchedule);
}
// 20110718
if (packetVersion >= 20110718)
{
- packet(CMSG_NPC_CASH_SHOP_BUY, 0x0288, -1, clif->pcashshop_buy);
packet(CMSG_NPC_CASH_SHOP_CLOSE, 0x084a, 2, clif->pCashShopClose);
packet(CMSG_NPC_CASH_SHOP_OPEN, 0x0844, 2, clif->pCashShopOpen);
packet(CMSG_NPC_CASH_SHOP_REQUEST_TAB, 0x0846, 4, clif->pCashShopReqTab);
- packet(CMSG_NPC_CASH_SHOP_SCHEDULE, 0x08c9, 2, clif->pCashShopSchedule);
}
// 20111005
@@ -1299,6 +1308,12 @@ if (packetVersion >= 20150513)
packet(CMSG_ITEM_LIST_WINDOW_SELECT, 0x0960, -1, clif->pItemListWindowSelected);
}
+// 20150805
+if (packetVersion >= 20150805)
+{
+ packet(CMSG_SELECT_CART, 0x0980, 7, clif->pSelectCart);
+}
+
// 20150916
if (packetVersion >= 20150916)
{
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp
index df9e43dee..2afc6876c 100644
--- a/src/net/eathena/partyhandler.cpp
+++ b/src/net/eathena/partyhandler.cpp
@@ -63,7 +63,6 @@ void PartyHandler::invite(const std::string &name) const
{
if (!actorManager)
return;
-
const Being *const being = actorManager->findBeingByName(
name, ActorType::Player);
if (being)
@@ -73,6 +72,8 @@ void PartyHandler::invite(const std::string &name) const
}
else
{
+ if (packetVersion < 20070227)
+ return;
createOutPacket(CMSG_PARTY_INVITE2);
outMsg.writeString(name, 24, "nick");
}
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index ccffde7a6..8798d09df 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -456,11 +456,10 @@ void PlayerHandler::setShortcut(const int idx,
void PlayerHandler::shortcutShiftRow(const int row) const
{
- if (packetVersion < 20141022 ||
- (serverVersion != 0 && serverVersion < 11))
- {
+ if (packetVersion < 20141022)
+ return;
+ if (serverVersion != 0 && serverVersion < 11)
return;
- }
createOutPacket(CMSG_SHORTCUTS_ROW_SHIFT);
outMsg.writeInt8(CAST_S8(row), "row");
}