private void AddPlayer(Characters.Player p) { p.SetID(NextCharacterID); allCharacters.Add(p); players.Add(p); p.SendPacket(new ClientToInstancePackets.Map_Reset_c(map.Terrain.NumBlocksX, map.Terrain.NumBlocksY)); p.SendPacket(new ClientToInstancePackets.Character_Add_c(p.Id, CharacterType.Player, p.Info.Name)); p.SendPacket(new ClientToInstancePackets.Character_Position_c(p.Id, p.Position.x, p.Position.y)); p.SendPacket(new ClientToInstancePackets.Player_SetControl_c(p.Id)); p.SendPacket(new ClientToInstancePackets.Character_UpdateStats_c(p.Id, p.Stats)); UpdatePlayerMapView(p); UpdateCharacterView(p); Log.Log("Player joined instance. [" + p.Info.Name + "]"); }
private void UpdatePlayerMapView(Characters.Player p) { //Give whole map for now Single[,] block; for (int i = 0; i < map.Terrain.NumBlocksX; i++) { for (int j = 0; j < map.Terrain.NumBlocksY; j++) { block = map.Terrain.GetBlock(i, j); p.SendPacket(new ClientToInstancePackets.Map_TerrainBlock_c(i, j, block)); } } }