balatrobot 0.6.1__tar.gz → 0.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of balatrobot might be problematic. Click here for more details.

Files changed (90) hide show
  1. {balatrobot-0.6.1 → balatrobot-0.7.1}/CHANGELOG.md +24 -0
  2. {balatrobot-0.6.1 → balatrobot-0.7.1}/PKG-INFO +4 -1
  3. {balatrobot-0.6.1 → balatrobot-0.7.1}/README.md +3 -0
  4. {balatrobot-0.6.1 → balatrobot-0.7.1}/balatrobot.json +1 -1
  5. {balatrobot-0.6.1 → balatrobot-0.7.1}/pyproject.toml +1 -1
  6. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/__init__.py +1 -1
  7. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/lua/api.lua +1 -21
  8. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/lua/utils.lua +48 -0
  9. {balatrobot-0.6.1 → balatrobot-0.7.1}/uv.lock +1 -1
  10. {balatrobot-0.6.1 → balatrobot-0.7.1}/.claude/commands/commit-msg.md +0 -0
  11. {balatrobot-0.6.1 → balatrobot-0.7.1}/.claude/commands/commit.md +0 -0
  12. {balatrobot-0.6.1 → balatrobot-0.7.1}/.claude/commands/test.md +0 -0
  13. {balatrobot-0.6.1 → balatrobot-0.7.1}/.claude/settings.json +0 -0
  14. {balatrobot-0.6.1 → balatrobot-0.7.1}/.cursor/rules/docs-formatting.mdc +0 -0
  15. {balatrobot-0.6.1 → balatrobot-0.7.1}/.cursor/rules/python-development.mdc +0 -0
  16. {balatrobot-0.6.1 → balatrobot-0.7.1}/.editorconfig +0 -0
  17. {balatrobot-0.6.1 → balatrobot-0.7.1}/.envrc.example +0 -0
  18. {balatrobot-0.6.1 → balatrobot-0.7.1}/.gitattributes +0 -0
  19. {balatrobot-0.6.1 → balatrobot-0.7.1}/.github/workflows/code_quality.yml +0 -0
  20. {balatrobot-0.6.1 → balatrobot-0.7.1}/.github/workflows/deploy_docs.yml +0 -0
  21. {balatrobot-0.6.1 → balatrobot-0.7.1}/.github/workflows/release-pypi.yml +0 -0
  22. {balatrobot-0.6.1 → balatrobot-0.7.1}/.github/workflows/release_please.yml +0 -0
  23. {balatrobot-0.6.1 → balatrobot-0.7.1}/.gitignore +0 -0
  24. {balatrobot-0.6.1 → balatrobot-0.7.1}/.gitmodules +0 -0
  25. {balatrobot-0.6.1 → balatrobot-0.7.1}/.mdformat.toml +0 -0
  26. {balatrobot-0.6.1 → balatrobot-0.7.1}/.python-version +0 -0
  27. {balatrobot-0.6.1 → balatrobot-0.7.1}/.vscode/extensions.json +0 -0
  28. {balatrobot-0.6.1 → balatrobot-0.7.1}/.vscode/settings.json +0 -0
  29. {balatrobot-0.6.1 → balatrobot-0.7.1}/CLAUDE.md +0 -0
  30. {balatrobot-0.6.1 → balatrobot-0.7.1}/LICENSE +0 -0
  31. {balatrobot-0.6.1 → balatrobot-0.7.1}/Makefile +0 -0
  32. {balatrobot-0.6.1 → balatrobot-0.7.1}/balatro.sh +0 -0
  33. {balatrobot-0.6.1 → balatrobot-0.7.1}/balatrobot.lua +0 -0
  34. {balatrobot-0.6.1 → balatrobot-0.7.1}/bots/example.py +0 -0
  35. {balatrobot-0.6.1 → balatrobot-0.7.1}/bots/replay.py +0 -0
  36. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/assets/balatrobot.svg +0 -0
  37. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/balatrobot-api.md +0 -0
  38. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/contributing.md +0 -0
  39. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/developing-bots.md +0 -0
  40. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/index.md +0 -0
  41. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/installation.md +0 -0
  42. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/logging-systems.md +0 -0
  43. {balatrobot-0.6.1 → balatrobot-0.7.1}/docs/protocol-api.md +0 -0
  44. {balatrobot-0.6.1 → balatrobot-0.7.1}/mkdocs.yml +0 -0
  45. {balatrobot-0.6.1 → balatrobot-0.7.1}/runs/.gitkeep +0 -0
  46. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/client.py +0 -0
  47. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/enums.py +0 -0
  48. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/exceptions.py +0 -0
  49. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/models.py +0 -0
  50. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/balatrobot/py.typed +0 -0
  51. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/lua/log.lua +0 -0
  52. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/lua/settings.lua +0 -0
  53. {balatrobot-0.6.1 → balatrobot-0.7.1}/src/lua/types.lua +0 -0
  54. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/balatrobot/conftest.py +0 -0
  55. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/balatrobot/test_client.py +0 -0
  56. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/balatrobot/test_exceptions.py +0 -0
  57. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/balatrobot/test_models.py +0 -0
  58. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/conftest.py +0 -0
  59. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/__init__.py +0 -0
  60. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/conftest.py +0 -0
  61. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/__init__.py +0 -0
  62. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/checkpoints/basic_shop_setup.jkr +0 -0
  63. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/checkpoints/buy_cant_use.jkr +0 -0
  64. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/checkpoints/plasma_deck.jkr +0 -0
  65. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_cash_out.py +0 -0
  66. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_get_gamestate.py +0 -0
  67. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_get_save_info.py +0 -0
  68. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_go_to_menu.py +0 -0
  69. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_load_save.py +0 -0
  70. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_play_hand_or_discard.py +0 -0
  71. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_rearrange_consumables.py +0 -0
  72. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_rearrange_hand.py +0 -0
  73. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_rearrange_jokers.py +0 -0
  74. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_sell_consumable.py +0 -0
  75. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_sell_joker.py +0 -0
  76. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_shop.py +0 -0
  77. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_skip_or_select_blind.py +0 -0
  78. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_start_run.py +0 -0
  79. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/endpoints/test_use_consumable.py +0 -0
  80. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/test_connection.py +0 -0
  81. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/test_log.py +0 -0
  82. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/lua/test_protocol_errors.py +0 -0
  83. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/buy_joker.jsonl +0 -0
  84. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/no_shop.jsonl +0 -0
  85. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/rearrange_consumables.jsonl +0 -0
  86. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/rearrange_jokers.jsonl +0 -0
  87. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/sell_consumables.jsonl +0 -0
  88. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/sell_jokers.jsonl +0 -0
  89. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/shop_reroll.jsonl +0 -0
  90. {balatrobot-0.6.1 → balatrobot-0.7.1}/tests/runs/use_consumable.planet.jsonl +0 -0
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.1](https://github.com/coder/balatrobot/compare/v0.7.0...v0.7.1) (2025-10-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * remove resize from screenshot ([83876d7](https://github.com/coder/balatrobot/commit/83876d70018098c0368f4388360ef9ac0228cb5c))
9
+
10
+
11
+ ### Documentation
12
+
13
+ * add pypi badge ([accb2df](https://github.com/coder/balatrobot/commit/accb2df7ee98c540170328aa51e30a96bb33d010))
14
+
15
+ ## [0.7.0](https://github.com/coder/balatrobot/compare/v0.6.1...v0.7.0) (2025-10-23)
16
+
17
+
18
+ ### Features
19
+
20
+ * add new description field to card objects ([0a55df6](https://github.com/coder/balatrobot/commit/0a55df6bd6f5923f397197be729e681ea272a37f))
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * typo in field in game state ([3f111b2](https://github.com/coder/balatrobot/commit/3f111b283a2578412b34a4e36b19201107e0bd0d))
26
+
3
27
  ## [0.6.1](https://github.com/coder/balatrobot/compare/v0.6.0...v0.6.1) (2025-10-23)
4
28
 
5
29
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: balatrobot
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: A framework for Balatro bot development
5
5
  Project-URL: Homepage, https://github.com/coder/balatrobot
6
6
  Project-URL: Issues, https://github.com/coder/balatrobot/issues
@@ -25,6 +25,9 @@ Description-Content-Type: text/markdown
25
25
  <a href="https://github.com/coder/balatrobot/releases">
26
26
  <img alt="GitHub release" src="https://img.shields.io/github/v/release/coder/balatrobot?include_prereleases&sort=semver&style=for-the-badge&logo=github"/>
27
27
  </a>
28
+ <a href="https://pypi.org/project/balatrobot/">
29
+ <img alt="PyPI" src="https://img.shields.io/pypi/v/balatrobot?style=for-the-badge&logo=pypi&logoColor=white"/>
30
+ </a>
28
31
  <a href="https://discord.gg/TPn6FYgGPv">
29
32
  <img alt="Discord" src="https://img.shields.io/badge/discord-server?style=for-the-badge&logo=discord&logoColor=%23FFFFFF&color=%235865F2"/>
30
33
  </a>
@@ -4,6 +4,9 @@
4
4
  <a href="https://github.com/coder/balatrobot/releases">
5
5
  <img alt="GitHub release" src="https://img.shields.io/github/v/release/coder/balatrobot?include_prereleases&sort=semver&style=for-the-badge&logo=github"/>
6
6
  </a>
7
+ <a href="https://pypi.org/project/balatrobot/">
8
+ <img alt="PyPI" src="https://img.shields.io/pypi/v/balatrobot?style=for-the-badge&logo=pypi&logoColor=white"/>
9
+ </a>
7
10
  <a href="https://discord.gg/TPn6FYgGPv">
8
11
  <img alt="Discord" src="https://img.shields.io/badge/discord-server?style=for-the-badge&logo=discord&logoColor=%23FFFFFF&color=%235865F2"/>
9
12
  </a>
@@ -14,7 +14,7 @@
14
14
  "badge_colour": "4CAF50",
15
15
  "badge_text_colour": "FFFFFF",
16
16
  "display_name": "BB",
17
- "version": "0.6.0",
17
+ "version": "0.7.0",
18
18
  "dependencies": [
19
19
  "Steamodded (>=1.*)"
20
20
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "balatrobot"
3
- version = "0.6.1"
3
+ version = "0.7.1"
4
4
  description = "A framework for Balatro bot development"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -5,7 +5,7 @@ from .enums import Actions, Decks, Stakes, State
5
5
  from .exceptions import BalatroError
6
6
  from .models import G
7
7
 
8
- __version__ = "0.6.1"
8
+ __version__ = "0.7.1"
9
9
  __all__ = [
10
10
  # Main client
11
11
  "BalatroClient",
@@ -1474,29 +1474,9 @@ API.functions["screenshot"] = function(args)
1474
1474
  -- Capture screenshot using LÖVE 11.0+ API
1475
1475
  love.graphics.captureScreenshot(function(imagedata)
1476
1476
  if imagedata then
1477
- -- Scale down the image to reduce file size (10% of original size)
1478
- local original_width = imagedata:getWidth()
1479
- local original_height = imagedata:getHeight()
1480
- local scale_factor = 0.2
1481
- local new_width = math.floor(original_width * scale_factor)
1482
- local new_height = math.floor(original_height * scale_factor)
1483
-
1484
- -- Create a new scaled ImageData
1485
- local scaled_imagedata = love.image.newImageData(new_width, new_height)
1486
-
1487
- -- Scale the image by sampling pixels
1488
- for y = 0, new_height - 1 do
1489
- for x = 0, new_width - 1 do
1490
- local src_x = math.floor(x / scale_factor)
1491
- local src_y = math.floor(y / scale_factor)
1492
- local r, g, b, a = imagedata:getPixel(src_x, src_y)
1493
- scaled_imagedata:setPixel(x, y, r, g, b, a)
1494
- end
1495
- end
1496
-
1497
1477
  -- Save the screenshot as PNG to LÖVE's write directory
1498
1478
  local png_success, png_err = pcall(function()
1499
- scaled_imagedata:encode("png", screenshot_filename)
1479
+ imagedata:encode("png", screenshot_filename)
1500
1480
  end)
1501
1481
 
1502
1482
  if png_success then
@@ -323,6 +323,7 @@ function utils.get_game_state()
323
323
  set = card.ability.set,
324
324
  },
325
325
  label = card.label,
326
+ description = utils.get_card_ui_description(card),
326
327
  cost = card.cost,
327
328
  sell_cost = card.sell_cost,
328
329
  sort_id = card.sort_id, -- Unique identifier for this card instance (used for rearranging)
@@ -356,6 +357,7 @@ function utils.get_game_state()
356
357
  },
357
358
  -- ability = table of card abilities effect, mult, extra_value
358
359
  label = card.label, -- str (default "Base Card") | ... | ... | ?
360
+ description = utils.get_card_ui_description(card),
359
361
  -- playing_card = card.config.card.playing_card, -- int. The card index in the deck for the current round ?
360
362
  -- sell_cost = card.sell_cost, -- int (default 1). The dollars you get if you sell this card ?
361
363
  sort_id = card.sort_id, -- int. Unique identifier for this card instance
@@ -419,6 +421,7 @@ function utils.get_game_state()
419
421
  set = card.ability.set, -- str. The set of the card: Joker, Planet, Voucher, Booster, or Consumable
420
422
  },
421
423
  label = card.label,
424
+ description = utils.get_card_ui_description(card), -- str. Full computed description text from UI
422
425
  cost = card.cost,
423
426
  sell_cost = card.sell_cost,
424
427
  sort_id = card.sort_id, -- Unique identifier for this card instance (used for rearranging)
@@ -465,6 +468,7 @@ function utils.get_game_state()
465
468
  debuff = card.debuff, -- bool. True if the card is a debuff
466
469
  cost = card.cost, -- int. The cost of the card
467
470
  label = card.label, -- str. The label of the card
471
+ description = utils.get_card_ui_description(card),
468
472
  facing = card.facing, -- str. The facing of the card: front | back
469
473
  highlighted = card.highlighted, -- bool. True if the card is highlighted
470
474
  sell_cost = card.sell_cost, -- int. The sell cost of the card
@@ -501,6 +505,7 @@ function utils.get_game_state()
501
505
  debuff = card.debuff,
502
506
  cost = card.cost,
503
507
  label = card.label,
508
+ description = utils.get_card_ui_description(card),
504
509
  facing = card.facing,
505
510
  highlighted = card.highlighted,
506
511
  sell_cost = card.sell_cost,
@@ -536,6 +541,7 @@ function utils.get_game_state()
536
541
  },
537
542
  cost = card.cost,
538
543
  label = card.label,
544
+ description = utils.get_card_ui_description(card),
539
545
  highlighted = card.highlighted,
540
546
  sell_cost = card.sell_cost,
541
547
  }
@@ -692,6 +698,48 @@ function utils.get_blinds_info()
692
698
  return blinds
693
699
  end
694
700
 
701
+ -- ==========================================================================
702
+ -- Cards Effects
703
+ -- ==========================================================================
704
+
705
+ ---Gets the description text for a card by reading from its UI elements
706
+ ---@param card table The card object
707
+ ---@return string description The description text from UI
708
+ function utils.get_card_ui_description(card)
709
+ -- Generate the UI structure (same as hover tooltip)
710
+ local ui_table = card:generate_UIBox_ability_table()
711
+ if not ui_table then
712
+ return ""
713
+ end
714
+
715
+ -- Extract all text nodes from the UI tree
716
+ local texts = {}
717
+
718
+ -- The UI table has main/info/type sections
719
+ if ui_table.main then
720
+ for _, line in ipairs(ui_table.main) do
721
+ local line_texts = {}
722
+ for _, section in ipairs(line) do
723
+ if section.config and section.config.text then
724
+ -- normal text and colored text
725
+ line_texts[#line_texts + 1] = section.config.text
726
+ elseif section.nodes then
727
+ for _, node in ipairs(section.nodes) do
728
+ if node.config and node.config.text then
729
+ -- hightlighted text
730
+ line_texts[#line_texts + 1] = node.config.text
731
+ end
732
+ end
733
+ end
734
+ end
735
+ texts[#texts + 1] = table.concat(line_texts, "")
736
+ end
737
+ end
738
+
739
+ -- Join text lines with spaces (in the game these are separated by newlines)
740
+ return table.concat(texts, " ")
741
+ end
742
+
695
743
  -- ==========================================================================
696
744
  -- Utility Functions
697
745
  -- ==========================================================================
@@ -36,7 +36,7 @@ wheels = [
36
36
 
37
37
  [[package]]
38
38
  name = "balatrobot"
39
- version = "0.6.0"
39
+ version = "0.7.0"
40
40
  source = { editable = "." }
41
41
  dependencies = [
42
42
  { name = "pydantic" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes