why you need to - determine whether the open-frame with the loot, the number of coins and lists the items lying in it
uint Loot_frame = 0xA0A024, //4.0.6.13596
Code:
#region using
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#endregion
public class LootFrame
{
WOW wow;
uint lf_base;
public string base_adr { get { return String.Format("{0:x2}", lf_base); } }
public bool coins_looted { get; set; }
public uint copper
{
get
{
uint count = wow.Read<uint>(lf_base + 860);
if (count == uint.MaxValue)
{
coins_looted = true;
return 0;
}
else
{
coins_looted = false;
return count;
}
}
}
public List<Loot> loot
{
get
{
List<Loot> list = new List<Loot>();
wow_loot wloot = new wow_loot();
Loot loot = new Loot();
int count = 0;
while ((wloot = wow.Read<wow_loot>((uint)(lf_base + (wloot.Size * count)))).id > 0)
{
loot = new Loot();
loot.id = wloot.id;
loot.type = wloot.type;
list.Add(loot);
count++;
}
return list;
}
}
public LootFrame(WOW _wow)
{
wow = _wow;
lf_base = wow.base_adr + (uint)Offs.Player.Loot_frame; //0xA0A024 in 4.0.6.13596
wow.ed.pg_loot.SelectedObject = this;
}
}
[StructLayout(LayoutKind.Sequential)]
public struct wow_loot
{
public uint id;//0-4
public uint hz;//4-8
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16 - 8)]
public byte[] b;
public uint hz2;//16-20
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24 - 20)]
public byte[] b2;
public uint type; //24-28
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 36 - 28)]
public byte[] b3;
public int Size { get { return Marshal.SizeOf(this); } } //36
}
public struct Loot //36
{
public uint id; // item id in ItemBD, >>http://www.wowhead.com/item=56968
public uint type;
public override string ToString()
{
return id.ToString();
}
}
how to use the example
Code:
#region LOOT
bool loot_started;
int loot_tik;
void Loot(Unit unit) //Key '+' /script c=GetNumLootItems(); for i=0, c do LootSlot(i+1);ConfirmLootSlot(i+1);end;
{
if (loot_started == false)
{
loot_tik = 0;
Log("Loot[Start] " + unit.guid);
Post.Press(VK.ADD); //<< Key '+'
loot_started = true;
return;
}
if (loot_window.loot.Count != 0 || loot_window.copper != 0) //еше не залутал
{
loot_tik++;
if (debug) Log("Loot[" + loot_tik + "] " + unit.guid);
}
else
{
Log("Loot Done[" + loot_tik + "] " + unit.guid);
task.actions.RemoveAt(0);
loot_started = false;
looted_done.Add(unit);
}
if (can_skin && unit.Creature == CreatureType.Beast)
{
task.actions.Add(Action.Skin);
}
if (task.actions.Count == 0)
task = null;
}
#endregion