//Moves actor to new zone, and sends packets to spawn at the given coords. public void DoZoneChangeContent(Player player, PrivateAreaContent contentArea, float spawnX, float spawnY, float spawnZ, float spawnRotation, ushort spawnType = SetActorPositionPacket.SPAWNTYPE_WARP_DUTY) { //Content area was null if (contentArea == null) { Program.Log.Debug("Request to change to content area not on this server by: {0}.", player.customDisplayName); return; } player.playerSession.LockUpdates(true); Area oldZone = player.zone; //Remove player from currentZone if transfer else it's login if (player.zone != null) { oldZone.RemoveActorFromZone(player); } contentArea.AddActorToZone(player); //Update player actor's properties player.zoneId = contentArea.GetParentZone().actorId; player.privateArea = contentArea.GetPrivateAreaName(); player.privateAreaType = contentArea.GetPrivateAreaType(); player.zone = contentArea; player.positionX = spawnX; player.positionY = spawnY; player.positionZ = spawnZ; player.rotation = spawnRotation; //Send "You have entered an instance" if it's a Private Area player.SendGameMessage(GetActor(), 34108, 0x20); //Send packets player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId)); player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x10)); player.SendZoneInPackets(this, spawnType); player.playerSession.ClearInstance(); player.SendInstanceUpdate(); player.playerSession.LockUpdates(false); LuaEngine.GetInstance().CallLuaFunction(player, contentArea, "onZoneIn", true); }
//Session started, zone into world public void DoZoneIn(Player player, bool isLogin, ushort spawnType) { //Add player to new zone and update Area playerArea; if (player.privateArea != null) { playerArea = GetPrivateArea(player.zoneId, player.privateArea, player.privateAreaType); } else { playerArea = GetZone(player.zoneId); } //This server does not contain that zoneId if (playerArea == null) { return; } //Set the current zone and add player player.zone = playerArea; playerArea.AddActorToZone(player); //Send packets if (!isLogin) { player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId)); player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x2)); //player.SendZoneInPackets(this, spawnType); } player.SendZoneInPackets(this, spawnType); player.destinationZone = 0; player.destinationSpawnType = 0; Database.SavePlayerPosition(player); player.playerSession.LockUpdates(false); LuaEngine.GetInstance().CallLuaFunction(player, playerArea, "onZoneIn", true); }
//Moves actor to new zone, and sends packets to spawn at the given coords. public void DoZoneChange(Player player, uint destinationZoneId, string destinationPrivateArea, int destinationPrivateAreaType, byte spawnType, float spawnX, float spawnY, float spawnZ, float spawnRotation) { //Add player to new zone and update Area newArea; if (destinationPrivateArea == null) { newArea = GetZone(destinationZoneId); } else //Add check for -1 if it is a instance { newArea = GetZone(destinationZoneId).GetPrivateArea(destinationPrivateArea, (uint)destinationPrivateAreaType); } //This server does not contain that zoneId if (newArea == null) { Program.Log.Debug("Request to change to zone not on this server by: {0}.", player.customDisplayName); RequestWorldServerZoneChange(player, destinationZoneId, spawnType, spawnX, spawnY, spawnZ, spawnRotation); return; } player.playerSession.LockUpdates(true); Area oldZone = player.zone; //Remove player from currentZone if transfer else it's login if (player.zone != null) { oldZone.RemoveActorFromZone(player); } newArea.AddActorToZone(player); //Update player actor's properties player.zoneId = newArea is PrivateArea ? ((PrivateArea)newArea).GetParentZone().actorId : newArea.actorId; player.privateArea = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaName() : null; player.privateAreaType = newArea is PrivateArea ? ((PrivateArea)newArea).GetPrivateAreaType() : 0; player.zone = newArea; player.positionX = spawnX; player.positionY = spawnY; player.positionZ = spawnZ; player.rotation = spawnRotation; //Delete any GL directors GuildleveDirector glDirector = player.GetGuildleveDirector(); if (glDirector != null) { player.RemoveDirector(glDirector); } //Delete content if have if (player.currentContentGroup != null) { player.currentContentGroup.RemoveMember(player.actorId); player.SetCurrentContentGroup(null); if (oldZone is PrivateAreaContent) { ((PrivateAreaContent)oldZone).CheckDestroy(); } } //Send packets player.playerSession.QueuePacket(DeleteAllActorsPacket.BuildPacket(player.actorId)); player.playerSession.QueuePacket(_0xE2Packet.BuildPacket(player.actorId, 0x2)); player.SendZoneInPackets(this, spawnType); player.playerSession.ClearInstance(); player.SendInstanceUpdate(); player.playerSession.LockUpdates(false); //Send "You have entered an instance" if it's a Private Area if (newArea is PrivateArea) { player.SendGameMessage(GetActor(), 34108, 0x20); } LuaEngine.GetInstance().CallLuaFunction(player, newArea, "onZoneIn", true); }