抽卡:修复重复获得武将都是new
This commit is contained in:
@@ -179,6 +179,7 @@ export class GmHandler {
|
||||
|
||||
activities = await ActivityModel.addActivity(aids, groupId, beginTime ? new Date(beginTime) : undefined, endTime ? new Date(endTime) : undefined, type, data, timeType, days, delayDay, interval, uid);
|
||||
|
||||
|
||||
let activityServers = pinus.app.getServersByType('activity');
|
||||
for(let server of activityServers) {
|
||||
pinus.app.rpc.activity.activityRemote.updateActivities.toServer(server.id, activities.map(activity => new ActivityInRemote(activity)));
|
||||
|
||||
@@ -102,7 +102,7 @@ export class GachaPull {
|
||||
private dicFloor: { id: number, weight: number, goodId?: number }; // 保底的一项,percent中的一项
|
||||
// 玩家数据
|
||||
private lv: number; // 玩家等级
|
||||
private userHeroes: HeroType[]; // 玩家的所有武将
|
||||
private userHeroes: number[]; // 玩家的所有武将
|
||||
private floorCount: number = 0; // 记录下的保底次数
|
||||
private hasGetFloor: boolean = false; // 玩家是否达到保底
|
||||
private hope: Hope[] = []; // 玩家记录的心愿单达成情况
|
||||
@@ -116,7 +116,7 @@ export class GachaPull {
|
||||
} else {
|
||||
this.dicFloorType = GACHA_FLOOR_TYPE.GOLD;
|
||||
}
|
||||
this.userHeroes = userHeroes;
|
||||
this.userHeroes = userHeroes.map(cur => cur.hid);
|
||||
this.lv = lv;
|
||||
}
|
||||
|
||||
@@ -291,14 +291,16 @@ export class GachaPull {
|
||||
let result = this.getResultFromContentId(contentId, goodId);
|
||||
if(!result) continue;
|
||||
if (result.hid > 0) {
|
||||
let hasHero = this.userHeroes.find(cur => cur.hid == result.hid);
|
||||
let hasHero = this.userHeroes.indexOf(result.hid) != -1;
|
||||
if (hasHero) { // 已有转换为碎片
|
||||
activityData.push({ hid: hasHero.hid, quality: hasHero.quality });
|
||||
let dicHero = gameData.hero.get(result.hid);
|
||||
activityData.push({ hid: result.hid, quality: dicHero.quality });
|
||||
let { pieceId, count } = transPiece(result.hid);
|
||||
result.transferToPiece(pieceId, count);
|
||||
items.push({ id: pieceId, count });
|
||||
} else {
|
||||
heroInfo.push({ hid: result.hid, count: 1 })//默认1个英雄
|
||||
this.userHeroes.push(result.hid);
|
||||
}
|
||||
} else {
|
||||
items.push({ id: result.id, count: result.count });
|
||||
@@ -317,14 +319,16 @@ export class GachaPull {
|
||||
let result = new GachaResult(contentId);
|
||||
result.setHero(hid);
|
||||
|
||||
let hasHero = this.userHeroes.find(cur => cur.hid == hid);
|
||||
let hasHero = this.userHeroes.indexOf(result.hid) != -1;
|
||||
if (hasHero) { // 已有转换为碎片
|
||||
activityData.push({ hid, quality: hasHero.quality });
|
||||
let dicHero = gameData.hero.get(result.hid);
|
||||
activityData.push({ hid: result.hid, quality: dicHero.quality });
|
||||
let { pieceId, count } = transPiece(hid);
|
||||
result.transferToPiece(pieceId, count);
|
||||
items.push({ id: pieceId, count });
|
||||
} else {
|
||||
heroInfo.push({ hid, count: 1 })//默认1个英雄
|
||||
this.userHeroes.push(result.hid);
|
||||
}
|
||||
resultList.push(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user