Example #1
0
        public static bool EditZone(Zone zone)
        {
            ZoneForm z = new ZoneForm();

            z.SetZone(zone);
            return(z.ShowDialog() == DialogResult.OK);
        }
Example #2
0
        private static void HandlePlayerCoordsChanged(ReceivedChat message)
        {
            //	local result = sprintf("%s\2%s\2%s\2%s\2%s\2%s", player.Name, player.HP, player.MaxHP, player.X, player.Y, player.Z);
            string[] detail = message.Message.Split((char)2);
            detail[3] = (Math.Round(Convert.ToDouble(detail[3]), 0)).ToString();
            detail[4] = (Math.Round(Convert.ToDouble(detail[4]), 0)).ToString();
            detail[5] = (Math.Round(Convert.ToDouble(detail[5]), 0)).ToString();

            _currentCoordinates = new Vector3((Math.Round(Convert.ToDouble(detail[3]), 0)), (Math.Round(Convert.ToDouble(detail[4]), 0)), (Math.Round(Convert.ToDouble(detail[5]), 0)));

            //this.Text = string.Format("{0} ({1}/{2}) {3},{4},{5}", detail);

            try
            {
                int zoneId = Convert.ToInt32(detail[6]);
                zoneId = zoneId % 1000;
                Zone z = (Zone)World.Data.Zones.Find(zone => zone.Id == zoneId);
                if (z == null)
                {
                    z      = new Zone();
                    z.Id   = zoneId;
                    z.Name = "New Zone Discovered";

                    if (ZoneForm.EditZone(z))
                    {
                        World.Data.Zones.Add(z);
                        World.SaveToDirectory(Path.GetFullPath("."));
                    }
                    //zoneBindingSource.ResetBindings(false);
                }

                _currentZone = z;
                //zoneComboBox.SelectedItem = z;
                GameNode node = World.FindNearestNode(World.PlayerPos);
                if (node != null)
                {
                    _nearestNode = node;
                }
            }
            catch (Exception)
            {
                throw;
            }

            //if (NodeVisualiser.Visualiser != null) NodeVisualiser.Visualiser.UpdatePlayerPosition();
            //DisplayMap();
        }