mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 14:17:58 +00:00
Lint Code [skip actions]
This commit is contained in:
parent
be560e4754
commit
954939744c
@ -87,8 +87,7 @@ export function getEntities(): Entity[] {
|
||||
internal: values[2]
|
||||
};
|
||||
})
|
||||
.filter((entity) =>
|
||||
!entity.name.includes("Mechanicus"));
|
||||
.filter((entity) => !entity.name.includes("Mechanicus"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,8 +58,7 @@ export function removeNavListener(listener: (page: Page) => void) {
|
||||
*/
|
||||
export function navigate(page: Page, update: boolean = true): Page | null {
|
||||
// Check the page.
|
||||
if (page == undefined)
|
||||
page = "Home";
|
||||
if (page == undefined) page = "Home";
|
||||
|
||||
// Navigate to the new page.
|
||||
const lastPage = currentPage;
|
||||
|
@ -103,11 +103,7 @@ export async function teleportTo(scene: number): Promise<CommandResponse> {
|
||||
* @param amount The amount of the entity to spawn.
|
||||
* @param level The level of the entity to spawn.
|
||||
*/
|
||||
export async function spawnEntity(
|
||||
entity: number,
|
||||
amount = 1,
|
||||
level = 1
|
||||
): Promise<CommandResponse> {
|
||||
export async function spawnEntity(entity: number, amount = 1, level = 1): Promise<CommandResponse> {
|
||||
// Validate the numbers.
|
||||
if (isNaN(entity) || isNaN(amount) || isNaN(level) || amount < 1 || level < 1 || level > 200)
|
||||
return { status: -1, message: "Invalid arguments." };
|
||||
|
@ -44,11 +44,7 @@ class App extends React.Component<{}, IState> {
|
||||
return (
|
||||
<div className={"App"}>
|
||||
<SideBar />
|
||||
{
|
||||
this.state.plain ?
|
||||
<PlainText /> :
|
||||
<Content initial={this.state.initial} />
|
||||
}
|
||||
{this.state.plain ? <PlainText /> : <Content initial={this.state.initial} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -12,11 +12,9 @@ class PlainText extends React.PureComponent {
|
||||
private getCommands(): React.ReactNode {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
listCommands()
|
||||
.map((command) =>
|
||||
<p>{`${command.name[0]} : ${command.description}`}</p>)
|
||||
}
|
||||
{listCommands().map((command) => (
|
||||
<p>{`${command.name[0]} : ${command.description}`}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -28,12 +26,11 @@ class PlainText extends React.PureComponent {
|
||||
private getAvatars(): React.ReactNode {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
listAvatars()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((avatar) =>
|
||||
<p>{`${avatar.id} : ${avatar.name}`}</p>)
|
||||
}
|
||||
{listAvatars()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((avatar) => (
|
||||
<p>{`${avatar.id} : ${avatar.name}`}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -45,12 +42,11 @@ class PlainText extends React.PureComponent {
|
||||
private getItems(): React.ReactNode {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
getItems()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((item) =>
|
||||
<p>{`${item.id} : ${item.name}`}</p>)
|
||||
}
|
||||
{getItems()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((item) => (
|
||||
<p>{`${item.id} : ${item.name}`}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -62,12 +58,11 @@ class PlainText extends React.PureComponent {
|
||||
private getMonsters(): React.ReactNode {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
getEntities()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((entity) =>
|
||||
<p>{`${entity.id} : ${entity.name}`}</p>)
|
||||
}
|
||||
{getEntities()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((entity) => (
|
||||
<p>{`${entity.id} : ${entity.name}`}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -79,12 +74,11 @@ class PlainText extends React.PureComponent {
|
||||
private getScenes(): React.ReactNode {
|
||||
return (
|
||||
<>
|
||||
{
|
||||
getScenes()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((scene) =>
|
||||
<p>{`${scene.id} : ${scene.identifier} [${scene.type}]`}</p>)
|
||||
}
|
||||
{getScenes()
|
||||
.sort((a, b) => a.id - b.id)
|
||||
.map((scene) => (
|
||||
<p>{`${scene.id} : ${scene.identifier} [${scene.type}]`}</p>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -93,8 +87,10 @@ class PlainText extends React.PureComponent {
|
||||
return (
|
||||
<div className={"PlainText"}>
|
||||
<p>
|
||||
// Grasscutter 3.6.0 GM Handbook<br />
|
||||
// Generated by the HTML GM Handbook.<br />
|
||||
// Grasscutter 3.6.0 GM Handbook
|
||||
<br />
|
||||
// Generated by the HTML GM Handbook.
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
// Commands
|
||||
|
@ -62,11 +62,9 @@ class EntityCard extends React.Component<IProps, IState> {
|
||||
if (isNaN(numeric) && value.length > 1) return;
|
||||
|
||||
// Check if the value should be a level.
|
||||
if (!this.state.showingCount && numeric > 200)
|
||||
numeric = 200;
|
||||
if (!this.state.showingCount && numeric > 200) numeric = 200;
|
||||
|
||||
const updated: any = this.state.showingCount ?
|
||||
{ count: numeric } : { level: numeric };
|
||||
const updated: any = this.state.showingCount ? { count: numeric } : { level: numeric };
|
||||
this.setState(updated);
|
||||
}
|
||||
|
||||
@ -78,8 +76,7 @@ class EntityCard extends React.Component<IProps, IState> {
|
||||
* @private
|
||||
*/
|
||||
private addCount(positive: boolean, multiple: boolean) {
|
||||
let value = this.state.showingCount ?
|
||||
this.state.count : this.state.level;
|
||||
let value = this.state.showingCount ? this.state.count : this.state.level;
|
||||
if (value === "") value = 1;
|
||||
if (typeof value == "string") value = parseInt(value);
|
||||
if (value < 1) value = 1;
|
||||
@ -90,11 +87,9 @@ class EntityCard extends React.Component<IProps, IState> {
|
||||
|
||||
value = Math.max(1, value + increment);
|
||||
// Check if the value should be a level.
|
||||
if (!this.state.showingCount && value > 200)
|
||||
value = 200;
|
||||
if (!this.state.showingCount && value > 200) value = 200;
|
||||
|
||||
const updated: any = this.state.showingCount ?
|
||||
{ count: value } : { level: value };
|
||||
const updated: any = this.state.showingCount ? { count: value } : { level: value };
|
||||
this.setState(updated);
|
||||
}
|
||||
|
||||
@ -160,8 +155,11 @@ class EntityCard extends React.Component<IProps, IState> {
|
||||
</div>
|
||||
<input
|
||||
type={"text"}
|
||||
value={this.state.showingCount ?
|
||||
`x${notNaN(this.state.count)}` : `Lv${notNaN(this.state.level)}`}
|
||||
value={
|
||||
this.state.showingCount
|
||||
? `x${notNaN(this.state.count)}`
|
||||
: `Lv${notNaN(this.state.level)}`
|
||||
}
|
||||
className={"ObjectCard_Count"}
|
||||
onChange={this.updateCount.bind(this)}
|
||||
onBlur={() => {
|
||||
|
Loading…
Reference in New Issue
Block a user