summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client.cpp8
-rw-r--r--src/client.h1
-rw-r--r--src/localplayer.cpp3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp
index d0348dec5..8497d337b 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2006,6 +2006,10 @@ void Client::initPacketLimiter()
mPacketLimits[PACKET_ATTACK].cntLimit = 1;
mPacketLimits[PACKET_ATTACK].cnt = 0;
+ mPacketLimits[PACKET_STOPATTACK].timeLimit = 2 + 10;
+ mPacketLimits[PACKET_STOPATTACK].lastTime = 0;
+ mPacketLimits[PACKET_STOPATTACK].cntLimit = 1;
+ mPacketLimits[PACKET_STOPATTACK].cnt = 0;
if (!mServerConfigDir.empty())
{
@@ -2043,7 +2047,7 @@ void Client::initPacketLimiter()
mPacketLimits[f].timeLimit = atoi(line);
}
inPacketFile.close();
- if (ver == 1)
+ if (ver < 3)
writePacketLimits(packetLimitsName);
}
}
@@ -2058,7 +2062,7 @@ void Client::writePacketLimits(std::string packetLimitsName)
outPacketFile.close();
return;
}
- outPacketFile << "2" << std::endl;
+ outPacketFile << "3" << std::endl;
for (int f = 0; f < PACKET_SIZE; f ++)
{
outPacketFile << toString(mPacketLimits[f].timeLimit)
diff --git a/src/client.h b/src/client.h
index 08bc1ecbf..776e9aa3d 100644
--- a/src/client.h
+++ b/src/client.h
@@ -136,6 +136,7 @@ enum PacketTypes
PACKET_SIT = 7,
PACKET_DIRECTION = 8,
PACKET_ATTACK = 9,
+ PACKET_STOPATTACK = 10,
PACKET_SIZE
};
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 11333af42..324f3af54 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1383,6 +1383,9 @@ void LocalPlayer::attack(Being *target, bool keep, bool dontChangeEquipment)
void LocalPlayer::stopAttack()
{
+ if (!Client::limitPackets(PACKET_STOPATTACK))
+ return;
+
if (mServerAttack && mAction == ATTACK)
Net::getPlayerHandler()->stopAttack();