public DoorsCommands(MapWindow mapWindow) { _map = mapWindow; Store.ComplexAlias.SubscribeAsync(async(message) => { await ProcessDoorCommands(message); }); }
public RoomFinder( MapWindow mapWindow) { _map = mapWindow; _movementFailedRegex = new Regex(string.Join("$|", _movementFailedStrings), RegexOptions.Compiled); Store.TcpSend.Subscribe((message) => { ProcessSentMessage(message); }); Store.ParsedOutput.SubscribeAsync(async(parsedOutputs) => { await ProcessParsedOutput(parsedOutputs); }); Store.ComplexAlias.Subscribe((output) => { var cleaned = output.Trim().ToLower(); if (cleaned == "qf") { QuickFind(); } if (cleaned.StartsWith("mv ") && cleaned.Length > 3) { var match = Regex.Match(cleaned, @"^mv ((?<count>\d*)?(?<direction>n|e|s|w|u|d))+$"); var counts = match.Groups["count"].Captures; var directions = match.Groups["direction"].Captures; for (int i = 0; i < counts.Count; i++) { int count = 1; var countString = counts[i].Value; if (countString.Length > 0) { count = int.Parse(countString); } var direction = directions[i].Value; for (int j = 0; j < count; j++) { MoveVirtualRoom(direction); FindSmartRoomId(); } } } }); }