This commit is contained in:
luying
2022-05-20 11:02:47 +08:00
parent 3dd37ffc7b
commit 72739ee9cf
7 changed files with 326 additions and 350 deletions

View File

@@ -780,8 +780,8 @@ export enum GACHA_CONTENT_TYPE {
HERO = 1, // 武将 param为武将品质
HERO_PIECE = 2, // 武将碎片 武将品质
// BLUEPRT = 3, // 藏宝图 藏宝图品质
JEWEL = 4, // 宝石 宝石等级
TERAPH_MATERIAL = 5, // 强化神像用的材料 材料物品id
STONE = 4, // 宝石 宝石等级
ITEMS = 5, // 物品id
// SUIT_PAPER = 6, // 套装图纸
}

View File

@@ -3,7 +3,7 @@ import { index, getModelForClass, prop, DocumentType, modelOptions } from '@type
import { getZeroPointD } from '../pubUtils/timeUtil';
import { RECRUIT } from '../pubUtils/dicParam';
class Floor {
export class Floor {
@prop({ required: true })
id: number; // 保底类型 1-紫将保底 2-金将保底 3-指定将保底
@prop({ required: true })

View File

@@ -4,7 +4,7 @@ import { prop } from '@typegoose/typegoose';
import { UserGachaType } from '../../db/UserGacha';
import { getTimeFun } from '../../pubUtils/timeUtil';
import { DicGacha } from '../../pubUtils/dictionary/DicGacha';
import { GACHA_OCCUPY_HID, } from '../../consts';
import { GACHA_CONTENT_TYPE, } from '../../consts';
import { gameData } from '../../pubUtils/data';
import { getFloorStatus } from '../../pubUtils/util';
@@ -52,6 +52,8 @@ export class Floor {
id: number; // 保底类型 1-紫将保底 2-金将保底 3-指定将保底
@prop({ required: true })
count: number; // 抽卡次数
@prop({ required: true })
hasGetFloor: boolean; // 是否抽到保底了
}
/**
@@ -87,7 +89,7 @@ export class GachaListReturn {
refFreeTime: number = 0; // 免费次数下次刷新时间
count: number = 0; // 整体已抽卡次数
guideResultCount: number = 0; // 引导已抽卡次数
floor: Floor[] = []; // 整体保底
floor: {id: number, count: number}[] = []; // 整体保底
hope: Hope[] = []; // 心愿单
point: number = 0; // 积分
turntable: Turntable[] = []; // 转盘记录
@@ -126,14 +128,26 @@ export class GachaResult {
id: number = 0; // 道具id
@prop({ required: true })
count: number = 0; // 道具数量
pickHero: number = 0;
constructor(contentId: number) {
constructor(contentId: number, id?: number) {
this.contentId = contentId;
if(id) this.pickHero = id;
}
setSetPickHero(hid: number) {
if (hid > 0 && this.hid == GACHA_OCCUPY_HID) {
this.hid = hid;
setContentId(contentId: number, id?: number) {
this.contentId = contentId;
if(id) this.pickHero = id;
}
setHidOrGid(id: number, count?: number) {
let dicGachaContent = gameData.gachaContent.get(id);
if(!dicGachaContent) return;
if(dicGachaContent.type == GACHA_CONTENT_TYPE.HERO) {
this.setHero(id);
} else {
this.setItem(id, count);
}
}
@@ -144,7 +158,7 @@ export class GachaResult {
setItem(id: number, count: number) {
this.id = id;
this.count = count;
if(count) this.count = count;
}
transferToPiece(id: number, count: number) {

View File

@@ -13,7 +13,7 @@ import { dicTower, loadTower } from "./dictionary/DicTower";
import { dicTowerTask, loadTowerTask } from "./dictionary/DicTowerTask";
import { dicWar, dicWarPvp, dicDailyWarByType, loadWar, dicHeroIdByWar } from "./dictionary/DicWar";
import { dicWarJson, loadWarJson } from "./dictionary/DicWarJson";
import { AUCTION_TIME } from "../consts";
import { AUCTION_TIME, GACHA_CONTENT_TYPE } from "../consts";
import { dicFashions, dicFashionsByHeroId, loadFashions } from "./dictionary/DicFashions";
import { friendShips, friendShipHidAandIds, loadFriendShip } from "./dictionary/DicFriendShip";
import { maxFriendShipLv, dicFriendShipLevelMap, loadFriendShipLevel } from "./dictionary/DicFriendShipLevel";
@@ -548,6 +548,13 @@ export function getFriendLvByExp(exp: number) {
return resultLv;
}
export function getGachaContentOfHeroQuality(quality: number) {
for(let [id, { type, param }] of gameData.gachaContent) {
if(type == GACHA_CONTENT_TYPE.HERO && param[0] == quality) return id;
}
return 0
}
/**
* 根据主公当前经验获得当前等级
* @param exp 累积经验