寻宝:修改奖励

This commit is contained in:
luying
2022-07-27 19:58:17 +08:00
parent e1dc6307d2
commit f65b8b8545
5 changed files with 39 additions and 24 deletions
+4 -1
View File
@@ -48,6 +48,8 @@ export class RoleStatus {
@prop({ required: true })
roleName: string;
@prop({ required: true })
sid: string;
@prop({ required: true })
guildCode: string;
@prop({ required: true })
isCap: boolean;
@@ -96,7 +98,7 @@ export class RoleStatus {
@prop({ required: true, default: 0 })
frdRatio: number = 0;
constructor(role: RoleUpdate, isCap: boolean, isFrd: boolean, heroes: ComRoleStatusHero[] = [], isRobot = false) {
constructor(role: RoleUpdate, sid: string, isCap: boolean, isFrd: boolean, heroes: ComRoleStatusHero[] = [], isRobot = false) {
if(role) {
this.roleId = role.roleId||'';
this.roleName = role.roleName||'';
@@ -107,6 +109,7 @@ export class RoleStatus {
this.topLineupCe = role.topLineupCe||0;
this.lv = role.lv||1;
}
this.sid = sid;
this.isCap = isCap;
this.totalDmg = 0;
this.isFrd = isFrd;
+7
View File
@@ -45,6 +45,13 @@ export default class FriendPoint extends BaseModel {
return rec;
}
public static async updateComBattleCntToday(roleId: string, roleName: string, cntInc: number, maxPerDay: number, type: number, lean = true) {
const curTime = getZeroPointD();
// 当 oldCnt + cntInc > maxPerDay 时需计算实际可以获得的点数:cntInc - (newCnt - maxPerDay)
const rec: FriendPointType = await FriendPointModel.findOneAndUpdate({roleId, roleName, createdAt: {$gte: curTime}, comBattleCnt: {$lt: maxPerDay}, type}, {$inc: {comBattleCnt: cntInc}}, {upsert: true, new: true}).lean(lean);
return rec;
}
/**
* @description 某个类型当天情谊点获取情况
* @static
+2 -2
View File
@@ -88,7 +88,6 @@ export function loadWar() {
o.fixReward = parseFixReward(o.fixReward);
o.conditionReward = parseConditionReward(o.conditionReward);
o.randomReward = parseRandomReward(o.RandomReward||o.randomReward);
o.teammateReward = parseFixReward(o.teammateReward);
o.fobiddenCharactor = parseForbiddenChara(o.fobiddenCharactor);
o.mapseid = parseNumberList(o.mapseid);
if(o.script_id && isString(o.script_id)) {
@@ -113,8 +112,9 @@ export function loadWar() {
o.winReward = parseTrainReward(o.winReward);
o.failReward = parseTrainReward(o.failReward);
} else if (o.warType == WAR_TYPE.COM_BATTLE) {
console.log('####', o)
let reward = {
captainReward: parseGoodStr(o.fixReward),
captainReward: o.fixReward,
teammateReward: parseGoodStr(o.teammateReward),
captainTimeReward: parseGoodStr(o.time_captain_normalReward),
teammateTimeReward: parseGoodStr(o.time_normalReward),