L2JMobius

C6 Clan buffs

G-hamsteR · 5 · 6605

Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
Hello,

Clan buffs (hearth of pagrio, etc) don't affect clan members. I received this report from an Overlord. I will look into it tonight, but I'm posting it here from now.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16051

Online Mobius

  • Distinguished King
  • *****
    • Posts: 16051
Try this.
Code: [Select]
Index: java/org/l2jmobius/gameserver/model/Skill.java
===================================================================
--- java/org/l2jmobius/gameserver/model/Skill.java (revision 7588)
+++ java/org/l2jmobius/gameserver/model/Skill.java (working copy)
@@ -2065,8 +2065,7 @@
  {
  final int radius = _skillRadius;
  final PlayerInstance player = (PlayerInstance) creature;
- final Clan clan = player.getClan();
- if (_targetType != SkillTargetType.TARGET_CORPSE_ALLY) // if corpose, the caster is not included
+ if (_targetType != SkillTargetType.TARGET_CORPSE_ALLY) // if corpse, the caster is not included
  {
  if (player.isInOlympiadMode())
  {
@@ -2080,6 +2079,7 @@
  return targetList;
  }
  }
+
  PlayerInstance src = null;
  if (creature instanceof PlayerInstance)
  {
@@ -2089,79 +2089,71 @@
  {
  src = ((Summon) creature).getOwner();
  }
- if (clan != null)
+
+ // Get all visible objects in a spheric area near the Creature
+ for (WorldObject newTarget : creature.getKnownList().getKnownObjects().values())
  {
- // Get all visible objects in a spheric area near the Creature
- // Get Clan Members
- for (WorldObject newTarget : creature.getKnownList().getKnownObjects().values())
+ if (!(newTarget instanceof PlayerInstance))
  {
- if (!(newTarget instanceof PlayerInstance))
+ continue;
+ }
+ final PlayerInstance playerTarget = (PlayerInstance) newTarget;
+ if (playerTarget.isDead() && (_targetType != SkillTargetType.TARGET_CORPSE_ALLY))
+ {
+ continue;
+ }
+
+ // When party, clan and ally are different continue.
+ if (((player.getClan() == null) || (player.getClan() != playerTarget.getClan())) && ((player.getAllyId() == 0) || (player.getAllyId() != playerTarget.getAllyId())))
+ {
+ continue;
+ }
+
+ // check for Events
+ if (src != null)
+ {
+ if (playerTarget == src)
  {
  continue;
  }
- final PlayerInstance playerTarget = (PlayerInstance) newTarget;
- if (playerTarget.isDead() && (_targetType != SkillTargetType.TARGET_CORPSE_ALLY))
+ // if src is in event and trg not OR viceversa:
+ // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
+ if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
  {
  continue;
  }
- // if ally is different --> clan is different too, so --> continue
- if (player.getAllyId() != 0)
+ }
+ final Summon pet = ((PlayerInstance) newTarget).getPet();
+ if ((pet != null) && Util.checkIfInRange(radius, creature, pet, true) && !onlyFirst && (((_targetType == SkillTargetType.TARGET_CORPSE_ALLY) && pet.isDead()) || ((_targetType == SkillTargetType.TARGET_ALLY) && !pet.isDead())) && player.checkPvpSkill(newTarget, this))
+ {
+ targetList.add(pet);
+ }
+ if (_targetType == SkillTargetType.TARGET_CORPSE_ALLY)
+ {
+ if (!((PlayerInstance) newTarget).isDead())
  {
- if (playerTarget.getAllyId() != player.getAllyId())
- {
- continue;
- }
- }
- else if (player.getClanId() != playerTarget.getClanId())
- {
  continue;
  }
- // check for Events
- if (src != null)
+ if ((_skillType == SkillType.RESURRECT) && ((PlayerInstance) newTarget).isInsideZone(ZoneId.SIEGE))
  {
- if (playerTarget == src)
- {
- continue;
- }
- // if src is in event and trg not OR viceversa:
- // to be fixed for mixed events status (in TvT joining phase, someone can attack a partecipating CTF player with area attack)
- if (((src._inEvent || src._inEventCTF || src._inEventDM || src._inEventTvT || src._inEventVIP) && (!playerTarget._inEvent && !playerTarget._inEventCTF && !playerTarget._inEventDM && !playerTarget._inEventTvT && !playerTarget._inEventVIP)) || ((playerTarget._inEvent || playerTarget._inEventCTF || playerTarget._inEventDM || playerTarget._inEventTvT || playerTarget._inEventVIP) && (!src._inEvent && !src._inEventCTF && !src._inEventDM && !src._inEventTvT && !src._inEventVIP)))
- {
- continue;
- }
- }
- final Summon pet = ((PlayerInstance) newTarget).getPet();
- if ((pet != null) && Util.checkIfInRange(radius, creature, pet, true) && !onlyFirst && (((_targetType == SkillTargetType.TARGET_CORPSE_ALLY) && pet.isDead()) || ((_targetType == SkillTargetType.TARGET_ALLY) && !pet.isDead())) && player.checkPvpSkill(newTarget, this))
- {
- targetList.add(pet);
- }
- if (_targetType == SkillTargetType.TARGET_CORPSE_ALLY)
- {
- if (!((PlayerInstance) newTarget).isDead())
- {
- continue;
- }
- if ((_skillType == SkillType.RESURRECT) && ((PlayerInstance) newTarget).isInsideZone(ZoneId.SIEGE))
- {
- continue;
- }
- }
- if (!Util.checkIfInRange(radius, creature, newTarget, true))
- {
  continue;
  }
- // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met
- if (!player.checkPvpSkill(newTarget, this))
- {
- continue;
- }
-
- targetList.add((Creature) newTarget);
- if (onlyFirst)
- {
- return targetList;
- }
  }
+ if (!Util.checkIfInRange(radius, creature, newTarget, true))
+ {
+ continue;
+ }
+ // Don't add this target if this is a Pc->Pc pvp casting and pvp condition not met
+ if (!player.checkPvpSkill(newTarget, this))
+ {
+ continue;
+ }
+
+ targetList.add((Creature) newTarget);
+ if (onlyFirst)
+ {
+ return targetList;
+ }
  }
  }
  return targetList;


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 333
This fixed my problem. I made it from scratch. It only targets ally members.

Code: [Select]
case TARGET_ALLY:
{
if (creature instanceof PlayerInstance)
{
final int radius = _skillRadius;
final PlayerInstance player = (PlayerInstance) creature;
final Clan clan = player.getClan();
if (_targetType != SkillTargetType.TARGET_CORPSE_ALLY) // if corpose, the caster is not included
{
if (player.isInOlympiadMode())
{
targetList.add(player);
return targetList;
}

targetList.add(player);
if (onlyFirst)
{
return targetList;
}
}
if (clan != null)
{
// Get all visible objects in a spheric area near the Creature
for (WorldObject newTarget : player.getKnownList().getKnownCharactersInRadius(radius))
{
final PlayerInstance newPlayer = newTarget.getActingPlayer();
if (newPlayer == null)
{
continue;
}
if (newPlayer.isDead())
{
continue;
}
if (player.isInDuel() && (player.getDuelId() != newPlayer.getDuelId()))
{
continue;
}
if (((player.getAllyId() == 0) && (newPlayer.getClanId() != player.getClanId())) || (player.getAllyId() != newPlayer.getAllyId()))
{
continue;
}
targetList.add(newPlayer);
if (onlyFirst)
{
return targetList;
}

}
return targetList;
}
}
return targetList;
}