-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
82 changed files
with
13,663 additions
and
841 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import mongoose from "mongoose"; | ||
|
||
const DB = process.env.DB!; | ||
|
||
mongoose.connect(DB, { | ||
useNewUrlParser: true, | ||
useUnifiedTopology: true, | ||
useFindAndModify: false, | ||
useCreateIndex: true, | ||
}); | ||
|
||
const db = mongoose.connection; | ||
db.on("error", console.error.bind(console, "connection error:")); | ||
db.once("open", function () { | ||
console.log("connected to", DB); | ||
}); | ||
|
||
export * from "./models/user"; |
This file was deleted.
Oops, something went wrong.
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,51 @@ | ||
import { getModelForClass, prop } from "@typegoose/typegoose"; | ||
import { User } from "./user"; | ||
import type { IArtifact, IAttr } from "~/modules/core"; | ||
|
||
/** | ||
* 圣遗物 | ||
* | ||
* @export | ||
* @class Artifact | ||
*/ | ||
export class Artifact implements IArtifact { | ||
/** 拥有者 */ | ||
@prop({ ref: () => User, index: true }) | ||
public owner!: string; | ||
|
||
/** 部位 */ | ||
@prop({ type: Number, required: true }) | ||
public typeId!: number; | ||
|
||
/** 等级 */ | ||
@prop({ type: Number, required: true, default: 0 }) | ||
public level!: number; | ||
|
||
/** 主属性类型 */ | ||
@prop({ type: Number, required: true }) | ||
public main!: number; | ||
|
||
/** 副属性 */ | ||
@prop({ type: () => [Attr] }) | ||
public attrs!: Attr[]; | ||
|
||
// 评分 | ||
@prop({ type: Number }) | ||
public score?: number; | ||
} | ||
|
||
/** | ||
* 属性 | ||
* | ||
* @class Attr | ||
*/ | ||
export class Attr implements IAttr { | ||
// | ||
@prop({ type: Number, required: true }) | ||
type!: number; | ||
|
||
@prop({ type: Number, required: true }) | ||
value!: number; | ||
} | ||
|
||
export const ArtifactModel = getModelForClass(Artifact); |
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,61 @@ | ||
import { getModelForClass, prop } from "@typegoose/typegoose"; | ||
import { User } from "./user"; | ||
import { Artifact } from "./artifact"; | ||
import { IWeapon } from "~/modules/core"; | ||
|
||
/** | ||
* 角色 | ||
* | ||
* @export | ||
* @class Char | ||
*/ | ||
export class Char { | ||
/** 拥有者 */ | ||
@prop({ ref: () => User, index: true }) | ||
public owner!: string; | ||
|
||
/** 等级 */ | ||
@prop({ type: Number, required: true, default: 0 }) | ||
public level!: number; | ||
|
||
/** 突破等级 */ | ||
@prop({ type: Number, required: true }) | ||
public promoteLevel!: number; | ||
|
||
/** 命座等级 */ | ||
@prop({ type: Number }) | ||
public talentLevel!: number; | ||
|
||
/** 普攻等级 */ | ||
@prop({ type: Number }) | ||
public attackLevel!: number; | ||
|
||
/** E等级 */ | ||
@prop({ type: Number }) | ||
public eLevel!: number; | ||
|
||
/** Q等级 */ | ||
@prop({ type: Number }) | ||
public qLevel!: number; | ||
|
||
/** 圣遗物 */ | ||
@prop({ ref: () => Artifact }) | ||
public artifacts!: Artifact[]; | ||
|
||
/** 武器 */ | ||
@prop({ type: () => Weapon }) | ||
public weaponId!: Weapon; | ||
} | ||
|
||
class Weapon implements IWeapon { | ||
@prop({ type: Number }) | ||
public typeId!: number; | ||
|
||
@prop({ type: Number }) | ||
public level!: number; | ||
|
||
@prop({ type: Number }) | ||
public promoteLevel!: number; | ||
} | ||
|
||
export const CharModel = getModelForClass(Char); |
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,41 @@ | ||
import { getModelForClass, prop } from "@typegoose/typegoose"; | ||
|
||
/** | ||
* 用户 | ||
* | ||
* @export | ||
* @class User | ||
*/ | ||
export class User { | ||
@prop({ type: String, required: true, unique: true }) | ||
public email!: string; | ||
|
||
@prop({ type: String }) | ||
public username?: string; | ||
|
||
// 类型 普通用户=1 | ||
@prop({ type: Number }) | ||
public type?: number; | ||
|
||
// password | ||
@prop({ type: String, required: true }) | ||
public pass!: string; | ||
|
||
// 旅行者性别 | ||
@prop({ type: Number }) | ||
public travelerGender!: number; | ||
|
||
// 平台 | ||
@prop({ type: String }) | ||
public platform!: string; | ||
|
||
// 服务器 | ||
@prop({ type: String }) | ||
public server!: string; | ||
|
||
// 圣遗物hash | ||
@prop({ type: String }) | ||
public artifactHash!: string; | ||
} | ||
|
||
export const UserModel = getModelForClass(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
Oops, something went wrong.