Colorize also playernames in chat message so its faster and easier to see color and name who is meant.
Details
- Reviewers
elexis vladislavbelov - Trac Tickets
- #4977
- Run the game;
- Start the multiplayer match with someone or another opened game;
- Check that all player names are colored.
Diff Detail
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
1103–1104 | why is this check added? observers should still get there ping, and observer messages should be colored too | |
1109–1111 | rewrite to if (msg.text.indexOf(g_PlayerAssignments[guid].name) != -1) msg.text = msg.text.replace(g_PlayerAssignments[guid].name, colorizePlayernameByGUID(guid)) and omnit some braces |
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
1103–1104 | observer are white no? ping sure hm |
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
1103–1104 | yea i got error sometimes and some lines later its also checked l1124 coloredUsername = msg.guid != -1 ? colorizePlayernameByGUID(msg.guid) : colorizePlayernameByID(msg.player); not sure keeping it. maybe safe. maybe break. |
I'm interesting, what happens if there are 4 players: Test, PrefixTest, TestSuffix, PrefixTestSuffix? I think it depends on the g_PlayerAssignments order.
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
1113 | Do we really need a check here? I mean, if the replace didn't find any occurrence, it wouldn't replace anything. |
Im so glad @vladislavbelov question all of this. Cause the replace in user mentioning in message in lobby is crapped same way. Its needs word barriers to replace. Therefore is the \b regex from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#special-word-boundary
So now it should work good.
binaries/data/mods/public/gui/session/messages.js | ||
---|---|---|
1113 | away |
Mozilla says:
Did you test for all possible symbols in names?
i hope they are not allowed for names in accounts? think so :)
Actualy just wanted to have a better replace function as we had before (f.e. in lobby) :)
ok i got some errors need to test further (signs like "(" or ")" which are in names allowed are a problem realy :(
Complains left @elexis @vladislavbelov @bb? I am feeling fine. Tests also done in P100.