root/trunk/AE-go_GameServer/src/com/aionemu/gameserver/world/World.java

9221006
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;
33
import com.aionemu.gameserver.utils.idfactory.IDFactory;
34
import com.aionemu.gameserver.utils.idfactory.IDFactory;
34
import com.aionemu.gameserver.utils.idfactory.IDFactoryAionObject;
35
import com.aionemu.gameserver.utils.idfactory.IDFactoryAionObject;
35
import com.aionemu.gameserver.world.container.PlayerContainer;
36
import com.aionemu.gameserver.world.container.PlayerContainer;
...
...
69
	private final Map<Integer, WorldMap>	worldMaps	= new HashMap<Integer, WorldMap>();
70
	private final Map<Integer, WorldMap>	worldMaps	= new HashMap<Integer, WorldMap>();
70
71
71
	private IDFactory						aionObjectsIDFactory;
72
	private IDFactory						aionObjectsIDFactory;
73
	@Inject
74
	private SpawnEngine						spawnEngine;
72
75
73
	/**
76
	/**
74
	 * Constructor.
77
	 * Constructor.
...
...
173
	}
176
	}
174
177
175
	/**
178
	/**
179
	 * @return the spawnEngine
180
	 */
181
	public SpawnEngine getSpawnEngine()
182
	{
183
		return spawnEngine;
184
	}
185
186
	/**
176
	 * Return World Map by id
187
	 * Return World Map by id
177
	 * 
188
	 * 
178
	 * @param id
189
	 * @param id
...
...
189
			throw new WorldMapNotExistException("Map: " + id + " not exist!");
200
			throw new WorldMapNotExistException("Map: " + id + " not exist!");
190
		return map;
201
		return map;
191
	}
202
	}
203
	
204
	/**
205
	 * 
206
	 * @param worldId
207
	 * @return
208
	 */
209
	public int getNextAvailableInstanceId(int worldId)
210
	{
211
		WorldMap map = worldMaps.get(worldId);
212
		return map.getNextFreeInstanceIndex();
213
	}
192
214
193
	/**
215
	/**
194
	 * Update position of VisibleObject [used when object is moving on one map instance]. Check if active map region
216
	 * Update position of VisibleObject [used when object is moving on one map instance]. Check if active map region
...
...
256
	 */
278
	 */
257
	public void setPosition(VisibleObject object, int mapId, float x, float y, float z, byte heading)
279
	public void setPosition(VisibleObject object, int mapId, float x, float y, float z, byte heading)
258
	{
280
	{
259
		int instanceIndex = 1;	
281
		int instanceId = 1;	
260
		if(object.getWorldId() == mapId)
282
		if(object.getWorldId() == mapId)
261
		{
283
		{
262
			instanceIndex = object.getInstanceId();
284
			instanceId = object.getInstanceId();
263
		}
285
		}
264
		this.setPosition(object, mapId, instanceIndex, x, y, z, heading);
286
		this.setPosition(object, mapId, instanceId, x, y, z, heading);
265
	}
287
	}
266
	
288
	
267
	/**
289
	/**