Page MenuHomeWildfire Games

Give Stock Information About Tribut Resource For Allied Players In Diplomacy Window
Needs ReviewPublic

Authored by ffffffff on Feb 5 2018, 1:49 PM.

Details

Reviewers
bb
temple
Summary

Test Plan

test

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

ffffffff created this revision.EditedFeb 5 2018, 1:49 PM

Or stock number in yellow color (maybe better seeable, maybe little darker yellow like golden) aha yellow seems fine to me

ffffffff updated this revision to Diff 5653.Feb 5 2018, 2:04 PM
ffffffff retitled this revision from Give Stock Information About Tribut Ressource For Team Players In Diplomacy Window to Give Stock Information About Tribut Ressource For Allied Players In Diplomacy Window.

shared LOS and yellow stock number

ffffffff retitled this revision from Give Stock Information About Tribut Ressource For Allied Players In Diplomacy Window to Give Stock Information About Tribut Resource For Allied Players In Diplomacy Window.Feb 6 2018, 10:39 AM
elexis added a subscriber: elexis.Feb 24 2018, 1:57 AM

Review:

(01:41:43) elexis: that \n should be in the sprintf string
(01:42:13) elexis: type should be resourceType so that translators know what its about
(01:42:17) elexis: can do when committing, yes
(01:42:33) elexis: and stock -> resourceCount
(01:43:18) elexis: order of sprintf arguments should correspond to the order of occurrences in the string
(01:43:49) elexis: weird ternary whitespace
(01:46:10) elexis: I'd suggest to not translate the \n and split that code
(01:46:30) elexis: thoug htranslating it is nice
(01:50:10) elexis: also Stock -> stock
(01:51:48) elexis: ah you added the \n there since it's conditional
(01:52:13) elexis: then translators can't relocate it well, so it can be non-translated too

function formatTributeTooltip(playerID, resourceCode, amount)
{
	let tooltip = sprintf(translate("Tribute %(resourceAmount)s %(resourceType)s to %(playerName)s. Shift-click to tribute %(greaterAmount)s."), {
		"resourceAmount": amount,
		"resourceType": resourceNameWithinSentence(resourceCode),
		"playerName": colorizePlayernameByID(playerID),
		"greaterAmount": amount < 500 ? 500 : amount + 500
	});

	if (g_IsObserver || (GetSimState().players[g_ViewedPlayer].hasSharedLos && g_Players[playerID].isMutualAlly[g_ViewedPlayer]))
		tooltip += "\n" + sprintf(translate("Current stock: %(resourceCount)s %(resourceType)s"), { 
			"resourceType": resourceNameWithinSentence(resourceCode),
			"resourceCount": Math.round(GetSimState().players[playerID].resourceCounts[resourceCode])
		})

	return tooltip;
}

The only thing that hinders me committing this is that the tooltip is not updated when doing a batch tribute. It appears that the donation wasn't received and the player might assume that the ally still has too few res.

ffffffff updated this revision to Diff 5936.Feb 25 2018, 9:15 PM
ffffffff added inline comments.Feb 26 2018, 2:32 AM
binaries/data/mods/public/gui/session/menu.js
1288

Maybe "Your %(resourceType)s Stock:..." is enough.

So "-own".