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.enums.PrivateStoreType;
import com.l2jserver.gameserver.handler.IActionHandler; import com.l2jserver.gameserver.handler.IActionHandler;
import com.l2jserver.gameserver.model.L2Object; 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.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent; 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.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
activeChar.onActionRequest(); 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 else
@ -115,6 +122,12 @@ public class L2PcInstanceAction implements IActionHandler
{ {
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target); 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; package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent; import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.ai.CtrlIntention;
@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect
info.getEffected().setRunning(); 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); 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()); 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 @Override
public boolean isInstant() public boolean isInstant()
{ {
@ -63,6 +57,11 @@ public final class TransferHate extends AbstractEffect
@Override @Override
public void onStart(BuffInfo info) 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())) for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange()))
{ {
if ((obj == null) || !obj.isAttackable() || obj.isDead()) if ((obj == null) || !obj.isAttackable() || obj.isDead())

View File

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

View File

@ -39,12 +39,6 @@ public final class VitalityPointUp extends AbstractEffect
_value = params.getInt("value", 0); _value = params.getInt("value", 0);
} }
@Override
public boolean canStart(BuffInfo info)
{
return (info.getEffected() != null) && info.getEffected().isPlayer();
}
@Override @Override
public boolean isInstant() public boolean isInstant()
{ {
@ -54,7 +48,10 @@ public final class VitalityPointUp extends AbstractEffect
@Override @Override
public void onStart(BuffInfo info) public void onStart(BuffInfo info)
{ {
info.getEffected().getActingPlayer().updateVitalityPoints(_value, false, false); if ((info.getEffected() != null) && info.getEffected().isPlayer())
info.getEffected().getActingPlayer().sendPacket(new UserInfo(info.getEffected().getActingPlayer())); {
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.enums.PrivateStoreType;
import com.l2jserver.gameserver.handler.IActionHandler; import com.l2jserver.gameserver.handler.IActionHandler;
import com.l2jserver.gameserver.model.L2Object; 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.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.TvTEvent; 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.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
activeChar.onActionRequest(); 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 else
@ -115,6 +122,12 @@ public class L2PcInstanceAction implements IActionHandler
{ {
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, target); 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; package handlers.effecthandlers;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlEvent; import com.l2jserver.gameserver.ai.CtrlEvent;
import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.ai.CtrlIntention;
@ -105,7 +106,17 @@ public final class Fear extends AbstractEffect
info.getEffected().setRunning(); 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); 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()); 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 @Override
public boolean isInstant() public boolean isInstant()
{ {
@ -63,6 +57,11 @@ public final class TransferHate extends AbstractEffect
@Override @Override
public void onStart(BuffInfo info) 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())) for (L2Character obj : info.getEffector().getKnownList().getKnownCharactersInRadius(info.getSkill().getAffectRange()))
{ {
if ((obj == null) || !obj.isAttackable() || obj.isDead()) if ((obj == null) || !obj.isAttackable() || obj.isDead())

View File

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

View File

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

View File

@ -24,12 +24,14 @@ import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData; import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Summon; import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.pathfinding.PathFinding;
import com.l2jserver.util.Rnd; import com.l2jserver.util.Rnd;
public class L2SummonAI extends L2PlayableAI implements Runnable public class L2SummonAI extends L2PlayableAI implements Runnable
@ -48,6 +50,17 @@ public class L2SummonAI extends L2PlayableAI implements Runnable
super(creature); 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 @Override
protected void onIntentionIdle() 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_ACTIVE;
import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK; 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.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -4465,15 +4464,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
distance = Math.sqrt((dx * dx) + (dy * dy)); distance = Math.sqrt((dx * dx) + (dy * dy));
} }
// @formatter:off
// Define movement angles needed // Define movement angles needed
// ^ // ^
// | X (x,y) // | X (x,y)
// | / // | /
// | /distance // | / distance
// | / // | /
// |/ angle // |/ angle
// X ----------> // X ---------->
// (curx,cury) // (curx,cury)
// @formatter:on
double cos; double cos;
double sin; double sin;
@ -4539,8 +4540,8 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
// Movement checks: // Movement checks:
// when PATHFINDING > 0, for all characters except mobs returning home (could be changed later to teleport if pathfinding fails) // 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 if (((Config.PATHFINDING > 0) && (!(isAttackable() && ((L2Attackable) this).isReturningToSpawnPoint()))) //
|| isAfraid()) || (isPlayer() && !(isInVehicle && (distance > 1500))))
{ {
if (isOnGeodataPath()) 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 // 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 // than the original movement was and the LoS gives a shorter distance than 2000
// This way of detecting need for pathfinding could be changed. // 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 // Path calculation
// Overrides previous movement check // 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()); m.geoPath = PathFinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId(), isPlayable());
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found 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 // the mob is attacking and right now we set it so that the mob will go
// after target anyway, is dz is small enough. // 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. // off the geonodes and some more checks.
// * Summons will follow their masters no matter what. // Summons will follow their masters no matter what.
// * Currently minions also must move freely since L2AttackableAI commands // Currently minions also must move freely since L2AttackableAI commands them to move along with their leader
// them to move along with their leader
if (isPlayer() || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((L2Summon) this).getFollowStatus())) if (isPlayer() || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((L2Summon) this).getFollowStatus()))
{ {
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); 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.SummonInfo;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage; import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.TeleportToLocation; import com.l2jserver.gameserver.network.serverpackets.TeleportToLocation;
import com.l2jserver.gameserver.pathfinding.PathFinding;
import com.l2jserver.gameserver.taskmanager.DecayTaskManager; import com.l2jserver.gameserver.taskmanager.DecayTaskManager;
import com.l2jserver.gameserver.util.Util; import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.Rnd; import com.l2jserver.util.Rnd;
@ -680,6 +681,12 @@ public abstract class L2Summon extends L2Playable
return false; 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 // Check if this is bad magic skill
if (skill.isBad()) if (skill.isBad())
{ {

View File

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

View File

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