mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 22:22:51 +00:00
Merge remote-tracking branch 'origin/unstable' into unstable
This commit is contained in:
commit
a96506ccf9
@ -30,8 +30,10 @@ function invalid(value: number): boolean {
|
||||
* @param talents The level for the avatar's talents.
|
||||
*/
|
||||
export async function grantAvatar(
|
||||
avatar: number, level = 90,
|
||||
constellations = 6, talents = 6
|
||||
avatar: number,
|
||||
level = 90,
|
||||
constellations = 6,
|
||||
talents = 6
|
||||
): Promise<CommandResponse> {
|
||||
// Validate the numbers.
|
||||
if (invalid(avatar) || invalid(level)
|
||||
@ -39,12 +41,15 @@ export async function grantAvatar(
|
||||
return { status: -1, message: "Invalid arguments." };
|
||||
|
||||
return await fetch(`https://localhost:443/handbook/avatar`, {
|
||||
method: "POST", body: JSON.stringify({
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
player: targetPlayer.toString(),
|
||||
avatar: avatar.toString(),
|
||||
level, constellations, talentLevels: talents
|
||||
level,
|
||||
constellations,
|
||||
talentLevels: talents
|
||||
})
|
||||
}).then(res => res.json());
|
||||
}).then((res) => res.json());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ export enum ItemCategory {
|
||||
export type CommandResponse = {
|
||||
status: number | 200 | 500;
|
||||
message: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a string is a page.
|
||||
|
@ -26,11 +26,9 @@ class AvatarsPage extends React.PureComponent {
|
||||
|
||||
<div className={"AvatarsPage_List"}>
|
||||
{listAvatars().map((avatar) =>
|
||||
avatar.id > 11000000 ? undefined :
|
||||
<Character
|
||||
key={avatar.id} data={avatar}
|
||||
onClick={this.grantAvatar.bind(this, avatar)}
|
||||
/>
|
||||
avatar.id > 11000000 ? undefined : (
|
||||
<Character key={avatar.id} data={avatar} onClick={this.grantAvatar.bind(this, avatar)} />
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user