mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-12 18:40:07 +02:00
MISC: Rework faction rumor (#2569)
This commit is contained in:
@@ -41,16 +41,14 @@ export function joinFaction(faction: Faction): void {
|
||||
// Add this faction to player's faction list, keeping it in standard order
|
||||
Player.factions = getRecordKeys(Factions).filter((facName) => Factions[facName].isMember);
|
||||
|
||||
// Ban player from this faction's enemies
|
||||
// Ban player from joining this faction's enemies
|
||||
for (const enemy of faction.getInfo().enemies) {
|
||||
if (Factions[enemy]) Factions[enemy].isBanned = true;
|
||||
Player.factionRumors.delete(enemy);
|
||||
}
|
||||
// Remove invalid invites and rumors
|
||||
// Remove invalid invites
|
||||
Player.factionInvitations = Player.factionInvitations.filter((factionName) => {
|
||||
return !Factions[factionName].isMember && !Factions[factionName].isBanned;
|
||||
});
|
||||
Player.factionRumors.delete(faction.name);
|
||||
}
|
||||
|
||||
//Returns a boolean indicating whether the player has the prerequisites for the
|
||||
|
||||
@@ -58,6 +58,16 @@ const JoinChecklist = (props: { faction: Faction }): React.ReactElement => {
|
||||
);
|
||||
};
|
||||
|
||||
function getStylesForFactionName(faction: Faction) {
|
||||
return {
|
||||
overflow: "hidden",
|
||||
whiteSpace: "nowrap",
|
||||
textOverflow: "ellipsis",
|
||||
color: faction.isBanned ? Settings.theme.error : "inherit",
|
||||
textDecorationLine: faction.isBanned ? "line-through" : "none",
|
||||
};
|
||||
}
|
||||
|
||||
interface FactionElementProps {
|
||||
faction: Faction;
|
||||
/** Rerender function to force the entire FactionsRoot to rerender */
|
||||
@@ -121,7 +131,7 @@ const FactionElement = (props: FactionElementProps): React.ReactElement => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{props.faction.discovery == FactionDiscovery.known ? (
|
||||
{props.faction.discovery === FactionDiscovery.known ? (
|
||||
<Tooltip
|
||||
title={
|
||||
<>
|
||||
@@ -130,13 +140,11 @@ const FactionElement = (props: FactionElementProps): React.ReactElement => {
|
||||
</>
|
||||
}
|
||||
>
|
||||
<span style={{ overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }}>
|
||||
{props.faction.name}
|
||||
</span>
|
||||
<span style={getStylesForFactionName(props.faction)}>{props.faction.name}</span>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Tooltip title={"Rumored Faction"}>
|
||||
<span style={{ overflow: "hidden", whiteSpace: "nowrap", textOverflow: "ellipsis" }}>
|
||||
<span style={getStylesForFactionName(props.faction)}>
|
||||
<CorruptibleText content={props.faction.name} spoiler={false} />
|
||||
</span>
|
||||
</Tooltip>
|
||||
@@ -217,7 +225,9 @@ export function FactionsRoot(): React.ReactElement {
|
||||
const joinedFactions = Object.values(Factions).filter((faction) => faction.isMember);
|
||||
// Display invitations and rumors in the order they were received
|
||||
const invitedFactions = Player.factionInvitations.map((facName) => Factions[facName]).filter((faction) => !!faction);
|
||||
const rumoredFactions = [...Player.factionRumors].map((facName) => Factions[facName]).filter((faction) => !!faction);
|
||||
const rumoredFactions = [...Player.factionRumors]
|
||||
.map((facName) => Factions[facName])
|
||||
.filter((faction) => !!faction && !faction.isMember && !faction.alreadyInvited);
|
||||
|
||||
return (
|
||||
<Container disableGutters maxWidth="lg" sx={{ mx: 0, mb: 10 }}>
|
||||
|
||||
Reference in New Issue
Block a user