Merged with released L2J-Unity files.
This commit is contained in:
39
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/All.java
vendored
Normal file
39
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/All.java
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class All implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.ALL;
|
||||
}
|
||||
}
|
||||
61
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Clan.java
vendored
Normal file
61
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Clan.java
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class Clan implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (activeChar == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
if (player != null)
|
||||
{
|
||||
final L2Clan clan = player.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
return clan == target.getClan();
|
||||
}
|
||||
}
|
||||
else if (activeChar.isNpc() && target.isNpc())
|
||||
{
|
||||
return ((L2Npc) activeChar).isInMyClan(((L2Npc) target));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.CLAN;
|
||||
}
|
||||
}
|
||||
130
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Friend.java
vendored
Normal file
130
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Friend.java
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class Friend implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (activeChar == target)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
if (targetPlayer != null)
|
||||
{
|
||||
// Same player.
|
||||
if (player == targetPlayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Party (command channel doesn't make you friends).
|
||||
final L2Party party = player.getParty();
|
||||
final L2Party targetParty = targetPlayer.getParty();
|
||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Arena.
|
||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Duel.
|
||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Olympiad.
|
||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clan.
|
||||
final L2Clan clan = player.getClan();
|
||||
final L2Clan targetClan = targetPlayer.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
if (clan == targetClan)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// War
|
||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Alliance.
|
||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Siege.
|
||||
if (target.isInsideZone(ZoneId.SIEGE))
|
||||
{
|
||||
// Players in the same siege side at the same castle are considered friends.
|
||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// By default any neutral non-flagged player is considered a friend.
|
||||
return (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getReputation() >= 0);
|
||||
}
|
||||
|
||||
// By default any npc that isnt mob is considered friend.
|
||||
return !target.isMonster() && !target.isAutoAttackable(player);
|
||||
}
|
||||
|
||||
return !target.isAutoAttackable(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.FRIEND;
|
||||
}
|
||||
}
|
||||
124
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/FriendPc.java
vendored
Normal file
124
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/FriendPc.java
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class FriendPc implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (!target.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
// Same player.
|
||||
if (player == targetPlayer)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Party (command channel doesn't make you friends).
|
||||
final L2Party party = player.getParty();
|
||||
final L2Party targetParty = targetPlayer.getParty();
|
||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Arena.
|
||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Duel.
|
||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Olympiad.
|
||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clan.
|
||||
final L2Clan clan = player.getClan();
|
||||
final L2Clan targetClan = targetPlayer.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
if (clan == targetClan)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// War
|
||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Alliance.
|
||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Siege.
|
||||
if (target.isInsideZone(ZoneId.SIEGE))
|
||||
{
|
||||
// Players in the same siege side at the same castle are considered friends.
|
||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// By default any neutral non-flagged player is considered a friend.
|
||||
return (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getReputation() >= 0);
|
||||
}
|
||||
|
||||
return target.isAutoAttackable(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.FRIEND_PC;
|
||||
}
|
||||
}
|
||||
41
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/HiddenPlace.java
vendored
Normal file
41
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/HiddenPlace.java
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class HiddenPlace implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
// TODO: What is this?
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.HIDDEN_PLACE;
|
||||
}
|
||||
}
|
||||
40
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Invisible.java
vendored
Normal file
40
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/Invisible.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* Invisible affect object implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class Invisible implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
return target.isInvisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.INVISIBLE;
|
||||
}
|
||||
}
|
||||
138
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java
vendored
Normal file
138
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriend.java
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* Not Friend affect object implementation. Based on Gracia Final retail tests.<br>
|
||||
* Such are considered flagged/karma players (except party/clan/ally). Doesn't matter if in command channel.<br>
|
||||
* In arena such are considered clan/ally/command channel (except party). <br>
|
||||
* In peace zone such are considered monsters.<br>
|
||||
* Monsters consider such all players, npcs (Citizens, Guild Masters, Merchants, Guards, etc. except monsters). Doesn't matter if in peace zone or arena.
|
||||
* @author Nik
|
||||
*/
|
||||
public class NotFriend implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (activeChar == target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
if (targetPlayer != null)
|
||||
{
|
||||
// Same player.
|
||||
if (player == targetPlayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Peace Zone.
|
||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Party (command channel doesn't make you friends).
|
||||
final L2Party party = player.getParty();
|
||||
final L2Party targetParty = targetPlayer.getParty();
|
||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Arena.
|
||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Duel.
|
||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Olympiad.
|
||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Clan.
|
||||
final L2Clan clan = player.getClan();
|
||||
final L2Clan targetClan = targetPlayer.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
if (clan == targetClan)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// War
|
||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Alliance.
|
||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Siege.
|
||||
if (target.isInsideZone(ZoneId.SIEGE))
|
||||
{
|
||||
// Players in the same siege side at the same castle are considered friends.
|
||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// By default any flagged/PK player is considered enemy.
|
||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||
}
|
||||
}
|
||||
|
||||
return target.isAutoAttackable(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.NOT_FRIEND;
|
||||
}
|
||||
}
|
||||
135
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriendPc.java
vendored
Normal file
135
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/NotFriendPc.java
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2Party;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class NotFriendPc implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (!target.isPlayer())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (activeChar == target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final L2PcInstance player = activeChar.getActingPlayer();
|
||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
// Same player.
|
||||
if (player == targetPlayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Peace Zone.
|
||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Party (command channel doesn't make you friends).
|
||||
final L2Party party = player.getParty();
|
||||
final L2Party targetParty = targetPlayer.getParty();
|
||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Arena.
|
||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Duel.
|
||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Olympiad.
|
||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Clan.
|
||||
final L2Clan clan = player.getClan();
|
||||
final L2Clan targetClan = targetPlayer.getClan();
|
||||
if (clan != null)
|
||||
{
|
||||
if (clan == targetClan)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// War
|
||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Alliance.
|
||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Siege.
|
||||
if (target.isInsideZone(ZoneId.SIEGE))
|
||||
{
|
||||
// Players in the same siege side at the same castle are considered friends.
|
||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// By default any flagged/PK player is considered enemy.
|
||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||
}
|
||||
|
||||
return target.isAutoAttackable(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.NOT_FRIEND_PC;
|
||||
}
|
||||
}
|
||||
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/ObjectDeadNpcBody.java
vendored
Normal file
44
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/ObjectDeadNpcBody.java
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class ObjectDeadNpcBody implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
if (activeChar == target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return target.isNpc() && target.isDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.OBJECT_DEAD_NPC_BODY;
|
||||
}
|
||||
}
|
||||
46
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/UndeadRealEnemy.java
vendored
Normal file
46
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/UndeadRealEnemy.java
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* Undead enemy npc affect object implementation.
|
||||
* @author Nik
|
||||
*/
|
||||
public class UndeadRealEnemy implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
// You are not an enemy of yourself.
|
||||
if (activeChar == target)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return target.isUndead() && target.isAutoAttackable(activeChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.UNDEAD_REAL_ENEMY;
|
||||
}
|
||||
}
|
||||
42
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/WyvernObject.java
vendored
Normal file
42
trunk/dist/game/data/scripts/handlers/targethandlers/affectobject/WyvernObject.java
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 handlers.targethandlers.affectobject;
|
||||
|
||||
import com.l2jmobius.gameserver.data.xml.impl.CategoryData;
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.handler.IAffectObjectHandler;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.skills.targets.AffectObject;
|
||||
|
||||
/**
|
||||
* @author Nik
|
||||
*/
|
||||
public class WyvernObject implements IAffectObjectHandler
|
||||
{
|
||||
@Override
|
||||
public boolean checkAffectedObject(L2Character activeChar, L2Character target)
|
||||
{
|
||||
// TODO Check if this is proper. Not sure if this is the object we are looking for.
|
||||
return CategoryData.getInstance().isInCategory(CategoryType.WYVERN_GROUP, target.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<AffectObject> getAffectObjectType()
|
||||
{
|
||||
return AffectObject.WYVERN_OBJECT;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user