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

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