processItemsAutoGather and pickupitems.txt

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

sofax222
Developers
Developers
Posts: 214
Joined: 24 Nov 2010, 03:08
Noob?: Yes

processItemsAutoGather and pickupitems.txt

#1 Post by sofax222 »

I trace the processItemsAutoGather in src/AI/CoreLogic.pm.

I found some thing:
When some item is set 2 in pickupitems.txt file.
It is same as setting 1.
Another words, the setting 2 in pickupitems.txt file has not "to take the item as fast as it can" effect !
Am I right ??

PS: The "to take the item as fast as it can" is the description in pickupitems.txt file.
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: processItemsAutoGather and pickupitems.txt

#2 Post by EternalHarvest »

Code: Select all

$ grep -r pickupitems . |grep 2
./Network/Receive/ServerType0.pm:	if ($AI == AI::AUTO && pickupitems(lc($item->{name})) == 2
./Network/Receive/kRO/Sakexe_0.pm:	if ($AI == AI::AUTO && pickupitems(lc($item->{name})) == 2

Code: Select all

	# Take item as fast as possible
	if ($AI == AI::AUTO && pickupitems(lc($item->{name})) == 2
	 && ($config{'itemsTakeAuto'} || $config{'itemsGatherAuto'})
	 && (percent_weight($char) < $config{'itemsMaxWeight'})
	 && distance($item->{pos}, $char->{pos_to}) <= 5) {
		$messageSender->sendTake($args->{ID});
	}
It's not good that this piece of logic is in the Network module, but there it is.