Commit Graph

461 Commits

Author SHA1 Message Date
Guangcong Luo
044f4f84e9 Fix crash in dexsearch 2016-03-16 09:44:14 -05:00
Guangcong Luo
e87fd32550 Refactor TeamValidator
The callback code in TeamValidator and the functions that use it have
been refactored to use Promises.

Pretty much all signatures have been changed, for instance:

    TeamValidator.validateTeamSync(format, team)
    -> TeamValidator(format).validateTeam(team)

    TeamValidator.validateTeam(format, team, callback)
    -> TeamValidator(format).prepTeam(team) // returns a Promise

Validators are no longer cached since they're really lightweight. They
contain a format and a Tools instance, and Tools instances are already
cached in Tools anyway. This saves a tiny bit of RAM in exchange for a
tiny bit of CPU time, but more importantly makes the code more
readable.

I'm introducing a new pattern/API for managing the parts of code with
child processes - their process managers are now at .PM and are now
opt-in, so you can use them synchronously without needing to spawn
any processes.

Fixes #2448
2016-03-16 09:43:59 -05:00
Bär Halberkamp
4ca5c1d2c8 Remove /mtg and allow /ygo in all rooms
The only wiki we could use sucks, and I'd rather only have a good command usable everywhere
2016-03-16 02:10:23 +01:00
Bär Halberkamp
bc00dab2f2 Convert dexsearch.js to be multiprocess 2016-03-15 19:47:18 +01:00
Ivo Julca
75b632fed0 Fix crashes in dexsearch 2016-03-11 07:54:28 -05:00
Ivo Julca
12e9ca78da Remove usage of Date|Function methods implemented by Sugar.js
Implements Tools#toTimeStamp to support Node.js builds without ICU support,
which are currently the default. If/when that changes, we should be able to
use Date#toLocaleDateString, given that appropriate locale options are used.
2016-03-09 16:55:47 -05:00
Ivo Julca
66c00d29af Remove usage of String|Number methods implemented by Sugar.js
Implements Tools#toDurationString to replace Number#duration.
2016-03-09 16:55:40 -05:00
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
Marty-D
c70bc2da94 Avoid all potential Thousand Arrows crashes from info commands 2016-03-07 21:45:29 -05:00
Ivo Julca
2b391ad824 Fix informational commands crashing for Thousand Arrows 2016-03-07 21:22:15 -05:00
Guangcong Luo
9111f2635f Split dexsearch off to its own chat plugin 2016-03-03 05:25:13 -06:00
Guangcong Luo
8474edccec Merge pull request #2436 from bumbadadabum/mafia3
Various updates
2016-03-02 04:12:30 -06:00
Bär Halberkamp
55b63a9e35 Rename the TG room for the YGO plugin 2016-03-02 06:03:33 +01:00
Guangcong Luo
e54fe99e37 Refactor Context#getLastIdOf to User#getLastId
Also add a User#getLastName

These functions allow punishment commands to show a user's userid
even if they try to avoid that by logging out.
2016-02-28 03:25:35 -06:00
Guangcong Luo
60ecc87ab9 Merge pull request #2431 from bumbadadabum/mafia3
Add permissions for roomgames
2016-02-26 15:25:50 -06:00
Bär Halberkamp
3465829e22 Add permissions for roomgames 2016-02-26 22:19:19 +01:00
Quinton Lee
ed36908033 The Studio plugin: update /aotd quote
It can now be used by drivers+.
2016-02-24 22:51:42 -06:00
Guangcong Luo
c97cadcb19 Implement /processes 2016-02-19 06:53:57 -05:00
Bär Halberkamp
f5a4e28205 Specify which game is in progress 2016-02-17 21:09:44 +01:00
Bär Halberkamp
4dd80754a4 Mafia: add an "autoModchat" option 2016-02-17 21:09:44 +01:00
Bär Halberkamp
370d49c078 Allow mafia roles with abilities that can only be used once 2016-02-17 21:09:44 +01:00
Bär Halberkamp
c207fab3cd Fix false negatives in polls upon joining 2016-02-17 21:09:44 +01:00
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
panpawn
ab6a88731e Standardize "User [user] not found." in commands
This replaces old instances like <code>"User [user] does not exist."</code> with instances like <code>"User [user] not found."</code>.
2016-02-05 02:28:10 +00:00
Guangcong Luo
d686404a17 Merge pull request #2406 from bumbadadabum/mafia3
Mafia: fix bug
2016-02-03 06:50:15 -06:00
Bär Halberkamp
52fb36bcc2 Mafia: fix bug 2016-02-03 02:32:53 +01:00
Guangcong Luo
4ed4fd460a Improve /learn messages
Specifically, the message for `.sourcesBefore` is now much clearer.
2016-02-01 22:06:38 -06:00
Guangcong Luo
1da53454cb Validator: Support tradebacks in GSC
Joim's previous code apparently already did, but this implementation
does it correctly with the set-intersect system.

As an added bonus of correctly using the set-intersect system, it now
shows up properly in /gsclearn
2016-01-31 16:52:24 -06:00
Guangcong Luo
77c667f617 Fix /learn in past gens
`Tools.includeMods()` is unfortunately still massively broken and
unable to be loaded on-demand. This commit restores the old Tools
behavior of loading it at the beginning, which is horrible for
startup time but is the only way of fixing incorrect /learn
results in past gens.

The previous displayed message for 'sourcesBefore' in gen 1-2 was
also wrong.

This was, as far as I can tell, a mistaken interpretation of what
'sourcesBefore' means; possibly due to a past bug in its
implementation.
2016-01-31 16:52:23 -06:00
Guangcong Luo
351aff4dad Merge pull request #2399 from bumbadadabum/mafia3
Mafia updates
2016-01-29 02:08:45 -08:00
Bär Halberkamp
01f93492b1 Mafia: implement new roles 2016-01-29 02:44:31 +01:00
Bär Halberkamp
8a9db339bc Mafia: Allow players to have their vote count different amounts 2016-01-28 16:20:25 +01:00
Marty-D
ccd75e0325 Fix build error in 64a5b14445 2016-01-27 21:51:00 -05:00
Guangcong Luo
64a5b14445 Polls: Make clear you can't vote after seeing results 2016-01-27 18:32:59 -05:00
Guangcong Luo
b355059f4e Polls: Optimize bandwidth use 2016-01-27 18:32:59 -05:00
Guangcong Luo
117ef7c378 Improve colors for !dt, especially Dark Mode 2016-01-27 04:37:54 -05:00
Bär Halberkamp
602e0a62c0 statcalc: fix !statcalc with no target 2016-01-26 17:48:38 +01:00
Teremiare
7d26b5d38b Wifi plugin: change various sendReply to errorReply 2016-01-26 15:11:44 +01:00
Guangcong Luo
f6b75e426c Merge pull request #2390 from bumbadadabum/mafia3
Mafia updates
2016-01-23 13:19:03 -08:00
Bär Halberkamp
6e7203e733 Mafia: implement other cops 2016-01-23 21:41:15 +01:00
Bär Halberkamp
f0c10298fd Mafia: make the 10 seconds left message less intrusive 2016-01-23 20:48:30 +01:00
Bär Halberkamp
cf057f512c Mafia: fix bugs 2016-01-23 20:46:52 +01:00
Hidden50
7d2f8290d1 Fix /statcalc to round between applying modifiers
!statcalc gardevoir, spe 252+ scarf
Base 80 at level 100 with 31 IVs, 252+ EVs at +1: 427. (should be 246)
!statcalc gardevoir 252+ spe
Base 80 at level 100 with 31 IVs, 252+ EVs: 284.
2016-01-22 12:58:04 +01:00
The Immortal
97de9f1e53 Smogdex: Remove Hoopa-U special case 2016-01-21 22:55:52 +04:00
Bär Halberkamp
49e16d003a Mafia: implement the latest changes to the RoomGame API 2016-01-20 19:10:08 +01:00
=
69495ebd07 Mafia plugin: Mafia scripts should not have the executable flag 2016-01-18 03:38:51 -04:00
Sebastian
da76fe2d37 Wi-Fi plugin: Remind users to use /ga to answer 2016-01-17 21:37:17 +00:00
Guangcong Luo
c8961c0cb5 Merge pull request #2379 from bumbadadabum/mafia3
Mafia: Update mafia with the new RoomGame features
2016-01-15 13:25:57 -08:00
Teremiare
34b767a434 Clarify how to set EVs in /statcalc 2016-01-15 16:56:45 +01:00
Bär Halberkamp
97c9d96e89 Mafia: Update mafia with the new RoomGame features 2016-01-15 15:03:28 +01:00