Added condition for flagged player state.

This commit is contained in:
MobiusDev
2016-01-12 10:09:55 +00:00
parent 624a576989
commit a5f9eb4091
2 changed files with 56 additions and 0 deletions

View File

@ -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());

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}