-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Crossing Temple path display bug
* Add sub alias to math/counter * Print command in window it was executed in (ex shopwindow) fixes #52
- Loading branch information
1 parent
176fd6a
commit 6133643
Showing
10 changed files
with
251 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/src/Outlander/Handlers/EmulateTextCommandHandler.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// EmulateTextCommandHandler.swift | ||
// Outlander | ||
// | ||
// Created by Joe McBride on 9/6/24. | ||
// Copyright © 2024 Joe McBride. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
class EmulateTextCommandHandler: ICommandHandler { | ||
var command = "#emulate" | ||
|
||
private let files: FileSystem | ||
private let log = LogManager.getLog(String(describing: EmulateTextCommandHandler.self)) | ||
let queue = DispatchQueue(label: "swiftlee.concurrent.queue", qos: .background) | ||
|
||
init(_ files: FileSystem) { | ||
self.files = files | ||
} | ||
|
||
func handle(_ input: String, with: GameContext) { | ||
let commands = input[command.count...].trimmingCharacters(in: .whitespacesAndNewlines).components(separatedBy: " ").filter { !$0.isEmpty } | ||
|
||
if commands.isEmpty { | ||
return | ||
} | ||
|
||
let fileName = commands[0] | ||
let filePath = with.applicationSettings.paths.logs.appendingPathComponent(fileName) | ||
|
||
if self.files.fileExists(filePath) { | ||
guard let data = self.files.load(filePath) else { | ||
return | ||
} | ||
|
||
guard let fileString = String(data: data, encoding: .utf8) else { | ||
return | ||
} | ||
|
||
let lines = fileString.components(separatedBy: .newlines) | ||
|
||
for line in lines { | ||
queue.async { | ||
with.events2.emulateGameText(line + "\r\n") | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.