Skip to content

Commit

Permalink
fix: invite buttons after relaunch party
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Jun 24, 2022
1 parent b5450d5 commit a942002
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Code/skyrim_ui/src/app/services/group.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ export class GroupService implements OnDestroy {
this.partyLeftSubscription = this.clientService.partyLeftChange.subscribe(() => {
const group = this.createGroup(this.group.value);

// TODO: this is probably redundant now
if (group) {
this.playerListService.resetHasBeenInvitedFlags();

group.isEnabled = false;
group.owner = undefined;
group.members.splice(0);
Expand Down
16 changes: 14 additions & 2 deletions Code/skyrim_ui/src/app/services/player-list.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,30 @@ export class PlayerListService {
}

public acceptPartyInvite(inviterId: number) {
this.clientService.acceptPartyInvite(inviterId);

const playerList = this.getPlayerList();

if (playerList) {
this.getPlayerById(inviterId).hasInvitedLocalPlayer = false;

this.clientService.acceptPartyInvite(inviterId);

this.playerList.next(playerList);
}
}

public getPlayerById(playerId: number) : Player {
return this.getPlayerList().players.find(player => player.id === playerId);
}

public resetHasBeenInvitedFlags() {
const playerList = this.getPlayerList();

if (playerList) {
for (const player of playerList.players) {
player.hasBeenInvited = false;
}

this.updatePlayerList();
}
}
}

0 comments on commit a942002

Please sign in to comment.