Faction guards.
This commit is contained in:
@ -73,11 +73,15 @@ public class L2GuardInstance extends L2Attackable
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True if hte attacker is a L2MonsterInstance.
|
||||
* Return True if the attacker is a L2MonsterInstance.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAutoAttackable(L2Character attacker)
|
||||
{
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayer() && ((attacker.getActingPlayer().isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (attacker.getActingPlayer().isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return attacker instanceof L2MonsterInstance;
|
||||
}
|
||||
|
||||
@ -151,6 +155,13 @@ public class L2GuardInstance extends L2Attackable
|
||||
return;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
interact = false;
|
||||
// TODO: Fix normal targeting
|
||||
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
|
||||
}
|
||||
|
||||
// Check if the L2PcInstance already target the L2GuardInstance
|
||||
if (getObjectId() != player.getTargetId())
|
||||
{
|
||||
|
@ -8733,16 +8733,14 @@ public final class L2PcInstance extends L2Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && skill.isBad()) && ((isGood() && target.getActingPlayer().isGood()) || (isEvil() && target.getActingPlayer().isEvil())))
|
||||
// Faction System Guards
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && (target instanceof L2GuardInstance))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && !skill.isBad()) && ((isGood() && target.getActingPlayer().isEvil()) || (isEvil() && target.getActingPlayer().isGood())))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
if (skill.isBad() && ((isGood() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)) || (isEvil() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME))))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// skills can be used on Walls and Doors only during siege
|
||||
@ -9164,6 +9162,16 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
}
|
||||
|
||||
// Faction System
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if ((isGood() && target.getActingPlayer().isGood()) || (isEvil() && target.getActingPlayer().isEvil()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// On retail, it is impossible to debuff a "peaceful" player.
|
||||
if ((targetPlayer.getPvpFlag() == 0) && (targetPlayer.getKarma() == 0))
|
||||
{
|
||||
|
@ -59,6 +59,21 @@ public class GuardKnownList extends AttackableKnownList
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Faction system
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((object.getActingPlayer().isGood() && getActiveChar().getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (object.getActingPlayer().isEvil() && getActiveChar().getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
|
||||
{
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
_log.fine(getActiveChar().getObjectId() + ": Enemy faction " + object.getObjectId() + " entered scan range");
|
||||
}
|
||||
|
||||
// Set the L2GuardInstance Intention to AI_INTENTION_ACTIVE
|
||||
if (getActiveChar().getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
|
||||
{
|
||||
getActiveChar().getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((Config.GUARD_ATTACK_AGGRO_MOB && getActiveChar().isInActiveRegion()) && object.isMonster())
|
||||
{
|
||||
|
@ -46,9 +46,11 @@ import com.l2jserver.gameserver.model.PcCondOverride;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2BlockInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.conditions.Condition;
|
||||
import com.l2jserver.gameserver.model.effects.AbstractEffect;
|
||||
@ -1184,6 +1186,18 @@ public final class Skill implements IIdentifiable
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && (target instanceof L2GuardInstance))
|
||||
{
|
||||
if (player.isGood() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (player.isEvil() && ((L2Npc) target).getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user