Skip to content

Commit

Permalink
HSTracker version 2.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
fmoraes74 committed Jun 30, 2023
1 parent 585337f commit 99175cf
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.4.7
## New
- Updated for Hearthstone 26.6.0

# 2.4.6
## New
- Updated for Hearthstone 26.4.3
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.6;
MARKETING_VERSION = 2.4.7;
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.6;
MARKETING_VERSION = 2.4.7;
OTHER_CODE_SIGN_FLAGS = "--deep";
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = net.hearthsim.hstracker;
Expand Down
4 changes: 4 additions & 0 deletions HSTracker/Database/Models/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ final class Card {
cc == cardClass
}) != nil
}

func isNeutral() -> Bool {
return playerClass == .neutral && multiClassGroup == .invalid
}

static let pluralRegex = Regex("\\$(\\d+) \\|4\\((\\w+),(\\w+)\\)")

Expand Down
4 changes: 4 additions & 0 deletions HSTracker/Database/Models/Deck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ class Deck: Object {
return sortedCards.all { CardSet.classicSets().contains($0.set ?? .invalid) }
}

var isTwistDeck: Bool {
return sortedCards.all { CardSet.twistSets().contains($0.set ?? .invalid) && !$0.isNeutral() }
}

/**
* Compares the card content to the other deck
*/
Expand Down
2 changes: 1 addition & 1 deletion HSTracker/HearthMirror-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
beb40fbc0797df99f06a61af246c90bcc6f14186
146d55bf6221f240a9243a9873039f93dc3a60fa
2 changes: 2 additions & 0 deletions HSTracker/HearthMirror/MatchInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ struct MatchInfo {
var wildMedalInfo: MedalInfo
var standardMedalInfo: MedalInfo
var classicMedalInfo: MedalInfo
var twistMedalInfo: MedalInfo
var cardBackId: Int

init(player: MirrorPlayer) {
Expand All @@ -50,6 +51,7 @@ struct MatchInfo {
self.standardMedalInfo = MedalInfo(mirrorMedalInfo: player.standardMedalInfo)
self.wildMedalInfo = MedalInfo(mirrorMedalInfo: player.wildMedalInfo)
self.classicMedalInfo = MedalInfo(mirrorMedalInfo: player.classicMedalInfo)
self.twistMedalInfo = MedalInfo(mirrorMedalInfo: player.twistMedalInfo)
}
}

Expand Down
3 changes: 3 additions & 0 deletions HSTracker/Hearthstone/Secrets/MultiIdCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class MultiIdCard: Hashable, Equatable {
var isWild: Bool { cards.any({ x in !CardSet.classicSets().contains(x.set ?? .invalid)})}
var isClassic: Bool { cards.any({ x in CardSet.classicSets().contains(x.set ?? .invalid)})}
var isStandard: Bool { cards.any({ x in !CardSet.wildSets().contains(x.set ?? .invalid) && !CardSet.classicSets().contains(x.set ?? .invalid)})}
var isTwist: Bool { cards.any({ x in !CardSet.twistSets().contains(x.set ?? .invalid) && !x.isNeutral()})}

func hasSet(set: CardSet) -> Bool {
return cards.any { x in x.set == set }
Expand Down Expand Up @@ -63,6 +64,8 @@ class MultiIdCard: Hashable, Equatable {
return cards.first { x in CardSet.classicSets().contains(x.set ?? .invalid) } ?? cards[0]
case .ft_standard:
return cards.first { x in !CardSet.wildSets().contains(x.set ?? .invalid) && !CardSet.classicSets().contains(x.set ?? .invalid) } ?? cards[0]
case .ft_twist:
return cards.first { x in CardSet.twistSets().contains(x.set ?? .invalid) } ?? cards[0]
case .ft_unknown:
return cards[0]
}
Expand Down
9 changes: 6 additions & 3 deletions HSTracker/Hearthstone/Secrets/SecretsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ class SecretsManager {
remoteData.arena?.exclusive_secrets?.all { s in card != s } ?? true
})
}
if format == .standard {
switch format {
case .standard:
cards = cards.filter { card in card.isStandard }
} else if format == .classic {
case .classic:
cards = cards.filter { card in card.isClassic }
} else if format == .wild {
case .twist:
cards = cards.filter { card in card.isTwist }
default:
cards = cards.filter { card in card.isWild }
}
}
Expand Down
5 changes: 4 additions & 1 deletion HSTracker/Logging/Enums/BnetGameType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ enum BnetGameType: Int {
bgt_ranked_classic = 58,
bgt_casual_classic = 59,
bgt_mercenaries_pve_coop = 60,
bgt_mercenaries_friendly = 61
bgt_mercenaries_friendly = 61,
bgt_battlegrounds_player_vs_ai = 62,
bgt_ranked_twist = 63,
bgt_casual_twist = 64

static func getBnetGameType(gameType: GameType, format: Format?) -> BnetGameType {
switch gameType {
Expand Down
15 changes: 13 additions & 2 deletions HSTracker/Logging/Enums/CardSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ enum CardSet: String, CaseIterable {
return_of_the_lich_king,
path_of_arthas,
battle_of_the_bands,
placeholder_202204
placeholder_202204,
titans

static func deckManagerValidCardSets() -> [CardSet] {
return [.all, .vanilla, .core, .basic, .expert1, .naxx, .gvg, .brm, .tgt,
Expand All @@ -67,7 +68,8 @@ enum CardSet: String, CaseIterable {
.dalaran, .uldum, .dragons, .year_of_the_dragon,
.black_temple, .demon_hunter_initiate, .scholomance, .darkmoon_faire,
.the_barrens, .wailing_caverns, .stormwind, .alterac_valley,
.the_sunken_city, .revendreth, .return_of_the_lich_king, .path_of_arthas, .battle_of_the_bands ]
.the_sunken_city, .revendreth, .return_of_the_lich_king, .path_of_arthas, .battle_of_the_bands,
.titans]
}

static func wildSets() -> [CardSet] {
Expand All @@ -86,6 +88,14 @@ enum CardSet: String, CaseIterable {
static func classicSets() -> [CardSet] {
return [ .vanilla ]
}

static func twistSets() -> [CardSet] {
return [ .battle_of_the_bands, .return_of_the_lich_king, .path_of_arthas,
.revendreth, .the_sunken_city, .core,
.alterac_valley, .stormwind, .the_barrens,
.darkmoon_faire, .scholomance, .demon_hunter_initiate,
.black_temple]
}
}

public enum CardSetInt: Int {
Expand Down Expand Up @@ -147,5 +157,6 @@ public enum CardSetInt: Int {
return_of_the_lich_king = 1776,
battle_of_bands = 1809,
placeholder_202204 = 1810,
titans = 1858,
path_of_arthas = 1869
}
5 changes: 3 additions & 2 deletions HSTracker/Logging/Enums/DeckType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ enum DeckType: Int, CaseIterable {
case all,
standard,
wild,
classic,
classic, // unused
arena,
duels,
dungeon
dungeon,
twist
}
7 changes: 6 additions & 1 deletion HSTracker/Logging/Enums/Format.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ enum Format: String {
all,
standard,
wild,
classic
classic,
twist

init(formatType: FormatType) {
switch formatType {
Expand All @@ -23,6 +24,8 @@ enum Format: String {
self = .standard
case .ft_classic:
self = .classic
case .ft_twist:
self = .twist
default:
self = .unknown
}
Expand All @@ -36,6 +39,8 @@ enum Format: String {
return .ft_wild
case .classic:
return .ft_classic
case .twist:
return .ft_twist
default: return .ft_unknown
}
}
Expand Down
3 changes: 2 additions & 1 deletion HSTracker/Logging/Enums/FormatType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ enum FormatType: Int {
case ft_unknown = 0,
ft_wild = 1,
ft_standard = 2,
ft_classic = 3
ft_classic = 3,
ft_twist = 4
}
9 changes: 7 additions & 2 deletions HSTracker/Logging/Game.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1700,13 +1700,17 @@ class Game: NSObject, PowerEventHandler {
if let matchInfo = self.matchInfo, self.currentGameMode == .ranked {
let wild = self.currentFormat == .wild
let classic = self.currentFormat == .classic

let twist = self.currentFormat == .twist

if wild {
result.playerMedalInfo = matchInfo.localPlayer.wildMedalInfo
result.opponentMedalInfo = matchInfo.opposingPlayer.wildMedalInfo
} else if classic {
result.playerMedalInfo = matchInfo.localPlayer.classicMedalInfo
result.opponentMedalInfo = matchInfo.opposingPlayer.classicMedalInfo
} else if twist {
result.playerMedalInfo = matchInfo.localPlayer.twistMedalInfo;
result.opponentMedalInfo = matchInfo.opposingPlayer.twistMedalInfo;
} else {
result.playerMedalInfo = matchInfo.localPlayer.standardMedalInfo
result.opponentMedalInfo = matchInfo.opposingPlayer.standardMedalInfo
Expand Down Expand Up @@ -2269,10 +2273,11 @@ class Game: NSObject, PowerEventHandler {
let hasCoin = player.hasCoin
let isWild = currentFormat == .wild
let isClassic = currentFormat == .classic
let isTwist = currentFormat == .twist
var playerStarLevel = 0
if let matchInfo = matchInfo {
let localPlayer = matchInfo.localPlayer
let playerInfo = isClassic ? localPlayer.classicMedalInfo : isWild ? localPlayer.wildMedalInfo : localPlayer.standardMedalInfo
let playerInfo = isClassic ? localPlayer.classicMedalInfo : isWild ? localPlayer.wildMedalInfo : isTwist ? localPlayer.twistMedalInfo : localPlayer.standardMedalInfo
playerStarLevel = playerInfo.starLevel
}
let sid = ShortIdHelper.getShortId(deck: currentDeck)
Expand Down
2 changes: 2 additions & 0 deletions HSTracker/UIs/DeckManager/DeckManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ class DeckManager: NSWindowController {
return !deck.isWildDeck
case .classic:
return deck.isClassicDeck
case .twist:
return deck.isTwistDeck
}
}

Expand Down
2 changes: 1 addition & 1 deletion HSTracker/cards-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
178555
179020
2 changes: 2 additions & 0 deletions Translations/macOS/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"RETURN_OF_THE_LICH_KING" = "March of the Lich King";
"PATH_OF_ARTHAS" = "Path of Arthas";
"BATTLE_OF_THE_BANDS" = "Festival of Legends";
"TITANS" = "Titans";

/* card type */
"all_types" = "All";
Expand Down Expand Up @@ -202,6 +203,7 @@
"DeckType_dungeon" = "Dungeon Run";
"DeckType_duels" = "Duels";
"DeckType_classic" = "Classic";
"DeckType_twist" = "Twist";

/* Stats tabs */
"Statistics" = "Statistics";
Expand Down

0 comments on commit 99175cf

Please sign in to comment.