装备:清理旧代码
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { STATUS } from './../../../consts/statusCode';
|
||||
import { EquipModel } from './../../../db/Equip';
|
||||
import { RoleModel, RoleType } from './../../../db/Role';
|
||||
import { UserModel } from '../../../db/User';
|
||||
import { GMUserModel } from '../../../db/GMUser';
|
||||
@@ -17,7 +16,6 @@ import { rmRoleFromQueue, roleLeave, getRoleOnlineInfo, roleLogin } from '../../
|
||||
|
||||
import { addRoleToGuildChannel, addRoleToSysChannel, addRoleToWorldChannel, leaveGuildAuctionChannel, leaveGuildChannel, leaveSysChannel, leaveWorldAuctionChannel, leaveWorldChannel, recentGuildMsgs, recentPrivateChatInfos, recentSysMsgs, recentWorldMsgs } from '../../../services/chatService';
|
||||
import { reportOneOnline, savePlayTime } from '../../../services/authenticateService';
|
||||
import { Rank } from '../../../services/rankService';
|
||||
import { checkTaskWithRole, } from '../../../services/taskService';
|
||||
import { pushData, everydayRefresh, kickUser } from '../../../services/connectorService';
|
||||
import { pick } from 'lodash';
|
||||
|
||||
@@ -5,8 +5,8 @@ import { WishPoolReportModel } from '../../../db/WishPoolReport';
|
||||
import { resResult, genCode } from '../../../pubUtils/util';
|
||||
import { ITEM_CHANGE_REASON, STATUS } from '../../../consts';
|
||||
import { getArmyWishPoolBaseByLv, getGoodById, getWishPoolReward } from '../../../pubUtils/data';
|
||||
import { addItems, checkGoods, checkHeroes } from '../../../services/rewardService';
|
||||
import { IT_TYPE } from '../../../consts/constModules/itemConst';
|
||||
import { addItems, checkGoods, checkHeroEquips, checkHeroes } from '../../../services/rewardService';
|
||||
import { ITID, CONSUME_TYPE } from '../../../consts/constModules/itemConst';
|
||||
import { GUILD_STRUCTURE } from '../../../consts/constModules/guildConst';
|
||||
import { refreshUserGuild, getWishPool, getUserGuildWithRefActive } from '../../../services/guildService';
|
||||
import { findIndex, findWhere } from 'underscore';
|
||||
@@ -40,23 +40,23 @@ export class WishPoolHandler {
|
||||
const { goodId, type, myUserGuild } = msg;
|
||||
const roleId: string = session.get('roleId');
|
||||
const serverId: number = parseInt(session.get('serverId'));
|
||||
let count;
|
||||
let goodInfo = getGoodById(goodId)
|
||||
if (!goodInfo)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (!(goodInfo.itid == IT_TYPE.HERO_PIECE && type == 2 ) && !(goodInfo.itid == IT_TYPE.EQUIP_PIECE && type == 1 ))
|
||||
let dicGoods = getGoodById(goodId)
|
||||
if (!dicGoods) return resResult(STATUS.WRONG_PARMS);
|
||||
let dicItid = ITID.get(dicGoods.itid);
|
||||
if (!(dicItid.type == CONSUME_TYPE.SOUL && type == 2 ) && !(dicItid.type == CONSUME_TYPE.DRAWING && type == 1 ))
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let userGuild = await refreshUserGuild(myUserGuild, roleId);
|
||||
if (!userGuild)
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
if (!userGuild) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
let result = await checkGoods(roleId, [goodId]);
|
||||
if (!result) {
|
||||
if (goodInfo.itid == IT_TYPE.HERO_PIECE ) {
|
||||
result = await checkHeroes(roleId, [goodInfo.hid]);
|
||||
if (dicItid.type == CONSUME_TYPE.SOUL ) {
|
||||
result = await checkHeroes(roleId, [dicGoods.hid]);
|
||||
if (!result)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_HERO);
|
||||
} else if (goodInfo.itid == IT_TYPE.EQUIP_PIECE ) {
|
||||
result = await checkGoods(roleId, [goodInfo.equipId]);
|
||||
} else if (dicItid.type == CONSUME_TYPE.DRAWING ) {
|
||||
result = await checkHeroEquips(roleId, dicGoods.quality);
|
||||
if (!result)
|
||||
return resResult(STATUS.GUILD_WISH_POOL_NOT_OWN_EQUIP);
|
||||
}
|
||||
@@ -65,27 +65,23 @@ export class WishPoolHandler {
|
||||
|
||||
let { structure } = await GuildModel.findGuild(code, serverId, 'structure');
|
||||
let { lv } = findWhere(structure, {id: GUILD_STRUCTURE.WISH_POOL});
|
||||
let { wishgoodsDrawings, wishGoodsHeros } = getArmyWishPoolBaseByLv(lv);
|
||||
let len = 0;
|
||||
wishGoods.map(({type: resType})=>{
|
||||
if (resType == type)
|
||||
len++;
|
||||
});
|
||||
let len = wishGoods.filter(cur => cur.type == type).length;
|
||||
|
||||
if(receivedWishPool.indexOf(type) != -1 && getSeconds(createdAt) > getZeroPoint()) {
|
||||
return resResult(STATUS.HAS_REACH_WISH_COUNT_LIMIT);
|
||||
}
|
||||
if (len >= ARMY.ARMY_WISH_TIMES) //今日已经许愿过
|
||||
return resResult(STATUS.HAS_REACH_WISH_COUNT_LIMIT);
|
||||
|
||||
let dicWishPool = getArmyWishPoolBaseByLv(lv);
|
||||
let count = 0;
|
||||
if (type == 1) {
|
||||
let wishGoodsDrawing = findWhere(wishgoodsDrawings, { quality: goodInfo.quality});
|
||||
if (!wishGoodsDrawing)
|
||||
return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
let wishGoodsDrawing = dicWishPool.wishgoodsDrawings.find(cur => cur.quality == dicGoods.quality);
|
||||
if (!wishGoodsDrawing) return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
count = wishGoodsDrawing.count;
|
||||
} else {
|
||||
let wishGoodsHero = findWhere(wishGoodsHeros, { quality: goodInfo.quality});
|
||||
if (!wishGoodsHero)
|
||||
return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
let wishGoodsHero = dicWishPool.wishGoodsHeros.find(cur => cur.quality == dicGoods.quality);
|
||||
if (!wishGoodsHero) return resResult(STATUS.NOT_WISH_THE_QUALITY_GOODS);
|
||||
count = wishGoodsHero.count;
|
||||
}
|
||||
const id = genCode(6);
|
||||
|
||||
@@ -1,24 +1,17 @@
|
||||
import { Application, BackendSession, HandlerService, } from "pinus";
|
||||
import { STATUS, EQUIP_STRENGTHEN_TYPE, CURRENCY_BY_TYPE, CURRENCY_TYPE, HERO_SYSTEM_TYPE, CONSUME_TYPE, HERO_GROW_MAX, MSG_SOURCE, JEWEL_PUSH_LV, TASK_TYPE, HERO_CE_RATIO, ITEM_CHANGE_REASON } from "../../../consts";
|
||||
import { STATUS, HERO_SYSTEM_TYPE, ITEM_CHANGE_REASON } from "../../../consts";
|
||||
import { ItemInter, RewardInter } from "../../../pubUtils/interface";
|
||||
|
||||
import { resResult, parseGoodStr } from "../../../pubUtils/util";
|
||||
import { addItems, handleCost, combineItems, CheckMeterial } from "../../../services/rewardService";
|
||||
import { EquipModel, EquipType } from "../../../db/Equip";
|
||||
import { HeroModel, EPlace, HeroType } from "../../../db/Hero";
|
||||
import Role from "../../../db/Role";
|
||||
import { HeroModel, EPlace } from "../../../db/Hero";
|
||||
import { calPlayerCeAndSave } from "../../../services/playerCeService";
|
||||
import { getGoodById, gameData, getEquipByJobClassAndEPlace, getNextEquipQuality, getEquipQualityIdByEquipIdAndPoint, getEquipStarIdByEquipId, getNextEquipStar } from "../../../pubUtils/data";
|
||||
import { gameData, getEquipByJobClassAndEPlace, getNextEquipQuality, getEquipStarIdByEquipId, getNextEquipStar } from "../../../pubUtils/data";
|
||||
import { BAG, EQUIP } from "../../../pubUtils/dicParam";
|
||||
import { ITID, QUALITY_TYPE, equipTypeToSortAttr, IT_TYPE, QUENCH_TYPE, REFINE_TYPE } from "../../../consts";
|
||||
import { checkEquipCanPut, quenchOnce, checkQuenchMaxByQualityAndGrade, getRandSeResult, refineOnce, checkRefineReachNextLv, calEquipCe, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip } from "../../../services/equipService";
|
||||
import { getRandSeResult, updateEplace, updateEplaces, checkJewelCanPutOnEquip, updateStone, checkStoneCanPutOnEquip } from "../../../services/equipService";
|
||||
|
||||
import { findIndex, isNumber, pick } from 'underscore';
|
||||
import { pushEquipRefineSucMsg, pushNormalEquipMsg, pushNormalItemMsg } from "../../../services/chatService";
|
||||
import { checkTaskWithHero, checkTaskWithEquip, checkTask, checkTaskWithArgs, checkActivityTask } from "../../../services/taskService";
|
||||
import { QuenchLogParam } from "../../../domain/roleField/equip";
|
||||
import { calEquipSeids } from "../../../pubUtils/playerCe";
|
||||
import { JewelModel, JewelType } from "../../../db/Jewel";
|
||||
import { isNumber, pick } from 'underscore';
|
||||
import { JewelModel } from "../../../db/Jewel";
|
||||
import { getJewelRandSe } from "../../../pubUtils/itemUtils";
|
||||
|
||||
export default function (app: Application) {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { getFriendPointObject } from "../../../pubUtils/itemUtils";
|
||||
import { RewardInter } from "../../../pubUtils/interface";
|
||||
import { FriendPresentLogModel } from '../../../db/FriendPresentLog';
|
||||
import { HeroModel, EPlace } from "../../../db/Hero";
|
||||
import { EquipModel } from "../../../db/Equip";
|
||||
import { getPlayerMainAttribute } from "../../../services/pvpService";
|
||||
import { FRIEND } from "../../../pubUtils/dicParam";
|
||||
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
|
||||
|
||||
@@ -11,11 +11,9 @@ import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, g
|
||||
import { ItemInter, RewardInter } from '../../../pubUtils/interface';
|
||||
import { getDropItems, FIGURE_UNLOCK_CONDITION } from '../../../consts/constModules/itemConst'
|
||||
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax, pushHeroWakeUp } from '../../../services/chatService';
|
||||
import { calculatetopLineup, calEquipSeids } from '../../../pubUtils/playerCe';
|
||||
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||
import { checkTaskWithHero, checkTask, checkActivityTask } from '../../../services/taskService';
|
||||
import { EquipModel, EquipType } from '../../../db/Equip';
|
||||
import { checkEquipCanPut } from '../../../services/equipService';
|
||||
import { pick } from 'underscore';
|
||||
|
||||
export default function (app: Application) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,153 +1,9 @@
|
||||
import { mergeSameGoods, getRandEelm, getRandValueByMinMax } from '../pubUtils/util';
|
||||
import { EquipModel, RandMain } from "../db/Equip";
|
||||
import { EPlace, HeroModel, HeroType, Stone } from "../db/Hero";
|
||||
import { getGoodById, gameData, getQuenchGradeByValue, getQuenchConsume, getQuenchByQualityAndGrade } from "../pubUtils/data";
|
||||
import { calPlayerCeAndSave } from "./playerCeService";
|
||||
import { CONSUME_TYPE, HERO_SYSTEM_TYPE, ITID, TASK_TYPE } from "../consts";
|
||||
import { dicGoods, DicGoods } from '../pubUtils/dictionary/DicGoods';
|
||||
import { QuenchLogParam } from '../domain/roleField/equip';
|
||||
import { QUENCH } from '../pubUtils/dicParam';
|
||||
import { DicQuenchQuality } from '../pubUtils/dictionary/DicQuenchQuality';
|
||||
import { getRandEelm, } from '../pubUtils/util';
|
||||
import { EPlace, Stone } from "../db/Hero";
|
||||
import { gameData } from "../pubUtils/data";
|
||||
import { JewelType, RandSe } from '../db/Jewel';
|
||||
import { getJewelRandSe } from '../pubUtils/itemUtils';
|
||||
|
||||
/**
|
||||
* 校验前端传入的消耗数量是否准确,并返回消耗的道具并加上特殊材料needConsumes
|
||||
* @param consumes
|
||||
* @param jewel
|
||||
* @param jewelCount
|
||||
*/
|
||||
export function checkMaterialEnough(consumes: Array<{ id: number, count: number }>, jewel: number, jewelCount: number) {
|
||||
let comJewelMap = new Map<number, number>(); // good_id => count
|
||||
let needConsumes:{ id: number, count: number }[] = []
|
||||
for(let {id, count} of consumes) {
|
||||
if(!comJewelMap.has(id)) {
|
||||
comJewelMap.set(id, count);
|
||||
} else {
|
||||
comJewelMap.set(id, comJewelMap.get(id) + count);
|
||||
}
|
||||
}
|
||||
|
||||
function checkCurMeterial(target: number, targetCount: number) {
|
||||
let dic = getGoodById(target);
|
||||
if(!dic) return false;
|
||||
let { composeMaterial } = dic;
|
||||
|
||||
let isEnough = true;
|
||||
for(let { id, count } of composeMaterial) {
|
||||
let consumeCount = comJewelMap.get(id)||0;
|
||||
let dicGood = getGoodById(id);
|
||||
if(!dicGoods) { isEnough = false; break; }
|
||||
let dicItid = ITID.get(dicGood.itid);
|
||||
if(dicItid.type != CONSUME_TYPE.JEWEL) {
|
||||
if(consumeCount < count * targetCount) {
|
||||
isEnough = false; break;
|
||||
} else {
|
||||
comJewelMap.set(id, consumeCount - count * targetCount);
|
||||
needConsumes.push({ id, count: count * targetCount });
|
||||
}
|
||||
} else {
|
||||
if(consumeCount < count * targetCount) {
|
||||
comJewelMap.set(id, 0);
|
||||
needConsumes.push({ id, count: consumeCount });
|
||||
isEnough = checkCurMeterial(id, count * targetCount - consumeCount);
|
||||
} else {
|
||||
comJewelMap.set(id, consumeCount - count * targetCount);
|
||||
needConsumes.push({ id, count: count * targetCount });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return isEnough
|
||||
}
|
||||
|
||||
let isEnough = checkCurMeterial(jewel, jewelCount);
|
||||
return isEnough? needConsumes: false;
|
||||
}
|
||||
|
||||
export function checkEquipCanPut(hero: HeroType, id: number) {
|
||||
let hid = hero.skinId;
|
||||
let dicGood = gameData.goods.get(id);
|
||||
if(dicGood.lvLimited > hero.lv) return false;
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
if(dicGood.jobLimited.indexOf(0) == -1 && dicGood.jobLimited.indexOf(dicHero.jobClass) == -1) return false;
|
||||
if(dicGood.charLimited.indexOf(0) == -1 && dicGood.charLimited.indexOf(hid) == -1) return false;
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 淬火一次
|
||||
* @param roleId 玩家id
|
||||
* @param sid 玩家sid
|
||||
* @param randMain 装备上的属性随机值
|
||||
* @param dicQuench 淬火表
|
||||
* @param dicGoods 物品表
|
||||
* @returns
|
||||
*/
|
||||
export async function quenchOnce(randMain: RandMain[], dicQuench: DicQuenchQuality, dicGoods: DicGoods) {
|
||||
let { quality, equipLvl } = dicGoods;
|
||||
|
||||
let canRandMain = randMain.filter(cur => { // 已升满的属性就不再淬火了
|
||||
return cur.rand < dicQuench.singleRatioMax;
|
||||
});
|
||||
let randMainResult = getRandEelm(canRandMain);
|
||||
if(randMainResult.length == 0) return false;
|
||||
|
||||
let add = new Map<number, number>(); // id => value,增加的数量
|
||||
let isCriticle = Math.random() * 100 < dicQuench.critProbability; // 暴击
|
||||
let addAttr = isCriticle? dicQuench.critEffect * QUENCH.QUENCH_UNIT_UPRATIO: QUENCH.QUENCH_UNIT_UPRATIO;
|
||||
let overAttr = randMainResult[0].rand + addAttr - dicQuench.singleRatioMax; // 如果有暴击,超出当前品相上限时
|
||||
if(overAttr > 0) { // 超出,转到另一条属性
|
||||
let anotherRandMain = canRandMain.filter(cur => {
|
||||
return cur.id != randMainResult[0].id;
|
||||
});
|
||||
if(anotherRandMain.length > 0) {
|
||||
let anotherOverAttr = anotherRandMain[0].rand + overAttr - dicQuench.singleRatioMax;
|
||||
if(anotherOverAttr > 0) {
|
||||
add.set(anotherRandMain[0].id, overAttr - anotherOverAttr);
|
||||
} else {
|
||||
add.set(anotherRandMain[0].id, overAttr);
|
||||
}
|
||||
}
|
||||
add.set(randMainResult[0].id, addAttr - overAttr);
|
||||
} else {
|
||||
add.set(randMainResult[0].id, addAttr);
|
||||
}
|
||||
|
||||
let value = 0;
|
||||
for(let r of randMain) {
|
||||
if(add.has(r.id)) {
|
||||
r.rand += add.get(r.id);
|
||||
}
|
||||
value += r.rand;
|
||||
}
|
||||
let grade = getQuenchGradeByValue(quality, value/2);
|
||||
|
||||
// 消耗
|
||||
let consumes = getQuenchConsume(equipLvl, quality);
|
||||
|
||||
let log = new QuenchLogParam(isCriticle, add);
|
||||
return { randMain, grade, log, consumes };
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查该品相是否到顶
|
||||
* @param quality 品质
|
||||
* @param grade 品相
|
||||
* @param randMain 装备上的随机值
|
||||
* @returns
|
||||
*/
|
||||
export function checkQuenchMaxByQualityAndGrade(quality: number, grade: number, randMain: RandMain[]) {
|
||||
let isMax = true;
|
||||
let dic = getQuenchByQualityAndGrade(quality, grade);
|
||||
if(!dic) return true;
|
||||
for(let { rand } of randMain) {
|
||||
if(rand < dic.max) isMax = false;
|
||||
}
|
||||
return isMax;
|
||||
}
|
||||
|
||||
export function getRandSeResult(id: number, randSe: RandSe[]) {
|
||||
let { randomEffect, effectCount } = gameData.jewel.get(id);
|
||||
|
||||
@@ -178,38 +34,6 @@ export function getRandSeResult(id: number, randSe: RandSe[]) {
|
||||
return newRandSe
|
||||
}
|
||||
|
||||
export async function refineOnce(lv: number, refineLv: number) {
|
||||
|
||||
let dicRefine = gameData.refine.get(refineLv + 1);
|
||||
if (!dicRefine) return false;
|
||||
|
||||
if(lv < dicRefine.levelLimited) return false;
|
||||
|
||||
return {
|
||||
refineLv: refineLv + 1,
|
||||
consumes: dicRefine.consume
|
||||
}
|
||||
}
|
||||
|
||||
export function checkRefineReachNextLv(oldRefineLv: number, refineLv: number) {
|
||||
let oldDic = gameData.refine.get(oldRefineLv);
|
||||
let dic = gameData.refine.get(refineLv);
|
||||
if(!oldDic || !dic) return true;
|
||||
|
||||
return dic.level > oldDic.level;
|
||||
}
|
||||
|
||||
export function calEquipCe(goodsAbility: Map<number, number>, randMain: RandMain[]) {
|
||||
let ce = 0;
|
||||
for(let [ id, ratio ] of gameData.equipAttributeRatio) {
|
||||
let valueBase = goodsAbility.get(id);
|
||||
let curRand = randMain.find(cur => cur.id == id);
|
||||
let valueRand = curRand?curRand.rand: 0;
|
||||
ce += Math.floor(valueBase * valueRand * ratio / 100);
|
||||
}
|
||||
return ce
|
||||
}
|
||||
|
||||
export function updateStone(origin: Stone[], id: number, target: number) {
|
||||
let newStones: Stone[] = [];
|
||||
let hasTarget = false;
|
||||
|
||||
@@ -1021,7 +1021,7 @@ export async function setRankRedisFromDb(type: string, args?: { serverId?: numbe
|
||||
} else if (type == REDIS_KEY.HERO_RANK) {
|
||||
let serverId = args.serverId;
|
||||
|
||||
for (let hid of gameData.dicMyHeroes) {
|
||||
for (let { actorId: hid } of gameData.recruit) {
|
||||
let ranks = await HeroModel.getRank(hid, serverId, HERO_SELECT.RANK_LINEUP);
|
||||
let r = new Rank(type, { serverId, hid });
|
||||
r.setIsInit(true);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ITID, CONSUME_TYPE, ITEM_TABLE, REDIS_KEY, TASK_TYPE, CURRENCY, CURRENCY_TYPE, MAIL_TYPE, HANDLE_REWARD_TYPE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, ITEM_CHANGE_REASON, TA_USERSET_TYPE, TA_EVENT } from './../consts';
|
||||
import { EquipModel, EquipType } from './../db/Equip';
|
||||
import { ITID, CONSUME_TYPE, ITEM_TABLE, CURRENCY, CURRENCY_TYPE, MAIL_TYPE, HANDLE_REWARD_TYPE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, ITEM_CHANGE_REASON, TA_USERSET_TYPE, TA_EVENT } from './../consts';
|
||||
import { getRandSingleEelm, resResult } from '../pubUtils/util';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
import { setAp } from './actionPointService';
|
||||
import { pushCalPlayerCe, pushCalAllHeroCe, calPlayerCeAndSave } from './playerCeService';
|
||||
import { pushCalAllHeroCe, calPlayerCeAndSave } from './playerCeService';
|
||||
import { ItemModel, ItemType } from '../db/Item';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { pinus } from 'pinus';
|
||||
@@ -14,13 +13,12 @@ import { uniq } from 'underscore';
|
||||
import { EPlace, HeroModel, HeroType, HeroUpdate } from '../db/Hero';
|
||||
import { Figure } from '../domain/dbGeneral';
|
||||
import { Rank } from './rankService';
|
||||
import { checkActivityTask, checkTaskWithHero, pushActivityUpdate, pushTaskUpdate } from './taskService';
|
||||
import { pushTaskUpdate } from './taskService';
|
||||
import { CreateHeroParam, HeroShowParam } from '../domain/roleField/hero';
|
||||
import { HeroSkin } from '../db/Hero';
|
||||
import { errlogger } from '../util/logger';
|
||||
import { BAG } from '../pubUtils/dicParam';
|
||||
import { sendMailByContent } from './mailService';
|
||||
import { calEquipSeids } from '../pubUtils/playerCe';
|
||||
import { CreateHeroes } from '../pubUtils/roleUtil';
|
||||
import { SkinUpdate } from '../db/Skin';
|
||||
import { getInitHeroById } from './roleService';
|
||||
@@ -541,6 +539,10 @@ export async function checkHeroes(roleId: string, hids: number[]) {
|
||||
return true
|
||||
}
|
||||
|
||||
export async function checkHeroEquips(roleId: string, quality: number) {
|
||||
return await HeroModel.checkEquipByQuality(roleId, quality);
|
||||
}
|
||||
|
||||
export async function unlockFigure(sid: string, roleId: string, conditions: { type: number, paramHid?: number, paramFavourLv?: number, paramSkinId?: number, paramWinStreakNum?: number }[], role?: RoleType) {
|
||||
let figureInfo = await pubUnlockFigure(roleId, conditions, role);
|
||||
await pushFigureUpdate(roleId, sid, figureInfo);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { EquipType } from './../db/Equip';
|
||||
|
||||
import { EPlace, HeroType } from '../db/Hero';
|
||||
import { GuildType } from '../db/Guild';
|
||||
import { CHANNEL_PREFIX, HERO_GROW_MAX, HERO_INITIAL_QUALITY, MSG_SOURCE, MSG_TYPE, ON_GROUP_MSG_ROUTE, STATUS, WAR_TYPE } from '../consts';
|
||||
|
||||
@@ -5,14 +5,13 @@ import { resResult, shouldRefresh } from '../pubUtils/util';
|
||||
import { STATUS, TASK_TYPE, TASK_FUN_TYPE, SHOP_REFRESH_TYPE, WAR_TYPE } from '../consts';
|
||||
import { TaskParam, TaskListReturn } from '../domain/roleField/task';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { EquipType } from '../db/Equip';
|
||||
import { getRoleOnlineInfo } from './redisService';
|
||||
import { HeroScores } from '../db/PvpHistoryOpp';
|
||||
import { ItemInter } from '../pubUtils/interface';
|
||||
import { UserTaskModel, UserTaskType } from '../db/UserTask';
|
||||
import { UserTaskRecModel } from '../db/UserTaskRec';
|
||||
import { UserTaskHistoryModel } from '../db/UserTaskHistory';
|
||||
import { gameData, getGoodById } from '../pubUtils/data';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { getSeconds, getZeroPointD } from '../pubUtils/timeUtil';
|
||||
import { RoleStatus } from '../db/ComBattleTeam';
|
||||
import { getActivities } from './activity/activityService';
|
||||
@@ -35,10 +34,10 @@ export async function checkTaskWithHero(roleId: string, sid: string, taskType: n
|
||||
pushTaskUpdate(roleId, sid, pushMessage);
|
||||
}
|
||||
|
||||
export async function checkTaskWithEquip(roleId: string, sid: string, taskType: number, equip: EquipType, args?: number[]) {
|
||||
let pushMessage = await taskUtil.checkTaskWithEquip(roleId, taskType, equip, args);
|
||||
pushTaskUpdate(roleId, sid, pushMessage);
|
||||
}
|
||||
// export async function checkTaskWithEquip(roleId: string, sid: string, taskType: number, equip: EquipType, args?: number[]) {
|
||||
// let pushMessage = await taskUtil.checkTaskWithEquip(roleId, taskType, equip, args);
|
||||
// pushTaskUpdate(roleId, sid, pushMessage);
|
||||
// }
|
||||
|
||||
export async function checkTaskWithArgs(roleId: string, sid: string, taskType: number, args: number[]) {
|
||||
let pushMessage = await taskUtil.checkTaskWithArgs(roleId, taskType, args);
|
||||
|
||||
Reference in New Issue
Block a user