体力:修复体力更新
This commit is contained in:
@@ -100,7 +100,7 @@ export async function setAp(roleId: string, ip: string, lv: number, changeAp: nu
|
|||||||
|
|
||||||
if (changeAp != 0) {
|
if (changeAp != 0) {
|
||||||
let uids = [{ uid: roleId, sid }];
|
let uids = [{ uid: roleId, sid }];
|
||||||
pinus.app.get('channelService').pushMessageByUids('onApUpdate', resResult(STATUS.SUCCESS, { ...apJson }), uids);
|
pinus.app.get('channelService').pushMessageByUids('onApUpdate', resResult(STATUS.SUCCESS, { apJson: { ...apJson, apBefore } }), uids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return apJson
|
return apJson
|
||||||
|
|||||||
@@ -234,12 +234,12 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
|||||||
|
|
||||||
// 3. 货币推送
|
// 3. 货币推送
|
||||||
if(gold.length > 0 || coin.length > 0 || ap > 0) {
|
if(gold.length > 0 || coin.length > 0 || ap > 0) {
|
||||||
let { ap: addAp } = await setAp(roleId, null, role.lv, ap, sid, reason);
|
await setAp(roleId, null, role.lv, ap, sid, reason);
|
||||||
let incCoin = coin.reduce((pre, cur) => pre + cur, 0);
|
let incCoin = coin.reduce((pre, cur) => pre + cur, 0);
|
||||||
let incGold = gold.reduce((pre, cur) => pre + cur.count, 0);
|
let incGold = gold.reduce((pre, cur) => pre + cur.count, 0);
|
||||||
role = await RoleModel.increaseGoldAndCoin(roleId, gold, incCoin);
|
role = await RoleModel.increaseGoldAndCoin(roleId, gold, incCoin);
|
||||||
pinus.app.get('channelService').pushMessageByUids('onPlayerDataChange', resResult(STATUS.SUCCESS, {
|
pinus.app.get('channelService').pushMessageByUids('onPlayerDataChange', resResult(STATUS.SUCCESS, {
|
||||||
gold: role.gold, coin: role.coin, ap: addAp
|
gold: role.gold, coin: role.coin
|
||||||
}), uids);
|
}), uids);
|
||||||
if(gold.length > 0) {
|
if(gold.length > 0) {
|
||||||
gold.forEach(({ count }) => {
|
gold.forEach(({ count }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user