Jump to content

Vendoring issues


Recommended Posts

It will repeatedly choose an Alliance vendor when I'm Horde, it made 17 trips to an Alliance base, obviously dying.

I manually disabled it in the DB and it still will go to that vendor which is farther than the nearest Horde one.

 

Any plans for fixes or at least an API call so I can rewrite functionality?

Link to comment
Share on other sites

private static Predicate<Npc> _dbFilter = n => n.CurrentProfileNpc && (n.Type == Npc.NpcType.Vendor || n.Type == Npc.NpcType.Repair);

public static void Start()
{
  FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState += VendorHandler;
}



private static void VendorHandler(Engine engine, State state, CancelEventArgs cancelable)
{
  if(state != null && state.GetType() == typeof(ToTown) && new ToTown().NeedToRun)
  {
    NpcDB.AcceptOnlyProfileNpc = true;
    NpcDB.ListNpc.RemoveAll(_dbFilter);
    Npc vendor = FindVendor(); //this is your own function that returns an object of type NPC
    if (vendor != null)
    {
      NpcDB.AddNpc(vendor, false, true);
    }
  }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...