Skip to content

Commit

Permalink
Version 2.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoraes74 committed Jun 2, 2023
1 parent 8da66de commit 35ba35b
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 13 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 2.4.5
## New
- Updated for Hearthstone 26.4.0

## Bob's Buddy:

- Added support for many Battlecry interactions with Rylak Metalhead
- Fixed various issues related to cards and mechanics added with Hearthstone 26.2.0.

# 2.4.4
## New
- Updated for path 26.2.2
Expand Down
4 changes: 2 additions & 2 deletions HSTracker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3938,7 +3938,7 @@
);
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native";
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.4.4;
MARKETING_VERSION = 2.4.5;
OTHER_CFLAGS = "$(inherited)";
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_LDFLAGS = "$(inherited)";
Expand Down Expand Up @@ -3983,7 +3983,7 @@
);
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/downloaded-frameworks/mono/runtimes/osx-x64/native";
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 2.4.4;
MARKETING_VERSION = 2.4.5;
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = net.hearthsim.hstracker;
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/BobsBuddy-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.2
1.10.3
2 changes: 1 addition & 1 deletion HSTracker/BobsBuddy/BobsBuddyInvoker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ class BobsBuddyInvoker {
var pHpData = playerHeroPower?[.tag_script_data_num_1] ?? 0

if playerHeroPower?.cardId == CardIds.NonCollectible.Neutral.TeronGorefiend_RapidReanimation {
let ench = game.player.playerEntities.first(where: { x in x.cardId == CardIds.NonCollectible.Neutral.TeronGorefiend_ImpendingDeath && (x.isInPlay || x.isInSetAside) })
let ench = game.player.playerEntities.first(where: { x in x.cardId == CardIds.NonCollectible.Neutral.TeronGorefiend_ImpendingDeath && (x.isInPlay || x.isInSetAside) }) ?? game.player.graveyard.last(where: { x in x.cardId == CardIds.NonCollectible.Neutral.TeronGorefiend_ImpendingDeath })
let target = ench?[.attached] ?? 0
if target > 0 {
pHpData = target
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/HearthMirror-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
27cde3077b888f9d850c874afd9999c3f98a9ff1
beb40fbc0797df99f06a61af246c90bcc6f14186
11 changes: 10 additions & 1 deletion HSTracker/HearthMirror/MirrorHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ struct MirrorHelper {
// waiting for mirror to be up and running
var attempts = 0
while attempts < 3 {
if let battleTag = mirror.getBattleTag() {
if let battleTag = mirror.getBattleTag(), let logDir = mirror.getLogSessionDir(), !logDir.isEmpty {
logger.verbose("Getting BattleTag from HearthMirror : \(battleTag)")
logger.verbose("Log directory: \(logDir)")
return mirror
} else {
// mirror might be partially initialized, reset
Expand Down Expand Up @@ -420,4 +421,12 @@ struct MirrorHelper {
}
return result ?? false
}

static func getLogSessionDir() -> String {
var result: String?
MirrorHelper.accessQueue.sync {
result = mirror?.getLogSessionDir()
}
return result ?? ""
}
}
17 changes: 16 additions & 1 deletion HSTracker/Logging/CoreManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ final class CoreManager: NSObject {
self.game = Game(hearthstoneRunState: HearthstoneRunState(isRunning: CoreManager.isHearthstoneRunning(),
isActive: CoreManager.isHearthstoneActive()))
super.init()
logReaderManager = LogReaderManager(logPath: Settings.hearthstonePath, coreManager: self)

let ok = Helper.ensureClientLogConfig()
if CoreManager.isHearthstoneRunning() && !ok {
NotificationManager.showNotification(type: .restartRequired)
}

let logPath = MirrorHelper.getLogSessionDir()
logReaderManager = LogReaderManager(logPath: logPath, coreManager: self)

self.toaster = Toaster(windowManager: game.windowManager)

Expand Down Expand Up @@ -260,6 +267,11 @@ final class CoreManager: NSObject {
let time = DispatchTime.now() + .seconds(1)
DispatchQueue.main.asyncAfter(deadline: time) { [unowned(unsafe) self] in
logger.info("Start Tracking")
if self.logReaderManager.running {
self.logReaderManager.stop(eraseLogFile: !CoreManager.isHearthstoneRunning())
}
let logPath = MirrorHelper.getLogSessionDir()
self.logReaderManager = LogReaderManager(logPath: logPath, coreManager: self)
self.logReaderManager.start()
}
}
Expand Down Expand Up @@ -310,6 +322,9 @@ final class CoreManager: NSObject {
if let app = notification.userInfo!["NSWorkspaceApplicationKey"] as? NSRunningApplication,
app.localizedName == CoreManager.applicationName {
logger.verbose("Hearthstone is now launched")
if !Helper.ensureClientLogConfig() {
NotificationManager.showNotification(type: .restartRequired)
}
self.startTracking()
self.game.setHearthstoneRunning(flag: true)
ExperienceWatcher._instance.startWatching()
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/Logging/LogReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class LogReader {
init(info: LogReaderInfo, logPath: String, removeLogfile: Bool = true) {
self.info = info

self.path = "\(logPath)/Logs/\(info.name.rawValue).log"
self.path = "\(logPath)/\(info.name.rawValue).log"
logger.info("Init reader for \(info.name) at path \(self.path)")
if fileManager.fileExists(atPath: self.path)
&& !FileUtils.isFileOpen(byHearthstone: self.path)
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/Mono/BrukanInvocationDeathrattles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BrukanInvocationDeathrattles: MonoClassInitializer {

static func initialize() {
if BrukanInvocationDeathrattles._class == nil {
BrukanInvocationDeathrattles._class = MonoHelper.loadClass(ns: "BobsBuddy", name: "BrukanInvocationDeathrattleActions")
BrukanInvocationDeathrattles._class = MonoHelper.loadClass(ns: "BobsBuddy.HeroPowers", name: "BrukanInvocationDeathrattleActions")
mono_class_init(BrukanInvocationDeathrattles._class)
_earth = MonoHelper.getField(BrukanInvocationDeathrattles._class, "Earth")
_fire = MonoHelper.getField(BrukanInvocationDeathrattles._class, "Fire")
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/Mono/ReplicatingMenace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ReplicatingMenace: MonoClassInitializer {

static func initialize() {
if ReplicatingMenace._class == nil {
ReplicatingMenace._class = MonoHelper.loadClass(ns: "BobsBuddy", name: "ReplicatingMenace")
ReplicatingMenace._class = MonoHelper.loadClass(ns: "BobsBuddy.Minions.Mech", name: "ReplicatingMenace")
ReplicatingMenace._deathrattle = MonoHelper.getMethod(ReplicatingMenace._class, "Deathrattle", 1)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class BattlegroundsHeroPickingViewModel: ViewModel {
if let selectedHeroIndex {
let direction = (selectedHeroIndex >= heroStats.count / 2) ? -1 : 1
for i in 0 ..< heroStats.count {
heroStats[i].setHiddenByHeroPower(i == selectedHeroIndex + direction || i == selectedHeroIndex + 2 * direction)
heroStats[i].setHiddenByHeroPower(i == selectedHeroIndex + direction)
}
} else {
for i in 0 ..< heroStats.count {
Expand Down
23 changes: 23 additions & 0 deletions HSTracker/Utility/Helper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,27 @@ struct Helper {
let pn = floor(Double(n) / divisor) * divisor
return Int(pn)
}

static func ensureClientLogConfig() -> Bool {
let targetContent = "[Log]\nFileSizeLimit.Int=-1"
let path = "\(Settings.hearthstonePath)client.config"
if FileManager.default.fileExists(atPath: path) {
if let content = FileManager.default.contents(atPath: path), let utf = String(data: content, encoding: .utf8) {
if utf == targetContent {
logger.info("client.config is up-to-date")
return true
}
}
}

// This probably need to be more lenient in the future and allow other file content
logger.info("Updating client.config")
do {
try FileManager.default.removeItem(atPath: path)
}
catch {
}
FileManager.default.createFile(atPath: path, contents: targetContent.data(using: .utf8))
return false
}
}
6 changes: 5 additions & 1 deletion HSTracker/Utility/NotificationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation

enum NotificationType {
case gameStart, turnStart, opponentConcede, hsReplayPush(replayId: String), hsReplayUploadFailed(error: String),
hsReplayCollectionUploaded, hsReplayMercenariesCollectionUploaded, hsReplayCollectionUploadFailed(error: String), hsReplayMercenariesCollectionUploadFailed(error: String), updateAvailable(version: String)
hsReplayCollectionUploaded, hsReplayMercenariesCollectionUploaded, hsReplayCollectionUploadFailed(error: String), hsReplayMercenariesCollectionUploadFailed(error: String), updateAvailable(version: String), restartRequired
}

class NotificationManager {
Expand Down Expand Up @@ -88,6 +88,10 @@ class NotificationManager {
message: String(format: NSLocalizedString("Version %@ is now available", comment: ""), version), duration: 30, action: {
AppDelegate.instance().sparkleUpdater.checkForUpdates(nil)
})
case .restartRequired:
show(title: NSLocalizedString("Hearthstone restart required!", comment: ""),
message: NSLocalizedString("Please restart Hearthstone", comment: ""), duration: 10)

}
}

Expand Down
2 changes: 1 addition & 1 deletion HSTracker/cards-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
176014
175913
2 changes: 2 additions & 0 deletions Translations/macOS/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
"Failed to upload Mercenaries collection: %@" = "Failed to upload Mercenaries collection: %@";
"A new update is available" = "A new update is available";
"Version %@ is now available" = "Version %@ is now available";
"Hearthstone restart required!" = "Hearthstone restart required!";
"Please restart Hearthstone" = "Please restart Hearthstone";

/* classes */
"shaman" = "Shaman";
Expand Down

0 comments on commit 35ba35b

Please sign in to comment.