Repository navigation
Templates
Generated from the thetowersdk repository. Edits made here are overwritten on the next push — change the source file instead.
Starting points to copy into your own project, rather than scripts to read. Each is complete, type-checked against the package source, and commented where the shape of the SDK is easy to get wrong.
| File | For | Runtime |
|---|---|---|
save-cli.ts |
A command-line tool that reads a player's save | Node |
browser-widget.ts |
A UI module with no Node built-ins anywhere | Browser |
calculator.ts |
A calculator: typed input, pure compute, separate formatting | Either |
bot-starter.ts |
A complete bot: every calculator, a hand-written command, a CLI | Node |
sheets-client.ts |
The googleapis adapter for @beardedunicorn/thetowersdk/sheets
|
Node |
.env.example |
Every variable a bot or sheet client needs, with the warnings | — |
Decode once. decodePlayerInfoSaveBytes is the only step that needs Node. The save root it
returns is a plain object that extractors read and never mutate, so run as many as you like over
one root.
Only @beardedunicorn/thetowersdk/node needs Node. data, save, formatting, mechanics, wiki,
charts, knowledge and inputs are all browser-safe. A widget that never opens an official game export
never imports the decoder — that is why browser-widget.ts exists as a separate file.
Say what you could not do. Extractors return null for features a save predates and carry a
warnings array; calculator.ts returns a notes array for the same reason. A planner that
silently returns 0 for an unknown lab is worse than one that says it does not know the lab.
-
Durations are text, and not all one shape. Most catalog rows are
"HH:MM:SS"with hours running past 24 ("500:00:00"), but some are"0s". UseparseDurationToHours; splitting on":"yourself returnsNaNon the"0s"rows and poisons the whole sum. -
Format with the game's ladder. If your tool prints
1.4e21where the game prints1.4s, a player cannot check your answer against their screen — and that is the only way they can trust it.formatLargeNumberandparseResourceround-trip.
Generated from TheTowerSDK — do not edit here. Docs and live demos: https://beardedunicorn.github.io/TheTowerSDK/
- Workshop
- Workshop Enhancements
- Labs
- Cards
- Modules
- Module Rarities and Merging
- Module Substats
- Module Upgrade Costs
- Ultimate Weapons
- Ultimate Weapon Plus
- Bots
- Guardian
- Relics
- Themes
- Tiers
- Battle Conditions
- Enemies
- Perks
- Tournaments
- Milestones
- The Vault
- Daily Missions
- Guild
- Currencies
- Reference Tables
- Glossary
- Irreversible Upgrades
- Game Patch Notes
- Game Version History
SDK
- Quick Start
- Entry Points
- How It Fits Together
- Getting an Official Game Export
- Reading a Save
- Reading The Community Wiki
- Game 29.1 Data
- Formulas
- Builders
- Charts
- Effective Paths
- Examples
- Templates
- Building a Bot On This
- Google Sheets
- Desktop and Mobile
- Optional Add-ons
- Using It With An AI Agent
- Using Your Own Artwork
- Names And Acronyms
- Patch Notes
- Accuracy
- Versioning
- Where the Docs Live
- Contributing
- Credits
- License
Guides
Examples
- 01-browse-game-data.ts
- 02-read-a-save-file.ts
- 03-plan-upgrades-from-a-save.ts
- 04-generate-a-chart.ts
- 05-generate-a-cost-table.ts
- 06-read-the-community-wiki.ts
- 07-format-like-the-game.ts
- 08-build-a-calculator.ts
- 09-build-a-bot.ts
- 10-read-a-sheet.ts
- 11-build-a-knowledge-base.ts
- 12-show-module-and-card-art.ts
Templates