Run the game as admin.
Everyone who's having problems with the script doing nothing, please use this version and post the log.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GW2API;
using System.Threading;
using System.Windows.Forms;
namespace WinterWonderland
{
public class WinterWonderland : BotScript
{
public override string GetAuthor()
{
return "Agedyn";
}
public override string GetName()
{
return "Winter Wonderland";
}
public static int droppedPresent = 132848;
public static int chestId = 235239;
public static Point3f chestPos = new Point3f(97.468f, 122.688f, 88.844f);
Point3f[] coordinates = {new Point3f(-18.52f, 70.75f, 41.98f - 3.0f), new Point3f(-36.71f, 67.21f, 39.96f), new Point3f(-99.09f, 55.22f, 63.85f), new Point3f(-100.41f, 49.63f, 77.04f),
new Point3f(-112.49f, 3.72f, 63.03f), new Point3f(-127.41f, -34.23f, 58.57f), new Point3f(-148.08f, -93.72f, 65.24f),
new Point3f(-158.48f, -128.1f, 50.19f), new Point3f(-190.65f, -119.23f, 49.81f), new Point3f(-202.22f, -123.66f, 51.32f),
new Point3f(-215.82f, -142.38f, 50.13f), new Point3f(-214.56f, -186.26f, 79f)};
Point3f[] pathToChest = { new Point3f(105.37f, 106.0f, 88.81f), new Point3f(97.174f, 123.449f, 88.845f) };
int idx = 0;
int traversingC = 0;
int tries = 0;
public override int Pulse()
{
/* var bitmap = Utilities.TakeSnapshot();
if (bitmap != null)
{
bitmap.Save("C:\\Users\\jarij\\Documents\\Guild Wars 2\\img.bmp");
}
return 10000;*/
if (Me.IsCasting())
{
Utilities.Print("Is casting");
return 1000;
}
if (Navigator.IsTraversing())
{
if (traversingC > 10)
{
Navigator.Stop();
Utilities.Print("Force stopping navigator");
}
else
{
Utilities.Print("Traversing...");
traversingC++;
return 1000;
}
}
traversingC = 0;
Utilities.Print("MapId: " + World.GetMapId());
if (World.GetMapId() == MapId.WINTER_WONDERLAND)
{
var chest = World.GetGadget(chestId, false);
var myAgent = Me.GetAgent();
if (myAgent == null) return 1000;
Point3f myPos = Me.GetInteractionPosition();
if (chest != null && idx == (coordinates.Length - 1))
{
World.TeleportTo(coordinates[0]);
Thread.Sleep(1000);
Utilities.Print("Fail. Trying again from the start.");
Navigator.TraversePath(new Point3f[] { new Point3f(-23.8563f, 66.907f, 40.3968f - 3.0f) });
idx = 0;
return 5000;
}
if (chest != null)
{
Utilities.Print("Chest != null, idx: " + idx);
}
if (tries > 15)
{
idx = 0;
tries = 0;
}
if (chest != null && tries <= 15 && idx == coordinates.Length)
{
if (chest.IsLootable())
{
if (myPos.DistanceTo(chest.GetPosition()) < 3.0f)
{
Utilities.Print("Open chest");
chest.Interact();
tries++;
return 2000;
}
else
{
Utilities.Print("Moving to chest");
World.TeleportTo(pathToChest[1]);
//Navigator.TraversePath(pathToChest);
tries++;
return 2000;
}
}
else
{
var portal = World.GetGadget(236332, false);
if (portal == null) return 1000;
tries = 0;
Utilities.Print("Teleport to start");
//cord.Z += 2.0f;
World.TeleportTo(coordinates[0]);
Thread.Sleep(500);
//Navigator.Jump();
Navigator.TraversePath(new Point3f[] { new Point3f(coordinates[0].X, coordinates[0].Y, 40.3968f - 3.0f) });
Utilities.Print("Waiting for a new chest to spawn");
idx = 1;
return (70 * 1000); //wait 70s for chest to spawn
/*if (portal.GetPosition().DistanceTo(myPos) > 3.0f)
{
Utilities.Print("Move to portal");
Navigator.TraversePath(new Point3f[] { portal.GetPosition() });
return 1000;
} else
{
Utilities.Print("Teleport to start");
//cord.Z += 2.0f;
World.TeleportTo(coordinates[0]);
Thread.Sleep(2000);
Navigator.TraversePath(new Point3f[] { new Point3f(-23.8563f, 66.907f, 40.3968f - 3.0f) });
Utilities.Print("Waiting for a new chest to spawn");
idx = 1;
return (60 * 1000);
}*/
//return 3000;
}
}
if (idx < coordinates.Length)
{
Utilities.Print("Teleporting to checkpoint " + (idx + 1));
Point3f coord = coordinates[idx++];
//coord.Z += 2.0f;
World.TeleportTo(coord);
}
if (idx >= coordinates.Length)
{
if (chest == null || chest != null && !chest.IsLootable())
{
Utilities.Print("Teleport to chest");
World.TeleportTo(coordinates[0]);
Thread.Sleep(1000);
Navigator.TraversePath(new Point3f[] { new Point3f(-23.8563f, 66.907f, 40.3968f - 3.0f) });
Thread.Sleep(3000);
World.TeleportTo(pathToChest[1]);
//Navigator.Jump(); //Synchronize and fall into gift box
return 1000;
}
}
} else
{
idx = 0;
}
/*
StringBuilder sb = new StringBuilder("character_name");
World.Login(sb);
var myPos = Me.GetAgent().GetPosition();*/
//return 10 * 1000;
return new Random(new DateTime().Millisecond).Next(100, 500);
}
}
}
Enable Autoloot.