Skip to content

Commit

Permalink
gold pass now properly grants all pro features
Browse files Browse the repository at this point in the history
  • Loading branch information
efroemling committed Dec 30, 2024
1 parent 368d63b commit 88e2aff
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 49 deletions.
56 changes: 28 additions & 28 deletions .efrocachemap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 1.7.37 (build 22150, api 9, 2024-12-28)
### 1.7.37 (build 22152, api 9, 2024-12-30)
- Bumping api version to 9. As you'll see below, there's some UI changes that
will require a bit of work for any UI mods to adapt to. If your mods don't
touch UI stuff at all you can simply bump your api version and call it a day.
Expand Down
2 changes: 1 addition & 1 deletion config/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cpplint==2.0.0
dmgbuild==1.6.2
filelock==3.16.1
furo==2024.8.6
mypy==1.14.0
mypy==1.14.1
pbxproj==4.2.1
pdoc==15.0.1
pur==7.3.3
Expand Down
7 changes: 3 additions & 4 deletions src/assets/ba_data/python/baclassic/_accountv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,12 @@ def have_pro(self) -> bool:
if plus is None:
return False

# Check our tickets-based pro upgrade and our two real-IAP based
# upgrades. Also always unlock this stuff in ballistica-core builds.
# Check various server-side purchases that mean we have pro.
return bool(
plus.get_v1_account_product_purchased('upgrades.pro')
plus.get_v1_account_product_purchased('gold_pass')
or plus.get_v1_account_product_purchased('upgrades.pro')
or plus.get_v1_account_product_purchased('static.pro')
or plus.get_v1_account_product_purchased('static.pro_sale')
or 'ballistica' + 'kit' == babase.appname()
)

def have_pro_options(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion src/assets/ba_data/python/baenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

# Build number and version of the ballistica binary we expect to be
# using.
TARGET_BALLISTICA_BUILD = 22150
TARGET_BALLISTICA_BUILD = 22152
TARGET_BALLISTICA_VERSION = '1.7.37'


Expand Down
10 changes: 9 additions & 1 deletion src/assets/ba_data/python/bauiv1lib/chest.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _on_chest_info_response(
return

if response.chest is None:
self._error('Would show general info about chests.')
self._show_about_chest_slots()
return

self.show_chest_actions(response.chest)
Expand Down Expand Up @@ -310,6 +310,14 @@ def _error(self, msg: str | bui.Lstr) -> None:
self._reset()
bui.textwidget(edit=self._infotext, text=msg, color=(1, 0, 0))

def _show_about_chest_slots(self) -> None:
self._reset()
msg = (
'This empty slot can hold a treasure chest.\n'
'Treasure chests are earned through gameplay.'
)
bui.textwidget(edit=self._infotext, text=msg, color=(1, 1, 1))

@override
def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes.
Expand Down
16 changes: 8 additions & 8 deletions src/assets/ba_data/python/bauiv1lib/resourcetypeinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,20 @@ def __init__(

if resource_type == 'tickets':
rdesc = (
'Use tickets to unlock characters, maps,\n'
'minigames, and more in the store.\n'
'Tickets can be used to unlock characters,\n'
'maps, minigames, and more in the store.\n'
'\n'
'Earn tickets by completing achievements or\n'
'by opening chests won in the game.'
'Earn tickets by completing achievements\n'
'or by opening chests won in the game.'
)
texname = 'tickets'
elif resource_type == 'tokens':
rdesc = (
'Tokens can be used to speed up chest unlocks\n'
'and skip other waits.\n'
'Tokens have various uses in the game such as\n'
'speeding up chest unlocks.\n'
'\n'
'You can buy packs of tokens or buy a Gold Pass\n'
'to get infinite tokens forever.\n'
'You can buy packs of tokens or you can buy a\n'
'Gold Pass to get unlimited tokens.\n'
)
texname = 'coin'
elif resource_type == 'trophies':
Expand Down
2 changes: 1 addition & 1 deletion src/ballistica/shared/ballistica.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ auto main(int argc, char** argv) -> int {
namespace ballistica {

// These are set automatically via script; don't modify them here.
const int kEngineBuildNumber = 22150;
const int kEngineBuildNumber = 22152;
const char* kEngineVersion = "1.7.37";
const int kEngineApiVersion = 9;

Expand Down
19 changes: 15 additions & 4 deletions src/ballistica/ui_v1/widget/root_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1396,22 +1396,31 @@ void RootWidget::SetTicketsMeterText(const std::string& val) {
void RootWidget::SetTokensMeterText(const std::string& val, bool gold_pass) {
assert(tokens_meter_text_);
assert(get_tokens_button_);
if (gold_pass) {
gold_pass_ = gold_pass;
if (gold_pass_) {
get_tokens_button_->force_hide = true;

// Use the infinity symbol if we have full unicode support.
tokens_meter_text_->widget->SetText(
g_buildconfig.enable_os_font_rendering() ? "\xE2\x88\x9E" : "inf");
tokens_meter_text_->widget->set_color(1.0f, 0.6f, 0.1f, 0.6f);
} else {
get_tokens_button_->force_hide = false;
tokens_meter_text_->widget->SetText(val);
tokens_meter_text_->widget->set_color(1.0f, 1.0f, 1.0f, 1.0f);
}
UpdateTokensMeterTextColor_();
// May need to animate in/out.
child_widgets_dirty_ = true;
}

void RootWidget::UpdateTokensMeterTextColor_() {
auto oval{have_live_values_ ? 1.0f : 0.4f};
if (gold_pass_ && have_live_values_) {
tokens_meter_text_->widget->set_color(1.0f, 0.6f, 0.1f, 0.6f);
} else {
tokens_meter_text_->widget->set_color(1.0f, 1.0f, 1.0f, oval);
}
}

void RootWidget::SetLeagueRankText(const std::string& val) {
assert(league_rank_text_);
league_rank_text_->widget->SetText(val);
Expand Down Expand Up @@ -1454,6 +1463,7 @@ void RootWidget::SetXPText(const std::string& val) {
}

void RootWidget::SetHaveLiveValues(bool have_live_values) {
have_live_values_ = have_live_values;
// auto cval{have_live_values ? 1.0f : 0.4f};
auto oval{have_live_values ? 1.0f : 0.4f};
auto oval2{have_live_values ? 1.0f : 0.4f};
Expand All @@ -1466,7 +1476,8 @@ void RootWidget::SetHaveLiveValues(bool have_live_values) {

assert(tokens_meter_text_);
assert(tokens_meter_icon_);
tokens_meter_text_->widget->set_color(1.0f, 1.0f, 1.0f, oval);
UpdateTokensMeterTextColor_();
// tokens_meter_text_->widget->set_color(1.0f, 1.0f, 1.0f, oval);
// tokens_meter_icon_->widget->set_color(cval, cval, cval);
tokens_meter_icon_->widget->set_opacity(oval2);

Expand Down
3 changes: 3 additions & 0 deletions src/ballistica/ui_v1/widget/root_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class RootWidget : public ContainerWidget {
void StepChildWidgets_(float dt);
void AddMeter_(MeterType_ type, float h_align, float r, float g, float b,
bool plus, const std::string& s);
void UpdateTokensMeterTextColor_();

std::list<Button_> buttons_;
std::list<Text_> texts_;
Expand Down Expand Up @@ -121,6 +122,8 @@ class RootWidget : public ContainerWidget {
ToolbarVisibility toolbar_visibility_{ToolbarVisibility::kInGame};
bool child_widgets_dirty_{true};
bool in_main_menu_{};
bool gold_pass_{};
bool have_live_values_{};
};

} // namespace ballistica::ui_v1
Expand Down

0 comments on commit 88e2aff

Please sign in to comment.