This commit is contained in:
mamengke01
2020-12-28 17:10:38 +08:00
parent 1e246ecb72
commit 8cad1f80d4
9 changed files with 359 additions and 282 deletions

View File

@@ -9,6 +9,7 @@ import { RoleModel } from '../../../db/Role';
import { ItemModel } from '../../../db/Item';
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById } from '../../../pubUtils/data';
import { RewardInter } from '../../../pubUtils/interface';
import { getDropItems } from '../../../consts/constModules/itemConst'
export default function(app: Application) {
return new HeroHandler(app);
@@ -44,7 +45,14 @@ export class HeroHandler {
let {id, count} = msg;
//let result = await handleCost(roleId, sid, [{id, count}] );
let result = await addItems(roleId, roleName, sid, [{id, count}] );
let items = [{id, count}];
if (id == 999999) {
items = getDropItems();
let role = await RoleModel.findByRoleId(roleId);
role.lv = 60;
await RoleModel.updateRoleInfo(roleId, role);
}
let result = await addItems(roleId, roleName, sid, items );
if(!result) {
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
}

View File

@@ -92,6 +92,7 @@ export class RoleHandler {
if (!result)
return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH);
await RoleModel.updateRoleInfo(roleId, { title });
await calAllHeroCe( sid, roleId, 2, [title]);
return resResult(STATUS.SUCCESS, { roleId, title });
}
@@ -284,7 +285,6 @@ export class RoleHandler {
});
}
// 激活/升级名将谱
async activeHeroScroll(msg: { hid: number }, session: BackendSession) {
let roleId = session.get('roleId');

View File

@@ -21,7 +21,7 @@ export async function calPlayerCeAndSave(sid: string, roleId: string, heros: Arr
}
export async function calAllHeroCe(sid: string, roleId: string, type?:number, args?:Array<number>) {
let {ce, pushHeros}= await reCalAllHeroCe(roleId,type, args);
let {ce, pushHeros}= await reCalAllHeroCe(roleId, type, args);
let uids = [{ uid: roleId, sid }];
pinus.app.get('channelService').pushMessageByUids('onPlayerCeUpdate', resResult(STATUS.SUCCESS, { ce: reduceCe(ce), heros: pushHeros, topFiveCe: 0 }), uids);
return;

View File

@@ -1,11 +1,5 @@
import { getRandNum, getRandomArr } from '../pubUtils/util';
import { EquipModel } from "../db/Equip";
import { HeroModel, EPlace } from "../db/Hero";
import { ITID } from "../consts/constModules/itemConst";
import { getHeroJob, getGoodById, gameData, getJewelById, getHeroEquipByClassId } from "../pubUtils/data";
import { calPlayerCeAndSave } from "./playerCeService";
import { TERAPH_RANDOM } from "../consts/consts";
import { getTeraphAttr } from '../consts/constModules/abilityConst';
const _ = require('underscore');
const TERAPH_STRENGTHEN = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
export function checkMaterialEnough(count: number, attrs:Array<any>, teraphInfo: any, teraph: any) {

View File

@@ -17,7 +17,8 @@ export const HERO_SYSTEM_TYPE = {
JEWEL_OFF: 14,
ADD_SKIN: 15,
SCHOOL: 16,
SCROLL: 17
SCROLL: 17,
TITLE:18,
};
// 武将上限

View File

@@ -189,4 +189,30 @@ export function getCurNameById(gid) {
} else if (currency.type == CURRENCY_TYPE.EXPEDITION_POINT) {
return 'expeditionPoint';
}
}
}
export function getDropItems() {
let items = [
{ id:25 ,count: 1 },{ id:225 ,count: 1 },{ id:625 ,count: 1 },{ id:2025 ,count: 1 },{ id:3025 ,count: 1 },{ id:4025 ,count: 1 },{ id:5025 ,count: 1 },{ id:6025 ,count: 1 },
{ id:1 ,count: 1 },{ id:2 ,count: 1 },{ id:101 ,count: 1 },{ id:102 ,count: 1 },{ id:201 ,count: 1 },{ id:202 ,count: 1 },{ id:301 ,count: 1 },{ id:302 ,count: 1 },
{ id:401 ,count: 1 },{ id:501 ,count: 1 },{ id:601 ,count: 1 },{ id:602 ,count: 1 },{ id:701 ,count: 1 },{ id:702 ,count: 1 },{ id:2001 ,count: 1 },{ id:2002 ,count: 1 },
{ id:2101 ,count: 1 },{ id:2102 ,count: 1 },{ id:2201 ,count: 1 },{ id:2202 ,count: 1 },{ id:3001 ,count: 1 },{ id:3002 ,count: 1 },{ id:3101 ,count: 1 },{ id:3102 ,count: 1 },
{ id:3201 ,count: 1 },{ id:3202 ,count: 1 },{ id:4001 ,count: 1 },{ id:4002 ,count: 1 },{ id:4101 ,count: 1 },{ id:4102 ,count: 1 },{ id:4201 ,count: 1 },{ id:4202 ,count: 1 },
{ id:5001 ,count: 1 },{ id:5002 ,count: 1 },{ id:5101 ,count: 1 },{ id:5102 ,count: 1 },{ id:5201 ,count: 1 },{ id:5202 ,count: 1 },{ id:6001 ,count: 1 },{ id:6002 ,count: 1 },
{ id:6101 ,count: 1 },{ id:6102 ,count: 1 },{ id:11001 ,count: 10000},{ id:11002 ,count: 10000 },{ id:11003,count: 10000 },{ id:11004 ,count: 100000 },{ id:11011 ,count: 100000 },
{ id:11012 ,count: 100000 },{ id:11013 ,count: 100000 },{ id:11014 ,count: 100000 },{ id:11015 ,count: 100000 },{ id:11016 ,count: 100000 },{ id:11017 ,count: 100000 },
{ id:17001 ,count: 100000 },{ id:17002 ,count: 100000 },{ id:17003 ,count: 100000 },{ id:17004 ,count: 100000 },{ id:17005 ,count: 100000 },{ id:17006 ,count: 100000 },
{ id:17007 ,count: 100000 },{ id:17008 ,count: 100000 },{ id:17009 ,count: 100000 },{ id:17010 ,count: 100000 },{ id:17011 ,count: 100000 },{ id:17012 ,count: 100000 },
{ id:17013 ,count: 100000 },{ id:17014 ,count: 100000 },{ id:17015 ,count: 100000 },{ id:17016 ,count: 100000 },{ id:17016 ,count: 100000 },{ id:17017 ,count: 100000 },
{ id:17018 ,count: 100000 },{ id:17019 ,count: 100000 },{ id:17020 ,count: 100000 },{ id:17021 ,count: 100000 },{ id:17022 ,count: 100000 },{ id:17023 ,count: 100000 },
{ id:17024 ,count: 100000 },{ id:17025 ,count: 100000 },{ id:17026 ,count: 100000 },{ id:17027 ,count: 100000 },{ id:17028 ,count: 100000 },{ id:17029 ,count: 100000 },
{ id:17030 ,count: 100000 },{ id:17031 ,count: 100000 },{ id:17032 ,count: 100000 },{ id:17033 ,count: 100000 },{ id:17034 ,count: 100000 },{ id:17035 ,count: 100000 },
{ id:17036 ,count: 100000 },{ id:17037 ,count: 100000 },{ id:17038 ,count: 100000 },{ id:17039 ,count: 100000 },{ id:17040 ,count: 100000 },{ id:17041 ,count: 100000 },
{ id:17042 ,count: 100000 },{ id:17043 ,count: 100000 },{ id:17044 ,count: 100000 },{ id:17045 ,count: 100000 },{ id:17046 ,count: 100000 },{ id:17047 ,count: 100000 },
{ id:21001 ,count: 100000 },{ id:21002 ,count: 100000 },{ id:31001 ,count: 100000 },{ id:31002 ,count: 100000 },{ id:31003 ,count: 100000 },{ id:33001 ,count: 100000 },
{ id:33002 ,count: 100000 },{ id:33003 ,count: 100000 },{ id:40001 ,count: 100000 },{ id:40002 ,count: 100000 },{ id:42001 ,count: 100000 },{ id:42002 ,count: 100000 },
{ id:50009 ,count: 100000 },{ id:50010 ,count: 100000 },{ id:60001 ,count: 100000 },{ id:60002 ,count: 100000 },{ id:60060 ,count: 100000 }
]
return items;
}

View File

@@ -5,6 +5,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
import User from './User';
import { shouldRefresh } from '../pubUtils/util';
import { HeroModel } from './Hero';
import { initRoleAtrr } from '../pubUtils/playerCe';
interface roleUpdate {
ce?: number;
_id?:number;
@@ -227,6 +228,7 @@ export default class Role extends BaseModel {
if (!user) return null;
const doc = new RoleModel();
const update = Object.assign(doc.toJSON(), roleInfo, { userInfo: user, serverType: user.serverType, serverId });
initRoleAtrr(update);
const role: RoleType = await RoleModel.findOneAndUpdate({ 'userInfo.uid': uid, serverId }, update, { upsert: true, new: true }).lean(lean);
return role;
}

View File

@@ -17,7 +17,7 @@ export interface DicTitle {
readonly mdef: number;
readonly agi: number;
readonly luk: number;
readonly assiAttrValue: Map<number, number>;
readonly assiAttrValue: Array<{id: number, number: number}>;
// 等级现在
readonly lvLimited: number;
// 升级消耗

File diff suppressed because it is too large Load Diff