diff --git a/src/api_s2c/ApiBingo.ts b/src/api_s2c/ApiBingo.ts index b4cd9d2..9ec8155 100644 --- a/src/api_s2c/ApiBingo.ts +++ b/src/api_s2c/ApiBingo.ts @@ -120,7 +120,13 @@ export default async function (call: ApiCall) { } } else if (shell[0] == 'heroMaxLv') { - let heros = await G.redis.get('hero', call.uid); + //let heros = await G.redis.get('hero', call.uid); + + let s = await G.mongodb.collection('hero').find({ + uid: call.uid + }).toArray(); + let heros = s.map(h => G.mongodb.conversionIdObj(h)); + for (let [_id, hero] of Object.entries(heros)) { await HeroFun.changeHeroAttr(call, hero, { lv: Object.keys(G.gc.playerLv).length * 3, diff --git a/src/api_s2c/ApiSyncBtn.ts b/src/api_s2c/ApiSyncBtn.ts index 2d74769..68065df 100644 --- a/src/api_s2c/ApiSyncBtn.ts +++ b/src/api_s2c/ApiSyncBtn.ts @@ -3,6 +3,7 @@ import {EventFun} from '../public/event/event'; import {PayFun} from '../public/pay'; import {ReqSyncBtn, ResSyncBtn, syncBtnKeys} from "../shared/protocols/PtlSyncBtn"; import {PublicShared} from '../shared/public/public'; +import {HuoDongFun} from "../public/huodongfun"; const defaultKeys: syncBtnKeys[] = [ 'huobanzhaomu', 'yibaichou', 'shouchong', @@ -10,7 +11,8 @@ const defaultKeys: syncBtnKeys[] = [ 'zhanling', 'xianshilibao', 'xianshizhaomu', - 'G123Gift' + 'G123Gift', + 'christmas', // 'kaifukuanghuan', // 'qiridenglu', @@ -36,6 +38,17 @@ export default async function (call: ApiCall) { change[key] = data[key]; } break; + case 'christmas': + //领完消失 + if (!data[key]) { + let _hdList = await HuoDongFun.gethdList(call, 8) + if (_hdList) { + // 无此活动 + data[key] = {active: true}; + change[key] = data[key]; + } + } + break; case 'dayjijin': case 'dengjijijin': case 'guanqiajijin': diff --git a/src/api_s2c/event/christmas/ApiGame.ts b/src/api_s2c/event/christmas/ApiGame.ts index 25486ab..a475f62 100644 --- a/src/api_s2c/event/christmas/ApiGame.ts +++ b/src/api_s2c/event/christmas/ApiGame.ts @@ -24,8 +24,10 @@ export default async function (call: ApiCall) { _mydata["val"] += addval _mydata["gamenum"] += 1 _setData["val"] = _mydata.val - _setData["game"] = _mydata["gamenum"] + _setData["gamenum"] = _mydata["gamenum"] await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData}) + // 监听任务 + G.emit("Class_task_154", 'Class_task_154', call, 1, 0); let changedata = { mydata: _mydata} // 推送红点 HongDianChange.sendChangeKey(call.uid, ['huodonghd']); diff --git a/src/api_s2c/hero/ApiChangePos.ts b/src/api_s2c/hero/ApiChangePos.ts index e1cf832..1ec5316 100644 --- a/src/api_s2c/hero/ApiChangePos.ts +++ b/src/api_s2c/hero/ApiChangePos.ts @@ -39,7 +39,7 @@ export default async function (call: ApiCall) { } } else if (call.req.state == 'change') { if (heroPos[call.req.pos]) { - let unLoadHero = await G.redis.get('hero', call.uid, heroPos[call.req.pos]); + let unLoadHero = await HeroFun.getHero(call, heroPos[call.req.pos]); unLoadHero && fightHeros.removeOne(id => id == unLoadHero.heroId); } if (fightHeros.includes(hero.heroId.toString())) return call.errorCode(-2); diff --git a/src/api_s2c/hero/ApiGetList.ts b/src/api_s2c/hero/ApiGetList.ts index e9db5af..c0882cb 100644 --- a/src/api_s2c/hero/ApiGetList.ts +++ b/src/api_s2c/hero/ApiGetList.ts @@ -4,7 +4,7 @@ import { ReqGetList, ResGetList } from "../../shared/protocols/hero/PtlGetList"; export default async function (call: ApiCall) { let list: ResGetList['list'] = {}; - let kvList: k_v = {}; + //let kvList: k_v = {}; let arrList = await G.mongodb.collection('hero').find({ uid: call.uid }).toArray(); let heroCon = G.gc.hero; @@ -12,7 +12,7 @@ export default async function (call: ApiCall) { let maxherolv = 0; arrList.forEach(v => { let d = G.mongodb.conversionIdObj(v); - kvList[G.formatRedisKey(d._id)] = d; + //kvList[G.formatRedisKey(d._id)] = d; list[d._id] = d; if (v.lv > maxherolv) maxherolv = v.lv; @@ -23,7 +23,7 @@ export default async function (call: ApiCall) { await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({ uid: call.conn.uid, type: 'usertasklog' }, { $set: { maxherolv: maxherolv, herocolor: color } }, { upsert: true }); - G.redis.set('hero', call.uid, kvList); + //G.redis.set('hero', call.uid, kvList); let recLshd = await G.mongodb.collection('playerInfo', 'lshd_hero').findOne({ uid: call.conn.uid, type: 'lshd_hero' }); let { uid, _id, type, ...heros } = (recLshd || {}); diff --git a/src/api_s2c/hero/ApiJinJie.ts b/src/api_s2c/hero/ApiJinJie.ts index 47b8cd3..90fda22 100644 --- a/src/api_s2c/hero/ApiJinJie.ts +++ b/src/api_s2c/hero/ApiJinJie.ts @@ -39,7 +39,7 @@ export default async function (call: ApiCall) let selectHeros: ResGetList['list'][''][] = []; for (let _id of call.req.idArr) { - let _hero = await G.redis.get('hero', call.uid, _id); + let _hero = await HeroFun.getHero(call, _id); if (!_hero) return call.error(globalThis.lng.hero_1); selectHeros.push(_hero); } diff --git a/src/api_s2c/task/ApiAllFinsh.ts b/src/api_s2c/task/ApiAllFinsh.ts index eee896d..f3e29a8 100644 --- a/src/api_s2c/task/ApiAllFinsh.ts +++ b/src/api_s2c/task/ApiAllFinsh.ts @@ -42,6 +42,12 @@ export default async function (call: ApiCall) { // 设置数据 await TaskFun.setTask(call.uid, { type: _type, taskid: { $in: _finishTaks } }, { finish: 1 }) let prize = await PlayerFun.sendPrize(call, _prize) + // 是否是每日任务奖励最终宝箱 + if (_type == 4 && 25 in _finishTaks){ + // 监听任务 + G.emit("Class_task_155", 'Class_task_155', call, 1, 0); + } + let data = { finishtask: _finishTaks, diff --git a/src/api_s2c/task/ApiFinsh.ts b/src/api_s2c/task/ApiFinsh.ts index 1a7a4bc..aebc8b1 100644 --- a/src/api_s2c/task/ApiFinsh.ts +++ b/src/api_s2c/task/ApiFinsh.ts @@ -44,6 +44,11 @@ export default async function (call: ApiCall) { } // 设置数据 await TaskFun.setTask(call.uid, {taskid: taskid}, {finish: 1}) + // 是否是每日任务奖励最终宝箱 + if (_task["type"] == 4 && 25 == taskid){ + // 监听任务 + G.emit("Class_task_155", 'Class_task_155', call, 1, 0); + } let _prize = await PlayerFun.sendPrize(call, _con["prize"]) _task["finish"] = 1 diff --git a/src/globalListener.ts b/src/globalListener.ts index bd10c64..a5a750f 100644 --- a/src/globalListener.ts +++ b/src/globalListener.ts @@ -140,6 +140,10 @@ export type gEventType = { Class_task_152: (eventname, call, val, chkVal) => void; /**合成x次装备 */ Class_task_153: (eventname, call, val, chkVal) => void; + /**参与圣诞活动小游戏 */ + Class_task_154: (eventname, call, val, chkVal) => void; + /**每日任务宝箱领取 */ + Class_task_155: (eventname, call, val, chkVal) => void; }; export function addListener() { diff --git a/src/json/herogrow_ewai.json b/src/json/herogrow_ewai.json new file mode 100644 index 0000000..791c542 --- /dev/null +++ b/src/json/herogrow_ewai.json @@ -0,0 +1,62 @@ +{ + "1": { + "id": 1, + "jieji": 0, + "ewai_buff": 0 + }, + "2": { + "id": 2, + "jieji": 1, + "ewai_buff": 0 + }, + "3": { + "id": 3, + "jieji": 2, + "ewai_buff": 0 + }, + "4": { + "id": 4, + "jieji": 3, + "ewai_buff": 0 + }, + "5": { + "id": 5, + "jieji": 4, + "ewai_buff": 0.4 + }, + "6": { + "id": 6, + "jieji": 5, + "ewai_buff": 0.5 + }, + "7": { + "id": 7, + "jieji": 6, + "ewai_buff": 0.6 + }, + "8": { + "id": 8, + "jieji": 7, + "ewai_buff": 0.8 + }, + "9": { + "id": 9, + "jieji": 8, + "ewai_buff": 1 + }, + "10": { + "id": 10, + "jieji": 9, + "ewai_buff": 1.2 + }, + "11": { + "id": 11, + "jieji": 10, + "ewai_buff": 1.4 + }, + "12": { + "id": 12, + "jieji": 11, + "ewai_buff": 1.8 + } +} \ No newline at end of file diff --git a/src/json/huodong.json5 b/src/json/huodong.json5 index d09b2bf..df17ba9 100644 --- a/src/json/huodong.json5 +++ b/src/json/huodong.json5 @@ -3332,17 +3332,17 @@ //玩游戏需要消耗 "gameneed": [{"a": "attr", "t":"jinbi", "n": 1}], //玩游戏拿分 - "game": [0,1,2,3,4,5], + "game": [5,10,20,30,50], //战令 "zhanling":[ { - "val": 1, - "pt": [{"a": "attr", "t":"jinbi", "n": 1}], - "gj": [{"a": "attr", "t":"jinbi", "n": 1}] + "val": 2500, + "pt": [{"a": "item", "t":"1", "n": 200000}], + "gj": [{"a": "item", "t":"50101", "n": 1},{"a": "item", "t":"1", "n": 500000}] }, { "val": 2, - "pt": [{"a": "attr", "t":"jinbi", "n": 1}], + "pt": [{"a": "attr", "t":"rmbmoney", "n": 500}], "gj": [{"a": "attr", "t":"jinbi", "n": 1}] }, { @@ -3351,6 +3351,7 @@ "gj": [{"a": "attr", "t":"jinbi", "n": 1}] } ], + //战令PayID "zlpayid":"ycmb_1_1", //活动礼包 "libao": { @@ -3475,6 +3476,7 @@ intr: "czlbtips_1", intr: "czlbtips_2", //礼包 + //礼包 gift: [ { id: '1', @@ -3483,7 +3485,10 @@ free: false, payId: 'czlb_1', buyNum: 1, - prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] + prize:{"1":[{'a': 'item', 't': '13', 'n': 600}], + "2":[{'a': 'item', 't': '13', 'n': 600}], + "3":[{'a': 'item', 't': '13', 'n': 600}] + } }, { id: '2', @@ -3492,7 +3497,10 @@ free: false, payId: 'czlb_2', buyNum: 1, - prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] + prize: {"1":[{'a': 'item', 't': '13', 'n': 600}], + "2":[{'a': 'item', 't': '13', 'n': 600}], + "3":[{'a': 'item', 't': '13', 'n': 600}] + } }, { id: '3', @@ -3501,7 +3509,10 @@ free: false, payId: 'czlb_3', buyNum: 1, - prize: [{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600},{'a': 'item', 't': '13', 'n': 600}] + prize: {"1":[{'a': 'item', 't': '13', 'n': 600}], + "2":[{'a': 'item', 't': '13', 'n': 600}], + "3":[{'a': 'item', 't': '13', 'n': 600}] + } } ] } diff --git a/src/json/pay.json b/src/json/pay.json index cce56c1..7a8595f 100644 --- a/src/json/pay.json +++ b/src/json/pay.json @@ -4183,7 +4183,33 @@ "n": 60 } ], - "prize": [], + "prize": [ + { + "a": "hero", + "t": "4002", + "n": 1 + }, + { + "a": "attr", + "t": "rmbmoney", + "n": 120 + }, + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 50000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 100000 + } + ], "firstPayPrize": [], "name": "pay_name_shouchong_1", "undefined": "首充礼包_6", @@ -4203,7 +4229,33 @@ "n": 300 } ], - "prize": [], + "prize": [ + { + "a": "hero", + "t": "5001", + "n": 1 + }, + { + "a": "attr", + "t": "rmbmoney", + "n": 600 + }, + { + "a": "item", + "t": "12", + "n": 1500 + }, + { + "a": "item", + "t": "1", + "n": 300000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 300000 + } + ], "firstPayPrize": [], "name": "pay_name_shouchong_2", "undefined": "首充礼包_30", @@ -4223,7 +4275,33 @@ "n": 980 } ], - "prize": [], + "prize": [ + { + "a": "hero", + "t": "5001", + "n": 1 + }, + { + "a": "equip", + "t": "1009", + "n": 1 + }, + { + "a": "equip", + "t": "2009", + "n": 1 + }, + { + "a": "equip", + "t": "3009", + "n": 1 + }, + { + "a": "equip", + "t": "4009", + "n": 1 + } + ], "firstPayPrize": [], "name": "pay_name_shouchong_3", "undefined": "首充礼包_98", @@ -4243,7 +4321,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 200000},{a: 'item', t: '1', n: 100000},{a: 'item', t: '4', n: 5}]", + "prize": [ + { + "a": "item", + "t": "4", + "n": 5 + }, + { + "a": "item", + "t": "1", + "n": 100000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 200000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_1", "undefined": "积天礼包_6", @@ -4263,7 +4357,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 400000},{a: 'item', t: '1', n: 200000},{a: 'item', t: '607', n: 20}]", + "prize": [ + { + "a": "item", + "t": "607", + "n": 20 + }, + { + "a": "item", + "t": "1", + "n": 200000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 400000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_2", "undefined": "积天礼包_6", @@ -4283,7 +4393,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 600000},{a: 'item', t: '1', n: 300000},{a: 'item', t: '4', n: 10}]", + "prize": [ + { + "a": "item", + "t": "4", + "n": 10 + }, + { + "a": "item", + "t": "1", + "n": 300000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 600000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_3", "undefined": "积天礼包_6", @@ -4303,7 +4429,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 800000},{a: 'item', t: '1', n: 400000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 400000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 800000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_4", "undefined": "积天礼包_6", @@ -4323,7 +4465,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 1000000},{a: 'item', t: '1', n: 500000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 500000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 1000000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_5", "undefined": "积天礼包_6", @@ -4343,7 +4501,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 1200000},{a: 'item', t: '1', n: 600000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 600000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 1200000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_6", "undefined": "积天礼包_6", @@ -4363,7 +4537,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 1400000},{a: 'item', t: '1', n: 700000},{a: 'item', t: '600', n: 20}]", + "prize": [ + { + "a": "item", + "t": "600", + "n": 20 + }, + { + "a": "item", + "t": "1", + "n": 700000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 1400000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_7", "undefined": "积天礼包_6", @@ -4383,7 +4573,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 1600000},{a: 'item', t: '1', n: 800000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 800000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 1600000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_8", "undefined": "积天礼包_6", @@ -4403,7 +4609,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 1800000},{a: 'item', t: '1', n: 900000},{a: 'item', t: '4', n: 10}]", + "prize": [ + { + "a": "item", + "t": "4", + "n": 10 + }, + { + "a": "item", + "t": "1", + "n": 900000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 1800000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_9", "undefined": "积天礼包_6", @@ -4423,7 +4645,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 2000000},{a: 'item', t: '1', n: 1000000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 1000000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 2000000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_10", "undefined": "积天礼包_6", @@ -4443,7 +4681,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 2200000},{a: 'item', t: '1', n: 1100000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 1100000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 2200000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_11", "undefined": "积天礼包_6", @@ -4463,7 +4717,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 2400000},{a: 'item', t: '1', n: 1200000},{a: 'item', t: '4', n: 10}]", + "prize": [ + { + "a": "item", + "t": "4", + "n": 10 + }, + { + "a": "item", + "t": "1", + "n": 1200000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 2400000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_12", "undefined": "积天礼包_6", @@ -4483,7 +4753,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 2600000},{a: 'item', t: '1', n: 1300000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 1300000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 2600000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_13", "undefined": "积天礼包_6", @@ -4503,7 +4789,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 2800000},{a: 'item', t: '1', n: 1400000},{a: 'item', t: '12', n: 500}]", + "prize": [ + { + "a": "item", + "t": "12", + "n": 500 + }, + { + "a": "item", + "t": "1", + "n": 1400000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 2800000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_14", "undefined": "积天礼包_6", @@ -4523,7 +4825,23 @@ "n": 60 } ], - "prize": "[{a: 'attr', t: 'jinbi', n: 3000000},{a: 'item', t: '1', n: 1500000},{a: 'item', t: '600', n: 20}]", + "prize": [ + { + "a": "item", + "t": "600", + "n": 20 + }, + { + "a": "item", + "t": "1", + "n": 1500000 + }, + { + "a": "attr", + "t": "jinbi", + "n": 3000000 + } + ], "firstPayPrize": [], "name": "pay_name_jitianlibao_15", "undefined": "积天礼包_6", diff --git a/src/json/skill_afteratk.json b/src/json/skill_afteratk.json index 287a4dc..39523ee 100644 --- a/src/json/skill_afteratk.json +++ b/src/json/skill_afteratk.json @@ -1011,7 +1011,7 @@ "mofa": 0, "islong": 0 }, - "describe": "普通攻击替换为随机攻击3个目标,造成基础伤害95%的物理伤害" + "describe": "普通攻击替换为随机攻击2个目标,造成基础伤害95%的物理伤害" }, "4002201": { "skillid": 4002201, @@ -1029,7 +1029,7 @@ "mofa": 0, "islong": 0 }, - "describe": "普通攻击替换为随机攻击3个目标,造成基础伤害114%的物理伤害" + "describe": "普通攻击替换为随机攻击2个目标,造成基础伤害114%的物理伤害" }, "4003200": { "skillid": 4003200, @@ -1202,7 +1202,7 @@ "order": "rand", "limit": 6, "data": { - "pro": 0.11 + "pro": 0.13 }, "chkdata": {}, "ext": {}, @@ -1217,7 +1217,7 @@ "order": "rand", "limit": 6, "data": { - "pro": 0.11 + "pro": 0.13 }, "chkdata": {}, "ext": {}, diff --git a/src/json/skill_buff.json b/src/json/skill_buff.json index e7c9168..5c3cdb0 100644 --- a/src/json/skill_buff.json +++ b/src/json/skill_buff.json @@ -739,7 +739,7 @@ "sxleixing": "zhongdu", "buff_type": 2, "xiaoguocanshu": { - "pro": 0.15, + "pro": 0.18, "type": "hp" }, "round": 2, @@ -759,7 +759,7 @@ "sxleixing": "zhongdu", "buff_type": 2, "xiaoguocanshu": { - "pro": 0.15, + "pro": 0.18, "type": "hp" }, "round": 2, diff --git a/src/public/equip.ts b/src/public/equip.ts index 126fec0..2238215 100644 --- a/src/public/equip.ts +++ b/src/public/equip.ts @@ -17,7 +17,7 @@ export class EquipFun { //穿戴装备时该装备穿戴在另一个英雄身上 if (change.wearaId != undefined && equip.wearaId && equip.wearaId != change.wearaId && changeHero) { - let takeHero = await G.redis.get('hero', call.uid, equip.wearaId); + let takeHero = await HeroFun.getHero(call, equip.wearaId); if (takeHero) { let _equip = Object.assign({}, takeHero.equip); _equip[G.gc.equip[equip.equipId].type] = ''; diff --git a/src/public/hero.ts b/src/public/hero.ts index 3e630bb..52e104a 100644 --- a/src/public/hero.ts +++ b/src/public/hero.ts @@ -24,9 +24,9 @@ export class HeroFun { hero.zhanli = HeroShared.getHeroZhanLi(hero, call.otherBuff, Object.values(call.conn.gud.heroPos).indexOf(hero._id)); change.zhanli = hero.zhanli; - for (let k in change) { - await G.redis.set('hero', call.uid, hero._id, k as any, change[k]); - } + // for (let k in change) { + // await G.redis.set('hero', call.uid, hero._id, k as any, change[k]); + // } await G.mongodb.collection('hero').updateOne({uid: call.uid, _id: new ObjectId(hero._id)}, { $set: { @@ -41,13 +41,13 @@ export class HeroFun { /**获取英雄 */ static async getHero(call: call, oid: string) { - let data = await G.redis.get('hero', call.uid, oid); - if (!data) { // 如果redis中的hero数据被清理掉 直接查询数据库 + //let data = await G.redis.get('hero', call.uid, oid); + //if (!data) { // 如果redis中的hero数据被清理掉 直接查询数据库 let {_id, ...info} = await G.mongodb.collection("hero").findOne({ _id: G.mongodb.conversionId(oid) }) - data = Object.assign({_id: _id.toHexString()}, info) - } + let data = Object.assign({_id: _id.toHexString()}, info) + //} return data } diff --git a/src/public/pay.ts b/src/public/pay.ts index bcda345..fa6b609 100644 --- a/src/public/pay.ts +++ b/src/public/pay.ts @@ -149,6 +149,12 @@ export class PayFun { needVip: 0, front: {} } + } else if (payId == '136GiftAll') { + // 136礼包一键购买,加入所有礼包奖励 + conf = { + ...conf, + prize: R.compose(R.flatten(), R.map(i => i.prize), R.filter(i => i.id.indexOf('136Gift') != -1), R.values())(G.gc.pay) + } } return conf } @@ -225,7 +231,7 @@ export class PayFun { prize.push(...conf.prize) } - let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs) + let isReplaceConf = await this.checkBuysAfterPay(uid, payId, conf, payArgs, player) if (isReplaceConf) { let prizePayId = `zuanshi_${conf.money}` payArgs.toPrizePayId = prizePayId @@ -314,8 +320,9 @@ export class PayFun { * @param payId * @param conf * @param payArgs + * @param player */ - static async checkBuysAfterPay(uid, payId, conf, payArgs) { + static async checkBuysAfterPay(uid, payId, conf, payArgs, player) { if (payId == 'G123SendGift') { let giftInfo = await G.mongodb.collection('giftLog').findOne({popup_id: payArgs.popup_id}); if (giftInfo.purchaseLimitAmount && giftInfo.buyNumber >= giftInfo.purchaseLimitAmount && number(giftInfo.price) > 0) { @@ -327,6 +334,12 @@ export class PayFun { buyLog = buyLog.filter(v => v.time >= PublicShared.getToDayZeroTime(G.time)); } if (conf.buys > 0 && buyLog.length >= conf.buys) return true; + //针对周末礼包的单独处理 + if (payId.indexOf('wkdlibao') != -1) { + let call = this.getCall(player) + let conf = await zmlbGetConf(call, {payId}) + if (buyLog.length && buyLog.length >= conf.buyNum) return true + } } return false } @@ -376,10 +389,20 @@ export class PayFun { if (conf.time != -1 && buyLog.slice(-1)[0]?.eTime > G.time && conf.buys == 0 && payId.indexOf('wkdlibao') == -1) { return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -2}); } - if (payId.indexOf('136Gift') != -1 && payId != '136Gift1') { - buyLog = await this.getPayLog(player.uid, '136Gift1'); - if (buyLog.slice(-1)[0]?.eTime > G.time) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -3}); + //针对每日礼包的单独处理 + let zeroTime = PublicShared.getToDayZeroTime(G.time) + if (payId.indexOf('136Gift') != -1 && payId != '136GiftAll') { + let buyLog136 = await this.getPayLog(player.uid, '136GiftAll'); + buyLog136 = buyLog136.filter(v => v.time >= zeroTime); + if (buyLog136.length) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -1}); } + if (payId.indexOf('136Gift') != -1 && payId == '136GiftAll') { + let ids = R.compose(R.map(i => i.id), R.filter(i => i.id.indexOf('136Gift') != -1 && i.id != '136GiftAll'), R.values())(G.gc.pay) + let buyLog136 = await this.getPayLogs(player.uid, ids); + let buyLog136list = R.compose(R.filter(v => v.time >= zeroTime), R.flatten(), R.values())(buyLog136) + if (buyLog136list.length) return G.server.sendMsgByUid(player.uid, 'msg_s2c/PayResult', {code: -1}); + } + //针对周末礼包的单独处理 if (payId.indexOf('wkdlibao') != -1) { let call = this.getCall(player) let conf = await zmlbGetConf(call, {payId}) diff --git a/src/public/player.ts b/src/public/player.ts index f5dac4e..ae286d0 100644 --- a/src/public/player.ts +++ b/src/public/player.ts @@ -454,12 +454,12 @@ export class PlayerFun { //hero/apiGetList里会G.redis.set('hero', call.uid, kvList); //在这之后再执行下面的代码则不会报错 - if (await G.redis.type('hero', call.uid) != null) { - G.redis.set('hero', call.uid, id, { - _id: id, - ...ops - }); - } + // if (await G.redis.type('hero', call.uid) != null) { + // G.redis.set('hero', call.uid, id, { + // _id: id, + // ...ops + // }); + // } call.addEventMsg('msg_s2c/HeroChange', id, { diff --git a/src/public/shiwu.ts b/src/public/shiwu.ts index 4d1e715..e05018e 100644 --- a/src/public/shiwu.ts +++ b/src/public/shiwu.ts @@ -38,7 +38,7 @@ export class ShiwuFun { //穿戴饰物时该装备穿戴在另一个英雄身上 if (change.wearId != undefined && shiwu.wearId && shiwu.wearId != change.wearId && changeHero) { - let takeHero = await G.redis.get('hero', call.uid, shiwu.wearId); + let takeHero = await HeroFun.getHero(call, shiwu.wearId); if (takeHero) { let _shiwu = Object.assign({}, takeHero.shiwu); let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0]; @@ -55,7 +55,7 @@ export class ShiwuFun { //属性发生变化并且穿戴在英雄身上时 if (change.wearId == undefined && shiwu.wearId) { - let takeHero = await G.redis.get('hero', call.uid, shiwu.wearId); + let takeHero = await HeroFun.getHero(call, shiwu.wearId); if (takeHero) { let _shiwu = Object.assign({}, takeHero.shiwu); let _pos = Object.keys(_shiwu).filter(pos => _shiwu[pos]._id == shiwu._id)[0]; diff --git a/src/public/taskclass.ts b/src/public/taskclass.ts index b1f2abf..5266c85 100644 --- a/src/public/taskclass.ts +++ b/src/public/taskclass.ts @@ -766,6 +766,24 @@ export module manager { return call.conn.gud?.helpHeros?.length || 0; } } + // 第56个任务 完成圣诞活动小游戏 + export class Class_task_154 extends BaseClass { + stype = 154 + isinc = 1 + + async initVal(call: ApiCall, con) { + return 1; + } + } + // 第57个任务 领取每日任务最终宝箱 + export class Class_task_155 extends BaseClass { + stype = 155 + isinc = 0 + + async initVal(call: ApiCall, con) { + return 1; + } + } } diff --git a/src/setRedis.ts b/src/setRedis.ts index 449987f..484d2a4 100644 --- a/src/setRedis.ts +++ b/src/setRedis.ts @@ -75,8 +75,9 @@ async function clearRedis() { G.redis.fromatKey('jjc'), G.redis.fromatKey('user'), G.redis.fromatKey('item'), + G.redis.fromatKey('hero'), + //G.redis.fromatKey('equip'), - //G.redis.fromatKey('hero'), //G.redis.fromatKey('shiwu'), //G.redis.fromatKey('gbtx'), //G.redis.fromatKey('dxlt'), diff --git a/src/shared/protocols/PtlSyncBtn.ts b/src/shared/protocols/PtlSyncBtn.ts index b5385dc..04f1524 100644 --- a/src/shared/protocols/PtlSyncBtn.ts +++ b/src/shared/protocols/PtlSyncBtn.ts @@ -30,4 +30,4 @@ export type defaultSyncBtn = { export type syncBtnKeys = 'shouchong' | 'kaifukuanghuan' | jijinType | 'zhanling' | 'qiridenglu' | 'xianshilibao' | 'yibaichou' | 'huobanzhaomu' | 'xianshizhaomu' | 'leijichongzhi' | 'xinshoulibao' | 'jierihuodong' | 'yuedujijin' | 'zixuanlibao' | 'diaoluoduihuan' | 'chuanshuozhilu' - | 'yangchengmubiao' | 'G123Gift' \ No newline at end of file + | 'yangchengmubiao' | 'G123Gift' | 'christmas' \ No newline at end of file diff --git a/src/shared/protocols/serviceProto.ts b/src/shared/protocols/serviceProto.ts index 2329b0e..63d417a 100644 --- a/src/shared/protocols/serviceProto.ts +++ b/src/shared/protocols/serviceProto.ts @@ -18826,6 +18826,13 @@ export const serviceProto: ServiceProto = { "type": "Literal", "literal": "G123Gift" } + }, + { + "id": 18, + "type": { + "type": "Literal", + "literal": "christmas" + } } ] },