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