All pastes #33113 Raw Edit

Anonymous

public text v1 · immutable
#33113 ·published 2005-12-09 19:18 UTC
rendered paste body
        case TARGET_AURA:
        {
            int charX, charY, charZ, targetX, targetY, targetZ, dx, dy, dz;
            int radius = getSkillRadius();
            
            for (L2Object obj : activeChar.getKnownObjects())
            {
                if (obj == null)
                    continue;
                
                if (obj instanceof L2Attackable || obj instanceof L2PcInstance)
                {
//                  Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met
                    if (activeChar instanceof L2PcInstance && !((L2PcInstance)activeChar).checkPvpSkill(obj, this))
                        continue;
                    
                    // check if both attacker and target are L2PcInstances and if they are in same party or clan
                    if (   (activeChar instanceof L2PcInstance && obj instanceof L2PcInstance) && 
                         (   ((L2PcInstance)activeChar).getClanId() == ((L2PcInstance)obj).getClanId() || 
                         (  (((L2PcInstance)activeChar).getParty() != null && ((L2PcInstance)obj).getParty() != null) &&
                             ((L2PcInstance)activeChar).getParty().getPartyLeaderOID() == ((L2PcInstance)obj).getParty().getPartyLeaderOID() )))
                        continue;
                    
                    charX = activeChar.getX();
                    charY = activeChar.getY();
                    charZ = activeChar.getZ();
                    targetX = obj.getX();
                    targetY = obj.getY();
                    targetZ = obj.getZ();
                    
                    dx = Math.abs(charX - targetX);
                    dy = Math.abs(charY - targetY);
                    dz = Math.abs(charZ - targetZ);
                    
                    if (dx*dx + dy*dy + dz*dz > radius*radius)
                        continue;
                    
                    targetList.add((L2Character)obj);
                }
            }
            return targetList.toArray(new L2Character[targetList.size()]);
        }