8000 GitHub - doshidak/showdex at v1.1.9
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Pokémon Showdown extension that harnesses the power of parabolic calculus to strategically extract your opponents' Elo.

License

Notifications You must be signed in to change notification settings

doshidak/showdex

Repository files navigation

showdex-icon

showdex

 Current v1.1.9   Install on Chrome · Opera · Firefox · Safari   Discuss on Smogon · Discord

Showdex is a browser extension for Pokémon Showdown that brings the Damage Calculator you know & love right into your battle! Automatically syncs all Pokémon & field conditions as you play, so you can spend less time shitting brix & more time hitting kicks.


Officially supported on Chrome (+ any native Chromium browser, like Edge & Brave), Opera & Firefox.

  ༼ つ ಥ_ಥ ༽つ  Safari  ...?

Despite Apple requiring us to shell out $100/year for the Apple Developer Program just to distribute a singular free extension on the App Store, thanks to the many generous contributions from the awesome Showdown community over the years, we're now planning on officially supporting Showdex on iOS & macOS in the future!

In the meantime, Enhanced Tooltips for Showdown (Source on GitHub), currently available on the App Store, bundles Showdex along with the Enhanced Tooltips & Randbats Tooltip extensions. Note that the bundled Showdex is not officially supported, so questions regarding Showdex running on Safari should be directed towards the maintainer of the aforementioned App Store app, Christian Brüggemann (Smogon · GitHub).

Would you like to know more?


Navigation

 Planned Features   Known Bugs 
 Suggest a Feature   Report a Bug   Contribute Code 


Developer Zone

Warning
You are about to get in the zone, the developer zone.
If you do not wish to get in the zone, the developer zone, please visit the Smogon Forums post instead.


Developer SparkNotes™

Note
This section is a work-in-progress.

This extension is written in TypeScript, which is essentially JavaScript on crack, using:

 How It's Made™ 

Note
More information coming soon!

uhhhhhhhhh



Requirements

Warning Due to the removal of --experimental-specifier-resolution=node in node v20, v18 is required (i.e., ^18.0.0) to build this project. Use something like nvm to install v18 alongside your current node installation.

  • node v18.0.0+
  • yarn Classic v1.22.0+
  • bash (Windows WSL, macOS, or Linux)

①  Setup

Note
If your browser is already configured for extension development, you can skip this part.

You'll need to apply some slight tweaks to your browser in order to directly install extensions from your local disk.

 Google Chrome
  1. Navigate to the Chrome extensions page (chrome://extensions).
  2. Enable Developer mode in the top-right corner.
  3. Verify that the Load unpacked option is available.
 Mozilla Firefox
  1. Navigate to the Advanced Preferences page (about:config).
  2. Search for the preference xpinstall.signatures.required.
  3. Set the preference's value to false (typically true by default).
  4. Navigate to the Debugging page (about:debugging).
  5. Select This Firefox on the left-hand panel.
  6. Verify that the Temporary Extensions section and the Load Temporary Add-on... option are available.
 Mozilla Firefox for Android

Note
More information coming soon!
Though instructions aren't currently provided, this project supports developing on Firefox for Android Nightly.

For now, see these instructions from Mozilla for setting up your Android device and Firefox for Android Nightly installation for extension development.



②  Installation

Note
These instructions are for building the extension from source.

  1. cd into your favorite directory.
  2. git clone git@github.com:doshidak/showdex.git
  3. cd showdex
  4. yarn
 Post-Installation Scripts 

Each time you run yarn (including yarn add & yarn remove), the postinstall script will automatically run afterwards, which itself runs the following:

This project is configured for ES Modules (ESM) (as opposed to ye olde CommonJS [CJS]), while also making use of cz-customizable, which requires cz-customizable-ghooks, which requires ghooks.

Node v18 doesn't allow you to run extensionless files (such as .git/hooks/commit-msg), which ghooks poops out, so patch-ghooks adds .js at the end of each pooped out file (e.g., .git/hooks/commit-msg.js).

Otherwise, Node will complain about running an extensionless file and critically fail when you attempt to make a git commit.

  • yarn patch-package

This runs patch-package, which reads from the patches directory and applies the diff to the corresponding package in your node_modules.

Patch for @babel/plugin-transform-typescript adds a custom option called yeetEmptyImportElisions, which, during the transpilation process from TS/TSX to JS, will completely remove the import statement if there aren't any imported modules left after removing all type modules (e.g., import { type SomeType } from 'some-package'; becomes import {} from 'some-package';, which will be removed if the aforementioned custom option is enabled; however, in the case of import { type SomeType, SomeModule } from 'some-package';, this import won't be removed as SomeModule remains after removing the type's, i.e., import { SomeModule } from 'some-package';). This is to prevent side-effects resulting from simply importing the file, even when no exported module in that file is actually being imported. Path for @babel/preset-typescript simply passes yeetEmptyImportElisions to @babel/plugin-transform-typescript. (Also, the terrible name for the custom option was intentional to indicate that this was a custom option I put in LOL.)

Patch for @smogon/calc incorporates all the changes up to the 06c7409 commit. Additionally, a custom modification interface called ShowdexCalcMods were added to the exported calculate() function, which allows the Calcdex to tap into specific parts of the damage calculation algorithm to implement moves like Beat Up. Finally, attack & defense stat override properties were implemented in the mechanics files for older gens.

Patch for simplebar adds typings for the untyped scrollableNode and contentNode options, which is actually used inside SimpleBar class, but not typed. These two options are required if the internal <div>s are provided outside of SimpleBar (by default, it will create its own <div>s inside the provided container element). For use with React, we must provide these internal <div>s ourselves, as React doesn't like it when a vanilla JS library adds and removes DOM elements that React isn't aware of.




③  Development

Note
yarn dev is an alias of yarn dev:chrome.

  1. cd showdex
  2. yarn dev:chrome or yarn dev:firefox

Warning
Although this project makes use of TypeScript & ESLint, they are only used suggestively. In other words, your code will still compile even if you have errors!

Built contents will be dumped into a build directory in the project root (will be created if it doesn't exist).

 Google Chrome
  1. Navigate to chrome://extensions.
  2. Select Load unpacked.
  3. Point to the chrome sub-directory in build.
  4. Verify the extension appears in the list.
  5. Navigate to Pokémon Showdown.
  6. Play or spectate a battle.

 Mozilla Firefox
  1. Navigate to about:debugging.
  2. Select Load Temporary Add-on.
  3. Point to the showdex-...-dev.firefox.xpi in build.
  4. Verify the extension appears under Temporary Extensions.
  5. Navigate to Pokémon Showdown.
  6. Play or spectate a battle.

 Mozilla Firefox for Android

Note
More information coming soon!
Though instructions aren't currently provided, this project supports developing on Firefox for Android Nightly.

For now, see these instructions from Mozilla for running the extension on your Android's Firefox for Android Nightly installation.



 "Hot" Reloading 

Warning
Hot-reloading is a bit of a mess right now since it requires you to reload the extension and refresh Pokémon Showdown. Will figure out a better system in the future.

While yarn dev:chrome or yarn dev:firefox is running, Webpack will trigger a re-compilation of the bundle when files are changed in the src directory.

  • For Chrome, you'll need to select the reload icon button in the Chrome extensions page (chrome://extensions). Once reloaded, refresh Pokémon Showdown to see your changes.
  • For Firefox, you'll need to Reload the extension in the Debugging page (about:debugging). Once reloaded, refresh Pokémon Showdown to see your changes.

 Environment Variables 

Note
More information coming soon!

uhhhhhh for now, check the .env



④  Building

Note
yarn build is an alias of yarn build:chrome && yarn build:firefox.

  1. cd showdex
  2. yarn build:chrome or yarn build:firefox

Warning
As mentioned in the Development section, TypeScript & ESLint are configured to be suggestive, so your code will still compile even if you have errors!

Built contents will be dumped into a dist directory in the project root (will be created if it doesn't exist).

There will be an un-zipped directory named after the BUILD_TARGET env (e.g., chrome, firefox) containing all the bundled files, as well as:

  • For Chrome, a packaged extension under showdex-...chrome.zip in dist, and
  • For Firefox, a packaged extension under showdex-...firefox.xpi in dist.
 What's the HTML file? 

Builds for each target come with their very own bundle size pie chart, showing you exactly which modules in the bundle are too thicc. Particularly useful for finding modules to chunk, especially since AMO enforces a 5 MB size limit per file.

  • Bundle size analysis is written to showdex-...[BUILD_TARGET].html in dist.


Contributing

(ノ◕ヮ◕)ノ* :・゚✧  Issues & PRs (Pull Requests) are very welcome!  ✧゚・: *ヽ(◕ヮ◕ヽ)


Issues

Found a bug? · Got a cool idea? · Have suggestions? · Hate these questions & demand answers?

Contributor Covenant

Thanks for your help in making Showdex better for everyone!

I'm not a stickler for how these should be formatted; just make sure you provide enough info for me to work off of. If you're having trouble running Showdex, please make sure you first try turning off your other extensions before opening an issue. This will help me narrow down the problem (e.g., your ad-blocker could potentially block Showdex from downloading sets!).

If possible, including the following would be immensely helpful!

  • Device (e.g., Custom PC, MacBook Pro 14" 2023, eMachines eTower 400i, Samsung Smart Fridge, etc.)
  • OS & Version (e.g., Windows 11, macOS Sonoma 14.1, Ubuntu 22.04.3 LTS, Android 12, etc.)
  • Browser (e.g., Chrome, Firefox, Opera, Netscape Navigator, etc.)
  • Showdex Version (e.g., v1.1.9)
  • Format, if applicable (e.g., Gen 9 VGC 2023 Regulation E Bo3)
  • Replay, if applicable

If you would like to be credited for your contribution, please also include your username on Smogon Forums or Pokémon Showdown. Otherwise, your GitHub username will be used, unless you don't want to be credited.

 Create a GitHub Issue 

No GitHub? No problem!

We're also listening for feedback & bug reports on our Showdex thread on Smogon Forums.

 Post on Smogon Forums 

Not on Smogon Forums? All good!

We also created a Discord community with channels where you can report bugs, request features & get help.

 Join Our Discord 

No Discord? Still, no problem!

Feel free to contact me directly via email.

 Slide Into My Inbox 

PRs

Fixed a bug? · Added something cool?

Commitizen friendly

Not a stickler with these either, but at the very least, please:

  • Fork this repo & commit changes to your fork,
  • Style your code according to the ESLint rules,
  • Create a PR from your fork to this repo, and
  • Provide a brief description of your changes in your PR.

Although this project makes use of Commitizen, you don't need to format your commit messages this way. Use whatever you're comfortable with!

Additionally, I don't make use of any fancy automations like CI (Continuous Integration), so each PR will be manually reviewed. Your patience is greatly appreciated!

 Fork Me on GitHub 

Credits

big thank to:


Supporters

big ・゚✧  sparkly thank  ✧゚・ to these fine individuals for their generous support!

Supreme Overlords

 ・゚✧  Dastardlydwarf  ✧゚・   ・゚✧  goddess mina  ✧゚・   ・゚✧  Zzodz  ✧゚・ 
 ・゚✧  Ah Ok Got It  ✧゚・ 

Pop Bombers

 ・゚✧  benzyne  ✧゚・ 

Blazikens

 ・゚✧  GabrielPBC  ✧゚・   ・゚✧  BruhMomentMaker  ✧゚・   ・゚✧  Christopher Y  ✧゚・ 
 ・゚✧  PokePastry  ✧゚・   ・゚✧  TheNexyr  ✧゚・   ・゚✧  Michael K  ✧゚・ 
 ・゚✧  Kristen G  ✧゚・ 

  ༼ つ ͡° ͜ʖ ͡° ༽つ

 ・゚✧  CPL593H  ✧゚・   ・゚✧  Angie L  ✧゚・   ・゚✧  Fubwubs  ✧゚・ 
 ・゚✧  Timothy B  ✧゚・   ・゚✧  PastGenOUFan  ✧゚・   ・゚✧  Luc H  ✧゚・ 
 ・゚✧  joshtheking7  ✧゚・   ・゚✧  Michael L  ✧゚・   ・゚✧  Bongphan  ✧゚・ 
 ・゚✧  Pulse_kS  ✧゚・   ・゚✧  Thilo P  ✧゚・   ・゚✧  GenOne  ✧゚・ 
 ・゚✧  Lunarvania  ✧゚・   ・゚✧  Leman T  ✧゚・   ・゚✧  Sunny B  ✧゚・ 
 ・゚✧  Peter T  ✧゚・   ・゚✧  Sam P  ✧゚・   ・゚✧  PokePastry  ✧゚・ 
 ・゚✧  DoubleCaret  ✧゚・   ・゚✧  JesskyKhemically  ✧゚・   ・゚✧  Plague von Karma  ✧゚・ 
 ・゚✧  MrMimikry  ✧゚・   ・゚✧  momalaharris  ✧゚・   ・゚✧  FR1E5  ✧゚・ 
 ・゚✧  Tanuj C  ✧゚・   ・゚✧  GoldenGottaGo  ✧゚・ 

  (づ ̄ ³ ̄)づ


Contributors

another big thank to these fine people for helping with development!

SpiffyTheSpaceman malaow3 · GitHub Cureja · GitHub

...and finally, big thank to these fine people who helped improve Showdex!

105C 85percent A_Wild_Noob_Appeared! AhmedA1559
aim alchemistake AndViet Baloor
Bice BlackCapCoder brokenmotor Catri
cbruegg · GitHub Celestia ChrisPBacon Clastia
Cloyster Chowder coral fan CPL593H cynicproject
DarkPhoenix911 dex Ducky dyrana
Elitemagikarp · GitHub Fitah_ Furret4ssb IHatePasswords
Iodyne ITR jmynes ketchuppainting
Kibo kirito_1707 Lazosful Legend-Recalls
lighthouse64 MachJacob madamadam-c Mandibuladel5555
Maxouille · GitHub mdragon13 Mia · GitHub MoltenGluten
mpique mnittsch Nails orangelego21
paolode99 _Pea_ pokeblade101 PokeChess
Pulse_kS Runoisch ry4242 Sabelette
Shiox Shock3600 · GitHub sh0shin ShrikeNW
Singiamtel · GitHub Sorrica Surgent James TheDebatingOne
ThornxRose ThrohKing TJ Timboberino
TrainerX493 Tree69420 · GitHub Turtlek zooki2006
zuils · GitHub

  \ (•◡•) /

0