//Moves actor to new zone, and sends packets to spawn at the given coords. public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) { Area oldZone; //Remove player from currentZone if transfer else it's login if (player.zone != null) { oldZone = player.zone; oldZone.removeActorFromZone(player); } //Add player to new zone and update Area newArea; if (destinationPrivateArea == null) { newArea = GetZone(destinationZoneId); } else { newArea = GetZone(destinationZoneId).getPrivateArea(destinationPrivateArea, 0); } //This server does not contain that zoneId if (newArea == null) { return; } newArea.addActorToZone(player); //Update player actor's properties player.zoneId = newArea.actorId; player.zone = newArea; player.positionX = spawnX; player.positionY = spawnY; player.positionZ = spawnZ; player.rotation = spawnRotation; //Send packets player.playerSession.queuePacket(DeleteAllActorsPacket.buildPacket(player.actorId), true, false); player.playerSession.queuePacket(_0xE2Packet.buildPacket(player.actorId, 0x0), true, false); player.sendZoneInPackets(this, spawnType); player.playerSession.clearInstance(); player.sendInstanceUpdate(); LuaEngine.onZoneIn(player); }
//Moves the actor to the new zone if exists. No packets are sent nor position changed. public void DoSeamlessZoneChange(Player player, uint destinationZoneId) { Area oldZone; if (player.zone != null) { oldZone = player.zone; oldZone.removeActorFromZone(player); } //Add player to new zone and update Zone newZone = GetZone(destinationZoneId); //This server does not contain that zoneId if (newZone == null) { return; } newZone.addActorToZone(player); LuaEngine.onZoneIn(player); }
//Login Zone In public void DoLogin(Player player) { //Add player to new zone and update Zone zone = GetZone(player.zoneId); //This server does not contain that zoneId if (zone == null) { return; } //Set the current zone and add player player.zone = zone; LuaEngine.onBeginLogin(player); zone.addActorToZone(player); //Send packets player.sendZoneInPackets(this, 0x1); LuaEngine.onLogin(player); LuaEngine.onZoneIn(player); }