掉落
This commit is contained in:
@@ -198,9 +198,8 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
equipInfos.push(equipInfo);
|
||||
}
|
||||
//装备推送
|
||||
if (!!equipInfos.length) {
|
||||
pinus.app.get('channelService').pushMessageByUids('onEquipAdd', resResult(STATUS.SUCCESS, {equipInfos}), uids);
|
||||
}
|
||||
if (!!equipInfos.length)
|
||||
pinus.app.get('channelService').pushMessageByUids('onEquipAdd', resResult(STATUS.SUCCESS, equipInfos), uids);
|
||||
|
||||
let data = {};
|
||||
for (let currency of currencys) {
|
||||
@@ -209,9 +208,8 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
}
|
||||
|
||||
//货币推送
|
||||
if (!!Object.keys(data).length) {
|
||||
if (!!Object.keys(data).length)
|
||||
pinus.app.get('channelService').pushMessageByUids('onPlayerDataChange', resResult(STATUS.SUCCESS, data), uids);
|
||||
}
|
||||
|
||||
let bagInfos = [];
|
||||
for (let item of bags) {
|
||||
@@ -221,9 +219,8 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
}
|
||||
|
||||
//背包除去装备推送
|
||||
if (!!bagInfos.length) {
|
||||
if (!!bagInfos.length)
|
||||
pinus.app.get('channelService').pushMessageByUids('onItemUpdate', resResult(STATUS.SUCCESS, {goods: bagInfos}), uids);
|
||||
}
|
||||
|
||||
let skinInfos = [];
|
||||
for (let skinId of skins) {//皮肤推送
|
||||
@@ -232,8 +229,9 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
showItems.push({id: skinId, count: 1});
|
||||
skinInfos.push(result);
|
||||
}
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
|
||||
}
|
||||
if (!!skinInfos.length)
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, skinInfos), uids);
|
||||
return showItems;
|
||||
}
|
||||
|
||||
@@ -253,7 +251,7 @@ function sortItems (goods: Array<Item>, bags: Array<Bag>, skins: Array<number>,
|
||||
} else {
|
||||
currencys.push(good);
|
||||
}
|
||||
} else if (goodInfo.itid == CONSUME_TYPE.SKIN) {
|
||||
} else if (type == CONSUME_TYPE.SKIN) {
|
||||
let index = _.indexOf(skins, good.id);
|
||||
if (index == -1) {
|
||||
skins.push(good.id);
|
||||
@@ -279,7 +277,7 @@ async function addSkins(roleId: string, id: number) {
|
||||
return false;
|
||||
if (!!_.findWhere(hero.skins, {id}))
|
||||
return false;
|
||||
hero.skins.push({id: id, enable: false});
|
||||
hero.skins.push({id, enable: false});
|
||||
await HeroModel.updateHeroInfo(roleId, hero.hid, hero);
|
||||
return {skins: hero.skins, hid: hero.hid};
|
||||
}
|
||||
@@ -287,7 +285,7 @@ async function addSkins(roleId: string, id: number) {
|
||||
async function addBags(roleId: string, roleName: string, data:Bag) {
|
||||
let {id, count, itemName, type, hid} = data;
|
||||
let item = await ItemModel.increaseItem(roleId, id, count, {roleId, roleName, itemName, id, type, hid});
|
||||
return item;
|
||||
return {id:item.id, count: item.count};
|
||||
}
|
||||
|
||||
async function addEquips (roleId: string, roleName: string, weapon: Equip) {
|
||||
|
||||
@@ -92,7 +92,7 @@ export default class Hero extends BaseModel {
|
||||
favourLv: number; // 好感等级
|
||||
@prop({ required: true, type:Connect, default: [] })
|
||||
connections: Connect[]; // 羁绊
|
||||
@prop({ required: true, default: [] })
|
||||
@prop({ required: true, type: Skin, default: [] })
|
||||
skins: Skin[]; // 皮肤
|
||||
|
||||
@prop({ ref: Equip, type: mongoose.Schema.Types.ObjectId })
|
||||
|
||||
Reference in New Issue
Block a user