Skip to content

Commit

Permalink
fix: setCell for ui display
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Jun 17, 2022
1 parent 6043c34 commit b99af4c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Code/client/Services/Generic/OverlayService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void OverlayService::OnPlayerCellChanged(const NotifyPlayerCellChanged& acMessag
auto pArguments = CefListValue::Create();
pArguments->SetInt(0, acMessage.PlayerId);
String cellName = GetCellName(acMessage.WorldSpaceId, acMessage.CellId);
pArguments->SetString(3, cellName.c_str());
pArguments->SetString(1, cellName.c_str());
m_pOverlay->ExecuteAsync("setCell", pArguments);
}

Expand Down
2 changes: 1 addition & 1 deletion Code/client/Services/Generic/TransportService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void TransportService::OnConsume(const void* apData, uint32_t aSize)

void TransportService::OnConnected()
{
AuthenticationRequest request;
AuthenticationRequest request{};
request.Version = BUILD_COMMIT;
request.SKSEActive = IsScriptExtenderLoaded();
request.MO2Active = GetModuleHandleW(kMO2DllName);
Expand Down
20 changes: 10 additions & 10 deletions Code/encoding/Messages/AuthenticationRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ struct AuthenticationRequest final : ClientMessage
Level == achRhs.Level;
}

uint64_t DiscordId;
bool SKSEActive;
bool MO2Active;
String Token;
String Version;
Mods UserMods;
String Username;
GameId WorldSpaceId;
GameId CellId;
uint16_t Level;
uint64_t DiscordId{};
bool SKSEActive{};
bool MO2Active{};
String Token{};
String Version{};
Mods UserMods{};
String Username{};
GameId WorldSpaceId{};
GameId CellId{};
uint16_t Level{};
};
10 changes: 5 additions & 5 deletions Code/encoding/Messages/NotifyPlayerJoined.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ struct NotifyPlayerJoined final : ServerMessage
Level == acRhs.Level;
}

uint32_t PlayerId;
String Username;
GameId WorldSpaceId;
GameId CellId;
uint16_t Level;
uint32_t PlayerId{};
String Username{};
GameId WorldSpaceId{};
GameId CellId{};
uint16_t Level{};
};
16 changes: 16 additions & 0 deletions Code/skyrim_ui/src/app/services/player-list.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class PlayerListService {
private connectionSubscription: Subscription;
private playerConnectedSubscription: Subscription;
private playerDisconnectedSubscription: Subscription;
private cellSubscription: Subscription;
private partyInviteReceivedSubscription: Subscription;

private isConnect = false;
Expand All @@ -22,13 +23,15 @@ export class PlayerListService {
this.onConnectionStateChanged();
this.onPlayerConnected();
this.onPlayerDisconnected();
this.onCellChange();
this.onPartyInviteReceived();
}

ngOnDestroy() {
this.connectionSubscription.unsubscribe();
this.playerConnectedSubscription.unsubscribe();
this.playerDisconnectedSubscription.unsubscribe();
this.cellSubscription.unsubscribe();
this.partyInviteReceivedSubscription.unsubscribe();
}

Expand Down Expand Up @@ -74,6 +77,19 @@ export class PlayerListService {
});
}

private onCellChange() {
this.cellSubscription = this.clientService.cellChange.subscribe((player: Player) => {
const playerList = this.createPlayerList(this.playerList.value);

if (playerList) {
const p = playerList.players.get(player.serverId);
if (p) {
p.cellName = player.cellName;
}
}
})
}

private onPartyInviteReceived() {
this.partyInviteReceivedSubscription = this.clientService.partyInviteReceivedChange.subscribe((inviterId: number) => {
const playerList = this.createPlayerList(this.playerList.value);
Expand Down

0 comments on commit b99af4c

Please sign in to comment.