装备:清理旧代码
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) {
|
||||
|
||||
Reference in New Issue
Block a user