Who is attacking me? menu

User Tag List

Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
            public static bool TargetingMeOrPet(WoWUnit u)
            {
                if (!u.IsValid || !Me.IsValid)
                {
                    return false;
                }
                if (u.CurrentTarget == Me)
                {
                    return true;
                }
                if (!Me.Pet.IsValid)
                {
                    return false;
                }
                if (u.CurrentTarget == Me.Pet)
                {
                    return true;
                }
    
                return false;
            }
    
            public static bool AttackingMeOrPet(WoWUnit u)
            {
                return TargetingMeOrPet(u) && u.InCombat && (u.IsAutoAttacking || u.Casting);
            }

    Who is attacking me?
  2. #17
    Shutzler's Avatar Member
    Reputation
    3
    Join Date
    Sep 2009
    Posts
    48
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Viano View Post
    Hi everyone,

    how do you detect whether a mob is attacking you? When I just read the mob's target, sometimes mobs are targeting me without attacking and sometimes players do target me without attacking either.

    Is there some flag like isInFightWithGuid?
    You could read your players target, that is if you dont have any before someone starts hammering on you. If you are targetless and just walking around(in AV for instance) someone who attacks you will become your own target.

  3. #18
    flo8464's Avatar Active Member
    Reputation
    30
    Join Date
    Apr 2009
    Posts
    434
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you think injecting asm-code is out-of-process?

  4. #19
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wanted to share how I determine if I'm in combat w/any units: (summary of what is in this thread + tested) I think the only difference is I've added a "is fleeing" check, as a unit that is feared won't be targeting you anymore.
    Code:
    // find all units we are in combat with
    - (void)doCombatSearch{
    	
    	// add all mobs + players
    	NSArray *mobs = [mobController allMobs];
    	NSArray *players = [playersController allPlayers];
    	
    	UInt64 playerGUID = [[playerData player] GUID];
    	UInt64 unitTarget = 0;
    	BOOL playerHasPet = [[playerData player] hasPet];
    	
    	for ( Mob *mob in mobs ){
    		unitTarget = [mob targetID];
    		if (
    			![mob isDead]	&&		// 1 - living units only
    			[mob isInCombat] &&		// 2 - in Combat
    			[mob isSelectable] &&	// 3 - can select this target
    			[mob isAttackable] &&	// 4 - attackable
    			//[mob isTapped] &&		// 5 - tapped - in theory someone could tap a target while you're casting, and you get agg - so still kill (removed as a unit @ 100% could attack us and not be tapped)
    			[mob isValid] &&		// 6 - valid mob
    			(	(unitTarget == playerGUID ||										// 7 - targetting us
    				(playerHasPet && unitTarget == [[playerData player] petGUID]) ) ||	// or targetting our pet
    				[mob isFleeing])													// or fleeing
    			){
    			
    			// add mob!
    			if ( ![_unitsAttackingMe containsObject: (Unit*)mob] ){
    				[_unitsAttackingMe addObject: (Unit*)mob];
    			}
    		}
    		// remove unit
    		else if ([_unitsAttackingMe containsObject: (Unit*)mob]){
    			[_unitsAttackingMe removeObject:(Unit*)mob];
    
    		}
    	}
    	
    	for ( Player *player in players ){
    		unitTarget = [player targetID];
    		if (
    			![player isDead] &&										// 1 - living units only
    			[player currentHealth] != 1 &&							// 2 - this should be a ghost check, being lazy for now
    			[player isInCombat] &&									// 3 - in Combat
    			[player isSelectable] &&								// 4 - can select this target
    			([player isAttackable] || [player isFeignDeath] ) &&	// 5 - attackable or feigned
    			[player isValid] &&										// 6 - valid
    			(	(unitTarget == playerGUID ||										// 7 - targetting us
    				 (playerHasPet && unitTarget == [[playerData player] petGUID]) ) ||	// or targetting our pet
    			 [player isFleeing])													// or fleeing
    			){
    			
    			// add player
    			if ( ![_unitsAttackingMe containsObject: (Unit*)player] ){
    				[_unitsAttackingMe addObject: (Unit*)player];
    			}
    		}
    		// remove unit
    		else if ([_unitsAttackingMe containsObject: (Unit*)player]){
    			[_unitsAttackingMe removeObject:(Unit*)player];
    			
    		}
    	}
    }

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Get who unit is attacking...
    By jbrauman in forum WoW Memory Editing
    Replies: 19
    Last Post: 02-02-2009, 05:03 AM
  2. How can you make guards that attack people who are PvP-ing ?
    By Wheeze201 in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 12-31-2007, 07:24 AM
  3. Unlimited Gun Attack Range
    By Matt in forum World of Warcraft Exploits
    Replies: 3
    Last Post: 05-11-2006, 04:09 AM
  4. Attack your own NPC's
    By oninuva in forum World of Warcraft Guides
    Replies: 0
    Last Post: 04-23-2006, 02:24 PM
  5. Warriors get a huge attack power boost
    By Matt in forum World of Warcraft Exploits
    Replies: 0
    Last Post: 04-02-2006, 10:02 PM
All times are GMT -5. The time now is 02:34 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search