Opened 2 years ago

Closed 19 months ago

Last modified 19 months ago

#3501 closed enhancement (fixed)

[PATCH] Distinguish player resign and defeat message

Reported by: stanislas69 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 19 months ago.
3501.patch (2.9 KB) - added by Damien PIQUET 19 months ago.
updated patch for ticket #3501
3501-2.patch (3.3 KB) - added by Damien PIQUET 19 months ago.
Updated patch for #3501 with colors
3501-3.patch (3.4 KB) - added by Damien PIQUET 19 months ago.
Improvements to 3501-2.patch
3501-4.patch (5.0 KB) - added by elexis 19 months ago.
Added credits entry.
3501-5.patch (4.1 KB) - added by Damien PIQUET 19 months ago.
3501-6.patch (3.7 KB) - added by Damien PIQUET 19 months ago.
Merged formatResignMessage and formatDefeatMessage functions
3501-7.patch (3.7 KB) - added by Damien PIQUET 19 months ago.
don't break translations detection

Download all attachments as: .zip

Change History (16)

comment:1 Changed 2 years ago by wraitii

Milestone: BacklogAlpha 20

comment:2 Changed 22 months ago by elexis

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

Changed 19 months ago by Damien PIQUET

Attachment: 3501.diff added

comment:3 Changed 19 months ago by Damien PIQUET

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 Changed 19 months ago by bb

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 Changed 19 months ago by elexis

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.

Changed 19 months ago by Damien PIQUET

Attachment: 3501.patch added

updated patch for ticket #3501

Changed 19 months ago by Damien PIQUET

Attachment: 3501-2.patch added

Updated patch for #3501 with colors

Changed 19 months ago by Damien PIQUET

Attachment: 3501-3.patch added

Improvements to 3501-2.patch

Changed 19 months ago by elexis

Attachment: 3501-4.patch added

Added credits entry.

Changed 19 months ago by Damien PIQUET

Attachment: 3501-5.patch added

Changed 19 months ago by Damien PIQUET

Attachment: 3501-6.patch added

Merged formatResignMessage and formatDefeatMessage functions

Changed 19 months ago by Damien PIQUET

Attachment: 3501-7.patch added

don't break translations detection

comment:6 Changed 19 months ago by elexis

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 Changed 19 months ago by elexis

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 Changed 19 months ago by elexis

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.