pvp:添加PVP任务

This commit is contained in:
luying
2021-10-29 16:36:23 +08:00
parent 2cf5895c52
commit 0d0855d312
9 changed files with 120 additions and 9 deletions
+2
View File
@@ -473,6 +473,7 @@ export const FILENAME = {
DIC_AUCTION_BASIC_POOL: 'dic_zyz_auction_basicPool',
DIC_AUCTION_REWARD: 'dic_zyz_auctionReward',
DIC_PVP_DIFFICULTRATIO: 'dic_zyz_pvp_difficultRatio',
DIC_PVP_DAILY_TASK: 'dic_zyz_pvp_dailyTask',
}
export const WAR_RELATE_TABLES = [
@@ -562,6 +563,7 @@ export enum TASK_FUN_TYPE {
MAIN = 1, // 主线
DAILY = 2, // 每日
ACHIEVEMENT = 3, // 成就
PVP = 4, // pvp任务
}
export enum TASK_TYPE {
+3 -3
View File
@@ -108,7 +108,7 @@ export default class PvpDefense extends BaseModel {
const result: PvpDefenseType = await PvpDefenseModel.findOne({ roleId })
.populate('role', 'head frame spine topLineupCe roleId roleName lv globalCeAttr')
.populate('heroes.hero')
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv title lv pLv defCe heroes').lean({ getters: true, virtuals: true });
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv title lv pLv defCe heroes warId buff').lean({ getters: true, virtuals: true });
return result;
}
@@ -116,7 +116,7 @@ export default class PvpDefense extends BaseModel {
const result: PvpDefenseType[] = await PvpDefenseModel.find({ seasonNum, 'defense.pLv': { $gte: min, $lte: max } })
.populate('role', '_id head frame spine heads frames spines topLineupCe roleId roleName lv globalCeAttr')
.populate('heroes.hero')
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv pLv title lv defCe heroes')
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv pLv title lv defCe heroes warId buff')
.lean({ getters: true, virtuals: true });
return result;
}
@@ -125,7 +125,7 @@ export default class PvpDefense extends BaseModel {
delete update._id;
let result: PvpDefenseType = await PvpDefenseModel.findOneAndUpdate({roleId}, {$set:update}, {new: true})
.populate('role', 'head frame spine heads frames spines topLineupCe roleId roleName lv')
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv pLv title lv defCe heroes').lean({ getters: true, virtuals: true });
.populate('oppPlayers.oppDef', 'oppRoleId pos roleName head frame spine heads frames spines rankLv pLv title lv defCe heroes warId buff').lean({ getters: true, virtuals: true });
return result;
}
public static async updateInfo(roleId: string, update: pvpUpdateInter, lean = true) {
+1 -1
View File
@@ -36,7 +36,7 @@ export default class UserTaskRec extends BaseModel {
private static getRefreshCondition(type: number) {
let today = getZeroPointD();
if(type == TASK_FUN_TYPE.DAILY) {
if(type == TASK_FUN_TYPE.DAILY || type == TASK_FUN_TYPE.PVP) {
return { type, createdAt: { $gte: today } };
} else {
return { type };
+2 -1
View File
@@ -73,7 +73,7 @@ import { dicShop, dicShopItem, loadShop } from "./dictionary/DicShop";
import { dicShopList, loadShopList } from "./dictionary/DicShopList";
import { dicRank, loadRank } from "./dictionary/DicRank";
import { dicRankReward, loadRankReward } from "./dictionary/DicRankReward";
import { dicTaskType, taskMap, dicMainTask, dicDailyTask, dicAchievement, loadTask } from "./dictionary/DicTask";
import { dicTaskType, taskMap, dicMainTask, dicDailyTask, dicAchievement, loadTask, dicPvpDailyTask } from "./dictionary/DicTask";
import { dicMainTaskStage, loadMainTaskStage } from "./dictionary/DicMainTaskStage";
import { dicTaskBox, loadTaskBox } from './dictionary/DicTaskBox';
import { dicGacha, loadGacha } from "./dictionary/DicGacha";
@@ -206,6 +206,7 @@ export const gameData = {
mainTask: dicMainTask,
dailyTask: dicDailyTask,
achievement: dicAchievement,
pvpDailyTask: dicPvpDailyTask,
mainTaskStage: dicMainTaskStage,
taskBox: dicTaskBox,
gacha: dicGacha,
+28 -1
View File
@@ -87,21 +87,40 @@ const DicAchievementKeys: KeysEnum<DicAchievement> = {
point: true
};
// pvp任务
export interface DicPvpDailyTask extends DicTaskBase {
// 奖励
readonly taskReward: RewardInter[];
}
const DicPvpDailyTaskKeys: KeysEnum<DicPvpDailyTask> = {
id: true,
taskType: true,
group: true,
taskParam: true,
condition: true,
taskReward: true
};
export type DicTask = DicTaskBase & { type: number };
export const dicMainTask = new Map<number, DicMainTask>(); // 主线任务
export const dicDailyTask = new Map<number, DicDailyTask>(); // 每日任务
export const dicAchievement = new Map<number, DicAchievement>(); // 成就
export const taskMap = new Map<number, Map<number, DicMainTask | DicDailyTask | DicAchievement>>();
export const dicPvpDailyTask = new Map<number, DicDailyTask>(); // 成就
export const taskMap = new Map<number, Map<number, DicMainTask | DicDailyTask | DicAchievement | DicDailyTask>>();
taskMap.set(TASK_FUN_TYPE.MAIN, dicMainTask);
taskMap.set(TASK_FUN_TYPE.DAILY, dicDailyTask);
taskMap.set(TASK_FUN_TYPE.ACHIEVEMENT, dicAchievement);
taskMap.set(TASK_FUN_TYPE.PVP, dicPvpDailyTask);
export const dicTaskType = new Map<number, DicTask[]>();
export function loadTask() {
dicMainTask.clear();
dicDailyTask.clear();
dicAchievement.clear();
dicPvpDailyTask.clear();
const arrMainTask = readFileAndParse(FILENAME.DIC_MAIN_TASK);
arrMainTask.forEach(o => {
@@ -128,6 +147,14 @@ export function loadTask() {
pushDicTaskType(o.taskType, TASK_FUN_TYPE.ACHIEVEMENT, o);
});
const arrPvpDailyTask = readFileAndParse(FILENAME.DIC_PVP_DAILY_TASK);
arrPvpDailyTask.forEach(o => {
o.taskParam = parseNumberList(o.taskParam);
o.taskReward = parseGoodStr(o.taskReward);
o.group = 1;
dicPvpDailyTask.set(o.id, _.pick(o, Object.keys(DicPvpDailyTaskKeys)));
pushDicTaskType(o.taskType, TASK_FUN_TYPE.PVP, o);
});
}
function pushDicTaskType(taskType: number, type: number, o: any) {
@@ -0,0 +1,56 @@
[
{
"id": 1,
"dailyTaskId": 8,
"taskType": 57,
"taskInfo": "演武3次",
"taskParam": "3&",
"taskReward": "40004&30",
"condition": 3
},
{
"id": 2,
"dailyTaskId": 8,
"taskType": 57,
"taskInfo": "演武5次",
"taskParam": "5&",
"taskReward": "40004&60",
"condition": 5
},
{
"id": 3,
"dailyTaskId": 8,
"taskType": 57,
"taskInfo": "演武7次",
"taskParam": "7&",
"taskReward": "40004&100",
"condition": 7
},
{
"id": 4,
"dailyTaskId": 9,
"taskType": 58,
"taskInfo": "演武胜利1次",
"taskParam": "1&",
"taskReward": "40004&100",
"condition": 1
},
{
"id": 5,
"dailyTaskId": 9,
"taskType": 58,
"taskInfo": "演武胜利3次",
"taskParam": "3&",
"taskReward": "40004&300",
"condition": 3
},
{
"id": 6,
"dailyTaskId": 9,
"taskType": 58,
"taskInfo": "演武胜利5次",
"taskParam": "5&",
"taskReward": "40004&500",
"condition": 5
}
]