Skip to content

Commit

Permalink
Added Shoes Cosmetics (fnbrjs#791)
Browse files Browse the repository at this point in the history
* Updated Default:RawSquadAssignments_j to Default:SquadInformation_j

* slight refactor

* Added shoes

* get shoes

* Added optional path for setShoes and add clearShoes()

* .setShoes doc

---------

Co-authored-by: ThisNils <[email protected]>
  • Loading branch information
KyeOnDiscord and ThisNils authored Nov 30, 2024
1 parent 1a1932f commit d557abd
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/defaultPartyMemberMeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"Default:ArbitraryCustomDataStore_j": "{\"ArbitraryCustomDataStore\":[]}",
"Default:AthenaBannerInfo_j": "{\"AthenaBannerInfo\":{\"bannerIconId\":\"standardbanner15\",\"bannerColorId\":\"defaultcolor15\",\"seasonLevel\":1}}",
"Default:AthenaCosmeticLoadoutVariants_j": "{\"AthenaCosmeticLoadoutVariants\":{\"vL\":{},\"fT\":false}}",
"Default:AthenaCosmeticLoadout_j": "{\"AthenaCosmeticLoadout\":{\"characterPrimaryAssetId\":\"\",\"characterEKey\":\"\",\"backpackDef\":\"None\",\"backpackEKey\":\"\",\"pickaxeDef\":\"/Game/Athena/Items/Cosmetics/Pickaxes/DefaultPickaxe.DefaultPickaxe\",\"pickaxeEKey\":\"\",\"contrailDef\":\"/Game/Athena/Items/Cosmetics/Contrails/DefaultContrail.DefaultContrail\",\"contrailEKey\":\"\",\"scratchpad\":[],\"cosmeticStats\":[{\"statName\":\"HabaneroProgression\",\"statValue\":0},{\"statName\":\"TotalVictoryCrowns\",\"statValue\":0},{\"statName\":\"TotalRoyalRoyales\",\"statValue\":0},{\"statName\":\"HasCrown\",\"statValue\":0}]}}",
"Default:AthenaCosmeticLoadout_j": "{\"AthenaCosmeticLoadout\":{\"characterPrimaryAssetId\":\"\",\"characterEKey\":\"\",\"backpackDef\":\"None\",\"backpackEKey\":\"\",\"pickaxeDef\":\"/Game/Athena/Items/Cosmetics/Pickaxes/DefaultPickaxe.DefaultPickaxe\",\"pickaxeEKey\":\"\",\"contrailDef\":\"/Game/Athena/Items/Cosmetics/Contrails/DefaultContrail.DefaultContrail\",\"contrailEKey\":\"\",\"shoesDef\":\"None\",\"shoesEKey\":\"\",\"scratchpad\":[],\"cosmeticStats\":[{\"statName\":\"HabaneroProgression\",\"statValue\":0},{\"statName\":\"TotalVictoryCrowns\",\"statValue\":0},{\"statName\":\"TotalRoyalRoyales\",\"statValue\":0},{\"statName\":\"HasCrown\",\"statValue\":0}]}}",
"Default:BattlePassInfo_j": "{\"BattlePassInfo\":{\"bHasPurchasedPass\":false,\"passLevel\":1,\"selfBoostXp\":0,\"friendBoostXp\":0}}",
"Default:bIsPartyUsingPartySignal_b": "false",
"Default:CampaignHero_j": "{\"CampaignHero\":{\"heroItemInstanceId\":\"\",\"heroType\":\"\"}}",
Expand Down
44 changes: 44 additions & 0 deletions src/structures/party/ClientPartyMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,30 @@ class ClientPartyMember extends PartyMember {
await this.sendPatch(patches);
}

/**
* 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, path?: string) {
let data = this.meta.get('Default:AthenaCosmeticLoadout_j');

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

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

/**
* Updates the client party member's emote
* @param id The emote's ID
Expand Down Expand Up @@ -431,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
7 changes: 7 additions & 0 deletions src/structures/party/PartyMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ class PartyMember extends User {
return this.meta.backpack;
}

/**
* The member's currently equipped shoes
*/
public get shoes() {
return this.meta.shoes;
}

/**
* Whether the member is ready
*/
Expand Down
7 changes: 7 additions & 0 deletions src/structures/party/PartyMemberMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class PartyMemberMeta extends Meta<PartyMemberSchema> {
return (this.get('Default:AthenaCosmeticLoadout_j')?.AthenaCosmeticLoadout?.backpackDef as string)?.match(/(?<=\w*\.)\w*/)?.shift();
}

/**
* The currently equipped shoes
*/
public get shoes(): string | undefined {
return (this.get('Default:AthenaCosmeticLoadout_j')?.AthenaCosmeticLoadout?.shoesDef as string)?.match(/(?<=\w*\.)\w*/)?.shift();
}

/**
* Whether the member is ready
*/
Expand Down

0 comments on commit d557abd

Please sign in to comment.