Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update setshoes #40

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/structures/party/ClientPartyMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,16 +359,19 @@ class ClientPartyMember extends PartyMember {
/**
* Updates the client party member's shoes
* @param id The shoes's ID
* @param path The shoes' path in the game files
* @throws {EpicgamesAPIError}
*/
public async setShoes(id: string) {
public async setShoes(id: string, path?: string) {
let data = this.meta.get('Default:AthenaCosmeticLoadout_j');

data = this.meta.set('Default:AthenaCosmeticLoadout_j', {
...data,
AthenaCosmeticLoadout: {
...data.AthenaCosmeticLoadout,
shoesDef: `/CosmeticShoes/Assets/Items/Cosmetics/${id}.${id}`,
shoesDef: `${
path?.replace(/\/$/, '') ?? '/CosmeticShoes/Assets/Items/Cosmetics'
}/${id}.${id}`,
},
});

Expand Down Expand Up @@ -452,6 +455,26 @@ class ClientPartyMember extends PartyMember {
});
}

/**
* Clears the client party member's shoes
* @throws {EpicgamesAPIError}
*/
public async clearShoes() {
let data = this.meta.get('Default:AthenaCosmeticLoadout_j');

data = this.meta.set('Default:AthenaCosmeticLoadout_j', {
...data,
AthenaCosmeticLoadout: {
...data.AthenaCosmeticLoadout,
shoesDef: '',
},
});

await this.sendPatch({
'Default:AthenaCosmeticLoadout_j': data,
});
}

/**
* Updates the client party member's match state.
* NOTE: This is visually, the client will not actually join a match
Expand Down