Here are two codes:
First one from d3a user fright01:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using D3;
namespace info
{
public class Program
{
public static void Main(string[] args)
{
Game.OnDrawEvent += new DrawEventHandler(AutoLoot);
}
static int tick = 0;
static void AutoLoot(EventArgs e)
{
tick++;
if (tick % 15 == 0 && Me.Life > 0)
{
var items = Unit.Get().Where(x => x.Type == UnitType.Item && x.ItemContainer == Container.Unknown && CheckItem(x) == true);
foreach (Unit u in items)
{
if (GetDistance(u.ItemX, u.ItemY) <= 4.5f)
{
Me.UsePower(SNOPowerId.Axe_Operate_Gizmo, u);
}
else if (GetDistance(u.ItemX, u.ItemY) <= 8.5f)
{
Me.UsePower(SNOPowerId.Axe_Operate_Gizmo, u);
}
else
{
Me.UsePower(SNOPowerId.Axe_Operate_Gizmo, u);
}
}
}
}
public static bool CheckItem(Unit unit)
{
SNOActorId[] s = {
// Tome Of Secrets
SNOActorId.Lore_Book_Flippy,
// Pages
SNOActorId.Page_of_Knowledge_flippy,
// Tomes
SNOActorId.BlacksmithsTome,
SNOActorId.Crafting_Training_Tome,
// Crafting Materials
SNOActorId.CraftingMaterials_Flippy_Global,
// Plans
SNOActorId.CraftingPlan_Smith_Drop,
SNOActorId.CraftingPlan_Jeweler_Drop,
// Gold Coins
SNOActorId.GoldCoins,
SNOActorId.GoldSmall,
SNOActorId.GoldMedium,
SNOActorId.GoldLarge,
SNOActorId.GoldCoin_flippy,
// Health Potions
SNOActorId.healthPotion_Runic,
SNOActorId.healthPotion_Mythic,
SNOActorId.healthPotion_Resplendent,
SNOActorId.healthPotion_Heroic,
SNOActorId.healthPotion_Super,
SNOActorId.healthPotion_Normal,
SNOActorId.healthPotion_Minor,
SNOActorId.healthPotion_Lesser,
SNOActorId.healthPotion_Greater,
SNOActorId.HealthPotionLarge,
// Gems
SNOActorId.Topaz_14,
SNOActorId.Topaz_13,
SNOActorId.Topaz_12,
SNOActorId.Topaz_11,
SNOActorId.Topaz_10,
SNOActorId.Topaz_09,
SNOActorId.Topaz_08,
SNOActorId.Topaz_07,
SNOActorId.Topaz_06,
SNOActorId.Topaz_05,
SNOActorId.Topaz_04,
SNOActorId.Topaz_03,
SNOActorId.Topaz_02,
SNOActorId.Topaz_01,
SNOActorId.Emerald_14,
SNOActorId.Emerald_13,
SNOActorId.Emerald_12,
SNOActorId.Emerald_11,
SNOActorId.Emerald_10,
SNOActorId.Emerald_09,
SNOActorId.Emerald_08,
SNOActorId.Emerald_07,
SNOActorId.Emerald_06,
SNOActorId.Emerald_05,
SNOActorId.Emerald_04,
SNOActorId.Emerald_03,
SNOActorId.Emerald_02,
SNOActorId.Emerald_01,
SNOActorId.Amethyst_14,
SNOActorId.Amethyst_13,
SNOActorId.Amethyst_12,
SNOActorId.Amethyst_11,
SNOActorId.Amethyst_10,
SNOActorId.Amethyst_09,
SNOActorId.Amethyst_08,
SNOActorId.Amethyst_07,
SNOActorId.Amethyst_06,
SNOActorId.Amethyst_05,
SNOActorId.Amethyst_04,
SNOActorId.Amethyst_03,
SNOActorId.Amethyst_02,
SNOActorId.Amethyst_01,
SNOActorId.Ruby_14,
SNOActorId.Ruby_13,
SNOActorId.Ruby_12,
SNOActorId.Ruby_11,
SNOActorId.Ruby_10,
SNOActorId.Ruby_09,
SNOActorId.Ruby_08,
SNOActorId.Ruby_07,
SNOActorId.Ruby_06,
SNOActorId.Ruby_05,
SNOActorId.Ruby_04,
SNOActorId.Ruby_03,
SNOActorId.Ruby_02,
SNOActorId.Ruby_01};
foreach( SNOActorId sno in s ) {
if (unit.ActorId == sno)
return true;
}
return unit.ItemQuality != UnitItemQuality.Normal &&
unit.ItemQuality != UnitItemQuality.Superior &&
unit.ItemQuality != UnitItemQuality.Inferior &&
unit.ItemQuality != UnitItemQuality.Invalid;
}
public static float GetDistance(float x, float y)
{
return (float)Math.Sqrt(Math.Pow(Me.X - x, 2) + Math.Pow(Me.Y - y, 2));
}
public static float GetDistance(float x, float y, float x2, float y2)
{
return (float)Math.Sqrt(Math.Pow(x - x2, 2) + Math.Pow(y - y2, 2));
}
}
}
Second one is by Epic from AHK forums:
Code:
=:: ;HotKey
ItemFound = 0 ;Loot
Loop, 3
{
YellowScanClick(0, 90, 1679, 888)
}
Return
F12:: ;Terminate App F12
Exitapp
YellowScanClick(X1, Y1, X2, Y2)
{
Global ItemFound
PixelSearch, xloc, yloc, %X1%, %Y1%, %X2%, %Y2%, 0x00FF00, 2, Fast ;Greens
If !ErrorLevel
{
ItemFound := 1
MouseClick,, %xloc%, %yloc%,, 3
Sleep, 500
}
PixelSearch, xloc, yloc, %X1%, %Y1%, %X2%, %Y2%, 0x00FFFF, 2, Fast ;Yellows
If !ErrorLevel
{
ItemFound := 1
MouseClick,, %xloc%, %yloc%,, 3
Sleep, 500
}
PixelSearch, xloc, yloc, %X1%, %Y1%, %X2%, %Y2%, 0x2F64BF, 2, Fast ;Legendaries
If !ErrorLevel
{
ItemFound := 1
MouseClick,, %xloc%, %yloc%,, 7
Sleep, 500
}
PixelSearch, xloc, yloc, %X1%, %Y1%, %X2%, %Y2%, 0xFF6969, 2, Fast ;Blues!
If !ErrorLevel
{
ItemFound := 1
MouseClick,, %xloc%, %yloc%,, 7
Sleep, 500
}
Return
}