mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Fix] Item Handins to Pets (#4687)
* [Fix] Item handins to pets * Update npc.cpp
This commit is contained in:
parent
e88ea24966
commit
8201175c2c
@ -4272,11 +4272,13 @@ bool NPC::CanPetTakeItem(const EQ::ItemInstance *inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsPetOwnerClient()) {
|
||||
if (!IsPetOwnerClient() && !IsCharmedPet()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool can_take_nodrop = RuleB(Pets, CanTakeNoDrop) || inst->GetItem()->NoDrop != 0;
|
||||
const bool can_take_nodrop = (RuleB(Pets, CanTakeNoDrop) || inst->GetItem()->NoDrop != 0)
|
||||
|| inst->GetItem()->NoRent == 0;
|
||||
|
||||
const bool is_charmed_with_attuned = IsCharmed() && inst->IsAttuned();
|
||||
|
||||
auto o = GetOwner() && GetOwner()->IsClient() ? GetOwner()->CastToClient() : nullptr;
|
||||
@ -4297,7 +4299,7 @@ bool NPC::CanPetTakeItem(const EQ::ItemInstance *inst)
|
||||
for (const auto &c : checks) {
|
||||
if (c.condition) {
|
||||
if (o) {
|
||||
o->Message(Chat::PetResponse, c.message.c_str());
|
||||
o->Message(Chat::PetResponse, fmt::format("{} says '{}'", GetCleanName(), c.message).c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -549,10 +549,10 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
|
||||
}
|
||||
}
|
||||
|
||||
auto with = tradingWith->CastToNPC();
|
||||
const EQ::ItemData *item = inst->GetItem();
|
||||
|
||||
if (with->IsPetOwnerClient() && with->CanPetTakeItem(inst)) {
|
||||
auto with = tradingWith->CastToNPC();
|
||||
const EQ::ItemData *item = inst->GetItem();
|
||||
const bool is_pet = with->IsPetOwnerClient() || with->IsCharmedPet();
|
||||
if (is_pet && with->CanPetTakeItem(inst)) {
|
||||
// pets need to look inside bags and try to equip items found there
|
||||
if (item->IsClassBag() && item->BagSlots > 0) {
|
||||
// if an item inside the bag can't be given to the pet, keep the bag
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user