December 13, 20187 yr Good day. I've got a List of WoWUnits, and i need to check, is there any WoWUnit with a specific creature type (lets say, humanoind, for example) in that List. Is is possible? Currently i can check the creature type of a target, but can't do the same for a WoWUnit from list. Thank you.
December 13, 20187 yr List.Any(unit => unit.CreatureTypeTarget == "Humanoid" ) Basically like that (pseudo code) Edited December 14, 20187 yr by Matenia
December 13, 20187 yr Author Yeah, but there is no WoWUnit method like CreatureType, that's the problem. And the only lua code i was able to find returns creature type of my target also ? Im doing something like this: var mobsList = new List<WoWUnit>(); mobsList.AddRange(ObjectManager.GetObjectWoWUnit().Where(u => u.Type != WoWObjectType.Player && u.blah-blah-blah).ToList());
December 14, 20187 yr You must 'touch' the unit to get the info. For Development Tools: Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + "-------------Start------------------" + "\")"); foreach (WoWUnit mob in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWUnit()) { var name = mob.Name; var baseAdress = mob.GetBaseAddress; wManager.Wow.Helpers.Interact.InteractGameObject(baseAdress,true,false); var type = mob.CreatureTypeTarget; Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + name + " " + type + "\")"); } Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + "-------------Stop------------------" + "\")"); There is another way to touch the unit ( without visible changing targets - nasty ye? ) You must use lua , focus and write the guid from scanning under focus then request the value. Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + "-------------Start------------------" + "\")"); foreach (WoWUnit mob in wManager.Wow.ObjectManager.ObjectManager.GetObjectWoWUnit()) { var name = mob.Name; var tmp = wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid; wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = mob.Guid; string type = Lua.LuaDoString<string>(@"creatureType = UnitCreatureType(""focus"")", "creatureType"); wManager.Wow.ObjectManager.ObjectManager.Me.FocusGuid = tmp; Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + name + " " + type + "\")"); } Lua.LuaDoString("DEFAULT_CHAT_FRAME:AddMessage(\"" + "-------------Stop------------------" + "\")"); And this is working solution for that problem. Credits for @reapler for showing the method with guid replacement. Tested on 2.4.3 nightbane and works here.
December 14, 20187 yr You can do the focus part in vanilla by using mouseover as the unit and writing the mouseover guid into memory. Use my vanilla fightclass framework as an example
December 16, 20187 yr Author Thank you a lot guys for advice. Unfortunately my test accounts got banned, that i was going to use for that feature test at exact same day i've asked about this :). Will have to level new one first to continue with this idea.
Create an account or sign in to comment