Commit Graph

221 Commits

Author SHA1 Message Date
Guangcong Luo
3621eb4519 Correctly set Hidden Power DVs in Gen 2 2015-12-26 10:04:12 -05:00
Guangcong Luo
863cdcb962 Teambuilder: Don't change folder when dragging teams
This allows multiple pokemon to be more easily dragged from one folder
to another.
2015-12-26 10:00:37 -05:00
Guangcong Luo
d2bccb20de Use XY models in teambuilder
This removes some gradients and shadows, but it's totally worth it.
2015-12-25 10:48:09 -06:00
Guangcong Luo
a9ab52c9c8 Support pressing Up/Down in teambuilder lists
It should now be a bit easier to select pokemon/moves/etc with the
keyboard.
2015-12-25 10:45:00 -06:00
Guangcong Luo
fa09ddcf8a Teambuilder: Use new icons in teambar 2015-12-24 12:38:30 -05:00
Guangcong Luo
fac99e2091 Teambuilder: Fix bug in remaining EV display 2015-12-24 12:38:11 -05:00
Guangcong Luo
4c3d1af539 Teambuilder: Fix gen 1-2 EV/IV display
- Gen 1-2 DVs are now shown properly as a 1-15 range.
- Gen 1-2 no longer display a total EV count.
- Fix an alignment issue with gen 1 calculated stats
2015-12-24 11:33:25 -05:00
urkerab
6dfbb06c4b Properly calculate EV spreads for level 1 2015-12-24 00:50:22 +00:00
Guangcong Luo
a76b0b95ef Build: Minify pokedex.js + formats-data.js, moves.js
The client-relevant parts of formats-data.js have been combined into
pokedex.js. pokedex.js and moves.js are now minified on the client.
2015-12-22 12:11:40 -05:00
Guangcong Luo
99bb786c55 Teambuilder: Add 'Remove folder' button 2015-12-22 12:11:40 -05:00
Guangcong Luo
e1ffede0f3 Teambuilder: Fix various bugs in search.js refactor
- Add pokemon list for CAP
- Add pokemon list for AG
- Add pokemon list for PU
- Make sure the move "Psychic" is above the type for move searches
- Fix bug in generating learnsets
- Fix move list for Smeargle
- Show tier instead of National dex number in pokemon charts
- Fix bug in pokemon field defocusing
2015-12-22 12:11:07 -05:00
Guangcong Luo
bd0a80db5e Rename MovePopup to MoveSetPopup
'MovePopup' is too vague of a name.
2015-12-22 08:13:11 -05:00
Guangcong Luo
cfacf4d906 Teambuilder: Improve move deselection
Now, if you click a selected move, it will deselect the move, and then
rearrange all the other moves up, so that the empty move slots will
always be on the bottom.
2015-12-22 08:13:11 -05:00
Guangcong Luo
2ddeff9352 Teambuilder: Clicking a selected move deselects it 2015-12-22 00:17:34 -06:00
Guangcong Luo
7fa72c1d20 Convert teambuilder from utilichart.js to search.js
The teambuilder is now running on search.js! Not all new features I'd
like to be in are in, but we've now reached feature parity, and most
of the bugs I found during testing have been fixed.

New in search.js is on-demand DOM loading, which basically means
much faster performance because instead of trying to load every single
row of e.g. the pokemon list at once, we just load the part that's
visible, and load the rest only when you scroll it into view.

Also new in search.js is a dexsearch-like feature, replacing the old
details-search system. The new filter system is simpler and more powerful
and has the same API as /dexsearch, although not all the more advanced
dexsearch features are supported.

On-demand DOM loading makes teambuilder loading pretty much completely
instantaneous. There are other small differences in how selection of
pokemon/items/abilities/moves works, but it should overall make more
sense.
2015-12-22 00:06:27 -06:00
Guangcong Luo
11e3863aa7 Improve utilichart/search code
The utilichart-relevant code has been overhauled for simplicity.

Utilichart results and headers are now both 33 pixels tall, total.

Headers are slightly larger, to make them fill the space better. The
larger font size makes them more header-like, anyway.

Results are two pixels taller than before, giving them enough room for
gen 6 pokemon icons (not enabled in this commit), and in general
aiding performance slightly (fewer result rows on the screen at a
time).

Making them both 33 pixels allows height to be computed precisely
as 33*rows, which is relevant for result rows to be inserted into
the DOM on-demand.

On-demand DOM insertion has previously been implemented in pokedex.js,
but the new on-demand DOM code in search.js works slightly differently.
It makes stronger assumptions (that the only bottleneck is DOM
insertion speed, and that ctrl+f without scrolling to the bottom
doesn't need to be supported, and that result rows and result
headers are always 33 pixels tall), which makes for much simpler
code, and is presumably slightly faster because of this.

The new on-demand DOM code is surfaced by an "All results" button
in the pokedex (pokemonshowdown.com/dex/), for basic testing, but
the long-term plan is for it to be used in the teambuilder for
pokemon/etc selection, to massively increase performance.

Nearly two years after I wrote search.js to be a better utilichart
API than utilichart.js, we'll soon finally start using it in place of
utilichart.js in the main sim teambuilder!
2015-12-20 04:28:15 -05:00
Guangcong Luo
dd08a6fd43 Minor improvement to teambuilder greeting
Rock-paper-scissors scores now cycle, so you'll see every possible
score before they repeat.
2015-12-20 04:27:10 -05:00
Guangcong Luo
4b21e3f125 Add a playable R-P-S game to Teambuilder greeting 2015-12-17 06:40:55 -05:00
Guangcong Luo
3fc38bb2c9 Support dragging teams from desktop to folder 2015-12-17 06:40:55 -05:00
Guangcong Luo
42ddd81c68 Teambuilder folder feature
In addition to format folders, we now support regular folders that
behave as you'd expect. These folders even map to actual
directories in the downloadable client!

Folders are delimited by `/` in team names in all storage formats
(including export, and packed saving), and are stored in the
`.folder` field of team objects.

Because of this, `/` is no longer an acceptable character in team
names. This improves interoperability with teams and filesystems,
so we should probably have done this anyway.

I also added back a friendly message to the top of the teambuilder.
2015-12-17 06:40:55 -05:00
Guangcong Luo
c9febae91e Fix some bugs in recent teambuilder changes
- 'uncategorized' was sometimes in the wrong place
- Firefox Windows button alignment
- crash when creating new format folder
- gen 2 and gen 3 were mixed up
2015-12-17 06:40:54 -05:00
Guangcong Luo
69cb27b596 Keep newly opened format folders visible
Normally, when navigating away from an empty format folder, it'll
disappear from the folder list. This keeps the folder visible if you
just opened it from a team selector or the 'New format folder'
button, so you can drag teams from other folders to that folder.
2015-12-16 01:23:39 -05:00
Guangcong Luo
c00e4088d7 Teambuilder: Support dragging teams onto folders
This was ridiculous, or, in other words, par for the course when
you're dealing with HTML5 drag-and-drop.

Folders are now clickable divs instead of buttons. This turned out
not to be necessary as it was a different issue that was causing
drag-and-drop to fail, but I'd already changed everything over when
I discovered the real bug. Oh well, some things are slightly nicer
this way.
2015-12-16 01:23:39 -05:00
Guangcong Luo
e1f3ac0001 Use the Format dropdown for teambuilder formats
You can now add formats to the teambuilder folderbar and select
teambuilder formats using the same Formats dropdown previously
used for challenges and searches.

It is no longer to move a team back to Uncategorized. A future
update will fix this.
2015-12-16 01:23:39 -05:00
Guangcong Luo
a8c3b54006 Tweak some button appearances 2015-12-16 01:23:39 -05:00
Guangcong Luo
04246a51fb Redesign teambuilder folders
This didn't come out looking nearly as perfect as I hoped, but
honestly it looks pretty good and I don't know how to make it
better.
2015-12-15 20:01:05 -05:00
Guangcong Luo
b5647d409a Improve team selector
The team selector now hides teams that aren't for the format, by
default. Other teams can still be selected with a 'more' button.

There's now a Teambuilder button to be taken straight to making
or editing teams for that format.
2015-12-15 18:37:01 -05:00
Guangcong Luo
3a41c51c37 Basic teambuilder 'folders'
The folders are really just format filter views, but in theory, this
should be all people need.

This implementation is very basic but I'm pretty sure I've gotten all
the bugs out. On small screens, the folders simply don't appear, on
the assumption that this will only happen on mobile, where people
shouldn't be creating enough teams to need folders, anyway. (I'll
fully support mobile later.)

Third-party servers may need to re-style the Edit and Delete buttons,
since they're black on transparent, which may interact poorly with
certain edgy background styles.
2015-12-15 17:34:53 -05:00
The Immortal
bae1b84fb0 Teambuilder: Update VGC 2015-12-10 03:56:29 +04:00
Guangcong Luo
06a403d148 Merge pull request #546 from augmt/tighten-dnd
Tighten up drag and drop code
2015-12-07 08:34:33 +00:00
Ivo Julca
8bb6f48223 Fix several global variable leaks 2015-12-03 02:26:29 -05:00
Ivo Julca
1d514bc6ec Miscellaneous style fixes for better alignment to server code style 2015-12-03 02:25:57 -05:00
Guangcong Luo
cf8bb24e71 Refactor data storage
Data (teams and prefs) are now always stored in localStorage in the
`https://play.pokemonshowdown.com` origin. Data storage at a low
level has been mostly rewritten for this, and moved to storage.js.

Tools.prefs has been renamed Storage.prefs, although the API
Tools.prefs(prefName) is still available, and recommended for
battle.js (because storage.js isn't available in replays). All
other pref functionality, such as setting prefs and saving prefs,
should only be used in Storage.prefs.

If the browser blocks third-party cookies in a detectable way,
data is instead stored in the local origin.

As a final safety measure, prefs/teams are mirrored in the local origin
in case third-party cookies are blocked in an undetectable way.

This refactor also replaces the 'init:loadprefs' and 'init:loadteams'
events with a new load tracking system that's basically a simplified
implementation of Promises, documented in the comments for
Tools.makeLoadTracker().
2015-11-28 04:36:41 -05:00
Guangcong Luo
11024a27bf Fix click handling after closing teambuilder
Because of sliders being dumb, the teambuilder frequently has to
clear global handlers, which cleared the global click handler that
handled room link opening, as well as external links on the
desktop client.

Anyway, click handlers are now a lot more standardized and all that.
2015-11-25 23:26:20 -05:00
Ivo Julca
abf9eccf79 Send a valid format in Validate team requests
Teambuilder-only base formats now map to their server-available variants
2015-11-22 22:39:56 -05:00
Hector Garcia
58f7322a09 Tighten up drag and drop code
* Break out of `defaultDragEnterTeam` immediately for non-file entities
2015-11-15 15:36:09 +00:00
Marty-D
37d767e2c1 Teambuilder: Default Gen 4 LC to level 5 2015-11-14 16:59:29 -05:00
Guangcong Luo
fe33dcc514 Merge pull request #550 from urkerab/teambuilder-ignore-ev-limits-gen-1-2
Teambuilder should ignore EV limits prior to Generation 3
2015-11-13 21:50:07 +00:00
The Immortal
e6f5747838 Fix past gens teambuilder
It selects the correct input for past gens now.

Gen 1: When you choose a Pokemon it goes to moves
Gen 2: When you choose an item it goes to moves.
2015-11-13 22:48:23 +04:00
urkerab
e440c276cf Guess EVs for Generations 1 and 2 2015-11-12 21:20:33 +00:00
urkerab
a52fa302df Teambuilder should ignore EV limits prior to Generation 3 2015-11-12 21:18:54 +00:00
urkerab
15b32d4e97 Automatically drag EVs appropriately for LC 2015-11-12 16:15:52 +00:00
Juanma Serrano
981fced511 Teambuilder: Filter Pokémon, moves, items, abilities by gen
Do not show Pokémon, moves, abilities, or items from future generations in teams in formats of past generations.
Also fix indentation.
2015-11-11 23:19:45 +01:00
Juanma Serrano
cabf8699f3 Teambuilder: Don't show ability and irrelevant stats on gens 1 and 2
Hides the ability for gens 1 and 2.
Shows Spc (Special) instead of SpA and SpD for gen 1.
Hides item, happiness, shinyness for gen 1.
Shows proper EV count for gens 1 and 2.
2015-11-11 19:47:21 +01:00
Juanma Serrano
cd3cfed675 Teambuilder: Store the generation of the current team 2015-11-11 19:05:58 +01:00
Guangcong Luo
13d69757a3 Support importing sets when adding sets in Teambuilder 2015-11-09 02:57:12 -05:00
Hector Garcia
4c3df24c69 Adjust curTeamIndex for each room accordingly
Rooms with `button.teamselect` present have their `curTeamIndex`
adjusted on various Teambuilder operations
2015-10-31 14:31:24 +00:00
Hector Garcia
2573f85921 Update teams on deletions, undeletions, and drops 2015-10-31 07:32:49 +00:00
urkerab
019be92103 Properly calculate EV spreads for LC 2015-10-18 20:33:13 +01:00
Ivo Julca
7c18127ddf More consistently escape formats 2015-10-07 01:31:09 -04:00