예제 #1
0
        private void button9_Click(object sender, EventArgs e)
        {
            var world    = ServerContext.GlobalWorldMapTemplateCache.Values.ElementAt(comboBox3.SelectedIndex);
            var template = new WarpTemplate();

            template.To = new Warp()
            {
                AreaId    = 0,
                PortalKey = (int)world.FieldNumber
            };

            template.ActivationMapId = _selectedArea.Id;
            template.Activations     = new List <Warp>();

            foreach (var activation in _worldactivations)
            {
                template.Activations.Add(new Warp()
                {
                    AreaId   = _selectedArea.Id,
                    Location = activation
                });
            }

            template.LevelRequired = 1;
            template.WarpType      = WarpType.World;
            template.WarpRadius    = 0;
            template.Name          = $"Warp from {_selectedArea.Id} to World Map.";

            StorageManager.WarpBucket.Save(template);
            ServerContext.LoadAndCacheStorage(true);
            MessageBox.Show("World Map Warp Created.");
        }
예제 #2
0
        public void WarpTo(WarpTemplate warps)
        {
            if (warps.WarpType == WarpType.World)
            {
                return;
            }

            if (ServerContext.GlobalMapCache.Values.Any(i => i.ID == warps.ActivationMapId))
            {
                if (warps.LevelRequired > 0 && Aisling.ExpLevel < warps.LevelRequired)
                {
                    var msgTier = Math.Abs(Aisling.ExpLevel - warps.LevelRequired);

                    SendMessage(0x02, msgTier <= 10
                        ? string.Format("You can't enter there just yet. ({0} req)", warps.LevelRequired)
                        : string.Format("Nightmarish visions of your own death repel you. ({0} Req)", warps.LevelRequired));
                    return;
                }

                if (Aisling.Map.ID != warps.To.AreaID)
                {
                    TransitionToMap(warps.To.AreaID, warps.To.Location);
                }
                else
                {
                    LeaveArea(true);
                    Aisling.X = warps.To.Location.X;
                    Aisling.Y = warps.To.Location.Y;
                    EnterArea();
                    Aisling.Client.CloseDialog();
                }
            }
        }
예제 #3
0
        private void CreateTargetWarpTemplate(int locationX, int locationY, int levelReq)
        {
            var template = new WarpTemplate
            {
                To = new Warp {
                    AreaId = _connectingArea.Id, Location = new Position(locationX, locationY)
                },
                ActivationMapId = _selectedArea.Id,
                Activations     = new List <Warp>()
            };

            foreach (var activation in _activations)
            {
                template.Activations.Add(new Warp()
                {
                    AreaId   = _selectedArea.Id,
                    Location = activation
                });
            }

            template.LevelRequired = Convert.ToByte(levelReq);
            template.WarpType      = WarpType.Map;
            template.WarpRadius    = 0;
            template.Name          = $"Map Warp from {_selectedArea.Id} to {_connectingArea.Id}";

            StorageManager.WarpBucket.Save(template);
        }
예제 #4
0
        private void CreateTargetWarpTemplate(int id, int LocationX, int LocationY, int levelReq)
        {
            var template = new WarpTemplate();

            template.To = new Warp()
            {
                AreaID   = id,
                Location = new Position(LocationX, LocationY),
            };

            template.ActivationMapId = SelectedArea.ID;
            template.Activations     = new List <Warp>();

            foreach (var activation in Activations)
            {
                template.Activations.Add(new Warp()
                {
                    AreaID   = SelectedArea.ID,
                    Location = activation,
                });
            }

            template.LevelRequired = Convert.ToByte(levelReq);
            template.WarpType      = WarpType.Map;
            template.WarpRadius    = 0;
            template.Name          = string.Format("Map Warp from {0} to {1}", SelectedArea.ID, id);

            StorageManager.WarpBucket.Save(template);
        }
        private void CreateReturnWarpTemplate(int id, int PreviousX, int PreviousY, int levelReq)
        {
            var template = new WarpTemplate();

            template.To = new Warp()
            {
                AreaID    = SelectedArea.ID,
                Location  = new Position(PreviousX, PreviousY),
                PortalKey = 0
            };

            template.ActivationMapId = id;
            template.Activations     = new List <Warp>();

            foreach (var activation in PreviousActivations)
            {
                template.Activations.Add(new Warp()
                {
                    AreaID    = id,
                    Location  = activation,
                    PortalKey = 0
                });
            }

            template.LevelRequired = Convert.ToByte(levelReq);
            template.WarpType      = WarpType.Map;
            template.WarpRadius    = 0;
            template.Name          = string.Format("Map Warp from {0} to {1}", id, SelectedArea.ID);

            StorageManager.WarpBucket.Save(template);
        }
예제 #6
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox1.Text))
            {
                MessageBox.Show("Error, You Must give it a name.");
                return;
            }

            if (SelectedPoint.X == 0 || SelectedPoint.Y == 0)
            {
                MessageBox.Show("Error, You Select a point in the map first.");
                return;
            }

            if (SelectedArea == null)
            {
                MessageBox.Show("Error, You Must select a map to warp to.");
                return;
            }

            try
            {
                var template = new WarpTemplate();

                template.To = new Warp()
                {
                    AreaID    = 0,
                    PortalKey = 1
                };

                template.ActivationMapId = SelectedArea.ID;
                template.Activations     = new List <Warp>();

                foreach (var activation in Activations)
                {
                    template.Activations.Add(new Warp()
                    {
                        AreaID    = SelectedArea.ID,
                        Location  = activation,
                        PortalKey = 0
                    });
                }

                template.LevelRequired = 1;
                template.WarpType      = WarpType.World;
                template.WarpRadius    = 0;
                template.Name          = string.Format("Warp from {0} to World Map.", SelectedArea.ID);

                StorageManager.WarpBucket.Save(template);
                ServerContext.LoadAndCacheStorage();
                MessageBox.Show("Warp Added. for this return point.");
            }
            catch (Exception)
            {
                MessageBox.Show("Error, Warp could not be saved.");
                return;
            }
        }
예제 #7
0
        public void WarpTo(WarpTemplate warps)
        {
            if (warps.WarpType == WarpType.World)
            {
                return;
            }

            if (ServerContext.GlobalMapCache.Values.Any(i => i.ID == warps.ActivationMapId))
            {
                if (warps.LevelRequired > 0 && Aisling.ExpLevel < warps.LevelRequired)
                {
                    var msgTier = Math.Abs(Aisling.ExpLevel - warps.LevelRequired);

                    SendMessage(0x02,
                                msgTier <= 10 ? "You can't enter there just yet." : "You have nightmarish visions.");
                    return;
                }

                if (Aisling.Map.ID != warps.To.AreaID)
                {
                    LeaveArea(true, false);
                    Aisling.Map          = ServerContext.GlobalMapCache[warps.To.AreaID];
                    Aisling.X            = warps.To.Location.X;
                    Aisling.Y            = warps.To.Location.Y;
                    Aisling.CurrentMapId = warps.To.AreaID;
                    Aisling.AreaID       = Aisling.CurrentMapId;
                    EnterArea();
                    Aisling.Client.CloseDialog();
                }
                else
                {
                    LeaveArea(true, false);
                    Aisling.X = warps.To.Location.X;
                    Aisling.Y = warps.To.Location.Y;
                    EnterArea();
                    Aisling.Client.CloseDialog();
                }
            }
        }