Merge branch 'feat/skin' into dev
This commit is contained in:
commit
72377fa50d
20
src/api_s2c/heroskin/ApiTakeOff.ts
Normal file
20
src/api_s2c/heroskin/ApiTakeOff.ts
Normal 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;
|
||||
}
|
||||
|
||||
HeroFun.changeHeroAttr(call, hero, { skin: "" });
|
||||
|
||||
call.succ({});
|
||||
}
|
36
src/api_s2c/heroskin/ApiUplv.ts
Normal file
36
src/api_s2c/heroskin/ApiUplv.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import HeroSkinFun from "../../public/heroskin";
|
||||
import { PlayerFun } from "../../public/player";
|
||||
import { ReqUplv, ResUplv } from "../../shared/protocols/heroskin/PtlUplv";
|
||||
|
||||
|
||||
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[skin.skid];
|
||||
|
||||
let need = [];
|
||||
for (let i = 0; i < call.req.lv; i++) {
|
||||
need.concat(
|
||||
G.gc.heroSkinLv[skinconf.colour][cur_lv + i].need
|
||||
)
|
||||
}
|
||||
|
||||
// 检测消耗
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
|
||||
// 扣除消耗
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
|
||||
// 更新等级
|
||||
skin[call.req.skid] = cur_lv + call.req.lv;
|
||||
|
||||
// 更新skinlv
|
||||
HeroSkinFun.updateHeroSkinLv(call, { [call.req.skid]: cur_lv + call.req.lv });
|
||||
|
||||
call.succ({});
|
||||
}
|
28
src/api_s2c/heroskin/ApiWear.ts
Normal file
28
src/api_s2c/heroskin/ApiWear.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { HeroFun } from "../../public/hero";
|
||||
import HeroSkinFun from "../../public/heroskin";
|
||||
import { ReqWear, ResWear } from "../../shared/protocols/heroskin/PtlWear";
|
||||
|
||||
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[skin.skid];
|
||||
if (skinconf.heroid != hero.heroId) { // 皮肤不属于该英雄
|
||||
call.error(lng.hero_21);
|
||||
return;
|
||||
}
|
||||
|
||||
HeroFun.changeHeroAttr(call, hero, { skin: call.req.skid });
|
||||
|
||||
call.succ({});
|
||||
}
|
@ -1330,6 +1330,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"name": "heroskin",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
"indexSignature": {
|
||||
"keyType": "String",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -1721,6 +1735,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"name": "skin",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -1953,7 +1953,8 @@
|
||||
"path": "Canvas/draw/uiRoot/uiView_weiwang/weiwang/xia/shengji/btn_sj",
|
||||
"undefined": "点升级按钮",
|
||||
"initiative": 1,
|
||||
"location": 1
|
||||
"location": 1,
|
||||
"filter": "loop_openConfGuideEnd"
|
||||
},
|
||||
"20001": {
|
||||
"id": 20001,
|
||||
|
@ -7,7 +7,14 @@
|
||||
"model": 50011,
|
||||
"card": 50011,
|
||||
"head": 50011,
|
||||
"colour": 5
|
||||
"colour": 5,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
@ -16,7 +23,14 @@
|
||||
"model": 50021,
|
||||
"card": 50021,
|
||||
"head": 50021,
|
||||
"colour": 5
|
||||
"colour": 5,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"3": {
|
||||
"id": 3,
|
||||
@ -25,7 +39,14 @@
|
||||
"model": 50031,
|
||||
"card": 50031,
|
||||
"head": 50031,
|
||||
"colour": 5
|
||||
"colour": 5,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"id": 4,
|
||||
@ -34,7 +55,14 @@
|
||||
"model": 50041,
|
||||
"card": 50041,
|
||||
"head": 50041,
|
||||
"colour": 5
|
||||
"colour": 5,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"5": {
|
||||
"id": 5,
|
||||
@ -43,7 +71,14 @@
|
||||
"model": 50051,
|
||||
"card": 50051,
|
||||
"head": 50051,
|
||||
"colour": 5
|
||||
"colour": 5,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"6": {
|
||||
"id": 6,
|
||||
@ -52,7 +87,14 @@
|
||||
"model": 40021,
|
||||
"card": 40021,
|
||||
"head": 40021,
|
||||
"colour": 4
|
||||
"colour": 4,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"7": {
|
||||
"id": 7,
|
||||
@ -61,7 +103,14 @@
|
||||
"model": 40061,
|
||||
"card": 40061,
|
||||
"head": 40061,
|
||||
"colour": 4
|
||||
"colour": 4,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
},
|
||||
"8": {
|
||||
"id": 8,
|
||||
@ -70,6 +119,13 @@
|
||||
"model": 40071,
|
||||
"card": 40071,
|
||||
"head": 40071,
|
||||
"colour": 4
|
||||
"colour": 4,
|
||||
"zhuanhuan": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -383,18 +383,7 @@
|
||||
"20": {
|
||||
"colour": 4,
|
||||
"lv": 20,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "jinbi",
|
||||
"n": 8019
|
||||
}
|
||||
],
|
||||
"need": [],
|
||||
"buff": {
|
||||
"atk": 30,
|
||||
"baoshangpro": 0.027
|
||||
@ -785,18 +774,7 @@
|
||||
"20": {
|
||||
"colour": 5,
|
||||
"lv": 20,
|
||||
"need": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "rmbmoney",
|
||||
"n": 10
|
||||
},
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "jinbi",
|
||||
"n": 8019
|
||||
}
|
||||
],
|
||||
"need": [],
|
||||
"buff": {
|
||||
"def": 30,
|
||||
"maxdps": 39
|
||||
|
@ -4307,10 +4307,7 @@
|
||||
//活动文本描述
|
||||
intr: "czlbtips_1",
|
||||
intr: "czlbtips_2",
|
||||
//邮件标题
|
||||
mailTitle: "intr_czhl_mailTitle",
|
||||
//邮件内容
|
||||
mailDes: "intr_czhl_mailDes",
|
||||
//礼包
|
||||
//礼包
|
||||
gift: [
|
||||
{
|
||||
|
@ -122,7 +122,7 @@
|
||||
"9": {
|
||||
"id": 9,
|
||||
"renownlevel": 9,
|
||||
"maxlevel": 11500,
|
||||
"maxlevel": 11250,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -137,7 +137,7 @@
|
||||
"10": {
|
||||
"id": 10,
|
||||
"renownlevel": 10,
|
||||
"maxlevel": 14500,
|
||||
"maxlevel": 13750,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -152,7 +152,7 @@
|
||||
"11": {
|
||||
"id": 11,
|
||||
"renownlevel": 11,
|
||||
"maxlevel": 18000,
|
||||
"maxlevel": 16500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -167,7 +167,7 @@
|
||||
"12": {
|
||||
"id": 12,
|
||||
"renownlevel": 12,
|
||||
"maxlevel": 22000,
|
||||
"maxlevel": 19500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -182,7 +182,7 @@
|
||||
"13": {
|
||||
"id": 13,
|
||||
"renownlevel": 13,
|
||||
"maxlevel": 26500,
|
||||
"maxlevel": 22750,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -197,7 +197,7 @@
|
||||
"14": {
|
||||
"id": 14,
|
||||
"renownlevel": 14,
|
||||
"maxlevel": 31500,
|
||||
"maxlevel": 26250,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -212,7 +212,7 @@
|
||||
"15": {
|
||||
"id": 15,
|
||||
"renownlevel": 15,
|
||||
"maxlevel": 36500,
|
||||
"maxlevel": 30000,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -227,7 +227,7 @@
|
||||
"16": {
|
||||
"id": 16,
|
||||
"renownlevel": 16,
|
||||
"maxlevel": 41500,
|
||||
"maxlevel": 34000,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -242,7 +242,7 @@
|
||||
"17": {
|
||||
"id": 17,
|
||||
"renownlevel": 17,
|
||||
"maxlevel": 46500,
|
||||
"maxlevel": 38250,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -257,7 +257,7 @@
|
||||
"18": {
|
||||
"id": 18,
|
||||
"renownlevel": 18,
|
||||
"maxlevel": 51500,
|
||||
"maxlevel": 42750,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -272,7 +272,7 @@
|
||||
"19": {
|
||||
"id": 19,
|
||||
"renownlevel": 19,
|
||||
"maxlevel": 56500,
|
||||
"maxlevel": 47500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -287,7 +287,7 @@
|
||||
"20": {
|
||||
"id": 20,
|
||||
"renownlevel": 20,
|
||||
"maxlevel": 61500,
|
||||
"maxlevel": 52500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -302,7 +302,7 @@
|
||||
"21": {
|
||||
"id": 21,
|
||||
"renownlevel": 21,
|
||||
"maxlevel": 66500,
|
||||
"maxlevel": 57500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -317,7 +317,7 @@
|
||||
"22": {
|
||||
"id": 22,
|
||||
"renownlevel": 22,
|
||||
"maxlevel": 71500,
|
||||
"maxlevel": 62500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -332,7 +332,7 @@
|
||||
"23": {
|
||||
"id": 23,
|
||||
"renownlevel": 23,
|
||||
"maxlevel": 76500,
|
||||
"maxlevel": 67500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -347,7 +347,7 @@
|
||||
"24": {
|
||||
"id": 24,
|
||||
"renownlevel": 24,
|
||||
"maxlevel": 81500,
|
||||
"maxlevel": 72500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -362,7 +362,7 @@
|
||||
"25": {
|
||||
"id": 25,
|
||||
"renownlevel": 25,
|
||||
"maxlevel": 86500,
|
||||
"maxlevel": 77500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -377,7 +377,7 @@
|
||||
"26": {
|
||||
"id": 26,
|
||||
"renownlevel": 26,
|
||||
"maxlevel": 91500,
|
||||
"maxlevel": 82500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -392,7 +392,7 @@
|
||||
"27": {
|
||||
"id": 27,
|
||||
"renownlevel": 27,
|
||||
"maxlevel": 96500,
|
||||
"maxlevel": 87500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -407,7 +407,7 @@
|
||||
"28": {
|
||||
"id": 28,
|
||||
"renownlevel": 28,
|
||||
"maxlevel": 101500,
|
||||
"maxlevel": 92500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -422,7 +422,7 @@
|
||||
"29": {
|
||||
"id": 29,
|
||||
"renownlevel": 29,
|
||||
"maxlevel": 106500,
|
||||
"maxlevel": 97500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -437,7 +437,7 @@
|
||||
"30": {
|
||||
"id": 30,
|
||||
"renownlevel": 30,
|
||||
"maxlevel": 111500,
|
||||
"maxlevel": 102500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -452,7 +452,7 @@
|
||||
"31": {
|
||||
"id": 31,
|
||||
"renownlevel": 31,
|
||||
"maxlevel": 116500,
|
||||
"maxlevel": 107500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -467,7 +467,7 @@
|
||||
"32": {
|
||||
"id": 32,
|
||||
"renownlevel": 32,
|
||||
"maxlevel": 121500,
|
||||
"maxlevel": 112500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -482,7 +482,7 @@
|
||||
"33": {
|
||||
"id": 33,
|
||||
"renownlevel": 33,
|
||||
"maxlevel": 126500,
|
||||
"maxlevel": 117500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -497,7 +497,7 @@
|
||||
"34": {
|
||||
"id": 34,
|
||||
"renownlevel": 34,
|
||||
"maxlevel": 131500,
|
||||
"maxlevel": 122500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -512,7 +512,7 @@
|
||||
"35": {
|
||||
"id": 35,
|
||||
"renownlevel": 35,
|
||||
"maxlevel": 136500,
|
||||
"maxlevel": 127500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -527,7 +527,7 @@
|
||||
"36": {
|
||||
"id": 36,
|
||||
"renownlevel": 36,
|
||||
"maxlevel": 141500,
|
||||
"maxlevel": 132500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -542,7 +542,7 @@
|
||||
"37": {
|
||||
"id": 37,
|
||||
"renownlevel": 37,
|
||||
"maxlevel": 146500,
|
||||
"maxlevel": 137500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -557,7 +557,7 @@
|
||||
"38": {
|
||||
"id": 38,
|
||||
"renownlevel": 38,
|
||||
"maxlevel": 151500,
|
||||
"maxlevel": 142500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -572,7 +572,7 @@
|
||||
"39": {
|
||||
"id": 39,
|
||||
"renownlevel": 39,
|
||||
"maxlevel": 156500,
|
||||
"maxlevel": 147500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
@ -587,7 +587,7 @@
|
||||
"40": {
|
||||
"id": 40,
|
||||
"renownlevel": 40,
|
||||
"maxlevel": 161500,
|
||||
"maxlevel": 152500,
|
||||
"cost": [
|
||||
{
|
||||
"a": "attr",
|
||||
|
@ -17,7 +17,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_1",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
@ -37,7 +37,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_2",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"3": {
|
||||
"id": 3,
|
||||
@ -57,7 +57,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_3",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"4": {
|
||||
"id": 4,
|
||||
@ -77,7 +77,7 @@
|
||||
"p": 1,
|
||||
"intr": "intr_xuanshangrenwu_intr_4",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"5": {
|
||||
"id": 5,
|
||||
@ -97,7 +97,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_5",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"6": {
|
||||
"id": 6,
|
||||
@ -117,7 +117,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_4",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"7": {
|
||||
"id": 7,
|
||||
@ -137,7 +137,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_5",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"8": {
|
||||
"id": 8,
|
||||
@ -157,7 +157,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_6",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"9": {
|
||||
"id": 9,
|
||||
@ -177,7 +177,7 @@
|
||||
"p": 1,
|
||||
"intr": "intr_xuanshangrenwu_intr_7",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"10": {
|
||||
"id": 10,
|
||||
@ -197,7 +197,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_8",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"11": {
|
||||
"id": 11,
|
||||
@ -217,7 +217,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_6",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"12": {
|
||||
"id": 12,
|
||||
@ -237,7 +237,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_7",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"13": {
|
||||
"id": 13,
|
||||
@ -257,7 +257,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_8",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"14": {
|
||||
"id": 14,
|
||||
@ -277,7 +277,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_9",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"15": {
|
||||
"id": 15,
|
||||
@ -297,7 +297,7 @@
|
||||
"p": 2,
|
||||
"intr": "intr_xuanshangrenwu_intr_10",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"16": {
|
||||
"id": 16,
|
||||
@ -317,7 +317,7 @@
|
||||
"p": 4,
|
||||
"intr": "intr_xuanshangrenwu_intr_8",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"17": {
|
||||
"id": 17,
|
||||
@ -337,7 +337,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_9",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"18": {
|
||||
"id": 18,
|
||||
@ -357,7 +357,7 @@
|
||||
"p": 1,
|
||||
"intr": "intr_xuanshangrenwu_intr_10",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"19": {
|
||||
"id": 19,
|
||||
@ -377,7 +377,7 @@
|
||||
"p": 4,
|
||||
"intr": "intr_xuanshangrenwu_intr_11",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"20": {
|
||||
"id": 20,
|
||||
@ -397,7 +397,7 @@
|
||||
"p": 4,
|
||||
"intr": "intr_xuanshangrenwu_intr_12",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"21": {
|
||||
"id": 21,
|
||||
@ -417,7 +417,7 @@
|
||||
"p": 3,
|
||||
"intr": "intr_xuanshangrenwu_intr_11",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"22": {
|
||||
"id": 22,
|
||||
@ -437,7 +437,7 @@
|
||||
"p": 2,
|
||||
"intr": "intr_xuanshangrenwu_intr_12",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"23": {
|
||||
"id": 23,
|
||||
@ -457,7 +457,7 @@
|
||||
"p": 1,
|
||||
"intr": "intr_xuanshangrenwu_intr_13",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"24": {
|
||||
"id": 24,
|
||||
@ -477,7 +477,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_14",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"25": {
|
||||
"id": 25,
|
||||
@ -497,7 +497,7 @@
|
||||
"p": 2,
|
||||
"intr": "intr_xuanshangrenwu_intr_15",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"26": {
|
||||
"id": 26,
|
||||
@ -517,7 +517,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_14",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"27": {
|
||||
"id": 27,
|
||||
@ -537,7 +537,7 @@
|
||||
"p": 5,
|
||||
"intr": "intr_xuanshangrenwu_intr_15",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"28": {
|
||||
"id": 28,
|
||||
@ -557,7 +557,7 @@
|
||||
"p": 1,
|
||||
"intr": "intr_xuanshangrenwu_intr_16",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 3
|
||||
"jiequNum": 3
|
||||
},
|
||||
"29": {
|
||||
"id": 29,
|
||||
@ -577,7 +577,7 @@
|
||||
"p": 2,
|
||||
"intr": "intr_xuanshangrenwu_intr_17",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
},
|
||||
"30": {
|
||||
"id": 30,
|
||||
@ -597,6 +597,6 @@
|
||||
"p": 4,
|
||||
"intr": "intr_xuanshangrenwu_intr_18",
|
||||
"img": "icon_jinbi",
|
||||
"appearNum": 0
|
||||
"jiequNum": 0
|
||||
}
|
||||
}
|
@ -136,9 +136,9 @@ type gc_clsl_dan = k_v<{
|
||||
/** 机器人 */
|
||||
'npc': number,
|
||||
/** 随机机器人概率*/
|
||||
'pro':number
|
||||
'pro': number
|
||||
/** 对手范围 */
|
||||
'fighter':number[]
|
||||
'fighter': number[]
|
||||
}>;
|
||||
|
||||
type gc_com = k_v<{
|
||||
@ -1809,6 +1809,28 @@ type gc_push_gift = {
|
||||
}
|
||||
}
|
||||
|
||||
type gc_hero_skin = {
|
||||
[k: string]: {
|
||||
/**皮肤id*/
|
||||
id: number
|
||||
/**干部id*/
|
||||
heroid: number
|
||||
/**皮肤品质*/
|
||||
colour: number
|
||||
/**摸到重复时转换*/
|
||||
zhuanhuan: atn[]
|
||||
}
|
||||
}
|
||||
|
||||
type gc_hero_skin_lv = {
|
||||
[colour: string]: {
|
||||
[lv: string]: {
|
||||
buff: { [k: string]: number }
|
||||
need: { a: string, t: string, n: number }[];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type gcType = {
|
||||
[key: string]: any
|
||||
armyattr: gc_armyattr
|
||||
@ -1959,6 +1981,8 @@ type gcType = {
|
||||
yuyuemail: gc_yuyuemail
|
||||
tuisonglibao: gc_push_gift
|
||||
renown_level: gc_renown_level
|
||||
heroSkin: gc_hero_skin
|
||||
heroSkinLv: gc_hero_skin_lv
|
||||
}
|
||||
|
||||
|
||||
|
@ -239,6 +239,9 @@ class Lng {
|
||||
hero_17 = "hero_17";
|
||||
hero_18 = "hero_18";
|
||||
hero_19 = "hero_19";
|
||||
hero_20 = "hero_20";
|
||||
hero_21 = "hero_21";
|
||||
hero_22 = "hero_22";
|
||||
|
||||
item_1 = "item_1";
|
||||
item_2 = "item_2";
|
||||
|
@ -1,25 +1,25 @@
|
||||
import {ResSyncBtn} from '../shared/protocols/PtlSyncBtn';
|
||||
import {payLog} from '../shared/protocols/pay/PtlGetList';
|
||||
import {rankType} from '../shared/protocols/rank/PtlOpen';
|
||||
import {CollectionChatLog} from './collection_chatlog';
|
||||
import {CollectionActionLog} from './collection_actionLog';
|
||||
import {CollectionCardlog} from './collection_cardlog';
|
||||
import {CollectionCllsCrossGroup, CollectionCllsCrossUser} from './collection_clsl';
|
||||
import {CollectionCrosskv} from './collection_crosskv';
|
||||
import {CollectionDayPay} from './collection_dayPay';
|
||||
import {CollectionDxlt} from './collection_dxlt';
|
||||
import {CollectionEmail} from './collection_email';
|
||||
import {CollectionEquip} from './collection_equip';
|
||||
import {CollectionEvent} from './collection_event';
|
||||
import {CollectionFriend} from './collection_friend';
|
||||
import {CollectionGanHai} from './collection_ganhai';
|
||||
import {CollectionGBTX} from './collection_gbtx';
|
||||
import {CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser} from './collection_gonghui';
|
||||
import {CollectionHbzbUserCross, CollectionHbzbUserZbs} from './collection_hbzb_user_cross';
|
||||
import {CollectionHero} from './collection_hero';
|
||||
import {CollectionItem} from './collection_item';
|
||||
import {CollectionJJC} from './collection_jjc';
|
||||
import {CollectionApiWeiXiuChang} from './collection_weixiuchang';
|
||||
import { ResSyncBtn } from '../shared/protocols/PtlSyncBtn';
|
||||
import { payLog } from '../shared/protocols/pay/PtlGetList';
|
||||
import { rankType } from '../shared/protocols/rank/PtlOpen';
|
||||
import { CollectionChatLog } from './collection_chatlog';
|
||||
import { CollectionActionLog } from './collection_actionLog';
|
||||
import { CollectionCardlog } from './collection_cardlog';
|
||||
import { CollectionCllsCrossGroup, CollectionCllsCrossUser } from './collection_clsl';
|
||||
import { CollectionCrosskv } from './collection_crosskv';
|
||||
import { CollectionDayPay } from './collection_dayPay';
|
||||
import { CollectionDxlt } from './collection_dxlt';
|
||||
import { CollectionEmail } from './collection_email';
|
||||
import { CollectionEquip } from './collection_equip';
|
||||
import { CollectionEvent } from './collection_event';
|
||||
import { CollectionFriend } from './collection_friend';
|
||||
import { CollectionGanHai } from './collection_ganhai';
|
||||
import { CollectionGBTX } from './collection_gbtx';
|
||||
import { CollectionGongHui, CollectionGongHuiFb, CollectionGongHuiUser } from './collection_gonghui';
|
||||
import { CollectionHbzbUserCross, CollectionHbzbUserZbs } from './collection_hbzb_user_cross';
|
||||
import { CollectionHero } from './collection_hero';
|
||||
import { CollectionItem } from './collection_item';
|
||||
import { CollectionJJC } from './collection_jjc';
|
||||
import { CollectionApiWeiXiuChang } from './collection_weixiuchang';
|
||||
|
||||
import {
|
||||
CollectionKbzzApplyUser,
|
||||
@ -134,7 +134,7 @@ export type MongodbCollections = {
|
||||
rmbuse: CollectionRmbuse
|
||||
fightLog: CollectionFightLog
|
||||
shop: CollectionShop
|
||||
pushgift:CollectionPushGift
|
||||
pushgift: CollectionPushGift
|
||||
|
||||
huodong_user: CollectionUser;
|
||||
weiwang: CollectionWeiwang;
|
||||
|
@ -2651,6 +2651,20 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
},
|
||||
{
|
||||
"id": 39,
|
||||
"name": "heroskin",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
"indexSignature": {
|
||||
"keyType": "String",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optional": true
|
||||
}
|
||||
]
|
||||
},
|
||||
|
49
src/public/heroskin.ts
Normal file
49
src/public/heroskin.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { call } from "../public/player";
|
||||
import { PlayerFun } from "./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 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算皮肤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;
|
||||
}
|
||||
}
|
@ -1,24 +1,25 @@
|
||||
import {ObjectId, OptionalId} from 'mongodb';
|
||||
import {ApiCall, BaseConnection, TsrpcError} from 'tsrpc';
|
||||
import {checkPlayerGift} from '../api_s2c/event/xianshilibao/fun';
|
||||
import {md_redPoint_check} from '../api_s2c/gongyu/mingdao/ApiOpen';
|
||||
import {CollectionPeiJian} from '../module/collection_peijian';
|
||||
import {Wjjl} from '../module/collection_wjjl';
|
||||
import {MongodbCollections} from '../module/mongodb';
|
||||
import {G123} from '../sdk/G123';
|
||||
import {ResGetList} from '../shared/protocols/item/PtlGetList';
|
||||
import {ResLogin} from '../shared/protocols/user/PtlLogin';
|
||||
import {player} from '../shared/protocols/user/type';
|
||||
import {HeroShared, otherBuff} from '../shared/public/hero';
|
||||
import {PublicShared} from '../shared/public/public';
|
||||
import {HeroFun} from './hero';
|
||||
import {ShiwuFun} from './shiwu';
|
||||
import {UserFun} from './user';
|
||||
import {getItemByItemId, getItemNum} from './item';
|
||||
import {getGud, setGud} from './gud';
|
||||
import {addGameLog} from "../gameLog";
|
||||
import {PushGiftFun} from "./pushgift";
|
||||
import { ObjectId, OptionalId } from 'mongodb';
|
||||
import { ApiCall, BaseConnection, TsrpcError } from 'tsrpc';
|
||||
import { checkPlayerGift } from '../api_s2c/event/xianshilibao/fun';
|
||||
import { md_redPoint_check } from '../api_s2c/gongyu/mingdao/ApiOpen';
|
||||
import { CollectionPeiJian } from '../module/collection_peijian';
|
||||
import { Wjjl } from '../module/collection_wjjl';
|
||||
import { MongodbCollections } from '../module/mongodb';
|
||||
import { G123 } from '../sdk/G123';
|
||||
import { ResGetList } from '../shared/protocols/item/PtlGetList';
|
||||
import { ResLogin } from '../shared/protocols/user/PtlLogin';
|
||||
import { player } from '../shared/protocols/user/type';
|
||||
import { HeroShared, otherBuff } from '../shared/public/hero';
|
||||
import { PublicShared } from '../shared/public/public';
|
||||
import { HeroFun } from './hero';
|
||||
import { ShiwuFun } from './shiwu';
|
||||
import { UserFun } from './user';
|
||||
import { getItemByItemId, getItemNum } from './item';
|
||||
import { getGud, setGud } from './gud';
|
||||
import { addGameLog } from "../gameLog";
|
||||
import { PushGiftFun } from "./pushgift";
|
||||
import { ActionLog } from './actionLog/actionLog';
|
||||
import HeroSkinFun from './heroskin';
|
||||
|
||||
|
||||
export type call = {
|
||||
@ -70,13 +71,13 @@ export class PlayerFun {
|
||||
if (err) {
|
||||
// 消耗不足 触发推送礼包
|
||||
PushGiftFun.chkItemGift(call.uid, atn)
|
||||
throw new TsrpcError('', {code: -104, atn: atn});
|
||||
throw new TsrpcError('', { code: -104, atn: atn });
|
||||
} else {
|
||||
return {isOk: false, atn: atn};
|
||||
return { isOk: false, atn: atn };
|
||||
}
|
||||
}
|
||||
}
|
||||
return {isOk: true, atn: null};
|
||||
return { isOk: true, atn: null };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,7 +95,7 @@ export class PlayerFun {
|
||||
atn: need
|
||||
};
|
||||
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);
|
||||
}
|
||||
@ -117,10 +118,10 @@ export class PlayerFun {
|
||||
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);
|
||||
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 +137,18 @@ export class PlayerFun {
|
||||
let equip = prizeList.filter(atn => atn.a == 'equip' && 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 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([
|
||||
attr.length > 0 && this.addAttr(call, attr),
|
||||
item.length > 0 && this.addItem(call, item),
|
||||
hero.length > 0 && this.addHero(call, hero),
|
||||
equip.length > 0 && this.addEquip(call, equip),
|
||||
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;
|
||||
@ -180,9 +183,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经验的任务监听
|
||||
@ -190,7 +193,7 @@ export class PlayerFun {
|
||||
G.emit("Class_task_157", 'Class_task_157', call, atn.n, 0);
|
||||
}
|
||||
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.upAttr(call, {...atn, n: change[atn.t]});
|
||||
}
|
||||
@ -233,17 +236,17 @@ export class PlayerFun {
|
||||
G.mongodb.collection('rmbuse').insertOne(data);
|
||||
// 消费竞赛开启时写入跨服数据库
|
||||
if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
|
||||
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, {
|
||||
$set: {time: G.time},
|
||||
$inc: {change: data.change}
|
||||
}, {upsert: true});
|
||||
G.crossmongodb.collection('rmbuse').updateOne({ uid: data.uid, type: `xfjs_${G.huodong.xfjsId}` }, {
|
||||
$set: { time: G.time },
|
||||
$inc: { change: data.change }
|
||||
}, { upsert: true });
|
||||
}
|
||||
}
|
||||
|
||||
static async changeAttr(uid: string, change: Partial<player>) {
|
||||
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]) {
|
||||
checkPlayerGift(G.server.uid_connections[uid].gud, change);
|
||||
@ -265,9 +268,9 @@ export class PlayerFun {
|
||||
const curLv = call.conn.gud.lv;
|
||||
while (conf[curLv + addLv + 1] && atn.n >= conf[curLv + addLv + 1].need) {
|
||||
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;
|
||||
case 'payExp':
|
||||
let addVip = 0;
|
||||
@ -276,7 +279,7 @@ export class PlayerFun {
|
||||
while (vipConf[curVip + addVip + 1] && atn.n >= vipConf[curVip + addVip + 1].exp) {
|
||||
addVip++;
|
||||
}
|
||||
addVip && await this.addAttr(call, {vip: curVip + addVip});
|
||||
addVip && await this.addAttr(call, { vip: curVip + addVip });
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -287,7 +290,7 @@ export class PlayerFun {
|
||||
static async addItem(call: call, val: atn[]) {
|
||||
for (let atn of val) {
|
||||
let upObj = {
|
||||
filter: {uid: call.uid, itemId: atn.t},
|
||||
filter: { uid: call.uid, itemId: atn.t },
|
||||
update: {
|
||||
$setOnInsert: {
|
||||
firstTime: G.time,
|
||||
@ -319,7 +322,7 @@ export class PlayerFun {
|
||||
};
|
||||
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options);
|
||||
call.addEventMsg('msg_s2c/ItemChange', atn.t, data);
|
||||
addGameLog(call.uid, "_itemChange", {"additem": 1}, {
|
||||
addGameLog(call.uid, "_itemChange", { "additem": 1 }, {
|
||||
"filter": upObj.filter,
|
||||
"update": upObj.update,
|
||||
"options": upObj.options
|
||||
@ -327,10 +330,10 @@ export class PlayerFun {
|
||||
} else {
|
||||
if (item.num + atn.n <= 0) {
|
||||
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});
|
||||
addGameLog(call.uid, "_itemChange", {"delitem": 1}, {"itemId": atn.t})
|
||||
call.addEventMsg('msg_s2c/ItemChange', atn.t, { num: 0 });
|
||||
addGameLog(call.uid, "_itemChange", { "delitem": 1 }, { "itemId": atn.t })
|
||||
} else {
|
||||
await Promise.all([
|
||||
G.mongodb.collection('item').updateOne(upObj.filter, upObj.update, upObj.options)
|
||||
@ -339,7 +342,7 @@ export class PlayerFun {
|
||||
num: item.num + atn.n,
|
||||
lastTime: upObj.update.$set.lastTime
|
||||
});
|
||||
addGameLog(call.uid, "_itemChange", {"attritem": 1}, {
|
||||
addGameLog(call.uid, "_itemChange", { "attritem": 1 }, {
|
||||
"filter": upObj.filter,
|
||||
"update": upObj.update,
|
||||
"options": upObj.options,
|
||||
@ -374,7 +377,7 @@ export class PlayerFun {
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
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);
|
||||
|
||||
@ -408,10 +411,10 @@ export class PlayerFun {
|
||||
*/
|
||||
static async cutEquip(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.mongodb.collection('equip').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/EquipChange', _id, {num: 0});
|
||||
G.mongodb.collection('equip').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/EquipChange', _id, { num: 0 });
|
||||
|
||||
addGameLog(call.uid, "_cutEquip", {}, {_id: _id})
|
||||
addGameLog(call.uid, "_cutEquip", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +448,7 @@ export class PlayerFun {
|
||||
let v = insertData[key]
|
||||
|
||||
let id = result.insertedIds[key].toHexString();
|
||||
let {_id, ...ops} = v;
|
||||
let { _id, ...ops } = v;
|
||||
|
||||
call.addEventMsg('msg_s2c/HeroChange', id, {
|
||||
_id: id,
|
||||
@ -478,9 +481,9 @@ export class PlayerFun {
|
||||
static async cutHero(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
await HeroFun.delHero(call, _id);
|
||||
G.mongodb.collection('hero').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/HeroChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutHero", {}, {_id: _id})
|
||||
G.mongodb.collection('hero').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/HeroChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutHero", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,7 +498,7 @@ export class PlayerFun {
|
||||
colour: v.colour,
|
||||
wearId: '',
|
||||
shiwuId: v.t,
|
||||
jichu: ShiwuFun.randomJichu({colour: v.colour, shiwuId: v.t}),
|
||||
jichu: ShiwuFun.randomJichu({ colour: v.colour, shiwuId: v.t }),
|
||||
fujia: []
|
||||
};
|
||||
if (v.shiwuBuff) {
|
||||
@ -515,7 +518,7 @@ export class PlayerFun {
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
let id = result.insertedIds[key].toHexString();
|
||||
let {_id, ...ops} = v;
|
||||
let { _id, ...ops } = v;
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', id, {
|
||||
_id: id,
|
||||
...ops
|
||||
@ -534,9 +537,9 @@ export class PlayerFun {
|
||||
*/
|
||||
static async cutShiwu(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.mongodb.collection('shiwu').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutShiwu", {}, {_id: _id})
|
||||
G.mongodb.collection('shiwu').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/ShiwuChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutShiwu", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,7 +564,7 @@ export class PlayerFun {
|
||||
addGameLog(call.uid, "_addPeiJian", {}, insertData)
|
||||
|
||||
insertData.forEach((v, key) => {
|
||||
let {_id, uid, ...ops} = v;
|
||||
let { _id, uid, ...ops } = v;
|
||||
let id = _id.toHexString();
|
||||
|
||||
if (G.gc.peijian[v.peijianId].colour != 5) {
|
||||
@ -569,8 +572,8 @@ export class PlayerFun {
|
||||
lshd[v.peijianId]++;
|
||||
}
|
||||
|
||||
G.redis.set('peijian', call.uid, id, {_id: id, ...ops});
|
||||
call.addEventMsg('msg_s2c/PeijianChange', id, {_id: id, ...ops});
|
||||
G.redis.set('peijian', call.uid, id, { _id: id, ...ops });
|
||||
call.addEventMsg('msg_s2c/PeijianChange', id, { _id: id, ...ops });
|
||||
});
|
||||
|
||||
G.mongodb.collection('playerInfo', 'lshd_peijian').updateOne(
|
||||
@ -591,15 +594,39 @@ export class PlayerFun {
|
||||
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.concat(G.gc.heroSkin[p.t].zhuanhuan);
|
||||
}
|
||||
}
|
||||
if (Object.keys(upskin).length > 0) {
|
||||
this.addAttr(call, Object.assign(heroskin, upskin));
|
||||
}
|
||||
|
||||
// 皮肤存在转换为其他奖励
|
||||
if (prize.length > 0) {
|
||||
this.sendPrize(call, prize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除配件
|
||||
*/
|
||||
static async cutPeijian(call: call, _idArr: string[]) {
|
||||
for (let _id of _idArr) {
|
||||
G.redis.del('peijian', call.uid, _id);
|
||||
G.mongodb.collection('peijian').deleteOne({uid: call.uid, _id: new ObjectId(_id)});
|
||||
call.addEventMsg('msg_s2c/PeijianChange', _id, {num: 0});
|
||||
addGameLog(call.uid, "_cutPeijian", {}, {_id: _id})
|
||||
G.mongodb.collection('peijian').deleteOne({ uid: call.uid, _id: new ObjectId(_id) });
|
||||
call.addEventMsg('msg_s2c/PeijianChange', _id, { num: 0 });
|
||||
addGameLog(call.uid, "_cutPeijian", {}, { _id: _id })
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,7 +635,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async getAttr(uid: string, where: { ctype: string; }) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
const _res = await G.mongodb.collection('playattr').find(_w).toArray();
|
||||
_res.forEach(v => {
|
||||
if (v._id) {
|
||||
@ -623,7 +650,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async getAttrOne(uid: string, where: { ctype: string; }) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
const _res = await G.mongodb.collection('playattr').findOne(_w);
|
||||
if (_res) {
|
||||
delete _res['_id'];
|
||||
@ -639,10 +666,10 @@ export class PlayerFun {
|
||||
time = G.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;
|
||||
Object.assign(_w, {uid: uid, ..._tmp});
|
||||
Object.assign(_w, { uid: uid, ..._tmp });
|
||||
const _res = await G.mongodb.collection('playattr').find(_w).toArray();
|
||||
_res.forEach(v => {
|
||||
if (v._id) {
|
||||
@ -657,7 +684,7 @@ export class PlayerFun {
|
||||
*/
|
||||
static async setAttr(uid: string, where: { ctype: string; }, data: {}, islasttime = 1) {
|
||||
let _w = where;
|
||||
Object.assign(_w, {uid: uid});
|
||||
Object.assign(_w, { uid: uid });
|
||||
|
||||
if (islasttime == 1) {
|
||||
data["lasttime"] = G.time;
|
||||
@ -668,7 +695,7 @@ export class PlayerFun {
|
||||
// 加入创建数据时间
|
||||
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;
|
||||
}
|
||||
}
|
@ -71,4 +71,6 @@ type heroAddKey = {
|
||||
peijian: {
|
||||
[pos: string]: string;
|
||||
};
|
||||
/**皮肤*/
|
||||
skin: string;
|
||||
};
|
7
src/shared/protocols/heroskin/PtlTakeOff.ts
Normal file
7
src/shared/protocols/heroskin/PtlTakeOff.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export interface ReqTakeOff {
|
||||
heroOid: string
|
||||
}
|
||||
|
||||
export interface ResTakeOff {
|
||||
|
||||
}
|
6
src/shared/protocols/heroskin/PtlUplv.ts
Normal file
6
src/shared/protocols/heroskin/PtlUplv.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface ReqUplv {
|
||||
lv: 1;
|
||||
skid: string;
|
||||
}
|
||||
|
||||
export interface ResUplv { }
|
6
src/shared/protocols/heroskin/PtlWear.ts
Normal file
6
src/shared/protocols/heroskin/PtlWear.ts
Normal 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
@ -195,4 +195,9 @@ export type playerAppend = {
|
||||
};
|
||||
/**威望额外属性*/
|
||||
weiwangbuff?: { [k: string]: number };
|
||||
|
||||
/**获得的皮肤*/
|
||||
heroskin?: {
|
||||
[skid: string]: number;
|
||||
}
|
||||
};
|
@ -1,3 +1,4 @@
|
||||
import HeroSkinFun from '../../public/heroskin';
|
||||
import { ResGetList } from '../protocols/hero/PtlGetList';
|
||||
import { player } from '../protocols/user/type';
|
||||
import { EquipShared } from './equip';
|
||||
@ -283,6 +284,17 @@ export class HeroShared {
|
||||
PublicShared.mergeProperty(buff, otherBuff?.weiwang || {});
|
||||
}
|
||||
|
||||
// 计算皮肤buff
|
||||
if (otherBuff?.heroskin) {
|
||||
for (let skinId in otherBuff.heroskin) {
|
||||
let skinConf = G.gc.heroSkin[skinId];
|
||||
if (skinConf.heroid != hero.heroId) console;
|
||||
PublicShared.mergeProperty(buff, HeroSkinFun.calcBuff(
|
||||
skinId, otherBuff.heroskin[skinId]
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
//最后进行加成属性计算
|
||||
for (let k in buff) {
|
||||
if (k.indexOf('pro') == -1) continue;
|
||||
|
Loading…
Reference in New Issue
Block a user