I tested it and it didn't work with a fuzzy match, and when I tested the full name with PNC "Auctioneer Billdu", I was able to match this PNC, but when I used the fuzzy name "Auctioneer", it didn't match properly, here's my code
string[] objectNames = new string[] { "Auctioneer Billdu" };
float maxDistance = 2250.0f;
while (true)
{
foreach (string objectName in objectNames)
{
var gameObjects = ObjectManager.GetObjectWoWGameObject()
.Where(o => objectNames.Contains(o.Name) && o.GetDistance <= maxDistance)
.OrderBy(o => o.GetDistance)
.FirstOrDefault();
if (gameObjects != null)
{
string luaPrintCommand = string.Format("print('Targeted object: {0}')", gameObjects.Name);
Lua.LuaDoString(luaPrintCommand);
Thread.Sleep(50);
}
}
}
If you change it to the following code, it will not match the NPC:
string[] objectNames = new string[] { "Auctioneer" };
float maxDistance = 2250.0f;
while (true)
{
foreach (string objectName in objectNames)
{
var gameObjects = ObjectManager.GetObjectWoWGameObject()
.Where(o => objectNames.Contains(o.Name) && o.GetDistance <= maxDistance)
.OrderBy(o => o.GetDistance)
.FirstOrDefault();
if (gameObjects != null)
{
string luaPrintCommand = string.Format("print('Targeted object: {0}')", gameObjects.Name);
Lua.LuaDoString(luaPrintCommand);
Thread.Sleep(50);
}
}
}