Goal Schema
This commit is contained in:
parent
d771f1a6b8
commit
f79767d71a
@ -51,7 +51,7 @@ import {
|
|||||||
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
} from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||||
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
import { toMongoDate, toOid } from "@/src/helpers/inventoryHelpers";
|
||||||
|
|
||||||
const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
export const typeCountSchema = new Schema<ITypeCount>({ ItemType: String, ItemCount: Number }, { _id: false });
|
||||||
|
|
||||||
const focusXPSchema = new Schema<IFocusXP>(
|
const focusXPSchema = new Schema<IFocusXP>(
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ import { IEquipmentSelection } from "@/src/types/inventoryTypes/commonInventoryT
|
|||||||
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
import { ILoadoutConfigDatabase, ILoadoutDatabase } from "@/src/types/saveLoadoutTypes";
|
||||||
import { Model, Schema, Types, model } from "mongoose";
|
import { Model, Schema, Types, model } from "mongoose";
|
||||||
|
|
||||||
const oidSchema = new Schema<IOid>(
|
export const oidSchema = new Schema<IOid>(
|
||||||
{
|
{
|
||||||
$oid: String
|
$oid: String
|
||||||
},
|
},
|
||||||
|
@ -10,7 +10,6 @@ import {
|
|||||||
IPVPChallengeInstanceParam,
|
IPVPChallengeInstanceParam,
|
||||||
IMission,
|
IMission,
|
||||||
IAlert,
|
IAlert,
|
||||||
ICountedItems,
|
|
||||||
IReward,
|
IReward,
|
||||||
ISortie,
|
ISortie,
|
||||||
ILiteSortie,
|
ILiteSortie,
|
||||||
@ -34,8 +33,11 @@ import {
|
|||||||
IFeaturedGuild,
|
IFeaturedGuild,
|
||||||
IActiveChallenge,
|
IActiveChallenge,
|
||||||
ISeasonInfo,
|
ISeasonInfo,
|
||||||
IWorldStateDocument
|
IWorldStateDocument,
|
||||||
|
IGoal
|
||||||
} from "@/src/types/worldStateTypes";
|
} from "@/src/types/worldStateTypes";
|
||||||
|
import { oidSchema } from "@/src/models/inventoryModels/loadoutModel";
|
||||||
|
import { typeCountSchema } from "@/src/models/inventoryModels/inventoryModel";
|
||||||
|
|
||||||
const messageSchema = new Schema<IMessage>(
|
const messageSchema = new Schema<IMessage>(
|
||||||
{
|
{
|
||||||
@ -78,20 +80,12 @@ EventSchema.set("toJSON", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const CountedItemsSchema = new Schema<ICountedItems>(
|
|
||||||
{
|
|
||||||
ItemType: String,
|
|
||||||
ItemCount: Number
|
|
||||||
},
|
|
||||||
{ _id: false }
|
|
||||||
);
|
|
||||||
|
|
||||||
const RewardSchema = new Schema<IReward>(
|
const RewardSchema = new Schema<IReward>(
|
||||||
{
|
{
|
||||||
credits: Number,
|
credits: Number,
|
||||||
xp: Number,
|
xp: Number,
|
||||||
items: [String],
|
items: [String],
|
||||||
countedItems: [CountedItemsSchema]
|
countedItems: [typeCountSchema]
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
@ -105,6 +99,7 @@ const MissionSchema = new Schema<IMission>(
|
|||||||
missionReward: RewardSchema,
|
missionReward: RewardSchema,
|
||||||
levelOverride: String,
|
levelOverride: String,
|
||||||
enemySpec: String,
|
enemySpec: String,
|
||||||
|
extraEnemySpec: String,
|
||||||
minEnemyLevel: Number,
|
minEnemyLevel: Number,
|
||||||
maxEnemyLevel: Number,
|
maxEnemyLevel: Number,
|
||||||
descText: String,
|
descText: String,
|
||||||
@ -119,15 +114,59 @@ const MissionSchema = new Schema<IMission>(
|
|||||||
vipAgent: Boolean,
|
vipAgent: Boolean,
|
||||||
leadersAlwaysAllowed: Boolean,
|
leadersAlwaysAllowed: Boolean,
|
||||||
goalTag: String,
|
goalTag: String,
|
||||||
|
questReq: String,
|
||||||
levelAuras: [String]
|
levelAuras: [String]
|
||||||
},
|
},
|
||||||
{ _id: false }
|
{ _id: false }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const GoalSchema = new Schema<IGoal>({
|
||||||
|
Activation: Number,
|
||||||
|
Expiry: Number,
|
||||||
|
|
||||||
|
Regions: [Number],
|
||||||
|
OptionalInMission: Boolean,
|
||||||
|
UpgradeIds: [oidSchema],
|
||||||
|
|
||||||
|
Node: String,
|
||||||
|
MissionKeyName: String,
|
||||||
|
Faction: String,
|
||||||
|
|
||||||
|
Icon: String,
|
||||||
|
ToolTip: String,
|
||||||
|
Desc: String,
|
||||||
|
|
||||||
|
Tag: String,
|
||||||
|
ScoreLocTag: String,
|
||||||
|
ScoreVar: String,
|
||||||
|
|
||||||
|
Reward: RewardSchema,
|
||||||
|
InterimRewards: [RewardSchema],
|
||||||
|
|
||||||
|
Goal: Number,
|
||||||
|
InterimGoals: [Number],
|
||||||
|
ClanGoal: [Number],
|
||||||
|
HealthPct: Number,
|
||||||
|
Count: Number,
|
||||||
|
ItemType: String,
|
||||||
|
|
||||||
|
Personal: Boolean,
|
||||||
|
Community: Boolean
|
||||||
|
});
|
||||||
|
|
||||||
|
GoalSchema.set("toJSON", {
|
||||||
|
transform(_document, returnedObject) {
|
||||||
|
returnedObject._id = { $oid: returnedObject._id.toString() };
|
||||||
|
returnedObject.Activation = { $date: { $numberLong: returnedObject.Activation.toString() } };
|
||||||
|
returnedObject.Expiry = { $date: { $numberLong: returnedObject.Expiry.toString() } };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const AlertSchema = new Schema<IAlert>({
|
const AlertSchema = new Schema<IAlert>({
|
||||||
Activation: Number,
|
Activation: Number,
|
||||||
Expiry: Number,
|
Expiry: Number,
|
||||||
MissionInfo: MissionSchema,
|
MissionInfo: MissionSchema,
|
||||||
|
Icon: String,
|
||||||
ForceUnlock: Boolean,
|
ForceUnlock: Boolean,
|
||||||
Tag: String
|
Tag: String
|
||||||
});
|
});
|
||||||
@ -539,7 +578,7 @@ SeasonInfoSchema.set("toJSON", {
|
|||||||
|
|
||||||
const WorldStateSchema = new Schema<IWorldStateDocument>({
|
const WorldStateSchema = new Schema<IWorldStateDocument>({
|
||||||
Events: [EventSchema],
|
Events: [EventSchema],
|
||||||
// Goals: [GoalSchema],
|
Goals: [GoalSchema],
|
||||||
Alerts: [AlertSchema],
|
Alerts: [AlertSchema],
|
||||||
Sorties: [SortieSchema],
|
Sorties: [SortieSchema],
|
||||||
LiteSorties: [LiteSortieSchema],
|
LiteSorties: [LiteSortieSchema],
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { IOid } from "@/src/types/commonTypes";
|
import { IOid } from "@/src/types/commonTypes";
|
||||||
import { Document, ObjectId } from "mongoose";
|
import { Document, ObjectId } from "mongoose";
|
||||||
|
import { ITypeCount } from "./inventoryTypes/inventoryTypes";
|
||||||
|
|
||||||
export interface IMessage {
|
export interface IMessage {
|
||||||
LanguageCode?: string;
|
LanguageCode?: string;
|
||||||
@ -21,12 +22,7 @@ export interface IReward {
|
|||||||
credits?: number;
|
credits?: number;
|
||||||
xp?: number;
|
xp?: number;
|
||||||
items?: string[];
|
items?: string[];
|
||||||
countedItems?: ICountedItems[];
|
countedItems?: ITypeCount[];
|
||||||
}
|
|
||||||
|
|
||||||
export interface ICountedItems {
|
|
||||||
ItemType: string;
|
|
||||||
ItemCount: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IMission {
|
export interface IMission {
|
||||||
@ -37,6 +33,7 @@ export interface IMission {
|
|||||||
missionReward: IReward;
|
missionReward: IReward;
|
||||||
levelOverride: string;
|
levelOverride: string;
|
||||||
enemySpec: string;
|
enemySpec: string;
|
||||||
|
extraEnemySpec?: string;
|
||||||
minEnemyLevel: number;
|
minEnemyLevel: number;
|
||||||
maxEnemyLevel: number;
|
maxEnemyLevel: number;
|
||||||
descText: string;
|
descText: string;
|
||||||
@ -51,11 +48,12 @@ export interface IMission {
|
|||||||
vipAgent?: boolean;
|
vipAgent?: boolean;
|
||||||
leadersAlwaysAllowed?: boolean;
|
leadersAlwaysAllowed?: boolean;
|
||||||
goalTag?: string;
|
goalTag?: string;
|
||||||
|
questReq?: string;
|
||||||
levelAuras?: string[];
|
levelAuras?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IEvent {
|
export interface IEvent {
|
||||||
Messages: IMessage[];
|
Messages?: IMessage[];
|
||||||
Msg?: string;
|
Msg?: string;
|
||||||
Prop?: string;
|
Prop?: string;
|
||||||
ImageUrl?: string;
|
ImageUrl?: string;
|
||||||
@ -71,28 +69,40 @@ export interface IEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IGoal extends IBaseWorldStateObject {
|
export interface IGoal extends IBaseWorldStateObject {
|
||||||
|
Regions?: number[];
|
||||||
|
OptionalInMission?: boolean;
|
||||||
|
UpgradeIds?: IOid[];
|
||||||
|
|
||||||
Node: string;
|
Node: string;
|
||||||
ScoreVar: string;
|
MissionKeyName?: string;
|
||||||
ScoreLocTag: string;
|
Faction?: string;
|
||||||
Count: number;
|
|
||||||
HealthPct: number;
|
Icon: string;
|
||||||
Regions: number[];
|
|
||||||
Desc: string;
|
|
||||||
ToolTip: string;
|
ToolTip: string;
|
||||||
OptionalInMission: boolean;
|
Desc: string;
|
||||||
Tag: string;
|
|
||||||
UpgradeIds: IOid[];
|
Tag?: string;
|
||||||
|
ScoreLocTag: string;
|
||||||
|
ScoreVar?: string;
|
||||||
|
|
||||||
|
Reward: IReward;
|
||||||
|
InterimRewards?: IReward[];
|
||||||
|
|
||||||
|
Goal: number;
|
||||||
|
InterimGoals?: number[];
|
||||||
|
ClanGoal?: number[];
|
||||||
|
HealthPct: number;
|
||||||
|
Count: number;
|
||||||
|
ItemType?: string;
|
||||||
|
|
||||||
Personal: boolean;
|
Personal: boolean;
|
||||||
Community: boolean;
|
Community: boolean;
|
||||||
Goal: number;
|
|
||||||
Reward: IReward;
|
|
||||||
InterimGoals: number[];
|
|
||||||
InterimRewards: IReward[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IAlert extends IBaseWorldStateObject {
|
export interface IAlert extends IBaseWorldStateObject {
|
||||||
MissionInfo: IMission;
|
MissionInfo: IMission;
|
||||||
ForceUnlock: boolean;
|
ForceUnlock?: boolean;
|
||||||
|
Icon?: string;
|
||||||
Tag: string;
|
Tag: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user