public static void AppendNpcSpawn(IMap map, PacketHitList hitlist, int mapNpcSlot) { MapNpc mapNpc = map.ActiveNpc[mapNpcSlot]; foreach (Client i in map.GetSurroundingClients(map)) { i.Player.SeeNewCharacter(mapNpc); } hitlist.AddPacketToSurroundingPlayers(map, CreateNpcSpawn(mapNpc)); }
/* public static void SendJoinMap(Client client) { // Send all players on current map to client foreach (Client i in ClientManager.GetClients()) { Player player2 = i.Player; if (player2 != null) { if (i.IsPlaying() && i != client && player2.MapID == client.Player.MapID) { TcpPacket packet = TcpPacket.CreatePacket("playerdata", i.ConnectionID.ToString(), player2.Name, player2.GetActiveRecruit().Sprite.ToString(), player2.MapID, player2.X.ToString(), player2.Y.ToString(), ((int)player2.Direction).ToString(), ((int)player2.Access).ToString(), player2.PK.ToIntString(), player2.GuildName, ((int)player2.GuildAccess).ToString(), player2.Status); if (player2.ConfusionStepCounter > 0) { packet.AppendParameter("1"); } else { packet.AppendParameter("0"); } packet.AppendParameters((int)player2.GetActiveRecruit().StatusAilment, player2.GetActiveRecruit().VolatileStatus.Count); for (int j = 0; j < player2.GetActiveRecruit().VolatileStatus.Count; j++) { packet.AppendParameter(player2.GetActiveRecruit().VolatileStatus[j].Emoticon); } SendDataTo(client, packet); } } } //SendActiveTeamToMap(client, player.mMap); // Send client's player data to everyone on the map including himself SendPlayerData(client); } */ public static void SendLeaveMap(Client client, IMap map, bool shouldUnsee, bool logout) { if (map != null) { // Remove the player ID from the maps player list map.PlayersOnMap.Remove(client.Player.CharID); //if ((map.MapType == Enums.MapType.RDungeonMap || map.MapType == Enums.MapType.Instanced) && map.PlayersOnMap.Count > 0) { // map.Save(); //} if (logout) { shouldUnsee = true; } else { if (map.MapType == Enums.MapType.Instanced || map.MapType == Enums.MapType.RDungeonMap) { client.Player.AddMapToDelete(map.MapID); } } //remove from everyone's seencharacter list if (shouldUnsee) { foreach (Client i in map.GetSurroundingClients(map)) { i.Player.UnseeLeftPlayer(client.Player); } PacketHitList hitlist = null; PacketHitList.MethodStart(ref hitlist); //hitlist.AddPacketToPlayersInSightBut(client, map, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString()), client.Player.X, client.Player.Y, 30); hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString())); PacketHitList.MethodEnded(ref hitlist); //SendDataToMapBut(client, map.MapID, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString())); } } }