Compare commits

..

No commits in common. "82c47aaadfe1cc09b163c9eda39cdd704f6e9cdb" and "3bdc98a1f6c54550f9632787f219aa31435f18bf" have entirely different histories.

16 changed files with 81 additions and 335 deletions

View File

@ -6,7 +6,7 @@ import { fightResult } from "../../../shared/fightControl/fightType";
import { FightFun } from "../../../public/fight";
export default async function (call: ApiCall<ReqFight, ResFight>) {
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid);
if (!hd) {
// 无此活动
@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqFight, ResFight>) {
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
// 开始战斗
let result: fightResult = await FightFun.fightNpc(call, hd.data.boss.npcId, 'hqjg');
let result: fightResult = await FightFun.fightNpc(call, hd.data.bossId, 'hqjg');
let up = false;
let today = HQJGFun.today(hd);

View File

@ -1,42 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqGiftRec, ResGiftRec } from "../../../shared/protocols/event/huangqijiuguan/PtlGiftRec";
import HQJGFun from "./fun";
export default async function (call: ApiCall<ReqGiftRec, ResGiftRec>) {
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
if (!hd || Object.keys(hd).length <= 0) {
// 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let gift = hd.data.gift.filter(i => i.id == call.req.giftid)[0];
if (!gift || !gift.free) {
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
if ((mydata.giftbuy[call.req.giftid] || { num: 0 }).num + 1 > gift.buynum) {
return call.error("", { code: -2, message: globalThis.lng.hqjgtips_28 })
}
let prize: atn[] = [].concat(gift.prize);
if (!mydata.giftbuy[call.req.giftid]) {
mydata.giftbuy[call.req.giftid] = { num: 0, select: [] };
}
if (gift.dlz) {
for (let i = 0; i < gift.dlz.length; i++) {
if (!mydata.giftbuy[call.req.giftid].select[i]) {
let ids = Object.keys(gift.dlz[i])
prize.push(gift.dlz[i][ids[0]]);
mydata.giftbuy[call.req.giftid].select[i] = Number(ids[0]);
} else {
prize.push(gift.dlz[i][mydata.giftbuy[call.req.giftid].select[i]]);
}
}
}
mydata.giftbuy[call.req.giftid].num++;
await HQJGFun.setMyData(call.uid, call.req.hdid, { giftbuy: mydata.giftbuy });
call.succ({ data: mydata, prize: prize })
}

View File

@ -1,35 +0,0 @@
import { ApiCall } from "tsrpc";
import { ReqGiftSelect, ResGiftSelect } from "../../../shared/protocols/event/huangqijiuguan/PtlGiftSelect";
import HQJGFun from "./fun";
export default async function (call: ApiCall<ReqGiftSelect, ResGiftSelect>) {
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
if (!hd || Object.keys(hd).length <= 0) {
// 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let gift = hd.data.gift.filter(i => i.id == call.req.giftid)[0];
if (!gift || !gift.dlz) {
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
for (let i = 0; i < call.req.seletc.length; i++) {
if (!gift.dlz[i] || !gift.dlz[i][call.req.seletc[i]]) {
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
}
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
if (!mydata.giftbuy[call.req.giftid]) {
mydata.giftbuy[call.req.giftid] = {
num: 0, select: call.req.seletc
}
} else {
mydata.giftbuy[call.req.giftid].select = call.req.seletc;
}
await HQJGFun.setMyData(call.uid, call.req.hdid, { giftbuy: mydata.giftbuy });
call.succ({ data: mydata });
}

View File

@ -1,9 +1,10 @@
import HQJGFun from "./fun";
import { ApiCall } from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun";
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/huangqijiuguan/PtlOpen";
export default async (call: ApiCall<ReqOpen, ResOpen>) => {
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid);
if (!hd || Object.keys(hd).length <= 0) {
// 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })

View File

@ -1,10 +1,11 @@
import { ApiCall } from "tsrpc";
import HQJGFun, { Data } from "./fun";
import { HuoDongFun } from "../../../public/huodongfun";
import { ReqRecDpsPrize, ResRecDpsPrize } from "../../../shared/protocols/event/huangqijiuguan/PtlRecDpsPrize";
import { PlayerFun } from "../../../public/player";
export default async function (call: ApiCall<ReqRecDpsPrize, ResRecDpsPrize>) {
let hd = await HQJGFun.HdInfo(call, call.req.hdid);
let hd = await HuoDongFun.getHdidInfo(call, call.req.hdid);
if (!hd) {
// 无此活动

View File

@ -19,7 +19,7 @@ export default async function (call: ApiCall<ReqZhaoMu, ResZhaoMu>) {
let prize = [];
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
for (let n = 1; n <= call.req.num; n++) {
for (let n = 0; n < call.req.num; n++) {
let num = mydata.zhaomu.num + n;
let baodi = hd.data.baodi.filter(x => x.num == num);
if (baodi.length > 0) {
@ -45,6 +45,4 @@ export default async function (call: ApiCall<ReqZhaoMu, ResZhaoMu>) {
await HQJGFun.setMyData(call.uid, call.req.hdid, { zhaomu: mydata.zhaomu });
call.succ({ data: mydata, prize: prize })
G.emit("Class_task_159", 'Class_task_159', call, 1, 0);
}

View File

@ -14,21 +14,15 @@ export default async function (call: ApiCall<ReqZhaoMuPrizeRec, ResZhaoMuPrizeRe
let mydata = await HQJGFun.getMydata(call, call.req.hdid);
for (let rec of call.req.recid) {
let con = hd.data.choukajiangli[rec.idx];
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec.idx)) {
let con = hd.data.choukajiangli[rec];
if (con.num > mydata.zhaomu.num || mydata.zhaomu.prize.includes(rec)) {
continue
}
if (con.dlz) {
prize.push(con.dlz[0][rec.sec]);
} else {
mydata.zhaomu.prize.push(rec);
prize = prize.concat(con.prize);
}
mydata.zhaomu.prize.push(rec.idx);
}
if (prize.length <= 0) {
return call.error('', { code: -2, message: globalThis.lng.hqjgtips_28 })
}

View File

@ -3,22 +3,18 @@ import { ReqAddHuoDong } from "../../../monopoly/protocols/PtlAddHuoDong"
import { HuoDongFun } from "../../../public/huodongfun"
import { PublicShared } from "../../../shared/public/public"
import { EmailFun } from "../../../public/email"
import { playerInfo } from "../../../shared/protocols/user/PtlLogin"
// hddata.data
export interface Data {
show: 1
task: {
[k: `day${number}`]: {
[k: string]: { pval: number, stype: number, cond: string[], tiaozhuan: number, prize: atn[], des: string }
[k: string]: { pval: number, stype: string, cond: string[], tiaozhuan: number, prize: atn[], des: string }
}
}
huobi: atn // 抽卡货币
boss: {
img: string
npcId: number
}
bossId: number // boss表的ID
// boss排行邮件
bossRank_des: string
@ -30,11 +26,11 @@ export interface Data {
chouka: { a: string, t: string, n: number, p: number, gailv: number, cishu: number }[]
choukajiangli: { num: number, prize?: any[], dlz: { [k: string]: atn } }[]
choukajiangli: { num: number, prize: any[] }[]
baodi: { num: number, prize: any[] }[]
gift: { id: number, free: boolean, payId: string, buynum: number, prize: atn[], dlz?: { [k: string]: atn }[] }[]
gift: { id: number, free: boolean, payId: string, buynum: number, prize: atn[] }[]
duihuan: { id: number, need: atn[], prize: atn[], buyNum: number }[]
@ -155,14 +151,14 @@ export default class HQJGFun {
}
/** 获取活动数据 */
static async HdInfo(call: ApiCall, hdid?: number): Promise<ReqAddHuoDong & { data: Data }> {
static async HdInfo(call: ApiCall, hdid?: number): Promise<ReqAddHuoDong> {
if (!hdid) {
let hdlist = await HuoDongFun.gethdList(
call, this.htype
);
return hdlist.length > 0 ? hdlist[0] : null
} else {
return await HuoDongFun.getHdidInfo(call, hdid) as any as ReqAddHuoDong & { data: Data }
return await HuoDongFun.getHdidInfo(call, hdid) as ReqAddHuoDong
}
}
@ -204,16 +200,24 @@ export default class HQJGFun {
}
}
static async buy(call: ApiCall, payId: string) {
let hddata = await this.HdInfo(call);
if (!hddata) { // 活动不存在
return
}
let mydata = await this.getMydata(call);
await this.setMyData(call.uid, (await this.HdInfo(call)).hdid, mydata);
}
/**
*
*/
static async dayDpsLvPrize(time: number) {
console.log(
"黄旗酒馆 每日伤害等级奖励结算 开始执行。。。"
)
static async dayDpsLvPrize() {
// 取stime小于当前时间的最后一条数据
let hdinfo = await G.mongodb.collection("hdinfo").find({
htype: this.htype, stime: { $lte: time }
htype: this.htype, stime: { $lte: G.time }
}, { sort: { stime: -1 } }).limit(1).toArray();
// 没有活动数
@ -223,7 +227,6 @@ export default class HQJGFun {
let hd = hdinfo[0];
let hdid = hdinfo[0].hdid;
// 活动结束
if (hd.etime < G.time - 300) {
return
}
@ -257,26 +260,17 @@ export default class HQJGFun {
contentInsertArr: [lvprize.lv],
})
}
console.log(
"黄旗酒馆 每日伤害等级奖励结算 执行完成!!!"
)
})
}
/**
*
*/
static async endDpsRankPrize(time: number) {
console.log(
"黄旗酒馆 最大伤害排行奖励结算 开始执行。。。"
)
let today = PublicShared.getToDayZeroTime(time + 300);
let yesterday = PublicShared.getToDayZeroTime(time - 300);
// 查询昨天23:59:00或者今天00:00:00结束的活动
static async endDpsRankPrize() {
// 取stime小于当前时间的最后一条数据
let hdinfo = await G.mongodb.collection("hdinfo").find({
htype: this.htype, rtime: { $gt: yesterday, $lte: today }
}).toArray();
htype: this.htype, stime: { $lte: G.time }
}, { sort: { stime: -1 } }).limit(1).toArray();
// 没有活动数
if (hdinfo.length <= 0) {
@ -285,7 +279,7 @@ export default class HQJGFun {
let hd = hdinfo[0];
let hdid = hdinfo[0].hdid;
if (hd.data.sendrank) {
if (hd.etime < G.time - 300) {
return
}
@ -312,91 +306,5 @@ export default class HQJGFun {
contentInsertArr: [rank],
})
}
// 标记已发送
await G.mongodb.collection("hdinfo").updateOne(
{ hdid: hdid }, { $set: { "data.sendrank": true } }
);
console.log(
"黄旗酒馆 最大伤害排行奖励结算 执行结束!!!"
)
}
/**设置任务 */
static async setTaskVal(call: ApiCall, stype: number, val: number, chkCall: Function, chkval: number = 0, isinc: number = 0, alchangeVal: Function, arg) {
// 活动过期,不计数
let hd = await this.HdInfo(call)
if (!hd) return
let today = this.today(hd);
await this.getMydata(call, hd.hdid)
let isset = 0;
let setData = {
$inc: {},
$set: {}
};
let tasks = hd.data.task[`day${today}`];
for (let taskid of Object.keys(tasks)) {
let taskCon = tasks[taskid];
if (taskCon.stype != stype) continue
// 不符合任务要求
if (!(await chkCall(taskCon["cond"], chkval, arg))) continue
// 根据需求改写
val = await alchangeVal(call, taskCon, val, arg)
isset = 1
if (isinc == 1) { // 累加
setData["$inc"][`task.val.day${today}.${taskid}`] = val
} else {
setData["$set"][`task.val.day${today}.${taskid}`] = val
}
}
// 设置任务
if (isset == 1) {
await G.mongodb.collection('event').updateOne({ uid: call.uid, type: this.dataType(hd.hdid) }, setData)
}
}
static async buy(player: playerInfo, payId: string, payArgs: any, call: ApiCall) {
let hd = await this.HdInfo(call);
if (!hd) { // 活动不存在
return
}
// 判断购买次数
let gift = hd.data.gift.filter(x => x.payId == payId)[0];
if (!gift) {
return
}
let mydata = await this.getMydata(call);
if (!mydata.giftbuy[gift.id]) {
mydata.giftbuy[gift.id] = { num: 0, select: [] };
}
let prize: atn[] = [];
if (mydata.giftbuy[gift.id].num + 1 > gift.buynum) {
let pay = G.gc.pay[payId];
prize.push({ a: "attr", t: "rmbmoney", n: pay.payExp[0].n })
} else {
prize = gift.prize;
for (let i = 0; i < gift.dlz.length; i++) {
if (!mydata.giftbuy[gift.id].select[i]) {
let ids = Object.keys(gift.dlz[i])
prize.push(gift.dlz[i][ids[0]]);
mydata.giftbuy[gift.id].select[i] = Number(ids[0]);
} else {
prize.push(gift.dlz[i][mydata.giftbuy[gift.id].select[i]]);
}
}
}
mydata.giftbuy[gift.id].num++;
await this.setMyData(call.uid, hd.hdid, { giftbuy: mydata.giftbuy });
}
}

View File

@ -16,14 +16,12 @@ import { player } from './shared/protocols/user/type';
import { PublicShared } from './shared/public/public';
import { setGud } from './public/gud';
import {checkResetBuyLog} from "./api_s2c/event/zhoumolibao/ApiOpen";
import {Christmasfun} from "./api_s2c/event/christmas/fun";
import {PushGiftFun} from "./public/pushgift";
import {LeiChongLiBaoBuyGift} from "./api_s2c/event/leichonglibao/ApiReceive";
import { HongDianChange } from './api_s2c/hongdian/fun';
import HQJGFun from './api_s2c/event/huangqijiuguan/fun';
export type gEventType = {
/**新的一天 */
NEW_DAY: (time: number) => void;
/**玩家断开连接 */
PLAYER_DISCONNECT: (uid: string) => void;
/**玩家修改名字 */
@ -154,8 +152,6 @@ export type gEventType = {
Class_task_157: (eventname, call, val, chkVal) => void;
/**今日参与{1}次抓娃娃小游戏 */
Class_task_158: (eventname, call, val, chkVal) => void;
/**黄旗酒馆累计抽卡X次*/
Class_task_159: (eventname, call, val, chkVal) => void;
};
export function addListener() {
@ -265,9 +261,4 @@ export function addListener() {
let call = PayFun.getCall(gud);
G.emit("Class_task_134", 'Class_task_134', call, 1, 0, items);
});
// 黄旗酒馆
G.on("NEW_DAY", HQJGFun.dayDpsLvPrize.bind(HQJGFun));
G.on("NEW_DAY", HQJGFun.endDpsRankPrize.bind(HQJGFun));
G.on("PLAYER_PAY", HQJGFun.buy.bind(HQJGFun));
}

View File

@ -800,8 +800,6 @@ type gc_npc = k_v<{
'ghname': string
/**npc名称 */
'npcname': string
/**怪物皮肤*/
'skin': number[]
}>;
type gc_openCond = k_v<{

View File

@ -27,44 +27,6 @@ export class SchedulerNewDayLocalCtor extends Scheduler {
async start() {
clusterRunOnce(async () => {
//这个定时器会被每个进程都启动这是这部分逻辑应该只执行1次
//重置所有的ActionLog
await ActionLog.initAllDayLog();
// 每周一,发放终身卡
(async () => {
if (PublicShared.getWeek(G.time) == 1) {
let logs = await G.mongodb.collection("payLogNew").find(
{ key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } }
).toArray();
if (logs.length == 0) {
console.log("没有终身卡数据,不发放终身卡");
}
let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0];
for (let i = 0; i < logs.length; i++) {
console.log("发放终身卡", logs[i].uid);
// 发送邮件
EmailFun.addEmail({
uid: logs[i].uid,
type: "system",
title: con.title,
content: con.content,
contentInsertArr: [],
createTime: G.time,
prize: con.prize,
})
}
}
})()
// 转点刷新事件
G.emit('NEW_DAY', G.time);
})
clusterRunOnce(async ()=>{
//这个定时器会被每个进程都启动这是这部分逻辑应该只执行1次

View File

@ -14,7 +14,6 @@ import { FunWeiXiuChang } from "./weixiuchang";
import {JJCFun} from "./jjc";
import {getGud} from "./gud";
import {Yuandanfun} from "../api_s2c/event/yuandan/fun";
import HQJGFun from "../api_s2c/event/huangqijiuguan/fun"
let _classNameFunc = {}
/**
@ -73,15 +72,13 @@ export module manager {
// 设置数据
async setVal(call: ApiCall, val: number, chkval, arg) {
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
TaskFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
// 养成目标任务计数
YangChengMuBiaofun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
YangChengMuBiaofun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
// 圣诞活动任务计数
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
Christmasfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
// 元旦活动任务计数
Yuandanfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
// 黄旗酒馆
HQJGFun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg);
Yuandanfun.setTaskVal(call, this.stype, val, this.chkCall, chkval, this.isinc, this.alchangeVal, arg)
}
// 任务数值, 和检测值,看情况需要上层复写
@ -836,11 +833,6 @@ export module manager {
}
}
// 第61个任务 黄旗酒馆累计抽卡X次
export class Class_task_159 extends BaseClass {
stype = 159
isinc = 1
}
}

View File

@ -121,7 +121,7 @@ export function createNpc(npcId: string | number, fixData: Partial<ResLogin['gud
isNpc: true
},
roles: Object.fromEntries(dataArr.map((d, i) => [i + 1, function () {
d['skin'] = (npcConf.skin?.[i] || '');
let { id, atk, def, mindps, maxdps, hp, speed, ...ops } = G.gc.armyattr[d.countId];
let buff = HeroShared.getHeroBasicAttr({ heroId: d.heroId, lv: d.lv });

View File

@ -1,11 +0,0 @@
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqGiftRec {
hdid: number
giftid: number
}
export interface ResGiftRec {
data: PlayerData
prize: { a: string, t: string, n: number }[]
}

View File

@ -1,11 +0,0 @@
import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqGiftSelect {
hdid: number
giftid: number
seletc: number[]
}
export interface ResGiftSelect {
data: PlayerData
}

View File

@ -2,7 +2,7 @@ import { PlayerData } from "../../../../api_s2c/event/huangqijiuguan/fun"
export interface ReqZhaoMuPrizeRec {
hdid: number
recid: { idx: number, sec: string }[]
recid: number[]
}
export interface ResZhaoMuPrizeRec {