* Added third type to /weakness
In case of Trick-or-Treat or Forest's Curse, a pokémon can have three types. I updated the /weakness command to reflect that.
* Fixed Travis' warning and error
simulator.js doesn't actually contain the simulator, but is really just
an implementation of battles in the RoomGame interface.
Renames:
`Simulator.Battle` -> `Rooms.RoomBattle`
`Simulator.BattlePlayer` -> `Rooms.RoomBattlePlayer`
`Simulator.SimulatorManager` -> `Rooms.SimulatorManager`
`Simulator.SimulatorProcess` -> `Rooms.SimulatorProcess`
`Simulator.create` -> no longer exists, use `new Rooms.RoomBattle(...)`
Due to the recent refactor that changed how `this.canTalk` works, if a user was muted in a room, and then tried to do a command that wasn't allowed to be used if they can't talk, it would send two replies: "You are muted and cannot talk in this room." AND "You cannot do this while unable to talk."
This makes it so that if you're using a command while muted that isn't allowed to be used if you can't talk, it will just use the "You are muted and cannot talk in this room." errorReply.
We had a lot of discussion in Dev and a somewhat-close poll, but in
the end "Chat" was a better name than "Messages", and also has the
advantage of being shorter (which is nice for Chat.html and
Chat.plural which should be short).
The following functions have been renamed:
- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
(notice the lowercase 's')
This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
I honestly don't know exactly why it exists (its commit didn't exactly
explain it), but Slayer95 thinks it's high-priority so this solution
should probably be sufficient?
?_?
This is the source of the infamous !om g issue.
The new design looks better, anyway, and allows !formatshelp to also
be braodcast since it's no longer spammy.
!om searching will also now only search OMs.
PMs no longer special-case commands. The implementation of /invite,
/me, etc in commands have been fully moved from messages.js back to
commands.js and the rest. This makes Messages command support a lot
closer to how CommandParser itself handles commands; the two files
should be mergeable soon.
/me has been refactored, and now supports /ME, /me's, etc in PMs and
regular chat exactly the same way.
context.pmTarget is now guaranteed to be `User|undefined`, rather than
its previous specification of `User|string|undefined`. The previous
use-case of putting a string in context.pmTarget was to support
errorReply when PMing a nonexistent user, but special-casing that
case is easier than having to support a possible string pmTarget
everywhere.
Aliases like /j used to not work when called from the global room while not in
lobby.
Using rest parameters for TestPattern#register instead of a
single array came out to be faster.
/roomtopic also isn't a command.
This now makes it so that if a user can broadcast but cannot declare in that room, and they attempt to broadcast it, it will now send them the error reply themselves instead of broadcasting the error reply to the room.
Credits to Slayer95 for this fix!
These changes were supposed to be in de524c1a26 but got lost in my
Git stash...
Once again, this is very experimental code; please don't base any
serious changes on it.
- /ip would display "undefined" for rooms a user isn't banned/muted in
- CrisisMonitor would report private roombans/blacklists
- Roombans/blacklists would alert for rooms you're not in
- There were crashes in /mute and /hidetext
Roombans/blacklists have been mostly rewritten from scratch.
The new code mostly uses the same patterns as global punishments.
In addition:
- /ban has been renamed /globalban
- globalbans and blacklists now require a reason
- bans and blacklists in public rooms now show up in global modlog
- blacklist syntax is different: /blacklist and /unblacklist
- ban/blacklist display in /whoare is now more detailed
This isn't all the work that needs to be done on blacklists, but it's
the highest-priority changes.
- blacklists.tsv has been renamed room-punishments.tsv
- The format everywhere has changed to roomid:userid, rather than
roomid|userid
- roompunishments.tsv's format is now `Room ID:User ID, IPs and alts`
rather than `User ID, Room ID|IPs and alts`, which is more sane and
also cuts down on repetition of room IDs
Those are the changes that affect storage format, which are highest
priority because I don't want to support the previous format.
Other changes include:
- Punishments.roombannedIps renamed to Punishments.roomIps
- Punishments.roombannedUserids renamed to Punishments.roomUserids
- Some refactoring for ES6 destructuring
- Various bugfixes
Before, an options object containing properties and values to be used
was how decorated instances of the class would be created. This meant
the constructor could assign anything you feel like to `this`. Rather
than that, the constructor now assigns a strict set of values, and
methods are redefined in subclasses.
Basic unit tests were added to test if they could be written for after
the final refactor to fix the other memory leak here.
Before, if a user was perma locked or perma banned, it would show that their lock would expire in a negative time - this fixes that.
For consistency, I also added the check to the namelock check as well.
This commit introduces Tools.html and Tools.plural, helper functions
for string construction.
Tools.html is a template tag function that escapes HTML inside the
template string.
Tools.plural is a helper function that takes a passed Number, Array,
Set, or Map and returns a string representing whether or not it's
plural.
It also starts doing some refactors of some files to make it clear how
I expect code style for template strings to look.
Previously, we used ' for IDs, " for English text, and ' for code.
We should now be using ' for IDs, ` for English text, and ` for code.
This lets regular users, or users who don't have permission to use !htmlbox to first test and validate HTML by using the same validation system PS uses across the sim for things like roomintros, for example.
Users#roomCount, previously a null-prototype roomid:count Object,
is now Users#inRooms, a roomid Set.
The new name is "inRooms" rather than "rooms" mostly for ease of
greppability. I'm kind of tired of getting Rooms.rooms when
grepping for ".rooms"
This is the next step in the process of using Maps/Sets instead of
null-proto Objects for maps/sets we add/remove to/from a lot.
I tried to get rid of the room counter completely, but that made
iterating a user's rooms take tens of milliseconds rather than
tens of microseconds, which is unacceptably slow for how often we do
that.
Not actively tracking the number of connections in a room does not
change the asymptotic complexity of any function. It slows down
leaveRoom but doesn't change its asymptotic complexity (nor does
it slow it down in any noticeable way).
leaveRoom was, incidentally, kinda gnarly code which is now a lot
cleaner. Yay!
#Zarel: >No results found.
#Zarel: why is that red???
%panpawn: I don't know
%panpawn: it was red before that commit
#Zarel: Should probably be sendReply for "No results found"