Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with continuation of plugin

Featured Replies

Hi! Im trying to add a function in the plugin: 

 

Basically i want to add a function or replace one so it hops when there isnt a living mob close by, eg. The warbringers in pandaria. If i kill mob, i want to check next realm, if it isnt there i want to jump to next and so on. 

For now my function looks like this: 

private List<WoWUnit> GetNPCNearMe()
    {
        return ObjectManager.GetObjectWoWUnit()
                            .Where(p => p.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping).ToList();
    }

 

However, i think if its there but dead, it still thinks there is a mob. So what can i do?

 

Regards

Hello, i would replace it by this:

    public bool NpcExist(string name)
    {
        foreach (var unit in ObjectManager.GetObjectWoWUnit())
        {
            if (unit.Name == name 
                && !unit.IsDead
                && unit.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping)
                Logging.Write("Unit found.");
                return true;
        }
        return false;
    }

Usage:

        if (NpcExist("Warbringer"))
        {
            //your code
        }

 

 

 

or if you want the ordered npc list by distance:

    public List<Npc> GetNearestNpcs(string name)
    {
        return ObjectManager.GetObjectWoWUnit().Where(i => i != null
                                        && !i.IsDead
                                        && i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
        ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
    }

Usage to get closest WoWUnit:

GetNearestNpcs("Warbringer").FirstOrDefault();

 

 

I couldn't test it but it should work :)

  • 2 weeks later...

Yep.

It's almost the same ;)

        public List<WoWGameObject> WoWGameObjects(string name)
        {
            return ObjectManager.GetObjectWoWGameObject().Where(i => i != null
                                            && i.Name == name
                                            //&& i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
                                            //or other arguments
            ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
        }

usage:

WoWGameObjects("Kingsblood").FirstOrDefault();

 

  • Author

Thanks, however my game plus wrobot crashes with this. I tried using the first method instead (warbringer) then it doesnt crash but its doesnt work either. 

@Pelle now i could test it more, that should work:

        public List<WoWGameObject> WoWGameObjects(string name)
        {
            return ObjectManager.GetObjectWoWGameObject().Where(i => i != null
                                            && i.Name == name
                                            //&& i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
            ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
        }




        public List<WoWUnit> GetNearestUnits(string name)
        {
            return ObjectManager.GetObjectWoWUnit().Where(i => i != null
                                            && !i.IsDead
                                            && i.Name == name
                                            && i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
                                            ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
        }

 

  • Author
11 hours ago, camelot10 said:

its bad practice to search npc by name. use id and entry

How would you do it then? :)

        public List<WoWGameObject> WoWGameObjects(int mobID)
        {
            return ObjectManager.GetObjectWoWGameObject().Where(i => i != null
                                            && i.Entry == mobID
                                            //&& i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
            ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
        }




        public List<WoWUnit> GetNearestUnits(int mobID)
        {
            return ObjectManager.GetObjectWoWUnit().Where(i => i != null
                                            && !i.IsDead
                                            && i.Entry == mobID
                                            && i.GetDistance <= RealmHopSettings.CurrentSetting.DistanceBeforeHopping
                                            ).OrderBy(i => ObjectManager.Me.Position.DistanceTo(i.Position)).ToList();
        }

May for your understanding:

.Where({condition for every single object})
In this sample "i" represents a single object from the list, thats why you have access to its properties like Name or the Entry(ID)

The result will be a list of all items that are equals your condition.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.