public Place(RdlPlace tag) : base(tag) { Init(); // Actors foreach (var actor in tag.Actors) { this.Actors.Add(new Actor(actor)); } }
public void Refresh(RdlPlace place) { this.Place = new Place(place); this.RenderLocation = new Point(this.Place.X * this.Width, this.Place.Y * this.Height); this.SetExits(); var terrain = Game.Terrain.Where(t => t.ID == place.Properties.GetValue <int>("Terrain")).FirstOrDefault(); if (terrain != null) { this.Fill = Brushes.GetBrush(terrain.GetColor()); } }
private void DrawTile(Point mousePosition) { // See if a tile already exists. Tile tile = null; RdlPlace place = null; int x = (int)(mousePosition.X / Tile.TileWidth); int y = (int)(mousePosition.Y / Tile.TileHeight); var terrain = cboTerrain.SelectedItem as Terrain; var desc = cboPlaceType.SelectedItem as PlaceTypeDesc; tile = _tiles.Where(t => t.Location.X == x && t.Location.Y == y && t.Location.Z == _zIndex).FirstOrDefault(); if (tile == null) { place = new RdlPlace(0, txtPlaceName.Text, x, y, _zIndex); tile = new Tile(place); _tiles.Add(tile); } else { place = tile.Place; } if (terrain != null) { tile.Place.Properties.SetValue("Terrain", terrain.ID); } if (desc != null) { tile.Place.Properties.SetValue("RuntimeType", desc.Name); } if (desc.Name.Contains("Wilderness")) { tile.Place.Properties.SetValue("CreatureMinLevel", txtMinCreatureLevel.Text); tile.Place.Properties.SetValue("CreatureMaxLevel", txtMaxCreatureLevel.Text); } tile.IsModified = true; tile.Refresh(place); this.RenderMap(); }
private void client_SavePlacesCompleted(object sender, SavePlacesCompletedEventArgs e) { _placesSavedCount++; if (_placesSavedCount >= _placesToSaveCount) { _placesSavedCount = 0; _placesToSaveCount = 0; ctlWait.Hide(); } if (e.Result.Success) { // TODO: Display successful save. RdlTagCollection tags = RdlTagCollection.FromString(e.Result.TagString); RdlPlace place = e.UserState as RdlPlace; if (place != null) { var savedPlace = tags.GetPlaces().Where(p => p.X == place.X && p.Y == place.Y && p.Z == place.Z).FirstOrDefault(); if (savedPlace != null) { place = savedPlace; } var tile = _tiles.Where(t => t.Location.X == place.X && t.Location.Y == place.Y && t.Location.Z == place.Z).FirstOrDefault(); if (tile != null) { tile.IsModified = false; tile.Refresh(place); } } } else { // TODO: Display error message. } }
private void ProcessTags(RdlTagCollection tags) { // AuthKey tags this.UpdateAuthKeys(tags.Where(t => t.TagName == "AUTH").Select(t => t as RdlAuthKey)); // Place Types var placeTypes = tags.Where(t => t.TagName == "PLACETYPE" && t.TypeName == "PLACETYPE"); if (placeTypes.Count() > 0) { List <string> types = new List <string>(); foreach (var pt in placeTypes) { types.Add(pt.GetArg <string>(0)); } ddlPlaceTypes.ItemsSource = types; } // Properties if (this.Player != null) { var properties = tags.GetProperties(_playerId); if (properties != null && properties.Count > 0) { // Location Point3 location = new Point3(this.Player.X, this.Player.Y, this.Player.Z); // Loop through all of the properties. foreach (var item in properties) { // All other properties. this.Player.Properties.SetValue(item.Name, item.Value); } Point3 playerLoc = new Point3(this.Player.X, this.Player.Y, this.Player.Z); if (location != playerLoc) { ctlMap.SetView(playerLoc); } } } int count = tags.GetObjects <RdlPlace>().Count; if (count == 1) { // Place RdlPlace place = tags.GetObjects <RdlPlace>().FirstOrDefault(); if (place != null) { _placeId = place.ID; _currentLocation = new Point3(place.X, place.Y, place.Z); txtPlaceName.Text = place.Name; txtPlaceDesc.Text = place.Properties.GetValue <string>("Description") ?? String.Empty; ddlPlaceTypes.SelectedItem = place.Properties.GetValue <string>("RuntimeType"); ddlTerrain.SelectedItem = Game.Terrain.Where(t => t.ID == place.Properties.GetValue <int>("Terrain")).FirstOrDefault(); ctlMap.Tiles.Add(new Tile(place)); ctlMap.SetView(new Point3(this.Player.X, this.Player.Y, this.Player.Z)); ctlMap.HideLoading(); } List <RdlActor> actors = tags.GetActors(); if (actors.Count > 0) { lstActors.ItemsSource = actors; } } else if (count > 1) { // Map ctlMap.LoadMap(tags); ctlMap.SetView(new Point3(this.Player.X, this.Player.Y, this.Player.Z)); ctlMap.HideLoading(); } // Chat Messages ctlChat.WriteMessages(tags); }
public PlaceEventArgs(RdlPlace place) { this.Place = place; }
public Wilderness(RdlPlace placeTag) : base(placeTag) { }
public Temple(RdlPlace placeTag) : base(placeTag) { }
public DungeonFinalRoom(RdlPlace placeTag) : base(placeTag) { }
public DungeonEntrance(RdlPlace placeTag) : base(placeTag) { }
public Room(RdlPlace placeTag) : base(placeTag) { Init(); }
public Dungeon(RdlPlace placeTag) : base(placeTag) { }
public Tile(RdlPlace place) : this() { this.Refresh(place); }
/// <summary> /// Initializes a new instance of the Place class from the specified RdlPlace and RdlProperty tags. /// </summary> /// <param name="placeTag">The RdlPlace tag containing the ID, Name and Location of the place.</param> public Place(RdlPlace placeTag) : base((RdlActor)placeTag) { this.Init(); this.Location = new Point3(placeTag.X, placeTag.Y, placeTag.Z); }