Sync with L2jServer HighFive May 4th 2015.

This commit is contained in:
MobiusDev
2015-05-05 16:08:48 +00:00
parent 00168279b4
commit 84eb9cef7d
16 changed files with 106 additions and 68 deletions

View File

@ -24,6 +24,7 @@ import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.enums.PrivateStoreType;
import com.l2jserver.gameserver.handler.IActionHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
@ -105,6 +106,12 @@ public class L2PcInstanceAction implements IActionHandler
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
activeChar.onActionRequest();
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
activeChar.onActionRequest();
}
}
}
else
@ -115,6 +122,12 @@ public class L2PcInstanceAction implements IActionHandler
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
activeChar.onActionRequest();
}
}
}
}

View File

@ -18,6 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect
info.getEffected().setRunning();
}
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
// If pathfinding enabled the creature will go to the defined destination (retail like).
// Otherwise it will go to the nearest obstacle.
final Location destination;
if (Config.PATHFINDING > 0)
{
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
}
else
{
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}

View File

@ -48,12 +48,6 @@ public final class TransferHate extends AbstractEffect
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public boolean canStart(BuffInfo info)
{
return Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true);
}
@Override
public boolean isInstant()
{
@ -63,6 +57,11 @@ public final class TransferHate extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
if (!Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true))
{
return;
}
for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange()))
{
if ((obj == null) || !obj.isAttackable() || obj.isDead())

View File

@ -55,16 +55,9 @@ public final class Unsummon extends AbstractEffect
return true;
}
}
return false;
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isSummon();
}
@Override
public boolean isInstant()
{

View File

@ -39,12 +39,6 @@ public final class VitalityPointUp extends AbstractEffect
_value = params.getInt("value", 0);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public boolean isInstant()
{
@ -54,7 +48,10 @@ public final class VitalityPointUp extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false);
info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer()));
if ((info.getEffected() != null) && info.getEffected().isPlayer())
{
info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false);
info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer()));
}
}
}

View File

@ -24,6 +24,7 @@ import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.enums.PrivateStoreType;
import com.l2jserver.gameserver.handler.IActionHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent;
@ -105,6 +106,12 @@ public class L2PcInstanceAction implements IActionHandler
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
activeChar.onActionRequest();
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
activeChar.onActionRequest();
}
}
}
else
@ -115,6 +122,12 @@ public class L2PcInstanceAction implements IActionHandler
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target);
}
else
{
final Location destination = GeoData.getInstance().moveCheck(activeChar.getX(), activeChar.getY(), activeChar.getZ(), target.getX(), target.getY(), target.getZ(), activeChar.getInstanceId());
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
activeChar.onActionRequest();
}
}
}
}

View File

@ -18,6 +18,7 @@
*/
package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention;
@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect
info.getEffected().setRunning();
}
final Location destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
// If pathfinding enabled the creature will go to the defined destination (retail like).
// Otherwise it will go to the nearest obstacle.
final Location destination;
if (Config.PATHFINDING > 0)
{
destination = new Location(posX, posY, posZ, info.getEffected().getInstanceId());
}
else
{
destination = GeoData.getInstance().moveCheck(info.getEffected().getX(), info.getEffected().getY(), info.getEffected().getZ(), posX, posY, posZ, info.getEffected().getInstanceId());
}
info.getEffected().getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, destination);
}
}

View File

@ -48,12 +48,6 @@ public final class TransferHate extends AbstractEffect
return Formulas.calcProbability(_chance, info.getEffector(), info.getEffected(), info.getSkill());
}
@Override
public boolean canStart(BuffInfo info)
{
return Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true);
}
@Override
public boolean isInstant()
{
@ -63,6 +57,11 @@ public final class TransferHate extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
if (!Util.checkIfInRange(info.getSkill().getEffectRange(), info.getEffector(), info.getEffected(), true))
{
return;
}
for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange()))
{
if ((obj == null) || !obj.isAttackable() || obj.isDead())

View File

@ -55,16 +55,9 @@ public final class Unsummon extends AbstractEffect
return true;
}
}
return false;
}
@Override
public boolean canStart(BuffInfo info)
{
return info.getEffected().isSummon();
}
@Override
public boolean isInstant()
{

View File

@ -39,12 +39,6 @@ public final class VitalityPointUp extends AbstractEffect
_value = params.getInt("value", 0);
}
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override
public boolean isInstant()
{
@ -54,7 +48,10 @@ public final class VitalityPointUp extends AbstractEffect
@Override
public void onStart(BuffInfo info)
{
info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false);
info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer()));
if ((info.getEffected() != null) && info.getEffected().isPlayer())
{
info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false);
info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer()));
}
}
}

View File

@ -636,7 +636,7 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
}
// If NPC with random fixed coord, don't move (unless needs to return to spawnpoint)
if ((TerritoryTable.getInstance().getProcMax(npc.getSpawn().getLocationId()) > 0) && !npc.isReturningToSpawnPoint())
if (!npc.isReturningToSpawnPoint() && (TerritoryTable.getInstance().getProcMax(npc.getSpawn().getLocationId()) > 0))
{
return;
}

View File

@ -24,12 +24,14 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.concurrent.Future;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager;
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.pathfinding.PathFinding;
import com.l2jserver.util.Rnd;
public class L2SummonAI extends L2PlayableAI implements Runnable
@ -48,6 +50,17 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
super(creature);
}
@Override
protected void onIntentionAttack(L2Character target)
{
if ((Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(_actor.getX(), _actor.getY(), _actor.getZ(), target.getX(), target.getY(), target.getZ(), _actor.getInstanceId(), true) == null))
{
return;
}
super.onIntentionAttack(target);
}
@Override
protected void onIntentionIdle()
{

View File

@ -20,7 +20,6 @@ package com.l2jserver.gameserver.model.actor;
import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE;
import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
import java.util.ArrayList;
import java.util.Collection;
@ -4465,15 +4464,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
distance = Math.sqrt((dx * dx) + (dy * dy));
}
// @formatter:off
// Define movement angles needed
// ^
// | X (x,y)
// | /
// | /distance
// | X (x,y)
// | /
// | / distance
// | /
// |/ angle
// X ---------->
// (curx,cury)
// @formatter:on
double cos;
double sin;
@ -4539,8 +4540,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Movement checks:
// when PATHFINDING > 0, for all characters except mobs returning home (could be changed later to teleport if pathfinding fails)
if (((Config.PATHFINDING > 0) && (!(isAttackable() && ((L2Attackable) this).isReturningToSpawnPoint()))) || (isPlayer() && !(isInVehicle && (distance > 1500))) || (isSummon() && !(getAI().getIntention() == AI_INTENTION_FOLLOW)) // assuming intention_follow only when following owner
|| isAfraid())
if (((Config.PATHFINDING > 0) && (!(isAttackable() && ((L2Attackable) this).isReturningToSpawnPoint()))) //
|| (isPlayer() && !(isInVehicle && (distance > 1500))))
{
if (isOnGeodataPath())
{
@ -4590,7 +4591,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result
// than the original movement was and the LoS gives a shorter distance than 2000
// This way of detecting need for pathfinding could be changed.
if ((Config.PATHFINDING > 0) && ((originalDistance - distance) > 30) && (distance < 2000) && !isAfraid())
if ((Config.PATHFINDING > 0) && ((originalDistance - distance) > 30) && (distance < 2000))
{
// Path calculation
// Overrides previous movement check
@ -4599,14 +4600,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
m.geoPath = PathFinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId(), isPlayable());
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
{
// * Even though there's no path found (remember geonodes aren't perfect),
// Even though there's no path found (remember geonodes aren't perfect),
// the mob is attacking and right now we set it so that the mob will go
// after target anyway, is dz is small enough.
// * With cellpathfinding this approach could be changed but would require taking
// With cellpathfinding this approach could be changed but would require taking
// off the geonodes and some more checks.
// * Summons will follow their masters no matter what.
// * Currently minions also must move freely since L2AttackableAI commands
// them to move along with their leader
// Summons will follow their masters no matter what.
// Currently minions also must move freely since L2AttackableAI commands them to move along with their leader
if (isPlayer() || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((L2Summon) this).getFollowStatus()))
{
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);

View File

@ -67,6 +67,7 @@ import com.l2jserver.gameserver.network.serverpackets.RelationChanged;
import com.l2jserver.gameserver.network.serverpackets.SummonInfo;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.TeleportToLocation;
import com.l2jserver.gameserver.pathfinding.PathFinding;
import com.l2jserver.gameserver.taskmanager.DecayTaskManager;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.Rnd;
@ -680,6 +681,12 @@ public abstract class L2Summon extends L2Playable
return false;
}
if ((this != target) && skill.isPhysical() && (Config.PATHFINDING > 0) && (PathFinding.getInstance().findPath(getX(), getY(), getZ(), target.getX(), target.getY(), target.getZ(), getInstanceId(), true) == null))
{
sendPacket(SystemMessageId.CANNOT_SEE_TARGET);
return false;
}
// Check if this is bad magic skill
if (skill.isBad())
{

View File

@ -38,10 +38,10 @@ public interface IAmountMultiplierStrategy
{
double multiplier = 1;
Float dropChanceMultiplier = Config.RATE_DROP_AMOUNT_MULTIPLIER.get(item.getItemId());
if (dropChanceMultiplier != null)
Float dropAmountMultiplier = Config.RATE_DROP_AMOUNT_MULTIPLIER.get(item.getItemId());
if (dropAmountMultiplier != null)
{
multiplier *= dropChanceMultiplier;
multiplier *= dropAmountMultiplier;
}
else if (ItemTable.getInstance().getTemplate(item.getItemId()).hasExImmediateEffect())
{

View File

@ -358,14 +358,6 @@ public final class RequestEnchantItem extends L2GameClientPacket
activeChar.sendPacket(sm);
}
if (!Config.FORCE_INVENTORY_UPDATE)
{
if (crystals != null)
{
iu.addItem(crystals);
}
}
if (crystalId == 0)
{
activeChar.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));