Skip to content

Instantly share code, notes, and snippets.

@RoyCurtis
Created November 25, 2012 18:31
Show Gist options
  • Save RoyCurtis/4144710 to your computer and use it in GitHub Desktop.
Save RoyCurtis/4144710 to your computer and use it in GitHub Desktop.
Seek and DestROY
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using VpNet.Core;
using VpNet.Core.Structs;
using VpNet.NativeApi;
namespace VPSeekAndDestroy
{
class SeekAndDestroy
{
static void Main(string[] args)
{
Console.WriteLine("Seek and DestROY");
var bot = new Instance();
Console.WriteLine("Connecting...");
bot.Connect();
Console.WriteLine("Logging in...");
bot.Login("Roy Curtis", "###", "Seek and DestROY");
Console.WriteLine("Entering...");
bot.Enter("test");
bot.UpdateAvatar();
bot.Wait(1000);
bot.EventQueryCellResult += onCellQuery;
bot.EventQueryCellEnd += onCellEnd;
for (var t = 0; t < 3; t++)
{
var i = -20;
var j = -20;
while (true)
{
Console.WriteLine("[{2}] Querying cell {0} x {1}", i, j, t);
bot.QueryCell(i, j);
i++;
j++;
if (i > 20 || j > 20) break;
}
}
while (true) { bot.Wait(1000); }
// dead code
Console.WriteLine("Press any key to end...");
Console.ReadKey();
bot.Dispose();
}
static void onCellEnd(Instance sender, int x, int z)
{
Console.WriteLine("End of cell {0} x {1}", x, z);
}
static void onCellQuery(Instance sender, VpObject objectData)
{
if (objectData.Description.Contains("roytest")) {
Console.WriteLine("Killing object {0}", objectData.Id);
objectData.Action = "create scale 1";
sender.ChangeObject(objectData);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment