-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe5bef
commit dde6c34
Showing
6 changed files
with
67 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const uri = process.env?.SERVER_URI || 'http://localhost:3000' | ||
export const username = process.env?.RPG_FOR_BOTS_USERNAME || 'foobar' | ||
export const password = process.env?.RPG_FOR_BOTS_PASSWORD || 'foobar2' | ||
export const password = process.env?.RPG_FOR_BOTS_PASSWORD || 'foobar' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CharacterList } from '../shared/socket' | ||
|
||
import users, { User } from './data/users' | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export async function getCharacterList( | ||
username: string, | ||
): Promise<CharacterList> { | ||
const user = users.find((u: User) => u.username === username) | ||
let { characters } = user || {} | ||
|
||
const demoUser = users.find((u: User) => u.username === 'demo') as User | ||
if (!user) { | ||
characters = demoUser.characters | ||
} | ||
|
||
return (characters || []).map((c) => ({ | ||
name: c.name, | ||
})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export type Character = { | ||
name: string | ||
} | ||
|
||
export type User = { | ||
username: string | ||
characters: Character[] | ||
} | ||
|
||
export default [ | ||
{ | ||
username: 'demo', | ||
characters: [ | ||
{ | ||
name: 'jim', | ||
}, | ||
{ | ||
name: 'jack', | ||
}, | ||
{ | ||
name: 'johnny', | ||
}, | ||
], | ||
}, | ||
] as User[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters