Sync with L2JServer Jan 24th 2015.

This commit is contained in:
mobius
2015-01-24 20:02:32 +00:00
parent d349bd3924
commit 1c6301c46d
1012 changed files with 23069 additions and 6307 deletions

View File

@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
@@ -99,7 +98,7 @@ public class AreaFriendly implements ITargetTypeHandler
private boolean checkTarget(L2Character activeChar, L2Character target)
{
if ((Config.GEODATA > 0) && !GeoData.getInstance().canSeeTarget(activeChar, target))
if (!GeoData.getInstance().canSeeTarget(activeChar, target))
{
return false;
}

View File

@@ -39,7 +39,6 @@ public class AreaSummon implements ITargetTypeHandler
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
List<L2Character> targetList = new ArrayList<>();
target = activeChar.getSummon();
if ((target == null) || !target.isServitor() || target.isDead())
{
return EMPTY_TARGET_LIST;
@@ -47,10 +46,13 @@ public class AreaSummon implements ITargetTypeHandler
if (onlyFirst)
{
return new L2Character[]
if (activeChar.hasSummon())
{
target
};
return new L2Character[]
{
activeChar.getServitors().values().stream().findFirst().orElse(activeChar.getPet())
};
}
}
final boolean srcInArena = (activeChar.isInsideZone(ZoneId.PVP) && !activeChar.isInsideZone(ZoneId.SIEGE));

View File

@@ -74,11 +74,19 @@ public class Clan implements ITargetTypeHandler
final int radius = skill.getAffectRange();
final L2Clan clan = player.getClan();
if (Skill.addSummon(activeChar, player, radius, false))
if (Skill.addPet(activeChar, player, radius, false))
{
targetList.add(player.getSummon());
targetList.add(player.getPet());
}
player.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
if (clan != null)
{
L2PcInstance obj;
@@ -114,11 +122,19 @@ public class Clan implements ITargetTypeHandler
continue;
}
if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false))
if (Skill.addPet(activeChar, obj, radius, false))
{
targetList.add(obj.getSummon());
targetList.add(obj.getPet());
}
obj.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
if (!Skill.addCharacter(activeChar, obj, radius, false))
{
continue;

View File

@@ -50,11 +50,19 @@ public class CommandChannel implements ITargetTypeHandler
final L2Party party = player.getParty();
final boolean hasChannel = (party != null) && party.isInCommandChannel();
if (Skill.addSummon(activeChar, player, radius, false))
if (Skill.addPet(activeChar, player, radius, false))
{
targetList.add(player.getSummon());
targetList.add(player.getPet());
}
player.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
// if player in not in party
if (party == null)
{

View File

@@ -37,7 +37,7 @@ public class EnemySummon implements ITargetTypeHandler
if (target.isSummon())
{
L2Summon targetSummon = (L2Summon) target;
if ((activeChar.isPlayer() && (activeChar.getSummon() != targetSummon) && !targetSummon.isDead() && ((targetSummon.getOwner().getPvpFlag() != 0) || (targetSummon.getOwner().getKarma() > 0))) || (targetSummon.getOwner().isInsideZone(ZoneId.PVP) && activeChar.getActingPlayer().isInsideZone(ZoneId.PVP)) || (targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId())))
if ((activeChar.isPlayer() && (activeChar.getPet() != targetSummon) && activeChar.hasServitor(targetSummon.getObjectId()) && !targetSummon.isDead() && ((targetSummon.getOwner().getPvpFlag() != 0) || (targetSummon.getOwner().getKarma() > 0))) || (targetSummon.getOwner().isInsideZone(ZoneId.PVP) && activeChar.getActingPlayer().isInsideZone(ZoneId.PVP)) || (targetSummon.getOwner().isInDuel() && activeChar.getActingPlayer().isInDuel() && (targetSummon.getOwner().getDuelId() == activeChar.getActingPlayer().getDuelId())))
{
return new L2Character[]
{

View File

@@ -0,0 +1,99 @@
/*
* Copyright (C) 2004-2015 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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;
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2SiegeFlagInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* @author St3eT
*/
public final class OneFriendly implements ITargetTypeHandler
{
@Override
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
// Check for null target or any other invalid target
if ((target == null) || target.isDead())
{
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
return EMPTY_TARGET_LIST;
}
if (!checkTarget(activeChar, target))
{
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
return EMPTY_TARGET_LIST;
}
// If a target is found, return it in a table else send a system message TARGET_IS_INCORRECT
return new L2Character[]
{
target
};
}
private boolean checkTarget(L2Character activeChar, L2Character target)
{
if ((target == null) || target.isAlikeDead() || target.isDoor() || (target instanceof L2SiegeFlagInstance) || target.isMonster())
{
return false;
}
if ((target.getActingPlayer() != null) && (target.getActingPlayer() != activeChar) && (target.getActingPlayer().inObserverMode() || target.getActingPlayer().isInOlympiadMode()))
{
return false;
}
if (target.isPlayable())
{
boolean friendly = false;
if ((activeChar.getAllyId() > 0) && (activeChar.getAllyId() == target.getActingPlayer().getAllyId()))
{
friendly = true;
}
else if ((activeChar.getClanId() > 0) && (activeChar.getClanId() == target.getActingPlayer().getClanId()))
{
friendly = true;
}
else if (activeChar.isInParty() && activeChar.getParty().containsPlayer(target.getActingPlayer()))
{
friendly = true;
}
else if ((target != activeChar) && (target.getActingPlayer().getPvpFlag() == 0))
{
friendly = true;
}
return friendly;
}
return true;
}
@Override
public Enum<L2TargetType> getTargetType()
{
return L2TargetType.ONE_FRIENDLY;
}
}

View File

@@ -58,10 +58,18 @@ public class Party implements ITargetTypeHandler
}
else if (activeChar.isPlayer())
{
if (Skill.addSummon(activeChar, player, radius, false))
if (Skill.addPet(activeChar, player, radius, false))
{
targetList.add(player.getSummon());
targetList.add(player.getPet());
}
player.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
}
if (activeChar.isInParty())
@@ -79,10 +87,18 @@ public class Party implements ITargetTypeHandler
targetList.add(partyMember);
}
if (Skill.addSummon(activeChar, partyMember, radius, false))
if (Skill.addPet(activeChar, partyMember, radius, false))
{
targetList.add(partyMember.getSummon());
targetList.add(partyMember.getPet());
}
partyMember.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
}
}
return targetList.toArray(new L2Character[targetList.size()]);

View File

@@ -60,11 +60,19 @@ public class PartyClan implements ITargetTypeHandler
final boolean hasClan = player.getClan() != null;
final boolean hasParty = player.isInParty();
if (Skill.addSummon(activeChar, player, radius, false))
if (Skill.addPet(activeChar, player, radius, false))
{
targetList.add(player.getSummon());
targetList.add(player.getPet());
}
player.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
// if player in clan and not in party
if (!(hasClan || hasParty))
{
@@ -128,24 +136,24 @@ public class PartyClan implements ITargetTypeHandler
continue;
}
if (!onlyFirst && Skill.addSummon(activeChar, obj, radius, false))
if (Skill.addPet(activeChar, obj, radius, false))
{
targetList.add(obj.getSummon());
targetList.add(obj.getPet());
}
obj.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
if (!Skill.addCharacter(activeChar, obj, radius, false))
{
continue;
}
if (onlyFirst)
{
return new L2Character[]
{
obj
};
}
if ((maxTargets > 0) && (targetList.size() >= maxTargets))
{
break;

View File

@@ -40,7 +40,7 @@ public class PartyMember implements ITargetTypeHandler
}
if (!target.isDead())
{
if ((target == activeChar) || (activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) || (activeChar.isPlayer() && target.isSummon() && (activeChar.getSummon() == target)) || (activeChar.isSummon() && target.isPlayer() && (activeChar == target.getSummon())))
if ((target == activeChar) || (activeChar.isInParty() && target.isInParty() && (activeChar.getParty().getLeaderObjectId() == target.getParty().getLeaderObjectId())) || ((activeChar.isPlayer() && target.isSummon() && ((activeChar.getPet() == target) || activeChar.hasServitor(target.getObjectId()))) || (activeChar.isSummon() && target.isPlayer() && ((activeChar == target.getPet()) || target.hasServitor(activeChar.getObjectId())))))
{
return new L2Character[]
{

View File

@@ -39,16 +39,13 @@ public class PartyNotMe implements ITargetTypeHandler
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
final List<L2Character> targetList = new ArrayList<>();
final int radius = skill.getAffectRange();
if (activeChar.getParty() != null)
{
final List<L2PcInstance> partyList = activeChar.getParty().getMembers();
for (L2PcInstance partyMember : partyList)
{
if ((partyMember == null) || partyMember.isDead())
{
continue;
}
else if (partyMember == activeChar)
if (partyMember == activeChar)
{
continue;
}
@@ -56,18 +53,28 @@ public class PartyNotMe implements ITargetTypeHandler
{
continue;
}
else if ((skill.getAffectRange() > 0) && !Util.checkIfInRange(skill.getAffectRange(), activeChar, partyMember, true))
{
continue;
}
else
{
targetList.add(partyMember);
if ((partyMember.getSummon() != null) && !partyMember.getSummon().isDead())
if (Skill.addPet(activeChar, partyMember, radius, false))
{
targetList.add(partyMember.getSummon());
targetList.add(partyMember.getPet());
}
partyMember.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
if (Skill.addCharacter(activeChar, partyMember, radius, false))
{
targetList.add(partyMember);
}
targetList.add(partyMember);
}
}
}

View File

@@ -95,7 +95,7 @@ public class PcBody implements ITargetTypeHandler
if (!onlyFirst)
{
targetList.add(target);
return targetList.toArray(new L2Object[targetList.size()]);
return targetList.toArray(new L2Character[targetList.size()]);
}
return new L2Character[]
{

View File

@@ -21,6 +21,7 @@ package handlers.targethandlers;
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
@@ -33,11 +34,12 @@ public class Pet implements ITargetTypeHandler
@Override
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
if (activeChar.hasPet())
final L2Summon pet = activeChar.getPet();
if (pet != null)
{
return new L2Character[]
{
activeChar.getSummon()
pet
};
}
return EMPTY_TARGET_LIST;

View File

@@ -33,12 +33,10 @@ public class Servitor implements ITargetTypeHandler
@Override
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
if (activeChar.hasServitor())
if (activeChar.hasServitors())
{
return new L2Character[]
{
activeChar.getSummon()
};
return activeChar.getServitors().values().toArray(new L2Character[activeChar.getServitors().size()]);
}
return EMPTY_TARGET_LIST;
}

View File

@@ -18,6 +18,9 @@
*/
package handlers.targethandlers;
import java.util.ArrayList;
import java.util.List;
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
@@ -35,10 +38,21 @@ public class Summon implements ITargetTypeHandler
{
if (activeChar.hasSummon())
{
return new L2Character[]
if (!activeChar.hasPet() && activeChar.hasServitors())
{
activeChar.getSummon()
};
return activeChar.getServitors().values().toArray(new L2Character[0]);
}
else if (activeChar.hasPet() && !activeChar.hasServitors())
{
return new L2Character[]
{
activeChar.getPet()
};
}
final List<L2Character> targets = new ArrayList<>(1 + activeChar.getServitors().size());
targets.add(activeChar.getPet());
targets.addAll(activeChar.getServitors().values());
return targets.toArray(new L2Character[0]);
}
return EMPTY_TARGET_LIST;
}

View File

@@ -63,10 +63,18 @@ public class TargetParty implements ITargetTypeHandler
targetList.add(partyMember);
}
if (Skill.addSummon(player, partyMember, radius, false))
if (Skill.addPet(player, partyMember, radius, false))
{
targetList.add(partyMember.getSummon());
targetList.add(partyMember.getPet());
}
partyMember.getServitors().values().forEach(s ->
{
if (Skill.addCharacter(activeChar, s, radius, false))
{
targetList.add(s);
}
});
}
}
else