[Feature] Add humanoid and non-wielded restrictions to pick pocket (#2276)

* Add humanoid and non-wielded restructions to pick pocket

* Use constants for message string and char color

* Fixed more magic #s

* Fix to include valie bodytypes

* Fix incorrect scope of final else

* My extra message was not needed.  Client handles based on packet reply

* Removed string ID I added - issued by client

* Use existing pick pocket reply function / clean up
This commit is contained in:
Paul Coene 2022-07-02 23:02:43 -04:00 committed by GitHub
parent 30f35a920b
commit 5c60913583
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 19 deletions

View File

@ -11074,35 +11074,30 @@ 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.");
Message(Chat::White, "You catch yourself red-handed.");
}
else if (victim->GetOwnerID()) {
Message(0, "You cannot steal from pets!");
Message(Chat::White, "You cannot steal from pets!");
}
else if (victim->IsClient()) {
Message(Chat::White, "Stealing from clients not yet supported.");
}
else if (Distance(GetPosition(), victim->GetPosition()) > 20) {
Message(Chat::Red, "Attempt to pickpocket out of range detected.");
database.SetMQDetectionFlag(AccountName(), GetName(), "OP_PickPocket was sent from outside combat range.", zone->GetShortName());
}
else if (victim->IsNPC()) {
safe_delete(outapp);
victim->CastToNPC()->PickPocket(this);
return;
auto body = victim->GetBodyType();
if (body == BT_Humanoid || body == BT_Monster || body == BT_Giant ||
body == BT_Lycanthrope) {
victim->CastToNPC()->PickPocket(this);
return;
}
}
else {
Message(0, "Stealing from clients not yet supported.");
}
QueuePacket(outapp);
safe_delete(outapp);
SendPickPocketResponse(victim, 0, PickPocketFailed);
}
void Client::Handle_OP_PopupResponse(const EQApplicationPacket *app)

View File

@ -1867,7 +1867,7 @@ void NPC::PickPocket(Client* thief)
continue;
auto item_test = database.GetItem(item_iter->item_id);
if (item_test->Magic || !item_test->NoDrop || item_test->IsClassBag() || thief->CheckLoreConflict(item_test))
if (item_test->Magic || !item_test->NoDrop || item_test->IsClassBag() || thief->CheckLoreConflict(item_test) || item_iter->equip_slot != EQ::invslot::SLOT_INVALID)
continue;
loot_selection.push_back(std::make_pair(item_test, ((item_test->Stackable) ? (1) : (item_iter->charges))));