-
Member
IsEnemy
Hello everyone.
Tell me how can I understand that unit/player is my enemy or friend knowing his guid / baseaddres?
-
Active Member
-
Post Thanks / Like - 1 Thanks
Corthezz (1 members gave Thanks to badusername1234 for this useful post)
-
Member
If you are external (or internal), you can determine that by comparing the unit's faction template with your own. You'll also want to load FactionTemplate.db2 into your application's memory and run some logic against that. If you are internal, just call the appropriate method from World of Warcraft's API.
-
Member
-
Member
Originally Posted by
CodeBytes
If you are external (or internal), you can determine that by comparing the unit's faction template with your own. You'll also want to load FactionTemplate.db2 into your application's memory and run some logic against that. If you are internal, just call the appropriate method from World of Warcraft's API.
I think that is not quite enough.
I tried doing it this way too, but with the effect that my local bot ran straight into grom gol (as alliance) as the faction template based logic didn't identify the guys in there as hostile.
I've had a quick look at the cmangos source. I haven't had a chance to implement this myself yet, but from what I see it'd be necessary to at least check a) reputation-based status, and b) pvp guard flags.
(I'm not sure of there's any other "hard coded" bits like "horde is always hostile to alliance" or such. I presume that would be covered by a the reputation in faction.dbc, but I'll need to have a closer look)
-
Contributor
The function for determining the "enemy" status is very complicated and will take a lot of time and effort to replicate.
You have to look at the FactionTemplate and reputation as others have mentioned but there is also the special cases as when someone is mind-controlled they can appear to be friendly or hostile depending on who is controlling the character.
Imagine on Hakkar where the boss mind-controls the person tanking, if you don't take this in account you will scratch you head endlessly looking for bugs.
-
Post Thanks / Like - 1 Thanks
charles420 (1 members gave Thanks to ejt for this useful post)
-
Member
I catch packets from the server to throw / set traps. How can I identify the trap used by an enemy or friend?
-
Member
Tip: Just make a whitelist of mobs you want to kill. At a single bot location there usually 3-4 max different mobs that are running around.
-
Member
-
Member
Originally Posted by
shadowKD
i need against players
When you say players, do you actually mean only human players (aka non-npcs)?
If so, maybe I'm missing something here, but you could just compare the races of the other players with your own to determine whether it's horde/alliance.
Depending on your server type you might want to check if they're pvp flagged too. And potentially if they're mind controlled (I don't remember if MC changes attackability?)
All of those things would be very easy to figure out, memory offsets for many versions are around here, or should be easy to find via CE
Last edited by Bogie; 05-02-2020 at 11:56 AM.
-
Post Thanks / Like - 1 Thanks
krustx (1 members gave Thanks to Bogie for this useful post)