awesome pick hilfe

04/20/2009 22:55 wpsabused#1
hi
i want to edit my pick files of the awesome-o bot

i want my bot to pick up flawless amethysts and to stash any jewels

can somebody please help me to edit these files?
would be really nice

Code:
table.insert(itemActions,
	function(item, action)
		-- GEMS
		local priority = 3 -- pick priority

		if not isGem(item) then 
			return false
		elseif action == aPICK then
			return priority
		end

		return false
	end
)

-- note: make sure that the last line on returns
--		does not include "or", and that all lines except the last do
-- Thanks to plusmedic and wreinhardt!
function isGem(item)
	return (
			isPerfectGem(item) or
			isFlawlessGem(item)
			--isNormalGem(item) or
			--isFlawedGem(item or
			--isChippedGem(item)
			)
end

function isPerfectGem(item)
	return (
			item.baseItem.code == "gpv" or -- Perfect Amethyst
			item.baseItem.code == "gpw" or -- Perfect Diamond
			item.baseItem.code == "gpg" or -- Perfect Emerald
			item.baseItem.code == "gpr" or -- Perfect Ruby
			item.baseItem.code == "gpb" or -- Perfect Sapphire
			item.baseItem.code == "skz" or -- Perfect Skull
			item.baseItem.code == "gpy" -- Perfect Topaz
			)
end

function isFlawlessGem(item)
	return (
			item.baseItem.code == "gzv" or -- Flawless Amethyst
			item.baseItem.code == "glw" or -- Flawless Diamond
			item.baseItem.code == "glg" or -- Flawless Emerald
			item.baseItem.code == "glr" or -- Flawless Ruby
			item.baseItem.code == "glb" or -- Flawless Sapphire
			item.baseItem.code == "skl" or -- Flawless Skull
			item.baseItem.code == "gly" -- Flawless Topaz
			)
end

function isNormalGem(item)
	return (
			item.baseItem.code == "gsv" or -- Amethyst
			item.baseItem.code == "gsw" or -- Diamond
			item.baseItem.code == "gsg" or -- Emerald
			item.baseItem.code == "gsr" or -- Ruby
			item.baseItem.code == "gsb" or -- Sapphire
			item.baseItem.code == "sku" or -- Skull
			item.baseItem.code == "gsy" -- Topaz
			)
end

function isFlawedGem(item)
	return (
			item.baseItem.code == "gfv" or -- Flawed Amethyst
			item.baseItem.code == "gfw" or -- Flawed Diamond
			item.baseItem.code == "gfg" or -- Flawed Emerald
			item.baseItem.code == "gfr" or -- Flawed Ruby
			item.baseItem.code == "gfb" or -- Flawed Sapphire
			item.baseItem.code == "skf" or -- Flawed Skull
			item.baseItem.code == "gfy" -- Flawed Topaz
			)
end

function isChippedGem(item)
	return (
			item.baseItem.code == "gcv" or -- Chipped Amethyst
			item.baseItem.code == "gcw" or -- Chipped Diamond
			item.baseItem.code == "gcg" or -- Chipped Emerald
			item.baseItem.code == "gcr" or -- Chipped Ruby
			item.baseItem.code == "gcb" or -- Chipped Sapphire
			item.baseItem.code == "skc" or -- Chipped Skull
			item.baseItem.code == "gcy" -- Chipped Topaz
			)
end

Code:
table.insert(itemActions,
	function(item, action)
		-- MAGIC jewels
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 6
		local identify = true -- use false if you want to keep junk jewels
		local dump = true

		if not (item.quality == ItemQuality.Magic and item.baseItem.code == "jew") then
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodMagicJewel(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodMagicJewel(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodMagicJewel(item) then
			return dump
		end

		return false
	end
)

function isGoodMagicJewel(item)
	-- note: edam, mp, str, dex, eng, and hp are all assigned values
	-- so you can add custom jewels in the return
	-- do not try to compare other variables (bools) with numbers
	-- feel free to change the lower prefix/suffix bounds
	local prefix = false
	local edam, mp = 0, 0
	local suffix = false
	local str, ar, dex, dtm, def, eng, hp, ias, fhr, req = 0, 0, 0, 0, 0, 0, 0, false, false, false
	local affix = false
	local lmnd, lmxd = false, false
	
	if hasRes(item, 10, 4) or hasRes(item, 20, 1) then -- 10+allres or 20+singleres->prefix
		prefix = true
	end

	if hasRes(item, 15, 4) then -- 15allres->affix
		affix = true
	end

	for i = 0, item.mods:size() - 1 do
		if item.mods[i].Stat.Type == StatType.MaxDamagePercent then
			 if item.mods[i].Value >= 30 then -- 30+edam->prefix
				prefix = true
			end
			edam = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.MaxMana then
			 if item.mods[i].Value >= 15 then -- 15+mp->prefix
				prefix = true
			end
			mp = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.ArmorClass then
			 if item.mods[i].Value >= 41 then -- 41+def->prefix -- ivory
				prefix = true
			end
			def = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.DamageToMana then
			 if item.mods[i].Value >= 7 then -- 7+dmg2mana->prefix -- dun
				prefix = true
			end
			dtm = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.Strength then
			 if item.mods[i].Value >= 7 then -- 7+str->suffix
				suffix = true
			end
			str = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.Dexterity then
			 if item.mods[i].Value >= 7 then -- 7+dex->suffix
				suffix = true
			end
			dex = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.Energy then
			 if item.mods[i].Value >= 7 then -- 7+eng->suffix
				suffix = true
			end
			eng = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.MaxLife then
			 if item.mods[i].Value >= 15 then -- 15+hp->suffix
				suffix = true
			end
			hp = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.LightMinDamage then
			 if item.mods[i].Value >= 1 then -- 1+litemindmg->lmnd check
				lmnd = true
			end
		elseif item.mods[i].Stat.Type == StatType.LightMaxDamage then
			 if item.mods[i].Value >= 61 then -- 61+litemaxdmg->lmxd check
				lmxd = true
			end
		elseif item.mods[i].Stat.Type == StatType.FasterAttackRate then
			ias = true -- ias->suffix
			suffix = true
		elseif item.mods[i].Stat.Type == StatType.FasterHitRecovery then
			fhr = true -- fhr->suffix
			suffix = true
		elseif item.mods[i].Stat.Type == StatType.LowerRequirementsPercent then
			req = true -- req->suffix
			suffix = true
		end
	end
	
	if (lmnd == true and lmxd == true) then
		suffix = true
	end

	return (
			(edam == 40) or -- example of custom jewel
			(prefix and suffix) or
			affix
			)
end
thanks =)
04/20/2009 22:58 Medix#2
Hi, would be very nice if you could posts concerning the awesome-o bot in the awesome-o thread; here the link: [Only registered and activated users can see links. Click Here To Register...]

so I will close this thread but post the same question in the link above and i am sure you will get an answer

/closed