mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 09:22:49 +00:00
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.ai;
|
||||
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.l2jserver.service.game.ai;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.ai.script;
|
||||
|
||||
import com.l2jserver.model.world.capability.Attackable;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.service.game.ai.AIScript;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a
|
||||
*/
|
||||
public interface AttackAIScript extends AIScript {
|
||||
void attack(Attackable target);
|
||||
void attack(Actor actor);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.ai.script;
|
||||
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
|
||||
/**
|
||||
* This AI is used to receive notifications once another object aproaches.
|
||||
@@ -31,5 +31,5 @@ public interface ProximityAIScript {
|
||||
* @param object
|
||||
* the object
|
||||
*/
|
||||
void approach(Positionable object);
|
||||
void approach(PositionableObject object);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.ai.script;
|
||||
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.service.game.ai.AIScript;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
|
||||
@@ -26,5 +26,5 @@ import com.l2jserver.util.dimensional.Coordinate;
|
||||
public interface WalkingAIScript extends AIScript {
|
||||
void walk(Coordinate coord);
|
||||
|
||||
void follow(Positionable positionable);
|
||||
void follow(PositionableObject positionable);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.character;
|
||||
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
* Exception thrown when the character is trying to attack an {@link Actor} that
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.character;
|
||||
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.game.spawn.AlreadySpawnedServiceException;
|
||||
import com.l2jserver.service.game.spawn.NotSpawnedServiceException;
|
||||
|
||||
@@ -32,13 +32,13 @@ import com.l2jserver.game.net.packet.server.GameGuardQueryPacket;
|
||||
import com.l2jserver.game.net.packet.server.NPCInformationPacket;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterMoveType;
|
||||
import com.l2jserver.model.world.L2Character.CharacterState;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.character.event.CharacterEnterWorldEvent;
|
||||
import com.l2jserver.model.world.character.event.CharacterEvent;
|
||||
import com.l2jserver.model.world.character.event.CharacterLeaveWorldEvent;
|
||||
@@ -160,10 +160,10 @@ public class CharacterServiceImpl extends AbstractService implements
|
||||
// the given event will be broadcasted or not
|
||||
// TODO this should not be here, it should be i world service or a newly
|
||||
// created broadcast service.
|
||||
final WorldListener broadcastListener = new FilteredWorldListener<Positionable>(
|
||||
final WorldListener broadcastListener = new FilteredWorldListener<PositionableObject>(
|
||||
new KnownListFilter(character)) {
|
||||
@Override
|
||||
protected boolean dispatch(WorldEvent e, Positionable object) {
|
||||
protected boolean dispatch(WorldEvent e, PositionableObject object) {
|
||||
if (e instanceof NPCSpawnEvent) {
|
||||
conn.write(new NPCInformationPacket((NPC) object));
|
||||
} else if (e instanceof CharacterMoveEvent) {
|
||||
@@ -175,7 +175,7 @@ public class CharacterServiceImpl extends AbstractService implements
|
||||
} else if (e instanceof PlayerTeleportedEvent
|
||||
|| e instanceof CharacterEnterWorldEvent) {
|
||||
// TODO this should not be here!
|
||||
for (final WorldObject o : worldService
|
||||
for (final PositionableObject o : worldService
|
||||
.iterable(new KnownListFilter(character))) {
|
||||
if (o instanceof NPC) {
|
||||
conn.write(new NPCInformationPacket((NPC) o));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.region;
|
||||
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.service.Service;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.l2jserver.service.game.spawn;
|
||||
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.event.SpawnEvent;
|
||||
import com.l2jserver.model.world.player.event.PlayerTeleportingEvent;
|
||||
import com.l2jserver.service.Service;
|
||||
@@ -36,7 +36,7 @@ public interface SpawnService extends Service {
|
||||
* An {@link SpawnEvent} will be dispatched and the object will be
|
||||
* registered in the world (if it isn't already)
|
||||
*
|
||||
* @param spawnable
|
||||
* @param object
|
||||
* the spawnable object
|
||||
* @param point
|
||||
* the spawning point. If null, will try to use
|
||||
@@ -47,7 +47,7 @@ public interface SpawnService extends Service {
|
||||
* @throws AlreadySpawnedServiceException
|
||||
* if the object is already spawned in the world
|
||||
*/
|
||||
void spawn(Spawnable spawnable, Point point)
|
||||
void spawn(PositionableObject object, Point point)
|
||||
throws SpawnPointNotFoundServiceException,
|
||||
AlreadySpawnedServiceException;
|
||||
|
||||
@@ -75,7 +75,7 @@ public interface SpawnService extends Service {
|
||||
* @param spawnable
|
||||
* the spawnable object
|
||||
*/
|
||||
void scheduleRespawn(Spawnable spawnable);
|
||||
void scheduleRespawn(PositionableObject spawnable);
|
||||
|
||||
/**
|
||||
* Unspawns an object from the world
|
||||
@@ -85,5 +85,5 @@ public interface SpawnService extends Service {
|
||||
* @throws NotSpawnedServiceException
|
||||
* if the object is not spawned
|
||||
*/
|
||||
void unspawn(Spawnable spawnable) throws NotSpawnedServiceException;
|
||||
void unspawn(PositionableObject spawnable) throws NotSpawnedServiceException;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterState;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.model.world.Player;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.event.SpawnEvent;
|
||||
import com.l2jserver.model.world.npc.event.NPCSpawnEvent;
|
||||
import com.l2jserver.model.world.player.event.PlayerTeleportingEvent;
|
||||
@@ -74,32 +74,32 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawn(Spawnable spawnable, Point point)
|
||||
public void spawn(PositionableObject object, Point point)
|
||||
throws SpawnPointNotFoundServiceException {
|
||||
Preconditions.checkNotNull(spawnable, "spawnable");
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
// sanitize
|
||||
if (point == null)
|
||||
// retrieving stored point
|
||||
point = spawnable.getPoint();
|
||||
point = object.getPoint();
|
||||
if (point == null) {
|
||||
// not point send and no point stored, aborting
|
||||
throw new SpawnPointNotFoundServiceException();
|
||||
}
|
||||
|
||||
// set the spawning point
|
||||
spawnable.setPoint(point);
|
||||
object.setPoint(point);
|
||||
// register object in the world
|
||||
if (!worldService.add(spawnable))
|
||||
if (!worldService.add(object))
|
||||
// TODO this should throw an exception
|
||||
// object was already in world
|
||||
return;
|
||||
|
||||
// create the SpawnEvent
|
||||
SpawnEvent event = null;
|
||||
if (spawnable instanceof NPC) {
|
||||
final NPC npc = (NPC) spawnable;
|
||||
if (object instanceof NPC) {
|
||||
final NPC npc = (NPC) object;
|
||||
event = new NPCSpawnEvent(npc, point);
|
||||
} else if (spawnable instanceof L2Character) {
|
||||
} else if (object instanceof L2Character) {
|
||||
event = null;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
|
||||
public void teleport(Player player, Coordinate coordinate) {
|
||||
Preconditions.checkNotNull(player, "player");
|
||||
Preconditions.checkNotNull(coordinate, "coordinate");
|
||||
System.out.println("teleport: "+coordinate);
|
||||
System.out.println("teleport: " + coordinate);
|
||||
player.setPosition(coordinate);
|
||||
if (player instanceof L2Character) {
|
||||
final Lineage2Connection conn = networkService
|
||||
@@ -132,15 +132,15 @@ public class SpawnServiceImpl extends AbstractService implements SpawnService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduleRespawn(Spawnable spawnable) {
|
||||
Preconditions.checkNotNull(spawnable, "spawnable");
|
||||
public void scheduleRespawn(PositionableObject object) {
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unspawn(Spawnable spawnable) {
|
||||
Preconditions.checkNotNull(spawnable, "spawnable");
|
||||
public void unspawn(PositionableObject object) {
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
|
||||
import com.l2jserver.service.game.world.filter.WorldObjectFilter;
|
||||
@@ -79,7 +79,7 @@ public interface WorldService extends Service, Iterable<WorldObject> {
|
||||
* @param callback
|
||||
* the callback
|
||||
*/
|
||||
void knownlist(Positionable object, KnownListCallback callback);
|
||||
void knownlist(PositionableObject object, KnownListCallback callback);
|
||||
|
||||
/**
|
||||
* The KnownList callback is used to execute an action for each object know
|
||||
|
||||
@@ -26,8 +26,8 @@ import org.slf4j.LoggerFactory;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
@@ -122,10 +122,10 @@ public class WorldServiceImpl extends AbstractService implements WorldService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void knownlist(Positionable object, KnownListCallback callback) {
|
||||
public void knownlist(PositionableObject object, KnownListCallback callback) {
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
Preconditions.checkNotNull(callback, "callback");
|
||||
for (Positionable known : iterable(new KnownListFilter(object))) {
|
||||
for (PositionableObject known : iterable(new KnownListFilter(object))) {
|
||||
callback.knownObject(known);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.world.filter.impl;
|
||||
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.service.game.world.filter.AndFilter;
|
||||
|
||||
/**
|
||||
@@ -26,12 +26,12 @@ import com.l2jserver.service.game.world.filter.AndFilter;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class KnownListFilter extends AndFilter<Positionable> {
|
||||
public class KnownListFilter extends AndFilter<PositionableObject> {
|
||||
public static final int KNOWNLIST_RANGE = 2000;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public KnownListFilter(Positionable object) {
|
||||
super(new InstanceFilter<Positionable>(Positionable.class),
|
||||
public KnownListFilter(PositionableObject object) {
|
||||
super(new InstanceFilter<PositionableObject>(PositionableObject.class),
|
||||
new RangeFilter(object, KNOWNLIST_RANGE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package com.l2jserver.service.game.world.filter.impl;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.l2jserver.model.world.capability.Positionable;
|
||||
import com.l2jserver.model.world.PositionableObject;
|
||||
import com.l2jserver.service.game.world.filter.WorldObjectFilter;
|
||||
|
||||
/**
|
||||
@@ -25,11 +25,11 @@ import com.l2jserver.service.game.world.filter.WorldObjectFilter;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class RangeFilter implements WorldObjectFilter<Positionable> {
|
||||
public class RangeFilter implements WorldObjectFilter<PositionableObject> {
|
||||
/**
|
||||
* The coordinate point
|
||||
*/
|
||||
private final Positionable object;
|
||||
private final PositionableObject object;
|
||||
/**
|
||||
* The desired maximum distance of the object
|
||||
*/
|
||||
@@ -43,7 +43,7 @@ public class RangeFilter implements WorldObjectFilter<Positionable> {
|
||||
* @param range
|
||||
* the desired maximum distance of the object
|
||||
*/
|
||||
public RangeFilter(final Positionable object, final int range) {
|
||||
public RangeFilter(final PositionableObject object, final int range) {
|
||||
Preconditions.checkNotNull(object, "object");
|
||||
Preconditions.checkState(range >= 0, "range < 0");
|
||||
this.object = object;
|
||||
@@ -51,7 +51,7 @@ public class RangeFilter implements WorldObjectFilter<Positionable> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(Positionable other) {
|
||||
public boolean accept(PositionableObject other) {
|
||||
if (other == null)
|
||||
return false;
|
||||
return other.getPosition().getDistance(object.getPosition()) <= range;
|
||||
|
||||
Reference in New Issue
Block a user