[Bug Fix] Add range check to OP_PickPocket (#1912)

* [Bug Fix] Add range check to OP_PickPocket

* Pickpocket distance is 15 constant according to Mackal

* Re-add wiggle room for distance check due to pathing
This commit is contained in:
Natedog2012 2022-01-03 21:26:37 -06:00 committed by GitHub
parent 3853c4f150
commit 6bf5608cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11066,48 +11066,35 @@ void Client::Handle_OP_PickPocket(const EQApplicationPacket *app)
return;
p_timers.Start(pTimerBeggingPickPocket, 8);
auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct));
sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer;
pick_out->coin = 0;
pick_out->from = victim->GetID();
pick_out->to = GetID();
pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets);
pick_out->type = 0;
//if we do not send this packet the client will lock up and require the player to relog.
if (victim == this) {
Message(0, "You catch yourself red-handed.");
auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct));
sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer;
pick_out->coin = 0;
pick_out->from = victim->GetID();
pick_out->to = GetID();
pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets);
pick_out->type = 0;
//if we do not send this packet the client will lock up and require the player to relog.
QueuePacket(outapp);
safe_delete(outapp);
}
else if (victim->GetOwnerID()) {
Message(0, "You cannot steal from pets!");
auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct));
sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer;
pick_out->coin = 0;
pick_out->from = victim->GetID();
pick_out->to = GetID();
pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets);
pick_out->type = 0;
//if we do not send this packet the client will lock up and require the player to relog.
QueuePacket(outapp);
safe_delete(outapp);
}
else if (Distance(GetPosition(), victim->GetPosition()) > 20) {
Message(Chat::Red, "Attempt to pickpocket out of range detected.");
database.SetMQDetectionFlag(this->AccountName(), this->GetName(), "OP_PickPocket was sent from outside combat range.", zone->GetShortName());
}
else if (victim->IsNPC()) {
safe_delete(outapp);
victim->CastToNPC()->PickPocket(this);
return;
}
else {
Message(0, "Stealing from clients not yet supported.");
auto outapp = new EQApplicationPacket(OP_PickPocket, sizeof(sPickPocket_Struct));
sPickPocket_Struct* pick_out = (sPickPocket_Struct*)outapp->pBuffer;
pick_out->coin = 0;
pick_out->from = victim->GetID();
pick_out->to = GetID();
pick_out->myskill = GetSkill(EQ::skills::SkillPickPockets);
pick_out->type = 0;
//if we do not send this packet the client will lock up and require the player to relog.
QueuePacket(outapp);
safe_delete(outapp);
}
QueuePacket(outapp);
safe_delete(outapp);
}
void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app)