Page 1 of 1

Need a selective loot function

Posted: Fri May 10, 2013 7:20 pm
by sparky
I have the bot running around killing only mobs named in <mobs> definition, and then loot. Loot all = false, loot in combat = true.

The problem comes from using AOE to kill the mob and everything around it. If there are more than one named mob killed, only the first gets looted. I need a short function to loot the other dead named mobs.

I can't turn on loot all, otherwise all the trash mobs from AOE get looted too.

I'm thinking a simple function added after <onLeaveCombat>

check for nearby dead/lootable targets
for each, if name defined in <mobs> then loot

I don't know lua well enough to write it though :( I'd appreciate any help with this!

Thanks

Re: Need a selective loot function

Posted: Sat May 11, 2013 1:20 am
by kuripot
you need loot_all set in true/// it mean it will loot all dead body

Re: Need a selective loot function

Posted: Sat May 11, 2013 7:18 am
by rock5
There is no way to do that with the current functions.

My first idea was to just copy lootAll and modify it but it uses findNearestNameOrId while using the evalTargetLootable eval function. So I think what we will actually have to do is hook into the evalTargetLootable. Something like this.

Code: Select all

if evalTargetLootableOrig == nil then evalTargetLootableOrig = evalTargetLootable end
function evalTargetLootable(address, target)
	if not target or not target.HP then
		target = CPawn.new(address)
	end

	-- First check the original function
	local result = evalTargetLootableOrig(address, target)

	-- Further check if it's on the mob list
	if settings.profile.mobs and result == true then 
		if not player:isInMobs(target) then
			result = false
		end
	end

	return result
end
Put this in the onload of a waypoint or create a userfunction file for it if you want it to always be in effect.

This should cause the lootall function to loot only mobs in the "mobs" list. If there is no mobs list then it will loot all. It wont affect looting the mob you are directly attacking.

I wonder if this should be added to the bot as an option. Anyone have an opinion on that?

Re: Need a selective loot function

Posted: Sat May 11, 2013 11:53 am
by sparky
Wow! Thanks rock! Works like a champ!

I put it in the waypoint file, as you suggested, and turned loot all on.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onload>
	if evalTargetLootableOrig == nil then evalTargetLootableOrig = evalTargetLootable end
	function evalTargetLootable(address, target)
		if not target or not target.HP then
			target = CPawn.new(address)
		end

		-- First check the original function
		local result = evalTargetLootableOrig(address, target)

		-- Further check if it's on the mob list
		if settings.profile.mobs and result == true then
			if not player:isInMobs(target) then
				result = false
			end
		end

		return result
	end

</onload>

	<!-- #  1 --><waypoint x="-14317" z="34821" y="106">	</waypoint>
	<!-- #  2 --><waypoint x="-14359" z="34731" y="103">	</waypoint>
</waypoints>
I'd love to see a few loot options added, such as:

lootall = true, false, lootonlythese, lootallbutthese

Re: Need a selective loot function

Posted: Mon Jul 01, 2013 10:48 am
by C3PO
Hello,

I would also like to loot selective, but not on mobs. I'd like to loot only special Items.
  • !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    I know lootomatic and so on
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
but that's not what I want. So the question is: is it possible to loot everything the mob offers, and drop all item's (that where looted and) that are not in the list?

Re: Need a selective loot function

Posted: Mon Jul 01, 2013 11:24 am
by lolita
C3PO wrote:So the question is: is it possible to loot everything the mob offers, and drop all item's (that where looted and) that are not in the list?
I think it's done already with Cleanbag userfunction
http://solarstrike.net/phpBB3/viewtopic ... 413#p25413

you just need to setup

Code: Select all

-- custom database for user added items to trow out
   forcedrop = {
      "Lost Gift",
   }
   
   -- custom database for user added items to keep
   forcekeep = {
      "Blend Rune",
      "Phirius Potion - Type A",
      "Phirius Potion - Type B",
      "Phirius Elixir - Type A",
      "Phirius Elixir - Type B"
   }
in file