装备:清理旧代码
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { GachaData, Floor, GachaResult, Hope, GachaListReturn } from "../../domain/activityField/gachaField";;
|
||||
import { ActivityModel } from "../../db/Activity";
|
||||
import { DicGacha } from "../../pubUtils/dictionary/DicGacha";
|
||||
import { UserGachaType, UserGachaModel } from "../../db/UserGacha";
|
||||
import { shouldRefresh, getRandEelm, getRandEelmWithWeight } from "../../pubUtils/util";
|
||||
@@ -221,15 +220,11 @@ export class GachaPull {
|
||||
} else {
|
||||
let pool: number[] = [];
|
||||
if (type == GACHA_CONTENT_TYPE.HERO_PIECE) {
|
||||
pool = getAllItemByQuality(IT_TYPE.HERO_PIECE, param[0], this.lv);
|
||||
} else if (type == GACHA_CONTENT_TYPE.BLUEPRT) {
|
||||
pool = getAllItemByQuality(IT_TYPE.BLUEPRT, param[0], this.lv);
|
||||
pool = getAllItemByQuality(IT_TYPE.HERO_PIECE, param[0]);
|
||||
} else if (type == GACHA_CONTENT_TYPE.JEWEL) {
|
||||
pool = getAllJewelByLv(param[0]);
|
||||
} else if (type == GACHA_CONTENT_TYPE.TERAPH_MATERIAL) {
|
||||
pool = param;
|
||||
} else if (type == GACHA_CONTENT_TYPE.SUIT_PAPER) {
|
||||
pool = getSuitPaper(this.lv);
|
||||
}
|
||||
|
||||
if(pool.length <= 0) {
|
||||
@@ -497,11 +492,11 @@ export function getAllHeroByQuality(quality: number) {
|
||||
return allHero;
|
||||
}
|
||||
|
||||
function getAllItemByQuality(itid: number, quality: number, lv: number) {
|
||||
function getAllItemByQuality(itid: number, quality: number) {
|
||||
let allPiece: number[] = [];
|
||||
for (let [id, dicGoods] of gameData.goods) {
|
||||
if (dicGoods.itid == itid) {
|
||||
if ((quality == 0 || dicGoods.quality == quality) && dicGoods.lvLimited <= lv) {
|
||||
if (quality == 0 || dicGoods.quality == quality) {
|
||||
allPiece.push(id);
|
||||
}
|
||||
}
|
||||
@@ -510,67 +505,9 @@ function getAllItemByQuality(itid: number, quality: number, lv: number) {
|
||||
}
|
||||
|
||||
function getAllJewelByLv(lv: number) {
|
||||
let itids: number[] = [];
|
||||
for (let [id, { type }] of ITID) {
|
||||
if (type == CONSUME_TYPE.JEWEL) itids.push(id);
|
||||
}
|
||||
let items: number[] = [];
|
||||
for (let [id, dicGoods] of gameData.goods) {
|
||||
if (itids.includes(dicGoods.itid)) {
|
||||
if (lv == 0 || dicGoods.lvLimited == lv) {
|
||||
items.push(id);
|
||||
}
|
||||
}
|
||||
for(let [id, dicStone] of gameData.stone) {
|
||||
if(dicStone.lv >= lv) items.push(id);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
function getSuitPaper(lv: number) {
|
||||
let items: number[] = [];
|
||||
for (let [id, dicGoods] of gameData.goods) {
|
||||
if (dicGoods.itid == IT_TYPE.PAPER) {
|
||||
if (dicGoods.lvLimited <= lv) {
|
||||
items.push(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据contentId获得抽卡结果 新武将抽卡活动
|
||||
* @param contentId dic_zyz_gachaContent的id
|
||||
* @param lv 玩家等级
|
||||
* @param goodId 大于0指定id,0:随机
|
||||
*/
|
||||
export function getResultFromContentIdNewHeroActivity(contentId: number, goodId: number, lv: number,) {
|
||||
let dic = gameData.gachaContent.get(contentId);
|
||||
let { type, param, count } = dic;
|
||||
if (type == GACHA_CONTENT_TYPE.HERO) {
|
||||
let result = new GachaResult(contentId);
|
||||
result.setHero(goodId);
|
||||
return result
|
||||
} else {
|
||||
let pool: number[] = [];
|
||||
if (type == GACHA_CONTENT_TYPE.HERO_PIECE) {
|
||||
pool = getAllItemByQuality(IT_TYPE.HERO_PIECE, param[0], lv);
|
||||
} else if (type == GACHA_CONTENT_TYPE.BLUEPRT) {
|
||||
pool = getAllItemByQuality(IT_TYPE.BLUEPRT, param[0], lv);
|
||||
} else if (type == GACHA_CONTENT_TYPE.JEWEL) {
|
||||
pool = getAllJewelByLv(param[0]);
|
||||
} else if (type == GACHA_CONTENT_TYPE.TERAPH_MATERIAL) {
|
||||
pool = param;
|
||||
} else if (type == GACHA_CONTENT_TYPE.SUIT_PAPER) {
|
||||
pool = getSuitPaper(lv);
|
||||
}
|
||||
let item = getRandEelm(pool);
|
||||
let result = new GachaResult(contentId);
|
||||
result.setItem(item[0], count);
|
||||
if (goodId > 0) {
|
||||
result.setItem(goodId, count);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user