Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3501 closed enhancement (fixed)

[PATCH] Distinguish player resign and defeat message

Reported by: Stan Owned by: Damien PIQUET
Priority: Nice to Have Milestone: Alpha 21
Component: UI & Simulation Keywords: patch
Cc: damien@… Patch:

Description

Currently it says X has been defeated while it should either say

X has resigned X has been defeated

or just

X has resigned.

Attachments (8)

3501.diff (3.0 KB ) - added by Damien PIQUET 8 years ago.
3501.patch (2.9 KB ) - added by Damien PIQUET 8 years ago.
updated patch for ticket #3501
3501-2.patch (3.3 KB ) - added by Damien PIQUET 8 years ago.
Updated patch for #3501 with colors
3501-3.patch (3.4 KB ) - added by Damien PIQUET 8 years ago.
Improvements to 3501-2.patch
3501-4.patch (5.0 KB ) - added by elexis 8 years ago.
Added credits entry.
3501-5.patch (4.1 KB ) - added by Damien PIQUET 8 years ago.
3501-6.patch (3.7 KB ) - added by Damien PIQUET 8 years ago.
Merged formatResignMessage and formatDefeatMessage functions
3501-7.patch (3.7 KB ) - added by Damien PIQUET 8 years ago.
don't break translations detection

Download all attachments as: .zip

Change History (16)

comment:1 by wraitii, 8 years ago

Milestone: BacklogAlpha 20

comment:2 by elexis, 8 years ago

Keywords: simple added
Milestone: Alpha 20Backlog
Priority: Should HaveNice to Have
Summary: Incorrect Message When Resigning a MP GameDistinguish player resign and defeat message
Type: defectenhancement

Yes, it would be nice to distinguish between defeat and resign.

The reisgn-command is defined in Commands.js (and called from session.js):

	"defeat-player": function(player, cmd, data)
	{
		// Send "OnPlayerDefeated" message to player
		Engine.PostMessage(data.playerEnt, MT_PlayerDefeated, { "playerId": player } );
	},

Since it only works for the current playerID, it is not possible to defeat a different player. Therefore it should be safe to add a boolean resign argument to the message that is sent in that case, pass it to the notification sent in Player.js and display the alternative message in messages.js

by Damien PIQUET, 8 years ago

Attachment: 3501.diff added

comment:3 by Damien PIQUET, 8 years ago

Cc: damien@… added
Keywords: review patch added
Milestone: BacklogAlpha 22
Owner: set to Damien PIQUET
Status: newassigned
Summary: Distinguish player resign and defeat message[PATCH] Distinguish player resign and defeat message

That's my first patch attempt. It may need rework as i'm not used to the code, i'll rewrite it according to suggestions if needed.

comment:4 by bb, 8 years ago

Milestone: Alpha 22Alpha 21

A21 is next release so putted milestone on that.

From a quick look at the code: "} )" should be simply "})" and use double quotations instead of single.

comment:5 by elexis, 8 years ago

In addition to bb's comments you should also fix the following:

  • Commands.js, Player.js: Remove that unneeded variable and just avoid the undefined warning by using !!foo.bar
  • The formatResignMessage is ugly. Better copy from the updated formatDefeatMessage, which should be less ugly as of r18147.

Also want to mention that setting the resign-boolean in the GUI is the right place, as for example triggerscripts of maps (TriggerHelper.DefeatPlayer()) might want to send a defead command for that player from the simulation, which should not show up as a resign.

by Damien PIQUET, 8 years ago

Attachment: 3501.patch added

updated patch for ticket #3501

by Damien PIQUET, 8 years ago

Attachment: 3501-2.patch added

Updated patch for #3501 with colors

by Damien PIQUET, 8 years ago

Attachment: 3501-3.patch added

Improvements to 3501-2.patch

by elexis, 8 years ago

Attachment: 3501-4.patch added

Added credits entry.

by Damien PIQUET, 8 years ago

Attachment: 3501-5.patch added

by Damien PIQUET, 8 years ago

Attachment: 3501-6.patch added

Merged formatResignMessage and formatDefeatMessage functions

by Damien PIQUET, 8 years ago

Attachment: 3501-7.patch added

don't break translations detection

comment:6 by elexis, 8 years ago

Resolution: fixed
Status: assignedclosed

In 18161:

Distinguish resign- and defeat-chatmessage. Patch by dpiquet, fixes #3501.
For consistency, also colorize the "You" part in the singleplayer variants.

comment:7 by elexis, 8 years ago

Keywords: simple review removed

Thanks for the patch and staying with us throughout all the iterations. ;) More patches are always welcome (not only for simple tickets)

comment:8 by elexis, 8 years ago

In 18180:

Use an actual playername instead of "You" in singleplayer, fixes #3979.

Differentiate between SP and MP name and allow editing it in the settings.
Defaults to the OS username.
Makes sharing singleplayer replays more effective.
Also fixes a troublesome colorization of "You" in a translated sentence, refs #3501.

Note: See TracTickets for help on using tickets.