Merge branch 'version/v0.1' of gitlab.trgame.cn:zyztech/zyz_server
# Conflicts: # shared/resource/jsons/dic_api.json
This commit is contained in:
@@ -39,13 +39,13 @@ export default class HangUpRecord extends BaseModel {
|
||||
received: boolean; // 是否已经领取,true-领取,false-未领取
|
||||
|
||||
public static async initRecord(roleId: string, roleName: string, lean = true) {
|
||||
console.log('****** initRecord before')
|
||||
// console.log('****** initRecord before')
|
||||
const curTime = new Date();
|
||||
const recDoc = new HangUpRecordModel();
|
||||
const update = Object.assign(recDoc.toJSON(), {roleId, roleName, startTime: curTime, startLv: dicParam.TOWER_HANG_UP.TOWER_HANG_UP_ENABLE_LV + 1});
|
||||
const rec: HangUpRecordType = await HangUpRecordModel.findOneAndUpdate({roleId, startLv: dicParam.TOWER_HANG_UP.TOWER_HANG_UP_ENABLE_LV + 1}, { $setOnInsert: update }, {upsert: true, new: true}).lean(lean);
|
||||
|
||||
console.log('****** initRecord after')
|
||||
// console.log('****** initRecord after')
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export abstract class ActivityBase {
|
||||
|
||||
this.type = activityData.type;
|
||||
// console.log('今天是活动第几天', activityData.beginTime, new Date, this.todayIndex)
|
||||
console.log('***** activityData', activityData.timeType)
|
||||
// console.log('***** activityData', activityData.timeType)
|
||||
switch (activityData.timeType) {
|
||||
case ACTIVITY_TIME_TYPE.SERVER_OPEN_TIME: {
|
||||
this.beginTime = moment(SERVER_OPEN_TIME).add(this.delayDay, 'd').startOf('d').add(REFRESH_TIME, 'h').valueOf();
|
||||
@@ -43,7 +43,7 @@ export abstract class ActivityBase {
|
||||
this.endTime = moment(this.beginTime).add(1, 'd').valueOf();
|
||||
}
|
||||
this.todayIndex = deltaDays(moment(this.beginTime).toDate(), new Date) + 1;
|
||||
console.log('活动时间数据11...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
// console.log('活动时间数据11...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
break;
|
||||
}
|
||||
case ACTIVITY_TIME_TYPE.ROLE_REGISTER_TIME: {
|
||||
@@ -55,11 +55,11 @@ export abstract class ActivityBase {
|
||||
}
|
||||
this.todayIndex = deltaDays(moment(this.beginTime).toDate(), new Date) + 1;
|
||||
|
||||
console.log('活动时间数据22...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
// console.log('活动时间数据22...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
break;
|
||||
}
|
||||
case ACTIVITY_TIME_TYPE.DATE_TIME: {
|
||||
console.log('活动时间数据33...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
// console.log('活动时间数据33...', activityData.timeType, this.beginTime, this.endTime, this.todayIndex, this.roundIndex, this.nextRefreshTime)
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -71,9 +71,9 @@ export abstract class ActivityBase {
|
||||
this.nextRefreshTime = moment(this.beginTime).add(activityData.interval * this.roundIndex, 'second').valueOf();
|
||||
this.todayIndex = Math.ceil(((moment(new Date).valueOf() - this.beginTime) / (24 * 60 * 60 * 1000)));
|
||||
}
|
||||
console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(),
|
||||
'结束:', this.endTime, moment(this.endTime).toDate(),
|
||||
'今天第几天:', this.todayIndex, '回合:', this.roundIndex, '下次刷新:', this.nextRefreshTime, moment(this.nextRefreshTime).toDate())
|
||||
// console.log('活动时间数据...', '活动id:', activityData.activityId, '类型:', activityData.timeType, '开始时间:', this.beginTime, moment(this.beginTime).toDate(),
|
||||
// '结束:', this.endTime, moment(this.endTime).toDate(),
|
||||
// '今天第几天:', this.todayIndex, '回合:', this.roundIndex, '下次刷新:', this.nextRefreshTime, moment(this.nextRefreshTime).toDate())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -773,7 +773,7 @@ export function getWishPoolReward(id: number) {
|
||||
if(dicItid.type == CONSUME_TYPE.PIECE) {
|
||||
starLevel = dicGoods.equipLvl;
|
||||
}
|
||||
console.log('*****', dicGoods.itid, starLevel, dicGoods.quality)
|
||||
// console.log('*****', dicGoods.itid, starLevel, dicGoods.quality)
|
||||
return gameData.guildWishReward.get(`${dicGoods.itid}_${starLevel}_${dicGoods.quality}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ export async function reCalAllHeroCe(type: number, roleId: string, update: RoleU
|
||||
update.topLineupCe = topLineupCe;
|
||||
}
|
||||
|
||||
console.log('************ roleAttr', update.attr)
|
||||
// console.log('************ roleAttr', update.attr)
|
||||
role = await RoleModel.incRoleInfo(roleId, { ce: allIncCe },update);
|
||||
|
||||
let guild = await GuildModel.updateCe(roleId, allIncCe); // 公会更新战力
|
||||
@@ -959,28 +959,28 @@ async function calSchoolStarIncAttr(role: RoleType, heros: HeroType[], type: num
|
||||
*/
|
||||
function calScrollAddAttr(role: RoleType,heros: HeroType[], hid: number) {
|
||||
let { attr: roleAttrs } = role;
|
||||
console.log('********** calScrollAddAttr', hid)
|
||||
// console.log('********** calScrollAddAttr', hid)
|
||||
|
||||
let curHero = heros.find(cur => cur.hid == hid);
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
if (!curHero || !dicHero) return roleAttrs;
|
||||
let { quality } = dicHero;
|
||||
let { star, quality: curQuality, colorStar } = curHero;
|
||||
console.log('********** calScrollAddAttr curHero', star, curQuality, colorStar);
|
||||
// console.log('********** calScrollAddAttr curHero', star, curQuality, colorStar);
|
||||
let heroScroll = getScollByStar(quality, star, curQuality, colorStar);
|
||||
if (!heroScroll) return roleAttrs;
|
||||
console.log('********** heroScroll', heroScroll);
|
||||
// console.log('********** heroScroll', heroScroll);
|
||||
|
||||
let isInit = star == dicHero.initialStars && curQuality == dicHero.quality && colorStar == 0;
|
||||
let preScroll = isInit? null: gameData.preHeroScroll.get(heroScroll.id);
|
||||
console.log('********** preScroll', preScroll);
|
||||
// console.log('********** preScroll', preScroll);
|
||||
|
||||
|
||||
heroScroll.ceAttr.forEach((add, attrId) => {
|
||||
|
||||
let preAdd = preScroll ? preScroll.ceAttr.get(attrId) : 0;
|
||||
let fixUp = (add - preAdd) * HERO_CE_RATIO;
|
||||
console.log('********** preAdd', attrId, preAdd, fixUp);
|
||||
// console.log('********** preAdd', attrId, preAdd, fixUp);
|
||||
updateRoleAttr(roleAttrs, attrId, { inc: { fixUp } });
|
||||
});
|
||||
return roleAttrs;
|
||||
|
||||
@@ -325,18 +325,18 @@ export class CreateHeroes extends UpdateHeroes {
|
||||
|
||||
public async clearTask(activitiesTypeMap: ActivityInRemote[]) {
|
||||
// 任务
|
||||
console.log('****** checkTask before', Date.now())
|
||||
// console.log('****** checkTask before', Date.now())
|
||||
let m1 = await checkTask(this.roleId, TASK_TYPE.HERO_NUM, this.heroNum, true, {});
|
||||
let m2 = await checkTaskWithHeroes(this.roleId, TASK_TYPE.HERO_QUALITY, this.resultHeroes);
|
||||
let m3 = await checkTaskWithHeroes(this.roleId, TASK_TYPE.HERO_QUALITY_STAR_UP, this.resultHeroes);
|
||||
let m4 = await checkTaskWithHeroes(this.roleId, TASK_TYPE.HERO_LV, this.resultHeroes);
|
||||
this.taskPushMessage.push(...m1, ...m2, ...m3, ...m4);
|
||||
console.log('****** checkTask after', Date.now())
|
||||
// console.log('****** checkTask after', Date.now())
|
||||
//成长任务
|
||||
console.log('****** accomplishTask before', Date.now())
|
||||
// console.log('****** accomplishTask before', Date.now())
|
||||
let mm1 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_NUM, this.heroNum, null, activitiesTypeMap)
|
||||
let mm2 = await accomplishTask(this.serverId, this.roleId, TASK_TYPE.HERO_QUALITY, this.heroNum, { heroes: this.resultHeroes }, activitiesTypeMap);
|
||||
console.log('****** accomplishTask after', Date.now())
|
||||
// console.log('****** accomplishTask after', Date.now())
|
||||
this.activityTaskPushMessage.push(...mm1, ...mm2);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import * as crypto from 'crypto'
|
||||
|
||||
export function md5(str: string, treatStr?: (str: string) => string) {
|
||||
if(treatStr) str = treatStr(str);
|
||||
console.log('*****str', str)
|
||||
// console.log('*****str', str)
|
||||
return crypto.createHash('md5').update(str, 'utf8').digest("hex");
|
||||
};
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
||||
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData);
|
||||
console.log('******* dailyChallenge', addCount, record)
|
||||
// console.log('******* dailyChallenge', addCount, record)
|
||||
if (addCount) {
|
||||
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV || taskType == TASK_TYPE.FRIEND_NUM) {
|
||||
let playerRecord = await ActivityDailyChallengesModel.setTaskCount(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount);
|
||||
|
||||
Reference in New Issue
Block a user