public override void Execute() { SendOk("Welcome to RazzleServer"); var mapIds = new[] { 100000000, 101000000 }; var result = SendChoice("Where do you want to go?" + Blue(CreateSelectionList(NpcListType.Map, mapIds))); if (result >= 0) { GameCharacter.ChangeMap(mapIds[result]); } }
public override void Execute(GameCharacter caller, string[] args) { if (args.Length == 0) { ShowSyntax(caller); return; } if (args[0] == "-current") { caller.Notify("[Command] Current map: " + caller.Map.MapleId); caller.Notify(" -X: " + caller.Position.X); caller.Notify(" -Y: " + caller.Position.Y); return; } var mapName = ""; int mapId = int.TryParse(args[0], out mapId) ? mapId : -1; byte portalId = 0; if (args.Length >= 2) { byte.TryParse(args[1], out portalId); } if (mapId == -1) { mapName = string.Join(" ", args); Enum.TryParse(mapName, true, out CommandMaps val); if (val > 0) { mapId = (int)val; } } if (CachedData.Maps.Data.ContainsKey(mapId)) { caller.ChangeMap(mapId, portalId); } else { caller.Notify($"[Command] Invalid map name: {mapName}"); } }