Commit Graph

234 Commits

Author SHA1 Message Date
Guangcong Luo
c0d707c1e1 Ensure players get up-to-date HP information 2015-12-09 06:24:58 -05:00
Guangcong Luo
13a90c3096 Fix avatar display when rejoining battles 2015-12-05 23:28:31 -05:00
Guangcong Luo
580c464e83 Work around client error when renaming
Apparently the client can't handle requests being re-sent. To-do:
figure out why.
2015-12-05 23:27:49 -05:00
Guangcong Luo
81beefb462 Fix crash caused by refactor
Battle no longer inherits from RoomGame
2015-12-04 15:05:51 -05:00
Guangcong Luo
ce756e6212 Add new RoomGame event onUpdateConnection
onUpdateConnection is called when a user in a room merges with
another user. There are various corner cases when one might want
to handle this situation differently from onConnect

Also document the events in room-game.js in more detail, and fix
up simulator.js's RoomGame implementation a bit.
2015-12-04 05:59:29 -05:00
Guangcong Luo
341ab3b684 Refactor simulator.js to new RoomGame API
This is a huge refactor that's a half-scratch rewrite of simulator.js.

Everything seems to be working so far, but with such a huge change,
I wouldn't be surprised if something went wrong.
2015-12-03 18:30:47 -06:00
Guangcong Luo
e6125e34de Refactor user.battles to user.games
This is a small part of a larger refactor to make a more general
games system.
2015-12-03 18:30:47 -06:00
Ivo Julca
90973d5c0c Style fixes
- Cut down excessive spacing
- Add braces to missing conditionals
2015-11-07 17:08:09 -05:00
Ivo Julca
0479d2b729 Clean up handling of variable bindings in switch statements 2015-11-06 21:58:36 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Guangcong Luo
ab71ae20fe Refactor ResourceMonitor into monitor.js
ResourceMonitor has been moved from app.js into monitor.js and
renamed to simply Monitor. It also gains the ability to fine-
grained control the log level, although in a pretty crude way.

Monitor.debug - bugs in PS's engine that we need to fix
someday - by default, these aren't reported

Monitor.warn - issues that suggest an attacker or poorly
coded custom client - these should probably be looked at

Monitor.notice - issues that staff probably want to know.
These are usually also written to the Staff room.
2015-10-04 17:02:17 -04:00
Ivo Julca
a0d2a59875 Fix replays being uploaded under an alt after player rename 2015-07-07 03:18:08 -05:00
Guangcong Luo
e0efc92d12 Slightly more console output 2015-05-12 02:33:07 -04:00
Ivo Julca
4222ffb5df Dependant support: make sure that relative paths are resolved properly 2015-05-11 15:38:18 -05:00
Morfent
ce1724e179 Replace all s.substr(x, 1) with s.charAt(x) 2015-04-06 21:20:43 -03:00
Ivo Julca
e276f56d60 Battle#resendRequest's argument is now a connection, rather than user
- The higher specificity saves bandwidth and suppresses a client crash when another user connection joins the battle.
2014-12-25 18:18:21 -05:00
Ivo Julca
688bd5f9e4 Add missing sideupdate message type to simulator 2014-12-10 14:00:53 -05:00
小太
5027be79fb Add jscs as a style checker, and add some extra jshint options 2014-09-29 18:38:01 +10:00
Guangcong Luo
265eced415 Stop users from joining battles they're already in 2014-09-16 22:14:04 -04:00
Guangcong Luo
9bd804838f Implement subchannels
This pushes most of the work of dealing with `|split` from the
main (room) process to the socket process.
2014-08-25 23:48:33 -04:00
Ivo Julca
b3b435c1fd Battle.active now defaults to false.
This fixes the issue of players being unable to join any battles they start.
2014-08-25 00:01:00 -05:00
Guangcong Luo
af2026436a More style fixes and Gulpfile updates
JSHint is now a fair bit stricter, and is now correctly checking
files in `mods/`.

The code has been fixed to match the new stricter standards.

JSHint has now caught its second actual bug: Gen 5 Pinap Berry
was Ice instead of Grass.
2014-08-10 20:43:53 -04:00
Guangcong Luo
12b673bb49 Fix style errors; update gulpfile
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.

All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
2014-08-10 18:06:44 -04:00
小太
5c8fc7b982 Space after function for anonymous functions 2014-04-22 01:58:16 +10:00
小太
6fb3bc332a Spaces around operators and === instead of == 2014-04-22 01:56:11 +10:00
Slayer95
05e7060474 Deprecate 'toUserid' global
Replaced by 'toId'.
2014-04-18 16:49:16 -05:00
Slayer95
75559362b4 Rename global config to Config 2014-04-17 01:12:28 -04:00
Guangcong Luo
692f47fc0a Support dynamically spawning simulator processes 2014-04-17 00:16:15 -04:00
小太
4f6a3e9c36 Merge remote-tracking branch 'upstream/master' into tournaments-frontend
Conflicts:
	package.json
2014-03-10 12:15:35 +11:00
Tyler Stark
bff353cc58 Second Pass at cleaning up the code. These are pretty safe edits that include adding 0 to decimal values, fixing variables that are declared multiple times, and removing duplicate keys 2014-02-09 23:38:57 -06:00
Tyler Stark
afb3dc0c09 First pass at code quality: adding semicolons. 2014-02-09 20:35:42 -06:00
小太
f9101abbe7 Merge remote-tracking branch 'upstream/master' into tournaments-frontend
Conflicts:
	package.json
2014-02-03 00:24:23 +11:00
Guangcong Luo
1b0b3ec63b Optimize team validator
The main process no longer does any JSON parsing/stringifying of
teams. The communication protocol with validator processes has
been changed from JSON to a string protocol delimited by pipes.

A variety of more minor optimizations have also been done.
2014-01-23 21:35:26 -08:00
小太
250aeb3260 Merge branch 'tournaments' into tournaments-frontend
Conflicts:
	app.js
2013-09-16 16:05:45 +10:00
Guangcong Luo
ae62e9e737 Update ResourceMonitor to control bandwidth 2013-09-01 02:37:35 -07:00
小太
f2f973fe29 Obliterate trailing whitespace 2013-08-18 21:33:15 +10:00
小太
24279166b3 Core file edits to support frontend 2013-08-07 23:22:07 +10:00
Guangcong Luo
15297f2c0f Less logging 2013-07-12 22:32:10 -07:00
Guangcong Luo
238a709f3b Rename battles.js to battle-engine.js 2013-05-24 20:50:30 -07:00
Guangcong Luo
27be062395 Tons of documentation 2013-05-24 14:59:29 -07:00
Guangcong Luo
9f79b1423e Switch to new protocol 2013-05-22 20:43:13 -07:00
Guangcong Luo
355f906e3f Fix timer issue 2013-05-01 03:05:00 -07:00
Cathy J. Fitzpatrick
3b6d0792f9 Fix rejoining battles 2013-04-21 18:42:28 -06:00
Cathy J. Fitzpatrick
a0dc8bb12a Fix /potd 2013-04-14 17:48:38 -06:00
Cathy J. Fitzpatrick
7b98429a75 Implement /hotpatch battles 2013-04-14 17:46:39 -06:00
Cathy J. Fitzpatrick
31fac973e0 Correct trapping mechanics
This doesn't yet handle modded formats that don't validate ability
selection in the ordinary manner. Those formats will continue to work
essentially in the same manner as before, rather than with the correct
mechanics.
2013-04-10 21:19:35 -06:00
Cathy J. Fitzpatrick
6259cd8ed0 Implement multiple simulator processes 2013-02-22 23:14:00 -07:00
Cathy J. Fitzpatrick
6e54bccb16 Commit missing file for last commit
I accidentally forgot to commit the other file for Zarel/Pokemon-Showdown@9b3e433bc7
2013-01-26 13:01:58 -07:00
Cathy J. Fitzpatrick
923498e7ba Reinstate stopgap for now
On further analysis, I'm not sure what the bug is here so I will
leave in the stopgap until is more thoroughly analysed.
2013-01-26 12:36:51 -07:00
Cathy J. Fitzpatrick
5b74e24a90 Fix bug causing crashes
Previously, Simulator.prototype.resendRequest() called user.sendTo()
with an invalid room specified, causing the server to send the
message to all rooms, leading to problems on the live server.
2013-01-26 12:26:30 -07:00