From a5f9eb4091d478fa51720e6d89f9df639e2e663b Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 12 Jan 2016 10:09:55 +0000 Subject: [PATCH] Added condition for flagged player state. --- .../gameserver/engines/DocumentBase.java | 7 +++ .../ConditionPlayerIsPvpFlagged.java | 49 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 trunk/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerIsPvpFlagged.java diff --git a/trunk/java/com/l2jmobius/gameserver/engines/DocumentBase.java b/trunk/java/com/l2jmobius/gameserver/engines/DocumentBase.java index c279556f17..494b29d53d 100644 --- a/trunk/java/com/l2jmobius/gameserver/engines/DocumentBase.java +++ b/trunk/java/com/l2jmobius/gameserver/engines/DocumentBase.java @@ -89,6 +89,7 @@ import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsClanLeader; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsHero; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsInCombat; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsOnSide; +import com.l2jmobius.gameserver.model.conditions.ConditionPlayerIsPvpFlagged; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerLandingZone; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerLevel; import com.l2jmobius.gameserver.model.conditions.ConditionPlayerLevelRange; @@ -567,6 +568,12 @@ public abstract class DocumentBase cond = joinAnd(cond, new ConditionPlayerIsHero(val)); break; } + case "ispvpflagged": + { + final boolean val = Boolean.parseBoolean(a.getNodeValue()); + cond = joinAnd(cond, new ConditionPlayerIsPvpFlagged(val)); + break; + } case "transformationid": { final int id = Integer.parseInt(a.getNodeValue()); diff --git a/trunk/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerIsPvpFlagged.java b/trunk/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerIsPvpFlagged.java new file mode 100644 index 0000000000..457e11bc9d --- /dev/null +++ b/trunk/java/com/l2jmobius/gameserver/model/conditions/ConditionPlayerIsPvpFlagged.java @@ -0,0 +1,49 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package com.l2jmobius.gameserver.model.conditions; + +import com.l2jmobius.gameserver.model.actor.L2Character; +import com.l2jmobius.gameserver.model.items.L2Item; +import com.l2jmobius.gameserver.model.skills.Skill; + +/** + * The Class ConditionPlayerIsPvpFlagged. + * @author Mobius + */ +public class ConditionPlayerIsPvpFlagged extends Condition +{ + private final boolean _val; + + /** + * Instantiates a new condition player is PvP flagged. + * @param val the val + */ + public ConditionPlayerIsPvpFlagged(boolean val) + { + _val = val; + } + + @Override + public boolean testImpl(L2Character effector, L2Character effected, Skill skill, L2Item item) + { + if (effector.getActingPlayer() == null) + { + return false; + } + return ((effector.getActingPlayer().getPvpFlag() > 0) == _val); + } +}