Added condition for picking up items: If the player has a pet out, don't pick up items manually

This commit is contained in:
Knaapchen 2022-11-15 01:04:00 +01:00
parent 440a89ffae
commit 0899e2ed3a
2 changed files with 28 additions and 24 deletions

View File

@ -178,6 +178,8 @@ namespace flyff {
DEFINE_MEMBER(3424, Vector<Skill>, skills);
DEFINE_MEMBER(3548, int, pickup_pet_inventory_index);
const MinimumSize<4096> size;
};

View File

@ -747,36 +747,38 @@ void attacker_script() {
return;
}
}
// No item target and no attack target
current_pickup_item = find_next_item();
item = neuz.get_mover(current_pickup_item);
if (item) {
auto *prop = reinterpret_cast<const flyff::ItemProperty *>(
static_cast<const flyff::ObjectProperty *>(item->property)
);
// Only pickup if player has no pickup pet spawned.
if(client.player->pickup_pet_inventory_index == -1) {
// No item target and no attack target
current_pickup_item = find_next_item();
item = neuz.get_mover(current_pickup_item);
if (item) {
auto *prop = reinterpret_cast<const flyff::ItemProperty *>(
static_cast<const flyff::ObjectProperty *>(item->property)
);
std::string str = "Picking up ";
str.append(neuz.get_text(prop->name));
std::string str = "Picking up ";
str.append(neuz.get_text(prop->name));
interact(item->object_id, 1);
neuz.show_message(str);
return;
} else {
current_target = find_closest_target();
monster = neuz.get_mover(current_target);
if (monster) {
std::string str = "Attacking ";
str.append(monster->name);
interact(current_target, 1);
interact(item->object_id, 1);
neuz.show_message(str);
} else {
neuz.show_message("Unable to find target.");
return;
}
}
current_target = find_closest_target();
monster = neuz.get_mover(current_target);
if (monster) {
std::string str = "Attacking ";
str.append(monster->name);
interact(current_target, 1);
neuz.show_message(str);
} else {
neuz.show_message("Unable to find target.");
}
}
}
}