Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Lines | "getActionInfo": function(entState, targetState) | ||||
"capacity": targetState.garrisonHolder.capacity | "capacity": targetState.garrisonHolder.capacity | ||||
}); | }); | ||||
let extraCount = 0; | let extraCount = 0; | ||||
if (entState.garrisonHolder) | if (entState.garrisonHolder) | ||||
extraCount += entState.garrisonHolder.garrisonedEntitiesCount; | extraCount += entState.garrisonHolder.garrisonedEntitiesCount; | ||||
if (targetState.garrisonHolder.garrisonedEntitiesCount + extraCount >= targetState.garrisonHolder.capacity) | if (targetState.garrisonHolder.garrisonedEntitiesCount + extraCount >= targetState.garrisonHolder.capacity) | ||||
tooltip = coloredText(tooltip, "orange"); | tooltip = setColor(tooltip, "orange"); | ||||
if (!MatchesClassList(entState.identity.classes, targetState.garrisonHolder.allowedClasses)) | if (!MatchesClassList(entState.identity.classes, targetState.garrisonHolder.allowedClasses)) | ||||
return false; | return false; | ||||
return { | return { | ||||
"possible": true, | "possible": true, | ||||
"tooltip": tooltip | "tooltip": tooltip | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | "getActionInfo": function(entState, targetState) | ||||
tooltip = sprintf(translate("Current garrison: %(garrisoned)s/%(capacity)s"), { | tooltip = sprintf(translate("Current garrison: %(garrisoned)s/%(capacity)s"), { | ||||
"garrisoned": targetState.garrisonHolder.garrisonedEntitiesCount, | "garrisoned": targetState.garrisonHolder.garrisonedEntitiesCount, | ||||
"capacity": targetState.garrisonHolder.capacity | "capacity": targetState.garrisonHolder.capacity | ||||
}); | }); | ||||
if (targetState.garrisonHolder.garrisonedEntitiesCount >= | if (targetState.garrisonHolder.garrisonedEntitiesCount >= | ||||
targetState.garrisonHolder.capacity) | targetState.garrisonHolder.capacity) | ||||
tooltip = coloredText(tooltip, "orange"); | tooltip = setColor(tooltip, "orange"); | ||||
} | } | ||||
else if (targetState.resourceSupply) | else if (targetState.resourceSupply) | ||||
{ | { | ||||
let resourceType = targetState.resourceSupply.type; | let resourceType = targetState.resourceSupply.type; | ||||
if (resourceType.generic == "treasure") | if (resourceType.generic == "treasure") | ||||
cursor = "action-gather-" + resourceType.generic; | cursor = "action-gather-" + resourceType.generic; | ||||
else | else | ||||
cursor = "action-gather-" + resourceType.specific; | cursor = "action-gather-" + resourceType.specific; | ||||
▲ Show 20 Lines • Show All 673 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator