Exemple #1
0
        private void ChangeMap(ZoneCharacter character, params string[] param)
        {
            ushort mapid = 0;

            if (!ushort.TryParse(param[1], out mapid))
            {
                param[1] = param[1].ToLower();
                var map = DataProvider.Instance.MapsByID.Values.ToList().Find(m => m.ShortName.ToLower() == param[1]);
                if (map != null)
                {
                    mapid = map.ID;
                }
                else
                {
                    character.DropMessage("Map not found");
                    return;
                }
            }
            else
            {
                if (!DataProvider.Instance.MapsByID.ContainsKey(mapid))
                {
                    character.DropMessage("Map not found");
                    return;
                }
            }

            if (param.Length > 2)
            {
                int x = int.Parse(param[2]);
                int y = int.Parse(param[3]);
                character.ChangeMap(mapid, x, y);
            }
            character.ChangeMap(mapid);
        }
Exemple #2
0
        private void Movetoplayer(ZoneCharacter character, params string[] param)
        {
            var player  = param[1];
            var playerC = ClientManager.Instance.GetClientByName(player);

            character.ChangeMap(playerC.Character.MapID, playerC.Character.Position.X, character.Position.Y);
        }
Exemple #3
0
        private static void AnswerOnGateQuestion(ZoneCharacter character, byte answer)
        {
            Npc     npc = (character.Question.Object as Npc);
            MapInfo mi  = null;

            if (DataProvider.Instance.MapsByName.TryGetValue(npc.Gate.MapServer, out mi))
            {
                switch (answer)
                {
                case 0:
                    character.ChangeMap(mi.ID, npc.Gate.CoordX, npc.Gate.CoordY);
                    break;

                case 1: break;

                default:
                    Log.WriteLine(LogLevel.Warn, "Invalid gate question response.");
                    break;
                }
            }
        }