root/trunk/AE-go_GameServer/src/com/aionemu/gameserver/world/World.java
| 1369 | 1514 | ||
|---|---|---|---|
30 | import com.aionemu.gameserver.model.gameobjects.VisibleObject; | 30 | import com.aionemu.gameserver.model.gameobjects.VisibleObject; |
31 | import com.aionemu.gameserver.model.gameobjects.player.Player; | 31 | import com.aionemu.gameserver.model.gameobjects.player.Player; |
32 | import com.aionemu.gameserver.model.templates.WorldMapTemplate; | 32 | import com.aionemu.gameserver.model.templates.WorldMapTemplate; |
33 | import com.aionemu.gameserver.spawnengine.SpawnEngine; | ||
34 | import com.aionemu.gameserver.taskmanager.tasks.KnownListUpdateTask.KnownListUpdateMode; | 33 | import com.aionemu.gameserver.taskmanager.tasks.KnownListUpdateTask.KnownListUpdateMode; |
35 | import com.aionemu.gameserver.utils.idfactory.IDFactory; | 34 | import com.aionemu.gameserver.utils.idfactory.IDFactory; |
36 | import com.aionemu.gameserver.utils.idfactory.IDFactoryAionObject; | 35 | import com.aionemu.gameserver.utils.idfactory.IDFactoryAionObject; |
... | ... | ||
71 | private final Map<Integer, WorldMap> worldMaps = new HashMap<Integer, WorldMap>(); | 70 | private final Map<Integer, WorldMap> worldMaps = new HashMap<Integer, WorldMap>(); |
72 | 71 | ||
73 | private IDFactory aionObjectsIDFactory; | 72 | private IDFactory aionObjectsIDFactory; |
74 | @Inject | ||
75 | private SpawnEngine spawnEngine; | ||
76 | 73 | ||
77 | /** | 74 | /** |
78 | * Constructor. | 75 | * Constructor. |
... | ... | ||
177 | } | 174 | } |
178 | 175 | ||
179 | /** | 176 | /** |
180 | * @return the spawnEngine | ||
181 | */ | ||
182 | public SpawnEngine getSpawnEngine() | ||
183 | { | ||
184 | return spawnEngine; | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Return World Map by id | 177 | * Return World Map by id |
189 | * | 178 | * |
190 | * @param id | 179 | * @param id |
... | ... | ||
201 | throw new WorldMapNotExistException("Map: " + id + " not exist!"); | 190 | throw new WorldMapNotExistException("Map: " + id + " not exist!"); |
202 | return map; | 191 | return map; |
203 | } | 192 | } |
204 | | ||
205 | /** | ||
206 | * | ||
207 | * @param worldId | ||
208 | * @return WorldMapInstance | ||
209 | */ | ||
210 | public WorldMapInstance getNextAvailableInstance(int worldId) | ||
211 | { | ||
212 | WorldMap map = worldMaps.get(worldId); | ||
213 | return map.getNextFreeInstance(); | ||
214 | } | ||
215 | 193 | ||
216 | public void destroyInstance(int worldId, int instanceId) | ||
217 | { | ||
218 | WorldMap map = worldMaps.get(worldId); | ||
219 | map.removeWorldMapInstance(instanceId); | ||
220 | } | ||
221 | |||
222 | /** | 194 | /** |
223 | * Update position of VisibleObject [used when object is moving on one map instance]. Check if active map region | 195 | * Update position of VisibleObject [used when object is moving on one map instance]. Check if active map region |
224 | * changed and do all needed updates. | 196 | * changed and do all needed updates. |
... | ... | ||
349 | object.getPosition().setIsSpawned(true); | 321 | object.getPosition().setIsSpawned(true); |
350 | if(object.getSpawn() != null) | 322 | if(object.getSpawn() != null) |
351 | object.getSpawn().setSpawned(true, object.getInstanceId()); | 323 | object.getSpawn().setSpawned(true, object.getInstanceId()); |
324 | object.getActiveRegion().getParent().addObject(object); | ||
352 | object.getActiveRegion().add(object); | 325 | object.getActiveRegion().add(object); |
353 | 326 | ||
354 | object.updateKnownlist(); | 327 | object.updateKnownlist(); |
... | ... | ||
363 | */ | 336 | */ |
364 | public void despawn(VisibleObject object) | 337 | public void despawn(VisibleObject object) |
365 | { | 338 | { |
339 | object.getActiveRegion().getParent().removeObject(object); | ||
366 | object.getActiveRegion().remove(object); | 340 | object.getActiveRegion().remove(object); |
367 | object.getPosition().setIsSpawned(false); | 341 | object.getPosition().setIsSpawned(false); |
368 | if(object.getSpawn() != null) | 342 | if(object.getSpawn() != null) |
... | ... | ||
370 | 344 | ||
371 | object.clearKnownlist(); | 345 | object.clearKnownlist(); |
372 | } | 346 | } |
373 | |||
374 | /** | ||
375 | * dummy method to initialize World. | ||
376 | */ | ||
377 | public static void init() | ||
378 | { | ||
379 | } | ||
380 | } | 347 | } |
Download diff