将扩展的Map.inc方法改为zinc
This commit is contained in:
parent
f349f827f0
commit
b898391648
@ -888,11 +888,11 @@ interface Map<K, V> {
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
inc?(key: K, value: V): this;
|
||||
zinc?(key: K, value: V): this;
|
||||
}
|
||||
|
||||
Object.defineProperties(Map.prototype, {
|
||||
inc: {
|
||||
zinc: {
|
||||
value: function<K, V> (key: K, value: V) {
|
||||
if (typeof value == 'number') {
|
||||
this.set(key, (this.get(key) || 0) + value );
|
||||
|
@ -57,8 +57,8 @@ export default class MatchController extends BaseController {
|
||||
}
|
||||
await BagItem.addItems(accountid, items, 'game_left', roomid)
|
||||
// 更新逃跑次数
|
||||
user.season_data.inc('escape', 1)
|
||||
user.season_data.inc('loss', 1)
|
||||
user.season_data.zinc('escape', 1)
|
||||
user.season_data.zinc('loss', 1)
|
||||
const fc = global.$cfg.get(BaseConst.FORMULA)
|
||||
let oldScore = user.season_score
|
||||
user.season_score = Math.max((user.season_score + scoreChange) | 0, fc.get(70002).number)
|
||||
|
@ -59,9 +59,9 @@ export async function parsePlayerMatchDate(player: GamePlayer, user: any, winner
|
||||
*/
|
||||
if (!player.escape) {
|
||||
if (winner == player.team) {
|
||||
user.season_data.inc('win', 1)
|
||||
user.season_data.zinc('win', 1)
|
||||
} else {
|
||||
user.season_data.inc('loss', 1)
|
||||
user.season_data.zinc('loss', 1)
|
||||
}
|
||||
let statData = player.statdata
|
||||
let honorp = 0
|
||||
@ -75,9 +75,9 @@ export async function parsePlayerMatchDate(player: GamePlayer, user: any, winner
|
||||
let val = Number(statData[key])
|
||||
honorp += val * scores[numKey]
|
||||
if (numKey == 4 || numKey == 5) {
|
||||
user.season_data.inc(key + '_total', val)
|
||||
user.season_data.zinc(key + '_total', val)
|
||||
} else {
|
||||
user.season_data.inc(key + '_total', val * scores[numKey])
|
||||
user.season_data.zinc(key + '_total', val * scores[numKey])
|
||||
}
|
||||
|
||||
if (user.season_data.has(key + '')) {
|
||||
@ -86,8 +86,8 @@ export async function parsePlayerMatchDate(player: GamePlayer, user: any, winner
|
||||
user.season_data.set(key + '', val)
|
||||
}
|
||||
}
|
||||
user.season_data.inc('honor_ap', honorp)
|
||||
user.season_data.inc('mvp_ap', player.mvpscore)
|
||||
user.season_data.zinc('honor_ap', honorp)
|
||||
user.season_data.zinc('mvp_ap', player.mvpscore)
|
||||
}
|
||||
/**
|
||||
* end of 处理比赛统计信息
|
||||
|
Loading…
x
Reference in New Issue
Block a user