Merge branch 'feature/skin' into release

# Conflicts:
#	src/cross/protocols/serviceProto.ts
#	src/json/huodong.json5
#	src/json/pay.json
#	src/json/renown_level.json
#	src/json/tanxian.json
#	src/json/xstask.json
#	src/jsonType.ts
#	src/module/mongodb.ts
#	src/monopoly/protocols/serviceProto.ts
#	src/shared/protocols/serviceProto.ts
#	src/shared/protocols/user/PtlLogin.ts
#	src/shared/public/hero.ts
This commit is contained in:
xichaoyin 2024-01-12 00:28:09 +08:00
commit ac90f9db33
26 changed files with 8788 additions and 13722 deletions

View File

@ -1,10 +1,10 @@
import {ApiCall} from "tsrpc"; import { ApiCall } from "tsrpc";
import {HeroFun} from '../public/hero'; import { HeroFun } from '../public/hero';
import {PlayerFun} from '../public/player'; import { PlayerFun } from '../public/player';
import {defaultUserAppend, UserFun} from '../public/user'; import { defaultUserAppend, UserFun } from '../public/user';
import {ReqBingo, ResBingo} from "../shared/protocols/PtlBingo"; import { ReqBingo, ResBingo } from "../shared/protocols/PtlBingo";
import {ReqEmail} from "../monopoly/protocols/PtlEmail"; import { ReqEmail } from "../monopoly/protocols/PtlEmail";
import {EmailFun} from "../public/email"; import { EmailFun } from "../public/email";
export default async function (call: ApiCall<ReqBingo, ResBingo>) { export default async function (call: ApiCall<ReqBingo, ResBingo>) {
// TODO // TODO
@ -72,37 +72,37 @@ export default async function (call: ApiCall<ReqBingo, ResBingo>) {
if (!G.gc.item[shell[1]]) return call.error(`道具id不存在${shell[1]}`); if (!G.gc.item[shell[1]]) return call.error(`道具id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
await PlayerFun.addItem(call, [{a: 'item', t: shell[1], n: parseInt(shell[2])}]); await PlayerFun.addItem(call, [{ a: 'item', t: shell[1], n: parseInt(shell[2]) }]);
} else if (shell[0] == 'hero') { } else if (shell[0] == 'hero') {
if (!G.gc.hero[shell[1]]) return call.error(`英雄id不存在${shell[1]}`); if (!G.gc.hero[shell[1]]) return call.error(`英雄id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
await PlayerFun.addHero(call, [{a: 'item', t: shell[1], n: parseInt(shell[2])}]); await PlayerFun.addHero(call, [{ a: 'item', t: shell[1], n: parseInt(shell[2]) }]);
} else if (shell[0] == 'equip') { } else if (shell[0] == 'equip') {
if (!G.gc.equip[shell[1]]) return call.error(`装备id不存在${shell[1]}`); if (!G.gc.equip[shell[1]]) return call.error(`装备id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
await PlayerFun.addEquip(call, [{a: 'equip', t: shell[1], n: parseInt(shell[2])}]); await PlayerFun.addEquip(call, [{ a: 'equip', t: shell[1], n: parseInt(shell[2]) }]);
} else if (shell[0] == 'shiwu') { } else if (shell[0] == 'shiwu') {
if (!G.gc.shiwu[shell[1]]) return call.error(`饰物id不存在${shell[1]}`); if (!G.gc.shiwu[shell[1]]) return call.error(`饰物id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
if (isNaN(parseInt(shell[3]))) return call.error(`请输入正确的品质`); if (isNaN(parseInt(shell[3]))) return call.error(`请输入正确的品质`);
await PlayerFun.addShiwu(call, [{a: 'shiwu', t: shell[1], n: parseInt(shell[2]), colour: parseInt(shell[3])}]); await PlayerFun.addShiwu(call, [{ a: 'shiwu', t: shell[1], n: parseInt(shell[2]), colour: parseInt(shell[3]) }]);
} else if (shell[0] == 'peijian') { } else if (shell[0] == 'peijian') {
if (!G.gc.peijian[shell[1]]) return call.error(`配件id不存在${shell[1]}`); if (!G.gc.peijian[shell[1]]) return call.error(`配件id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
await PlayerFun.addPeijian(call, [{a: 'peijian', t: shell[1], n: parseInt(shell[2])}]); await PlayerFun.addPeijian(call, [{ a: 'peijian', t: shell[1], n: parseInt(shell[2]) }]);
} else if (shell[0] == 'attr') { } else if (shell[0] == 'attr') {
if (G.gc.attr[shell[1]] == undefined) return call.error(`道具id不存在${shell[1]}`); if (G.gc.attr[shell[1]] == undefined) return call.error(`道具id不存在${shell[1]}`);
if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`); if (isNaN(parseInt(shell[2]))) return call.error(`请输入正确的数量`);
await PlayerFun.addAttr(call, [{a: 'attr', t: shell[1], n: parseInt(shell[2])}]); await PlayerFun.addAttr(call, [{ a: 'attr', t: shell[1], n: parseInt(shell[2]) }]);
} else if (shell.length == 2) { } else if (shell.length == 2) {
@ -141,6 +141,9 @@ export default async function (call: ApiCall<ReqBingo, ResBingo>) {
} }
if (shell[3]) emailMsg.prize = JSON.parse(shell[3]) if (shell[3]) emailMsg.prize = JSON.parse(shell[3])
EmailFun.addEmail(emailMsg); EmailFun.addEmail(emailMsg);
} else if (shell[0] == "heroskin") {
PlayerFun.sendPrize(call, [{ a: "heroskin", "t": shell[1], n: 1 }]);
} }
call.succ('succ'); call.succ('succ');
} }

View File

@ -0,0 +1,20 @@
import { ApiCall } from "tsrpc";
import { ReqTakeOff, ResTakeOff } from "../../shared/protocols/heroskin/PtlTakeOff";
import { HeroFun } from "../../public/hero";
export default async function (call: ApiCall<ReqTakeOff, ResTakeOff>) {
let hero = await HeroFun.getHero(call, call.req.heroOid);
if (!hero) { // 英雄不存在
call.error(lng.hero_1);
return;
}
if (!hero.skin) { // 没有穿戴皮肤
call.error(lng.hero_22);
return;
}
await HeroFun.changeHeroAttr(call, hero, { skin: "" });
call.succ({});
}

View File

@ -0,0 +1,38 @@
import { ApiCall } from "tsrpc";
import { PlayerFun } from "../../public/player";
import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv";
import HeroSkinFun from "../../public/heroskin";
export default async function (call: ApiCall<ReqUplv, ResUplv>) {
let skin = HeroSkinFun.getHeroSkin(call);
if (!skin[call.req.skid]) {// 皮肤未获得
call.error(lng.hero_20);
}
let cur_lv = skin[call.req.skid];
let skinconf = G.gc.heroSkin[call.req.skid];
let need = [];
for (let i = 0; i < call.req.lv; i++) {
need = need.concat(
G.gc.heroSkinLv[skinconf.colour][cur_lv + i].need
)
let conf = G.gc.heroSkin[call.req.skid];
need.push({ a: "item", "t": conf.heroId, "n": G.gc.heroSkinLv[skinconf.colour][cur_lv + i].suipian });
}
// 检测消耗
await PlayerFun.checkNeedIsMeet(call, need);
// 扣除消耗
await PlayerFun.cutNeed(call, need);
// 更新等级
skin[call.req.skid] = cur_lv + call.req.lv;
// 更新skinlv
await HeroSkinFun.updateHeroSkinLv(call, { [call.req.skid]: cur_lv + call.req.lv });
call.succ({});
}

View File

@ -0,0 +1,28 @@
import { ApiCall } from "tsrpc";
import { HeroFun } from "../../public/hero";
import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear";
import HeroSkinFun from "../../public/heroskin";
export default async function (call: ApiCall<ReqWear, ResWear>) {
let hero = await HeroFun.getHero(call, call.req.heroOid);
if (!hero) { // 英雄不存在
call.error(lng.hero_1);
return;
}
let skin = HeroSkinFun.getHeroSkin(call);
if (!skin || !skin[call.req.skid]) { // 皮肤不存在
call.error(lng.hero_20);
return;
}
let skinconf = G.gc.heroSkin[call.req.skid];
if (skinconf.heroId != hero.heroId) { // 皮肤不属于该英雄
call.error(lng.hero_21);
return;
}
await HeroFun.changeHeroAttr(call, hero, { skin: call.req.skid });
call.succ({});
}

View File

@ -20,7 +20,8 @@ export default async function (call: ApiCall<ReqChangeInfo, ResChangeInfo>) {
vip: call.conn.gud.vip, vip: call.conn.gud.vip,
lsyx: call.conn.lshd.hero, lsyx: call.conn.lshd.hero,
model: call.conn.gud.model, model: call.conn.gud.model,
active: active active: active,
heroskin: call.conn.gud.heroskin
}); });
if (!isMeet && call.req.type != 'headFrame' && call.req.type != 'chatFrame') return call.error(globalThis.lng.user_1); if (!isMeet && call.req.type != 'headFrame' && call.req.type != 'chatFrame') return call.error(globalThis.lng.user_1);

View File

@ -1319,7 +1319,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
}, },
{ {
"id": 38, "id": 38,
"name": "weiwangbuff", "name": "heroskin",
"type": { "type": {
"type": "Interface", "type": "Interface",
"indexSignature": { "indexSignature": {
@ -1721,6 +1721,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
} }
} }
} }
},
{
"id": 8,
"name": "skin",
"type": {
"type": "String"
}
} }
] ]
}, },

View File

@ -1,11 +1,18 @@
{ {
//赛区划分按照周三23:50的时候王者玩家100个一组 //赛区划分
//赛区划分时间周三23:50 divide: [
divideTime: 258600, { day: [1, 30], group: 0 },
//挑战时间周一08:00——周六22:00 { day: [31, 60], group: 1 },
{ day: [61, 120], group: 2 },
{ day: [121, 210], group: 3 },
{ day: [211, 99999999], group: 4 },
],
//赛区划分时间
divideTime: 0,
//挑战时间
fightTime: [28800, 511200], fightTime: [28800, 511200],
//发奖时间周六22:05 //发奖时间
prizeTime: 511500, prizeTime: 598200,
//胜场奖励 //胜场奖励
fightWinPrize: [ fightWinPrize: [
{ total: 5, prize: [{ a: 'attr', t: 'clsl_sd', n: 1 },{ a: 'item', t: '37', n: 1 }], star: 1 }, { total: 5, prize: [{ a: 'attr', t: 'clsl_sd', n: 1 },{ a: 'item', t: '37', n: 1 }], star: 1 },
@ -32,13 +39,13 @@
], ],
//段位奖励 //段位奖励
danPrize: [ danPrize: [
{ star: 49, title: "clsl_7", prize: [{ a: 'item', t: '605', n:3 },{ a: 'item', t: '29', n:10 },{ a: 'item', t: '631', n:3 },{ a: 'item', t: '40', n:1 }] }, { star: 49, prize: [{ a: 'item', t: '605', n:3 },{ a: 'item', t: '29', n:10 },{ a: 'item', t: '631', n:3 },{ a: 'item', t: '40', n:1 }] },
{ star: 39, title: "clsl_6", prize: [{ a: 'item', t: '605', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:2 }] }, { star: 39, prize: [{ a: 'item', t: '605', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:2 }] },
{ star: 29, title: "clsl_5", prize: [{ a: 'item', t: '606', n:3 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:1 }] }, { star: 29, prize: [{ a: 'item', t: '606', n:3 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:1 }] },
{ star: 21, title: "clsl_4", prize: [{ a: 'item', t: '606', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:1000 }] }, { star: 21, prize: [{ a: 'item', t: '606', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:1000 }] },
{ star: 13, title: "clsl_3", prize: [{ a: 'item', t: '606', n:1 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:800 }] }, { star: 13, prize: [{ a: 'item', t: '606', n:1 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:800 }] },
{ star: 7, title: "clsl_2", prize: [{ a: 'item', t: '29', n:10 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:600 }] }, { star: 7, prize: [{ a: 'item', t: '29', n:10 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:600 }] },
{ star: 0, title: "clsl_1", prize: [{ a: 'item', t: '29', n:5 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:400 }] } { star: 0, prize: [{ a: 'item', t: '29', n:5 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:400 }] }
], ],
//王者排名邮件信息 //王者排名邮件信息
email_rank: { email_rank: {

File diff suppressed because it is too large Load Diff

View File

@ -317,286 +317,172 @@
"22": { "22": {
"id": 22, "id": 22,
"renownlevel": 22, "renownlevel": 22,
"maxlevel": 62500, "maxlevel": 5000,
"cost": [ "cost": 54,
{ "atk": 14,
"a": "attr", "def": 7,
"t": "weiwang", "hp": 23
"n": 25
}
],
"atk": 1.4,
"def": 1.2,
"hp": 7
}, },
"23": { "23": {
"id": 23, "id": 23,
"renownlevel": 23, "renownlevel": 23,
"maxlevel": 67500, "maxlevel": 5000,
"cost": [ "cost": 57,
{ "atk": 16,
"a": "attr", "def": 8,
"t": "weiwang", "hp": 24
"n": 30
}
],
"atk": 1.4,
"def": 1.2,
"hp": 7
}, },
"24": { "24": {
"id": 24, "id": 24,
"renownlevel": 24, "renownlevel": 24,
"maxlevel": 72500, "maxlevel": 5000,
"cost": [ "cost": 60,
{ "atk": 16,
"a": "attr", "def": 8,
"t": "weiwang", "hp": 24
"n": 35
}
],
"atk": 1.4,
"def": 1.2,
"hp": 7
}, },
"25": { "25": {
"id": 25, "id": 25,
"renownlevel": 25, "renownlevel": 25,
"maxlevel": 77500, "maxlevel": 5000,
"cost": [ "cost": 63,
{ "atk": 16,
"a": "attr", "def": 8,
"t": "weiwang", "hp": 24
"n": 40
}
],
"atk": 1.4,
"def": 1.2,
"hp": 7
}, },
"26": { "26": {
"id": 26, "id": 26,
"renownlevel": 26, "renownlevel": 26,
"maxlevel": 82500, "maxlevel": 5000,
"cost": [ "cost": 66,
{ "atk": 16,
"a": "attr", "def": 8,
"t": "weiwang", "hp": 24
"n": 45
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"27": { "27": {
"id": 27, "id": 27,
"renownlevel": 27, "renownlevel": 27,
"maxlevel": 87500, "maxlevel": 5000,
"cost": [ "cost": 69,
{ "atk": 16,
"a": "attr", "def": 8,
"t": "weiwang", "hp": 24
"n": 50
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"28": { "28": {
"id": 28, "id": 28,
"renownlevel": 28, "renownlevel": 28,
"maxlevel": 92500, "maxlevel": 5000,
"cost": [ "cost": 72,
{ "atk": 18,
"a": "attr", "def": 9,
"t": "weiwang", "hp": 25
"n": 60
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"29": { "29": {
"id": 29, "id": 29,
"renownlevel": 29, "renownlevel": 29,
"maxlevel": 97500, "maxlevel": 5000,
"cost": [ "cost": 75,
{ "atk": 18,
"a": "attr", "def": 9,
"t": "weiwang", "hp": 25
"n": 80
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"30": { "30": {
"id": 30, "id": 30,
"renownlevel": 30, "renownlevel": 30,
"maxlevel": 102500, "maxlevel": 5000,
"cost": [ "cost": 78,
{ "atk": 18,
"a": "attr", "def": 9,
"t": "weiwang", "hp": 25
"n": 100
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"31": { "31": {
"id": 31, "id": 31,
"renownlevel": 31, "renownlevel": 31,
"maxlevel": 107500, "maxlevel": 5000,
"cost": [ "cost": 81,
{ "atk": 18,
"a": "attr", "def": 9,
"t": "weiwang", "hp": 25
"n": 120
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"32": { "32": {
"id": 32, "id": 32,
"renownlevel": 32, "renownlevel": 32,
"maxlevel": 112500, "maxlevel": 5000,
"cost": [ "cost": 84,
{ "atk": 18,
"a": "attr", "def": 9,
"t": "weiwang", "hp": 25
"n": 140
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"33": { "33": {
"id": 33, "id": 33,
"renownlevel": 33, "renownlevel": 33,
"maxlevel": 117500, "maxlevel": 5000,
"cost": [ "cost": 87,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 180
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"34": { "34": {
"id": 34, "id": 34,
"renownlevel": 34, "renownlevel": 34,
"maxlevel": 122500, "maxlevel": 5000,
"cost": [ "cost": 90,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 220
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"35": { "35": {
"id": 35, "id": 35,
"renownlevel": 35, "renownlevel": 35,
"maxlevel": 127500, "maxlevel": 5000,
"cost": [ "cost": 93,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 260
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"36": { "36": {
"id": 36, "id": 36,
"renownlevel": 36, "renownlevel": 36,
"maxlevel": 132500, "maxlevel": 5000,
"cost": [ "cost": 97,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 300
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"37": { "37": {
"id": 37, "id": 37,
"renownlevel": 37, "renownlevel": 37,
"maxlevel": 137500, "maxlevel": 5000,
"cost": [ "cost": 101,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 350
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"38": { "38": {
"id": 38, "id": 38,
"renownlevel": 38, "renownlevel": 38,
"maxlevel": 142500, "maxlevel": 5000,
"cost": [ "cost": 105,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 400
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"39": { "39": {
"id": 39, "id": 39,
"renownlevel": 39, "renownlevel": 39,
"maxlevel": 147500, "maxlevel": 5000,
"cost": [ "cost": 109,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 450
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
}, },
"40": { "40": {
"id": 40, "id": 40,
"renownlevel": 40, "renownlevel": 40,
"maxlevel": 152500, "maxlevel": 5000,
"cost": [ "cost": 113,
{ "atk": 18,
"a": "attr", "def": 10,
"t": "weiwang", "hp": 25
"n": 500
}
],
"atk": 1.4,
"def": 1.2,
"hp": 8
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_1", "intr": "intr_xuanshangrenwu_intr_1",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"2": { "2": {
"id": 2, "id": 2,
@ -37,7 +37,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_2", "intr": "intr_xuanshangrenwu_intr_2",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"3": { "3": {
"id": 3, "id": 3,
@ -57,7 +57,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_3", "intr": "intr_xuanshangrenwu_intr_3",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"4": { "4": {
"id": 4, "id": 4,
@ -77,7 +77,7 @@
"p": 1, "p": 1,
"intr": "intr_xuanshangrenwu_intr_4", "intr": "intr_xuanshangrenwu_intr_4",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"5": { "5": {
"id": 5, "id": 5,
@ -97,7 +97,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_5", "intr": "intr_xuanshangrenwu_intr_5",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"6": { "6": {
"id": 6, "id": 6,
@ -117,7 +117,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_4", "intr": "intr_xuanshangrenwu_intr_4",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"7": { "7": {
"id": 7, "id": 7,
@ -137,7 +137,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_5", "intr": "intr_xuanshangrenwu_intr_5",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"8": { "8": {
"id": 8, "id": 8,
@ -157,7 +157,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_6", "intr": "intr_xuanshangrenwu_intr_6",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"9": { "9": {
"id": 9, "id": 9,
@ -177,7 +177,7 @@
"p": 1, "p": 1,
"intr": "intr_xuanshangrenwu_intr_7", "intr": "intr_xuanshangrenwu_intr_7",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"10": { "10": {
"id": 10, "id": 10,
@ -197,7 +197,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_8", "intr": "intr_xuanshangrenwu_intr_8",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"11": { "11": {
"id": 11, "id": 11,
@ -217,7 +217,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_6", "intr": "intr_xuanshangrenwu_intr_6",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"12": { "12": {
"id": 12, "id": 12,
@ -237,7 +237,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_7", "intr": "intr_xuanshangrenwu_intr_7",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"13": { "13": {
"id": 13, "id": 13,
@ -257,7 +257,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_8", "intr": "intr_xuanshangrenwu_intr_8",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"14": { "14": {
"id": 14, "id": 14,
@ -277,7 +277,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_9", "intr": "intr_xuanshangrenwu_intr_9",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"15": { "15": {
"id": 15, "id": 15,
@ -297,7 +297,7 @@
"p": 2, "p": 2,
"intr": "intr_xuanshangrenwu_intr_10", "intr": "intr_xuanshangrenwu_intr_10",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"16": { "16": {
"id": 16, "id": 16,
@ -317,7 +317,7 @@
"p": 4, "p": 4,
"intr": "intr_xuanshangrenwu_intr_8", "intr": "intr_xuanshangrenwu_intr_8",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"17": { "17": {
"id": 17, "id": 17,
@ -337,7 +337,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_9", "intr": "intr_xuanshangrenwu_intr_9",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"18": { "18": {
"id": 18, "id": 18,
@ -357,7 +357,7 @@
"p": 1, "p": 1,
"intr": "intr_xuanshangrenwu_intr_10", "intr": "intr_xuanshangrenwu_intr_10",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"19": { "19": {
"id": 19, "id": 19,
@ -377,7 +377,7 @@
"p": 4, "p": 4,
"intr": "intr_xuanshangrenwu_intr_11", "intr": "intr_xuanshangrenwu_intr_11",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"20": { "20": {
"id": 20, "id": 20,
@ -397,7 +397,7 @@
"p": 4, "p": 4,
"intr": "intr_xuanshangrenwu_intr_12", "intr": "intr_xuanshangrenwu_intr_12",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"21": { "21": {
"id": 21, "id": 21,
@ -417,7 +417,7 @@
"p": 3, "p": 3,
"intr": "intr_xuanshangrenwu_intr_11", "intr": "intr_xuanshangrenwu_intr_11",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"22": { "22": {
"id": 22, "id": 22,
@ -437,7 +437,7 @@
"p": 2, "p": 2,
"intr": "intr_xuanshangrenwu_intr_12", "intr": "intr_xuanshangrenwu_intr_12",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"23": { "23": {
"id": 23, "id": 23,
@ -457,7 +457,7 @@
"p": 1, "p": 1,
"intr": "intr_xuanshangrenwu_intr_13", "intr": "intr_xuanshangrenwu_intr_13",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"24": { "24": {
"id": 24, "id": 24,
@ -477,7 +477,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_14", "intr": "intr_xuanshangrenwu_intr_14",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"25": { "25": {
"id": 25, "id": 25,
@ -497,7 +497,7 @@
"p": 2, "p": 2,
"intr": "intr_xuanshangrenwu_intr_15", "intr": "intr_xuanshangrenwu_intr_15",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"26": { "26": {
"id": 26, "id": 26,
@ -517,7 +517,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_14", "intr": "intr_xuanshangrenwu_intr_14",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"27": { "27": {
"id": 27, "id": 27,
@ -537,7 +537,7 @@
"p": 5, "p": 5,
"intr": "intr_xuanshangrenwu_intr_15", "intr": "intr_xuanshangrenwu_intr_15",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"28": { "28": {
"id": 28, "id": 28,
@ -557,7 +557,7 @@
"p": 1, "p": 1,
"intr": "intr_xuanshangrenwu_intr_16", "intr": "intr_xuanshangrenwu_intr_16",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 3 "appearNum": 3
}, },
"29": { "29": {
"id": 29, "id": 29,
@ -577,7 +577,7 @@
"p": 2, "p": 2,
"intr": "intr_xuanshangrenwu_intr_17", "intr": "intr_xuanshangrenwu_intr_17",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
}, },
"30": { "30": {
"id": 30, "id": 30,
@ -597,6 +597,6 @@
"p": 4, "p": 4,
"intr": "intr_xuanshangrenwu_intr_18", "intr": "intr_xuanshangrenwu_intr_18",
"img": "icon_jinbi", "img": "icon_jinbi",
"jiequNum": 0 "appearNum": 0
} }
} }

View File

@ -136,9 +136,9 @@ type gc_clsl_dan = k_v<{
/** 机器人 */ /** 机器人 */
'npc': number, 'npc': number,
/** 随机机器人概率*/ /** 随机机器人概率*/
'pro':number 'pro': number
/** 对手范围 */ /** 对手范围 */
'fighter':number[] 'fighter': number[]
}>; }>;
type gc_com = k_v<{ type gc_com = k_v<{
@ -1958,7 +1958,7 @@ type gcType = {
kfcb_prize: gc_kfcb_prize kfcb_prize: gc_kfcb_prize
yuyuemail: gc_yuyuemail yuyuemail: gc_yuyuemail
tuisonglibao: gc_push_gift tuisonglibao: gc_push_gift
renown_level: gc_renown_level
} }
@ -1969,3 +1969,4 @@ declare global {
export function initGcType() { export function initGcType() {
} }

View File

@ -239,6 +239,9 @@ class Lng {
hero_17 = "hero_17"; hero_17 = "hero_17";
hero_18 = "hero_18"; hero_18 = "hero_18";
hero_19 = "hero_19"; hero_19 = "hero_19";
hero_20 = "hero_20";
hero_21 = "hero_21";
hero_22 = "hero_22";
item_1 = "item_1"; item_1 = "item_1";
item_2 = "item_2"; item_2 = "item_2";

View File

@ -1,25 +1,25 @@
import {ResSyncBtn} from '../shared/protocols/PtlSyncBtn'; import { ResSyncBtn } from '../shared/protocols/PtlSyncBtn';
import {payLog} from '../shared/protocols/pay/PtlGetList'; import { payLog } from '../shared/protocols/pay/PtlGetList';
import {rankType} from '../shared/protocols/rank/PtlOpen'; import { rankType } from '../shared/protocols/rank/PtlOpen';
import {CollectionChatLog} from './collection_chatlog'; import { CollectionChatLog } from './collection_chatlog';
import {CollectionActionLog} from './collection_actionLog'; import { CollectionActionLog } from './collection_actionLog';
import {CollectionCardlog} from './collection_cardlog'; import { CollectionCardlog } from './collection_cardlog';
import {CollectionCllsCrossGroup, CollectionCllsCrossUser} from './collection_clsl'; import { CollectionCllsCrossGroup, CollectionCllsCrossUser } from './collection_clsl';
import {CollectionCrosskv} from './collection_crosskv'; import { CollectionCrosskv } from './collection_crosskv';
import {CollectionDayPay} from './collection_dayPay'; import { CollectionDayPay } from './collection_dayPay';
import {CollectionDxlt} from './collection_dxlt'; import { CollectionDxlt } from './collection_dxlt';
import {CollectionEmail} from './collection_email'; import { CollectionEmail } from './collection_email';
import {CollectionEquip} from './collection_equip'; import { CollectionEquip } from './collection_equip';
import {CollectionEvent} from './collection_event'; import { CollectionEvent } from './collection_event';
import {CollectionFriend} from './collection_friend'; import { CollectionFriend } from './collection_friend';
import {CollectionGanHai} from './collection_ganhai'; import { CollectionGanHai } from './collection_ganhai';
import {CollectionGBTX} from './collection_gbtx'; import { CollectionGBTX } from './collection_gbtx';
import {CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser} from './collection_gonghui'; import { CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser } from './collection_gonghui';
import {CollectionHbzbUserCross, CollectionHbzbUserZbs} from './collection_hbzb_user_cross'; import { CollectionHbzbUserCross, CollectionHbzbUserZbs } from './collection_hbzb_user_cross';
import {CollectionHero} from './collection_hero'; import { CollectionHero } from './collection_hero';
import {CollectionItem} from './collection_item'; import { CollectionItem } from './collection_item';
import {CollectionJJC} from './collection_jjc'; import { CollectionJJC } from './collection_jjc';
import {CollectionApiWeiXiuChang} from './collection_weixiuchang'; import { CollectionApiWeiXiuChang } from './collection_weixiuchang';
import { import {
CollectionKbzzApplyUser, CollectionKbzzApplyUser,
@ -27,39 +27,39 @@ import {
CollectionKbzzGroupTroop, CollectionKbzzGroupTroop,
CollectionKbzzGroupUser CollectionKbzzGroupUser
} from './collection_kbzz'; } from './collection_kbzz';
import {CollectionKuangDong} from './collection_kuangdong'; import { CollectionKuangDong } from './collection_kuangdong';
import {CollectionLingZhuLaiXi} from './collection_lingzhulaixi'; import { CollectionLingZhuLaiXi } from './collection_lingzhulaixi';
import {CollectionMingdao} from './collection_mingdao'; import { CollectionMingdao } from './collection_mingdao';
import {CollectionPlayerInfo} from './collection_palyerInfo'; import { CollectionPlayerInfo } from './collection_palyerInfo';
import {CollectionPata} from './collection_pata'; import { CollectionPata } from './collection_pata';
import {CollectionPeiJian} from './collection_peijian'; import { CollectionPeiJian } from './collection_peijian';
import {CollectionPlayAttr} from './collection_playattr'; import { CollectionPlayAttr } from './collection_playattr';
import {CollectionRank, CollectionRankList} from './collection_rank'; import { CollectionRank, CollectionRankList } from './collection_rank';
import {CollectionRecord} from './collection_record'; import { CollectionRecord } from './collection_record';
import {CollectionSchedler} from './collection_scheduler'; import { CollectionSchedler } from './collection_scheduler';
import {CollectionShiwu} from './collection_shiwu'; import { CollectionShiwu } from './collection_shiwu';
import {CollectionSlzdGh, CollectionSlzdUser, CollectionSlzdStash} from './collection_slzd'; import { CollectionSlzdGh, CollectionSlzdUser, CollectionSlzdStash } from './collection_slzd';
import {CollectionTanXian} from './collection_tanxian'; import { CollectionTanXian } from './collection_tanxian';
import {CollectionTask} from './collection_task'; import { CollectionTask } from './collection_task';
import {CollectionUser} from './collection_user'; import { CollectionUser } from './collection_user';
import {CollectionWanted} from './collection_wanted'; import { CollectionWanted } from './collection_wanted';
import {CollectionWjjl} from './collection_wjjl'; import { CollectionWjjl } from './collection_wjjl';
import {CollectionWzryCross} from './collection_wzry_user_cross'; import { CollectionWzryCross } from './collection_wzry_user_cross';
import {CollectionWzryCrossFight} from './collection_wzryfight'; import { CollectionWzryCrossFight } from './collection_wzryfight';
import {CollectionWzryCrossFightLOG} from './collection_wzryfightlOG'; import { CollectionWzryCrossFightLOG } from './collection_wzryfightlOG';
import {CollectionWzryCrossWiner} from './collection_wzrywiner'; import { CollectionWzryCrossWiner } from './collection_wzrywiner';
import {CollectionXstask} from './collection_xstask'; import { CollectionXstask } from './collection_xstask';
import {CollectionZhanLing} from './collection_zhanling'; import { CollectionZhanLing } from './collection_zhanling';
import {CollectionHdinfo} from './collection_hdinfo'; import { CollectionHdinfo } from './collection_hdinfo';
import {CollectionGiftLog} from "./collection_giftLog"; import { CollectionGiftLog } from "./collection_giftLog";
import {CollectionLoginLog} from "./collection_loginLog"; import { CollectionLoginLog } from "./collection_loginLog";
import {CollectionPayLogNew} from "./collection_payLogNew"; import { CollectionPayLogNew } from "./collection_payLogNew";
import {CollectionApiCount} from "./collection_apiCount"; import { CollectionApiCount } from "./collection_apiCount";
import {CollectionPlayerBehavior} from "./collection_player_behavior"; import { CollectionPlayerBehavior } from "./collection_player_behavior";
import {CollectionRmbuse} from "./collection_rmbuse"; import { CollectionRmbuse } from "./collection_rmbuse";
import {CollectionFightLog} from "./collection_fightLog"; import { CollectionFightLog } from "./collection_fightLog";
import {CollectionShop} from "./collection_shop"; import { CollectionShop } from "./collection_shop";
import {CollectionPushGift} from "./collection_pushgift"; import { CollectionPushGift } from "./collection_pushgift";
import { CollectionWeiwang } from './collection_weiwang'; import { CollectionWeiwang } from './collection_weiwang';
export type MongodbCollections = { export type MongodbCollections = {
@ -134,7 +134,7 @@ export type MongodbCollections = {
rmbuse: CollectionRmbuse rmbuse: CollectionRmbuse
fightLog: CollectionFightLog fightLog: CollectionFightLog
shop: CollectionShop shop: CollectionShop
pushgift:CollectionPushGift pushgift: CollectionPushGift
huodong_user: CollectionUser; huodong_user: CollectionUser;
weiwang: CollectionWeiwang; weiwang: CollectionWeiwang;

View File

@ -2640,7 +2640,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
}, },
{ {
"id": 38, "id": 38,
"name": "weiwangbuff", "name": "heroskin",
"type": { "type": {
"type": "Interface", "type": "Interface",
"indexSignature": { "indexSignature": {

32
src/public/heroskin.ts Normal file
View File

@ -0,0 +1,32 @@
import { ApiCall } from "tsrpc";
import { call } from "../public/player";
import { PlayerFun } from "../public/player";
export default class HeroSkinFun {
/**
*
* @param uid
* @returns
*/
static getHeroSkin(call: call, oids: string | string[] = '') {
return call.conn.gud.heroskin || {};
}
/**
*
*
* addAttr msg_s2c/PlayerChange
* addEventMsg PlayerChange change的key在player中则触发重算战力操作
* heroskin数据不需要主动重算战力
* @param oid
* @param data
* @returns
* */
static async updateHeroSkinLv(call: ApiCall, change: k_v<number>) {
let skin = this.getHeroSkin(call);
skin = Object.assign(skin, change);
await PlayerFun.addAttr(call, { heroskin: skin });
}
}

View File

@ -1,25 +1,25 @@
import {ObjectId, OptionalId} from 'mongodb'; import { ObjectId, OptionalId } from 'mongodb';
import {ApiCall, BaseConnection, TsrpcError} from 'tsrpc'; import { ApiCall, BaseConnection, TsrpcError } from 'tsrpc';
import {checkPlayerGift} from '../api_s2c/event/xianshilibao/fun'; import { checkPlayerGift } from '../api_s2c/event/xianshilibao/fun';
import {md_redPoint_check} from '../api_s2c/gongyu/mingdao/ApiOpen'; import { md_redPoint_check } from '../api_s2c/gongyu/mingdao/ApiOpen';
import {CollectionPeiJian} from '../module/collection_peijian'; import { CollectionPeiJian } from '../module/collection_peijian';
import {Wjjl} from '../module/collection_wjjl'; import { Wjjl } from '../module/collection_wjjl';
import {MongodbCollections} from '../module/mongodb'; import { MongodbCollections } from '../module/mongodb';
import {G123} from '../sdk/G123'; import { G123 } from '../sdk/G123';
import {ResGetList} from '../shared/protocols/item/PtlGetList'; import { ResGetList } from '../shared/protocols/item/PtlGetList';
import {ResLogin} from '../shared/protocols/user/PtlLogin'; import { ResLogin } from '../shared/protocols/user/PtlLogin';
import {player} from '../shared/protocols/user/type'; import { player } from '../shared/protocols/user/type';
import {HeroShared, otherBuff} from '../shared/public/hero'; import { HeroShared, otherBuff } from '../shared/public/hero';
import {PublicShared} from '../shared/public/public'; import { PublicShared } from '../shared/public/public';
import {HeroFun} from './hero'; import { HeroFun } from './hero';
import {ShiwuFun} from './shiwu'; import { ShiwuFun } from './shiwu';
import {UserFun} from './user'; import { UserFun } from './user';
import {getItemByItemId, getItemNum} from './item'; import { getItemByItemId, getItemNum } from './item';
import {getGud, setGud} from './gud'; import { getGud, setGud } from './gud';
import {addGameLog} from "../gameLog"; import { addGameLog } from "../gameLog";
import {PushGiftFun} from "./pushgift"; import { PushGiftFun } from "./pushgift";
import { ActionLog } from './actionLog/actionLog'; import { ActionLog } from './actionLog/actionLog';
import HeroSkinFun from './heroskin';
export type call = { export type call = {
get otherBuff(): otherBuff; get otherBuff(): otherBuff;
@ -70,13 +70,13 @@ export class PlayerFun {
if (err) { if (err) {
// 消耗不足 触发推送礼包 // 消耗不足 触发推送礼包
PushGiftFun.chkItemGift(call.uid, atn) PushGiftFun.chkItemGift(call.uid, atn)
throw new TsrpcError('', {code: -104, atn: atn}); throw new TsrpcError('', { code: -104, atn: atn });
} else { } else {
return {isOk: false, atn: atn}; return { isOk: false, atn: atn };
} }
} }
} }
return {isOk: true, atn: null}; return { isOk: true, atn: null };
} }
/** /**
@ -94,7 +94,7 @@ export class PlayerFun {
atn: need atn: need
}; };
if (args.length < 1) { if (args.length < 1) {
throw new TsrpcError('', {code: -104, atn: meet.atn}); throw new TsrpcError('', { code: -104, atn: meet.atn });
} }
return await this.checkNeedByArgs(call, ...args); return await this.checkNeedByArgs(call, ...args);
} }
@ -117,10 +117,10 @@ export class PlayerFun {
all.push(this.addItem(call, item)); all.push(this.addItem(call, item));
} }
// 记录消耗 // 记录消耗
addGameLog(call.uid, call.service.name, call.req, {need: val}) addGameLog(call.uid, call.service.name, call.req, { need: val })
await Promise.all(all); await Promise.all(all);
G.emit('USE_ITEM', call.conn.gud, needArr.map(need => { G.emit('USE_ITEM', call.conn.gud, needArr.map(need => {
return {...need, n: Math.abs(need.n)}; return { ...need, n: Math.abs(need.n) };
})); }));
} }
@ -136,16 +136,18 @@ export class PlayerFun {
let equip = prizeList.filter(atn => atn.a == 'equip' && atn.n != 0); let equip = prizeList.filter(atn => atn.a == 'equip' && atn.n != 0);
let shiwu = prizeList.filter(atn => atn.a == 'shiwu' && atn.n != 0); let shiwu = prizeList.filter(atn => atn.a == 'shiwu' && atn.n != 0);
let peijian = prizeList.filter(atn => atn.a == 'peijian' && atn.n != 0); let peijian = prizeList.filter(atn => atn.a == 'peijian' && atn.n != 0);
let heroskin = prizeList.filter(atn => atn.a == 'heroskin' && atn.n != 0);
// 记录获得 // 记录获得
addGameLog(call.uid, call.service.name, call.req, {prize: prizeList}) addGameLog(call.uid, call.service.name, call.req, { prize: prizeList })
await Promise.all([ await Promise.all([
attr.length > 0 && this.addAttr(call, attr), attr.length > 0 && this.addAttr(call, attr),
item.length > 0 && this.addItem(call, item), item.length > 0 && this.addItem(call, item),
hero.length > 0 && this.addHero(call, hero), hero.length > 0 && this.addHero(call, hero),
equip.length > 0 && this.addEquip(call, equip), equip.length > 0 && this.addEquip(call, equip),
shiwu.length > 0 && this.addShiwu(call, shiwu), shiwu.length > 0 && this.addShiwu(call, shiwu),
peijian.length > 0 && this.addPeijian(call, peijian) peijian.length > 0 && this.addPeijian(call, peijian),
heroskin.length > 0 && this.addHeroskin(call, heroskin),
]); ]);
return prizeList; return prizeList;
@ -180,9 +182,9 @@ export class PlayerFun {
} }
} }
if( (atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0 ){ if ((atn.t == 'rmbmoney' || atn.t == 'jinbi') && atn.n > 0) {
//统计今日获取的金币和钻石 //统计今日获取的金币和钻石
ActionLog.addDayLog(call.conn.uid, { key: 'got_'+atn.t, val: atn.n }); ActionLog.addDayLog(call.conn.uid, { key: 'got_' + atn.t, val: atn.n });
} }
// 增加vip经验的任务监听 // 增加vip经验的任务监听
@ -190,7 +192,7 @@ export class PlayerFun {
G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0); G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0);
} }
all.push(this.changeAttr(call.conn.uid, change)); all.push(this.changeAttr(call.conn.uid, change));
all.push(this.upAttr(call, {...atn, n: change[atn.t]})); all.push(this.upAttr(call, { ...atn, n: change[atn.t] }));
//await this.changeAttr(call.conn.uid, change); //await this.changeAttr(call.conn.uid, change);
//await this.upAttr(call, {...atn, n: change[atn.t]}); //await this.upAttr(call, {...atn, n: change[atn.t]});
} }
@ -233,17 +235,17 @@ export class PlayerFun {
G.mongodb.collection('rmbuse').insertOne(data); G.mongodb.collection('rmbuse').insertOne(data);
// 消费竞赛开启时写入跨服数据库 // 消费竞赛开启时写入跨服数据库
if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') { if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, { G.crossmongodb.collection('rmbuse').updateOne({ uid: data.uid, type: `xfjs_${G.huodong.xfjsId}` }, {
$set: {time: G.time}, $set: { time: G.time },
$inc: {change: data.change} $inc: { change: data.change }
}, {upsert: true}); }, { upsert: true });
} }
} }
static async changeAttr(uid: string, change: Partial<player>) { static async changeAttr(uid: string, change: Partial<player>) {
setGud(uid, change); setGud(uid, change);
G.mongodb.collection('user').updateOne({uid: uid}, {$set: change}); G.mongodb.collection('user').updateOne({ uid: uid }, { $set: change });
if (G.server.uid_connections[uid]) { if (G.server.uid_connections[uid]) {
checkPlayerGift(G.server.uid_connections[uid].gud, change); checkPlayerGift(G.server.uid_connections[uid].gud, change);
@ -265,9 +267,9 @@ export class PlayerFun {
const curLv = call.conn.gud.lv; const curLv = call.conn.gud.lv;
while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) { while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) {
addLv++; addLv++;
G123.sendUserLevelUp({...call.conn.gud, lv: curLv + addLv, nexp: atn.n}); G123.sendUserLevelUp({ ...call.conn.gud, lv: curLv + addLv, nexp: atn.n });
} }
addLv && await this.addAttr(call, {lv: curLv + addLv}); addLv && await this.addAttr(call, { lv: curLv + addLv });
break; break;
case 'payExp': case 'payExp':
let addVip = 0; let addVip = 0;
@ -276,7 +278,7 @@ export class PlayerFun {
while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) { while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) {
addVip++; addVip++;
} }
addVip && await this.addAttr(call, {vip: curVip + addVip}); addVip && await this.addAttr(call, { vip: curVip + addVip });
break; break;
} }
} }
@ -287,7 +289,7 @@ export class PlayerFun {
static async addItem(call: call, val: atn[]) { static async addItem(call: call, val: atn[]) {
for (let atn of val) { for (let atn of val) {
let upObj = { let upObj = {
filter: {uid: call.uid, itemId: atn.t}, filter: { uid: call.uid, itemId: atn.t },
update: { update: {
$setOnInsert: { $setOnInsert: {
firstTime: G.time, firstTime: G.time,
@ -319,7 +321,7 @@ export class PlayerFun {
}; };
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options); G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options);
call.addEventMsg('msg_s2c/ItemChange', atn.t, data); call.addEventMsg('msg_s2c/ItemChange', atn.t, data);
addGameLog(call.uid, "_itemChange", {"additem": 1}, { addGameLog(call.uid, "_itemChange", { "additem": 1 }, {
"filter": upObj.filter, "filter": upObj.filter,
"update": upObj.update, "update": upObj.update,
"options": upObj.options "options": upObj.options
@ -327,10 +329,10 @@ export class PlayerFun {
} else { } else {
if (item.num + atn.n <= 0) { if (item.num + atn.n <= 0) {
await Promise.all([ await Promise.all([
G.mongodb.collection('item').deleteOne({uid: call.uid, itemId: atn.t}) G.mongodb.collection('item').deleteOne({ uid: call.uid, itemId: atn.t })
]); ]);
call.addEventMsg('msg_s2c/ItemChange', atn.t, {num: 0}); call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: 0 });
addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t}) addGameLog(call.uid, "_itemChange", { "delitem": 1 }, { "itemId": atn.t })
} else { } else {
await Promise.all([ await Promise.all([
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options) G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options)
@ -339,7 +341,7 @@ export class PlayerFun {
num: item.num + atn.n, num: item.num + atn.n,
lastTime: upObj.update.$set.lastTime lastTime: upObj.update.$set.lastTime
}); });
addGameLog(call.uid, "_itemChange", {"attritem": 1}, { addGameLog(call.uid, "_itemChange", { "attritem": 1 }, {
"filter": upObj.filter, "filter": upObj.filter,
"update": upObj.update, "update": upObj.update,
"options": upObj.options, "options": upObj.options,
@ -374,7 +376,7 @@ export class PlayerFun {
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let {_id, ...ops} = v; let { _id, ...ops } = v;
Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false); Wjjl.setVal(call.uid, `has_equip_color_${G.gc.equip[ops.equipId].colour}`, 1, false);
@ -408,10 +410,10 @@ export class PlayerFun {
*/ */
static async cutEquip(call: call, _idArr: string[]) { static async cutEquip(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.mongodb.collection('equip').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); G.mongodb.collection('equip').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
call.addEventMsg('msg_s2c/EquipChange', _id, {num: 0}); call.addEventMsg('msg_s2c/EquipChange', _id, { num: 0 });
addGameLog(call.uid, "_cutEquip", {}, {_id: _id}) addGameLog(call.uid, "_cutEquip", {}, { _id: _id })
} }
} }
@ -445,7 +447,7 @@ export class PlayerFun {
let v = insertData[key] let v = insertData[key]
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let {_id, ...ops} = v; let { _id, ...ops } = v;
call.addEventMsg('msg_s2c/HeroChange', id, { call.addEventMsg('msg_s2c/HeroChange', id, {
_id: id, _id: id,
@ -478,9 +480,9 @@ export class PlayerFun {
static async cutHero(call: call, _idArr: string[]) { static async cutHero(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
await HeroFun.delHero(call, _id); await HeroFun.delHero(call, _id);
G.mongodb.collection('hero').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); G.mongodb.collection('hero').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
call.addEventMsg('msg_s2c/HeroChange', _id, {num: 0}); call.addEventMsg('msg_s2c/HeroChange', _id, { num: 0 });
addGameLog(call.uid, "_cutHero", {}, {_id: _id}) addGameLog(call.uid, "_cutHero", {}, { _id: _id })
} }
} }
@ -495,7 +497,7 @@ export class PlayerFun {
colour: v.colour, colour: v.colour,
wearId: '', wearId: '',
shiwuId: v.t, shiwuId: v.t,
jichu: ShiwuFun.randomJichu({colour: v.colour, shiwuId: v.t}), jichu: ShiwuFun.randomJichu({ colour: v.colour, shiwuId: v.t }),
fujia: [] fujia: []
}; };
if (v.shiwuBuff) { if (v.shiwuBuff) {
@ -515,7 +517,7 @@ export class PlayerFun {
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let id = result.insertedIds[key].toHexString(); let id = result.insertedIds[key].toHexString();
let {_id, ...ops} = v; let { _id, ...ops } = v;
call.addEventMsg('msg_s2c/ShiwuChange', id, { call.addEventMsg('msg_s2c/ShiwuChange', id, {
_id: id, _id: id,
...ops ...ops
@ -534,9 +536,9 @@ export class PlayerFun {
*/ */
static async cutShiwu(call: call, _idArr: string[]) { static async cutShiwu(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); G.mongodb.collection('shiwu').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0}); call.addEventMsg('msg_s2c/ShiwuChange', _id, { num: 0 });
addGameLog(call.uid, "_cutShiwu", {}, {_id: _id}) addGameLog(call.uid, "_cutShiwu", {}, { _id: _id })
} }
} }
@ -561,7 +563,7 @@ export class PlayerFun {
addGameLog(call.uid, "_addPeiJian", {}, insertData) addGameLog(call.uid, "_addPeiJian", {}, insertData)
insertData.forEach((v, key) => { insertData.forEach((v, key) => {
let {_id, uid, ...ops} = v; let { _id, uid, ...ops } = v;
let id = _id.toHexString(); let id = _id.toHexString();
if (G.gc.peijian[v.peijianId].colour != 5) { if (G.gc.peijian[v.peijianId].colour != 5) {
@ -569,8 +571,8 @@ export class PlayerFun {
lshd[v.peijianId]++; lshd[v.peijianId]++;
} }
G.redis.set('peijian', call.uid, id, {_id: id, ...ops}); G.redis.set('peijian', call.uid, id, { _id: id, ...ops });
call.addEventMsg('msg_s2c/PeijianChange', id, {_id: id, ...ops}); call.addEventMsg('msg_s2c/PeijianChange', id, { _id: id, ...ops });
}); });
G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne( G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne(
@ -591,15 +593,40 @@ export class PlayerFun {
return Object.values(result.insertedIds).map(v => G.mongodb.conversionId(v)); return Object.values(result.insertedIds).map(v => G.mongodb.conversionId(v));
} }
/**
*
* */
static async addHeroskin(call: call, val: atn[]) {
let prize = [];
let upskin = {};
let heroskin = HeroSkinFun.getHeroSkin(call);
for (let p of val) {
if (!heroskin[p.t]) {
upskin[p.t] = 1;
} else {
prize = prize.concat(G.gc.heroSkin[p.t].zhuanhuan);
}
}
if (Object.keys(upskin).length > 0) {
await this.addAttr(call, { heroskin: Object.assign(heroskin, upskin) });
}
// 皮肤存在转换为其他奖励
if (prize.length > 0) {
await this.sendPrize(call, prize);
}
}
/** /**
* *
*/ */
static async cutPeijian(call: call, _idArr: string[]) { static async cutPeijian(call: call, _idArr: string[]) {
for (let _id of _idArr) { for (let _id of _idArr) {
G.redis.del('peijian', call.uid, _id); G.redis.del('peijian', call.uid, _id);
G.mongodb.collection('peijian').deleteOne({uid: call.uid, _id: new ObjectId(_id)}); G.mongodb.collection('peijian').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
call.addEventMsg('msg_s2c/PeijianChange', _id, {num: 0}); call.addEventMsg('msg_s2c/PeijianChange', _id, { num: 0 });
addGameLog(call.uid, "_cutPeijian", {}, {_id: _id}) addGameLog(call.uid, "_cutPeijian", {}, { _id: _id })
} }
} }
@ -608,7 +635,7 @@ export class PlayerFun {
*/ */
static async getAttr(uid: string, where: { ctype: string; }) { static async getAttr(uid: string, where: { ctype: string; }) {
let _w = where; let _w = where;
Object.assign(_w, {uid: uid}); Object.assign(_w, { uid: uid });
const _res = await G.mongodb.collection('playattr').find(_w).toArray(); const _res = await G.mongodb.collection('playattr').find(_w).toArray();
_res.forEach(v => { _res.forEach(v => {
if (v._id) { if (v._id) {
@ -623,7 +650,7 @@ export class PlayerFun {
*/ */
static async getAttrOne(uid: string, where: { ctype: string; }) { static async getAttrOne(uid: string, where: { ctype: string; }) {
let _w = where; let _w = where;
Object.assign(_w, {uid: uid}); Object.assign(_w, { uid: uid });
const _res = await G.mongodb.collection('playattr').findOne(_w); const _res = await G.mongodb.collection('playattr').findOne(_w);
if (_res) { if (_res) {
delete _res['_id']; delete _res['_id'];
@ -639,10 +666,10 @@ export class PlayerFun {
time = G.time; time = G.time;
} }
let _zeroTime = PublicShared.getToDayZeroTime(time); let _zeroTime = PublicShared.getToDayZeroTime(time);
let _tmp = {lasttime: {$gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1}}; let _tmp = { lasttime: { $gte: _zeroTime, $lte: _zeroTime + 24 * 60 * 60 - 1 } };
let _w = where; let _w = where;
Object.assign(_w, {uid: uid, ..._tmp}); Object.assign(_w, { uid: uid, ..._tmp });
const _res = await G.mongodb.collection('playattr').find(_w).toArray(); const _res = await G.mongodb.collection('playattr').find(_w).toArray();
_res.forEach(v => { _res.forEach(v => {
if (v._id) { if (v._id) {
@ -657,7 +684,7 @@ export class PlayerFun {
*/ */
static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) { static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) {
let _w = where; let _w = where;
Object.assign(_w, {uid: uid}); Object.assign(_w, { uid: uid });
if (islasttime == 1) { if (islasttime == 1) {
data["lasttime"] = G.time; data["lasttime"] = G.time;
@ -668,7 +695,7 @@ export class PlayerFun {
// 加入创建数据时间 // 加入创建数据时间
data["ctime"] = G.time; data["ctime"] = G.time;
} }
let _res = await G.mongodb.collection('playattr').updateMany(_w, {$set: data}, {upsert: true}); let _res = await G.mongodb.collection('playattr').updateMany(_w, { $set: data }, { upsert: true });
return _res; return _res;
} }
} }

View File

@ -71,4 +71,6 @@ type heroAddKey = {
peijian: { peijian: {
[pos: string]: string; [pos: string]: string;
}; };
/**皮肤*/
skin: string | number;
}; };

View File

@ -0,0 +1,7 @@
export interface ReqTakeOff {
heroOid: string
}
export interface ResTakeOff {
}

View File

@ -0,0 +1,6 @@
export interface ReqUplv {
lv: 1;
skid: string;
}
export interface ResUplv { }

View File

@ -0,0 +1,6 @@
export interface ReqWear {
skid: string,
heroOid: string,
}
export interface ResWear { }

File diff suppressed because it is too large Load Diff

View File

@ -195,4 +195,9 @@ export type playerAppend = {
}; };
/**威望额外属性*/ /**威望额外属性*/
weiwangbuff?: { [k: string]: number }; weiwangbuff?: { [k: string]: number };
/**获得的皮肤*/
heroskin?: {
[skid: string]: number;
}
}; };

View File

@ -1,11 +1,13 @@
import { ResGetList } from '../protocols/hero/PtlGetList'; import { ResGetList } from '../protocols/hero/PtlGetList';
import { player } from '../protocols/user/type'; import { player } from '../protocols/user/type';
import { EquipShared } from './equip'; import { EquipShared } from './equip';
import HeroSkinShared from './heroskin';
import { PeijianShared } from './peijian'; import { PeijianShared } from './peijian';
import { PlayerShared } from './player'; import { PlayerShared } from './player';
import { PublicShared } from './public'; import { PublicShared } from './public';
import { ShiwuShared } from './shiwu'; import { ShiwuShared } from './shiwu';
export type otherBuff = Partial<player & { export type otherBuff = Partial<player & {
allBuff: k_v<number>; allBuff: k_v<number>;
}>; }>;
@ -31,7 +33,7 @@ export class HeroShared {
*/ */
static getHeroBasicAttr(hero: heroDataType, otherBuff: otherBuff = G.otherBuff, pos = 0) { static getHeroBasicAttr(hero: heroDataType, otherBuff: otherBuff = G.otherBuff, pos = 0) {
let jiban = 0; let jiban = 0;
let buff: k_v<any> = { skillArr: [] }; let buff: k_v<any> = {skillArr: []};
let heroConf = G.gc.hero[hero.heroId]; let heroConf = G.gc.hero[hero.heroId];
let heroLv = G.gc.herolv[heroConf.lvup]; let heroLv = G.gc.herolv[heroConf.lvup];
let heroGrow = G.gc.herogrow[heroConf.jjup]?.[hero.jieji]; let heroGrow = G.gc.herogrow[heroConf.jjup]?.[hero.jieji];
@ -40,7 +42,7 @@ export class HeroShared {
for (let k in heroLv.buff) { for (let k in heroLv.buff) {
let val = heroLv.buff[k]; let val = heroLv.buff[k];
if (typeof val == 'number') buff[k] = val; if (typeof val == 'number') buff[k] = val;
else buff[k] = PublicShared.eval(val, { lv: hero.lv }); else buff[k] = PublicShared.eval(val, {lv: hero.lv});
// else buff[k] = Math.floor(new Function(`let lv=${hero.lv}; return ${val}`)()); // else buff[k] = Math.floor(new Function(`let lv=${hero.lv}; return ${val}`)());
} }
@ -135,7 +137,7 @@ export class HeroShared {
PublicShared.mergeProperty(buff, PeijianShared.getAttr(p)); PublicShared.mergeProperty(buff, PeijianShared.getAttr(p));
let conf = G.gc.peijian[p.peijianId]; let conf = G.gc.peijian[p.peijianId];
if (conf.suit) { if (conf.suit) {
if (!suitObj[conf.suit]) suitObj[conf.suit] = { num: 0, minLv: 0 }; if (!suitObj[conf.suit]) suitObj[conf.suit] = {num: 0, minLv: 0};
suitObj[conf.suit].num++; suitObj[conf.suit].num++;
if (!suitObj[conf.suit].minLv || p.lv < suitObj[conf.suit].minLv) suitObj[conf.suit].minLv = p.lv; if (!suitObj[conf.suit].minLv || p.lv < suitObj[conf.suit].minLv) suitObj[conf.suit].minLv = p.lv;
} }
@ -273,14 +275,20 @@ export class HeroShared {
if (otherBuff?.skills) { if (otherBuff?.skills) {
for (let [id, lv] of Object.entries(otherBuff.skills)) { for (let [id, lv] of Object.entries(otherBuff.skills)) {
if (lv && G.gc.xunlianjihua[id].use == 0) { if (lv && G.gc.xunlianjihua[id].use == 0) {
PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], { slv: lv })]))); PublicShared.mergeProperty(buff, Object.fromEntries([G.gc.xunlianjihua[id].skill].map(k => [k, PublicShared.eval(G.gc.xunlianjihua[id].v[0], {slv: lv})])));
} }
} }
} }
// 威望加成计算 // 计算皮肤buff
if (otherBuff?.weiwangbuff) { if (otherBuff?.heroskin) {
PublicShared.mergeProperty(buff, otherBuff?.weiwangbuff || {}); for (let skinId in otherBuff.heroskin) {
let skinConf = G.gc.heroSkin[skinId];
if (skinConf.heroId != hero.heroId) console;
PublicShared.mergeProperty(buff, HeroSkinShared.calcBuff(
skinId, otherBuff.heroskin[skinId]
));
}
} }
//最后进行加成属性计算 //最后进行加成属性计算

View File

@ -0,0 +1,21 @@
export default class HeroSkinShared {
/**
* buff
* @param skid
* @param lv
* @returns {[string]: number}
* */
static calcBuff(skid: string, lv: number): k_v<number> {
let buff = {};
let skin = G.gc.heroSkin[skid];
for (let i = 1; i <= lv; i++) {
for (let k in (G.gc.heroSkinLv[skin.colour][i]?.buff || {})) {
buff[k] = (buff[k] || 0) + G.gc.heroSkinLv[skin.colour][i].buff[k];
}
}
return buff;
}
}

View File

@ -24,7 +24,7 @@ export class UserShared {
* *
* @param id 使 UserShared.getInfo id * @param id 使 UserShared.getInfo id
*/ */
static chechIsActive(fmtId: string, collection: Partial<{ lv: number, vip: number, lsyx: k_v<number>, model: k_v<any>, active: k_v<number>; }>) { static chechIsActive(fmtId: string, collection: Partial<{ lv: number, vip: number, lsyx: k_v<number>, model: k_v<any>, active: k_v<number>, heroskin: k_v<any>; }>) {
const [type, id] = fmtId.split('_'); const [type, id] = fmtId.split('_');
const jsonName = 'player' + type.slice(0, 1).toLocaleUpperCase() + type.slice(1); const jsonName = 'player' + type.slice(0, 1).toLocaleUpperCase() + type.slice(1);
@ -37,6 +37,7 @@ export class UserShared {
// else if (conf.cond[0] == 'time') return collection.active[fmtId] == -1 || collection.active[fmtId] > G.time; // else if (conf.cond[0] == 'time') return collection.active[fmtId] == -1 || collection.active[fmtId] > G.time;
else if (conf.cond[0] == 'time') return conf.cond[1] == -1 || collection.active?.[fmtId] > G.time; else if (conf.cond[0] == 'time') return conf.cond[1] == -1 || collection.active?.[fmtId] > G.time;
else if (conf.cond[0] == 'model') return Object.values(collection.model).find(i => i.id == conf.cond[1]); else if (conf.cond[0] == 'model') return Object.values(collection.model).find(i => i.id == conf.cond[1]);
else if (conf.cond[0] == 'heroskin') return conf.cond[1] in collection.heroskin;
else return false; else return false;
} }
} }