1
Stealth Client / Re: How to debug C# scripts with Visual Studio
« on: May 12, 2019, 03:54:03 AM »
I figured it out, just need to start bugging and it auomatictly start in steath, i didnt htink it would be that simple.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
class Program
{
public static List<Mobile> lunaMageShopNpcs;
public static Gump shopGump;
static void Main(string[] args)
{
lunaMageShopNpcs.Add(new Mobile(00000B08));
lunaMageShopNpcs.Add(new Mobile(00000B0B));
lunaMageShopNpcs.Add(new Mobile(00000B0A));
lunaMageShopNpcs.Add(new Mobile(00000B0C));
foreach (Mobile mobile in lunaMageShopNpcs)
{
mobile.DoubleClick();
Console.WriteLine(mobile.Name);
Console.WriteLine(mobile.Location);
}
}
}
namespace Test
{
public partial class MainWindow : Window
{
public PlayerMobile Player = PlayerMobile.GetPlayer();
public TargetHelper TargetHelper = TargetHelper.GetTarget();
private Thread TestThread;
public MainWindow()
{
InitializeComponent();
TestThread = new Thread(TestIfDead);
}
private void btnStart_Click(object sender, RoutedEventArgs e)
{
TestThread.Start();
}
public void TestIfDead()
{
var target = TargetHelper.VCursorToMobile();
do
{
if (target.Dead)
{
this.Dispatcher.Invoke((Action)(() =>
{
tbIsDead.Text = "TARGET DIED";
}));
}
else
{
this.Dispatcher.Invoke((Action)(() =>
{
tbIsDead.Text = "TARGET ALIVE";
}));
}
} while (!target.Dead);
}
}
}
var corpses = Item.Find(typeof(Corpse), 0x0, false);
public void StartLooting()
{
List<Item> lootItems = new List<Item>();
Thread.Sleep(500);
try
{
while (Looting)
{
var corpses = Item.Find(typeof(Corpse), 0x0, false);
if (corpses.Count > 0)
{
foreach (Corpse corpse in corpses)
{
if (corpse.Distance < 4)
{
corpse.DoubleClick();
}
Thread.Sleep(500);
var goldList = Item.Find(typeof(Gold), corpse.Serial.Value, false);
foreach (Gold gold in goldList)
{
lootItems.Add(new Loot(gold.Serial));
}
if (lootItems.Any())
{
foreach (Item loot in lootItems)
{
loot.MoveItem(Player.Backpack);
}
}
Looting = false;
Thread.Sleep(500);
}
}
}
}
catch (Exception e)
{
this.Dispatcher.Invoke((Action)(() =>
{
Clipboard.SetText(e.StackTrace);
listBox.Items.Clear();
listBox.Items.Add(e);
}));
}
}
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.Queue`1.Dequeue()
at StealthAPI.StealthClient.WaitReply[T](PacketType type)
at StealthAPI.StealthClient.SendPacket[T](PacketType packetType, Object[] parameters)
at StealthAPI.Stealth.FindTypeEx(UInt16 objType, UInt16 color, UInt32 container, Boolean inSub)
at ScriptSDK.Engines.Scanner.<>c__DisplayClass23_2`1.<Find>b__2(UInt32 le)
at System.Linq.Enumerable.<>c__DisplayClass6_0`1.<CombinePredicates>b__0(TSource x)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__22`3.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
at System.Linq.Enumerable.<SelectManyIterator>d__16`2.MoveNext()
at ScriptSDK.Engines.Scanner.Find[T](List`1 Graphics, List`1 Colors, List`1 Locations, Boolean SubSearch)
at ScriptSDK.Items.Item.Find(Type type, List`1 Locations, Boolean SubSearch)
at ScriptSDK.Items.Item.Find(Type type, UInt32 Location, Boolean SubSearch)
at AutoLoot.MainWindow.StartLooting() in C:\Users\GreyWalker\Desktop\UOStuff\Projects\AutoLoot\MainWindow.xaml.cs:line 58