Compare commits
12 Commits
5a3f489691
...
aab0951e6d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
aab0951e6d | ||
5dea65e51a | |||
0304c78991 | |||
![]() |
bfc1fb0c9c | ||
![]() |
96f8b26ce8 | ||
![]() |
582ac4f7e3 | ||
![]() |
dc50b71b01 | ||
![]() |
5fabfb2c5a | ||
![]() |
0f7c1db0a1 | ||
![]() |
8bc84b5816 | ||
![]() |
e9a2c50696 | ||
![]() |
dcea046183 |
12
oneKeyStartPm2.sh
Normal file
12
oneKeyStartPm2.sh
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
git fetch --all && git reset --hard origin/dev && git pull
|
||||
|
||||
npm run build_linux
|
||||
|
||||
cp src/config.json dist/
|
||||
|
||||
pm2 del heijiao_msg_s0
|
||||
|
||||
cd dist && pm2 start js_pm2.config.js
|
||||
|
||||
pm2 save
|
@ -8,17 +8,24 @@ import {PlayerFun} from "../../../public/player";
|
||||
export default async function (call: ApiCall<ReqGame, ResGame>) {
|
||||
let initCon = await Christmasfun.getCon(call)
|
||||
let need = initCon[call.req.hdid].data.gameneed;
|
||||
let freenum = initCon[call.req.hdid].data.gamefree
|
||||
let addval = initCon[call.req.hdid].data.game[call.req.index];
|
||||
// 判断消耗是否满足
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
// 扣除消耗
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
// 判断是否有免费配置
|
||||
if (_mydata.gamenum >= freenum) {
|
||||
// 判断消耗是否满足
|
||||
await PlayerFun.checkNeedIsMeet(call, need);
|
||||
// 扣除消耗
|
||||
await PlayerFun.cutNeed(call, need);
|
||||
}
|
||||
|
||||
let _setData = {}
|
||||
_mydata["val"] += addval
|
||||
_setData["val"] = _mydata["val"]
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData })
|
||||
_mydata["gamenum"] += 1
|
||||
_setData["val"] = _mydata.val
|
||||
_setData["game"] = _mydata["gamenum"]
|
||||
await Christmasfun.setMyData(call.uid, call.req.hdid, { $set: _setData})
|
||||
let changedata = { mydata: _mydata}
|
||||
// 推送红点
|
||||
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
|
||||
|
@ -22,13 +22,14 @@ export default async function (call: ApiCall<ReqLiBao, ResLiBao>) {
|
||||
// 判断是否能购买
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
const _select = _mydata.select[lbid] || {}
|
||||
if (Object.keys(_select).length >= _con.dlz.length) {
|
||||
let _select = _mydata.select[lbid] || {}
|
||||
if (Object.keys(_select).length < _con.dlz.length) {
|
||||
// 判断是否选择奖励了
|
||||
return call.error('', { code: -3, message: globalThis.lng.yangchengmubiao_2 })
|
||||
}
|
||||
|
||||
let _prize: atn[] = _con.prize
|
||||
let _prize: atn[] = _con.basep
|
||||
|
||||
for (let key in _select) {
|
||||
_prize.push(_con.dlz[parseInt(key)][_select[key]])
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
// 无此活动
|
||||
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
|
||||
}
|
||||
|
||||
let _mydata = await Christmasfun.getMyData(call, call.req.hdid)
|
||||
let changedata = { mydata: _mydata, hdinfo: _hdinfo }
|
||||
call.succ(changedata);
|
||||
|
@ -17,7 +17,7 @@ export default async function (call: ApiCall<ReqQianDao, ResQianDao>) {
|
||||
for(let i = 0; i < _diff; i++) {
|
||||
if (_mydata.qiandao.includes(i)) continue
|
||||
_mydata.qiandao.push(i)
|
||||
_prize.push(_con[i])
|
||||
_prize = _prize.concat(_con[i])
|
||||
}
|
||||
|
||||
if (!_prize){
|
||||
|
@ -20,12 +20,14 @@ export default async function (call: ApiCall<ReqZhanLingRec, ResZhanLingRec>) {
|
||||
|
||||
if (!_mydata.pt.includes(index)){
|
||||
// 如果普通奖励没有领取
|
||||
_prize.push(_con.pt)
|
||||
|
||||
_prize = _prize.concat(_con.pt)
|
||||
_mydata.pt.push(index)
|
||||
}
|
||||
if (_mydata.pay && !_mydata.gj.includes(index)){
|
||||
// 如果普通奖励没有领取
|
||||
_prize.push(_con.gj)
|
||||
_prize = _prize.concat(_con.gj)
|
||||
|
||||
_mydata.gj.push(index)
|
||||
}
|
||||
if (!_prize) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { strict } from 'assert';
|
||||
import { ApiCall } from 'tsrpc';
|
||||
import {ApiCall, BaseConnection} from 'tsrpc';
|
||||
import { ReqAddHuoDong } from '../../../monopoly/protocols/PtlAddHuoDong';
|
||||
import { HuoDongFun } from '../../../public/huodongfun';
|
||||
import { TaskFun } from '../../../public/task';
|
||||
import { christmas } from '../../../shared/protocols/event/christmas/PtlOpen';
|
||||
import { PublicShared } from '../../../shared/public/public';
|
||||
|
||||
import {player} from '../../../shared/protocols/user/type';
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
|
||||
export class Christmasfun {
|
||||
/**配置 */
|
||||
@ -61,6 +62,7 @@ export class Christmasfun {
|
||||
taskval: await this.getTaskVal(call, hdid),
|
||||
taskfinish: [],
|
||||
refresh: G.time,
|
||||
gamenum: 0,
|
||||
pt: [],
|
||||
gj: [],
|
||||
pay: false,
|
||||
@ -110,24 +112,54 @@ export class Christmasfun {
|
||||
mydata.taskfinish = []
|
||||
mydata.taskval = await this.getTaskVal(call, hdid)
|
||||
mydata.refresh = G.time
|
||||
await this.setMyData(call.uid, hdid, { $set: { refresh: mydata.refresh, taskfinish: mydata.taskfinish, taskval: mydata.taskval } })
|
||||
mydata.gamenum = 0
|
||||
await this.setMyData(call.uid, hdid, { $set: { refresh: mydata.refresh, taskfinish: mydata.taskfinish, taskval: mydata.taskval, gamenum: mydata.gamenum} })
|
||||
return mydata
|
||||
}
|
||||
|
||||
static async payChristmas(payid, call: ApiCall) {
|
||||
let _hd = await HuoDongFun.gethdList(call, 8)
|
||||
for (let index = 0; index < _hd.length; index++) {
|
||||
const hdinfo = _hd[index];
|
||||
const _hdid = hdinfo.hdid
|
||||
if (payid == hdinfo.data.zlpayid){
|
||||
let _mydata = await Christmasfun.getMyData(call, _hdid)
|
||||
if (_mydata.pay) continue
|
||||
await this.setMyData(call.uid, _hdid, { $set: { pay: true} })
|
||||
let _prize = hdinfo.data.zlpayprize
|
||||
await PlayerFun.sendPrize(call, _prize);
|
||||
}
|
||||
else{
|
||||
const libaos = hdinfo.data.libao
|
||||
for (let index = 0; index < Object.keys(libaos).length; index++){
|
||||
const lbid = Object.keys(libaos)[index];
|
||||
let _tmp = libaos[lbid]
|
||||
if (_tmp['payid'] != payid) continue
|
||||
let _mydata = await Christmasfun.getMyData(call, _hdid)
|
||||
let _buyNum = _mydata.libao[lbid] || 0
|
||||
if (_buyNum >= _tmp["buynum"]) continue
|
||||
_mydata.libao[lbid] = _buyNum + 1
|
||||
this.setMyData(call.uid, _hdid, { $set: { libao: _mydata.libao} })
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**设置任务 */
|
||||
static async setTaskVal(call: ApiCall, stype: number, val: number, chkCall: Function, chkval: number = 0, isinc: number = 0, alchangeVal: Function, arg) {
|
||||
let hdids = await this.gethdids(call)
|
||||
if (hdids.length <= 0) return // 活动过期,不计数
|
||||
let _initCon = await this.getCon(call)
|
||||
|
||||
|
||||
|
||||
for (let index = 0; index < hdids.length; index++) {
|
||||
const hdid = hdids[index];
|
||||
let _mydata = await Christmasfun.getMyData(call, hdid)
|
||||
let _tasks = _initCon[hdid].data.task
|
||||
|
||||
let _setData = {
|
||||
let _setData= {
|
||||
$inc: {},
|
||||
$set: {}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import {ApiCall} from "tsrpc";
|
||||
import {ReqReceive, ResReceive} from "../../../shared/protocols/event/zhoumolibao/PtlReceive";
|
||||
import {HuoDongFun} from "../../../public/huodongfun";
|
||||
import {PlayerFun} from "../../../public/player";
|
||||
import {HongDianChange} from "../../hongdian/fun";
|
||||
|
||||
export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
// 查询活动是否有当前领奖的免费选项
|
||||
@ -18,7 +19,9 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
|
||||
|
||||
await G.mongodb.cEvent('zhoumolibao').updateOne({uid: call.uid, type: 'zhoumolibao'}, {
|
||||
$inc: {[`record.${gift.id}`]: 1},
|
||||
},{ upsert: true })
|
||||
}, {upsert: true})
|
||||
|
||||
call.succ({})
|
||||
|
||||
HongDianChange.sendChangeKey(call.uid, ['zhoumolibao']);
|
||||
}
|
||||
|
@ -1,25 +1,25 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { DiXiaQianZhuangFun } from "../../public/dixiaqianzhuang";
|
||||
import { DxltFun } from "../../public/dxlt";
|
||||
import { GongHuiFun } from "../../public/gonghui/gonghui";
|
||||
import { JJCFun } from "../../public/jjc";
|
||||
import { KuangDongfun } from "../../public/kuangdong";
|
||||
import { LingZhuLaiXifun } from "../../public/lingzhulaixi";
|
||||
import { SignFun } from "../../public/sign";
|
||||
import { TaskFun } from "../../public/task";
|
||||
import { WangZheRongYaofun } from "../../public/wzry";
|
||||
import { XstaskFun } from "../../public/xstask";
|
||||
import { ReqGet, ResGet, hongdianKey } from "../../shared/protocols/hongdian/PtlGet";
|
||||
import { PublicShared } from '../../shared/public/public';
|
||||
import { getShouChongRedPoint } from '../event/shouchong/ApiReceive';
|
||||
import { md_redPoint } from '../gongyu/mingdao/ApiOpen';
|
||||
import { HongDianFun, HuoDongHongDianFun } from "./fun";
|
||||
import { FunWeiXiuChang } from "../../public/weixiuchang";
|
||||
import {ApiCall} from "tsrpc";
|
||||
import {DiXiaQianZhuangFun} from "../../public/dixiaqianzhuang";
|
||||
import {DxltFun} from "../../public/dxlt";
|
||||
import {GongHuiFun} from "../../public/gonghui/gonghui";
|
||||
import {JJCFun} from "../../public/jjc";
|
||||
import {KuangDongfun} from "../../public/kuangdong";
|
||||
import {LingZhuLaiXifun} from "../../public/lingzhulaixi";
|
||||
import {SignFun} from "../../public/sign";
|
||||
import {TaskFun} from "../../public/task";
|
||||
import {WangZheRongYaofun} from "../../public/wzry";
|
||||
import {XstaskFun} from "../../public/xstask";
|
||||
import {ReqGet, ResGet, hongdianKey} from "../../shared/protocols/hongdian/PtlGet";
|
||||
import {PublicShared} from '../../shared/public/public';
|
||||
import {getShouChongRedPoint} from '../event/shouchong/ApiReceive';
|
||||
import {md_redPoint} from '../gongyu/mingdao/ApiOpen';
|
||||
import {HongDianFun, HuoDongHongDianFun} from "./fun";
|
||||
import {FunWeiXiuChang} from "../../public/weixiuchang";
|
||||
|
||||
const defaultKeys: hongdianKey[] = ['jiuba', 'jiaotang', 'shouchong', 'clslhd', 'dixiaqianzhuanghd', 'gonghuihd', 'hbzbhd', 'jjchd', 'taskhd',
|
||||
'xstaskhd', 'lingzhulaixihd', 'dxlthd', 'wzcjhd', 'slzdhd', 'qjzzdhd', 'kuangdonghd', 'qiandaohd', 'kaifukuanghuanhd', 'jijinhd', 'zhuishalinghd',
|
||||
'yibaichouhd', 'huobanzhaomuhd', 'qirileichonghd', 'jierihd', 'kbzzhd', 'wzryhd', 'yuedujijin', 'mingdao', 'patahd',
|
||||
'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai'];
|
||||
'heishihd', 'huodonghd', 'renown', 'weixiuchang', 'kaifujingsai', 'zhoumolibao'];
|
||||
|
||||
export default async function (call: ApiCall<ReqGet, ResGet>) {
|
||||
|
||||
@ -28,13 +28,13 @@ export default async function (call: ApiCall<ReqGet, ResGet>) {
|
||||
let toDayZeroTime = PublicShared.getToDayZeroTime();
|
||||
|
||||
//正常跑完引导的等级
|
||||
if(call.conn.gud.lv >= 7){
|
||||
if (call.conn.gud.lv >= 7) {
|
||||
for (let key of keys) {
|
||||
switch (key) {
|
||||
case 'jiuba':
|
||||
case 'jiaotang':
|
||||
let db = await G.mongodb.collection('playerInfo', key).findOne({ uid: call.uid, type: key });
|
||||
res[key] = { show: (!db || toDayZeroTime >= db.freeTime) ? true : false };
|
||||
let db = await G.mongodb.collection('playerInfo', key).findOne({uid: call.uid, type: key});
|
||||
res[key] = {show: (!db || toDayZeroTime >= db.freeTime) ? true : false};
|
||||
break;
|
||||
case 'shouchong':
|
||||
res[key] = await getShouChongRedPoint(call);
|
||||
@ -160,6 +160,9 @@ export default async function (call: ApiCall<ReqGet, ResGet>) {
|
||||
case 'kaifujingsai':
|
||||
res[key] = await HongDianFun.kaifujingsai(call);
|
||||
break;
|
||||
case 'zhoumolibao':
|
||||
res[key] = await HongDianFun.zhoumolibao(call);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ import {PlayerFun} from "../../public/player";
|
||||
import kfjsFun from "../../public/kaifujingsai";
|
||||
import {RankKfjs} from "../../public/rank/rank_kfjs";
|
||||
import {ShopFun} from "../../public/shop";
|
||||
import { Christmasfun } from '../event/christmas/fun';
|
||||
import {Christmasfun} from '../event/christmas/fun';
|
||||
|
||||
export class HongDianFun {
|
||||
/**黑榜争霸红点 */
|
||||
@ -301,6 +301,18 @@ export class HongDianFun {
|
||||
return {show: true, val: canGet}
|
||||
}
|
||||
|
||||
/**周末礼包 */
|
||||
static async zhoumolibao(call: ApiCall): Promise<hongdianVal> {
|
||||
let _hd = (await HuoDongFun.gethdList(call, 9))[0]
|
||||
let gift = _hd?.data?.gift?.find(i => i.free)
|
||||
if (!gift) return {show: false}
|
||||
|
||||
let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
|
||||
let rec = data?.record?.[gift.id]
|
||||
if (rec && rec >= gift?.buyNum) return {show: false}
|
||||
return {show: true}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -708,10 +720,11 @@ export class HuoDongHongDianFun {
|
||||
if (_buyNum < _tmp.buynum) {
|
||||
_res.show = true;
|
||||
return _res;
|
||||
}}
|
||||
}
|
||||
}
|
||||
let _diff = PublicShared.getDiff(stime)
|
||||
// 循环判断是否有可以领取的
|
||||
for(let i = 0; i < _diff; i++) {
|
||||
for (let i = 0; i < _diff; i++) {
|
||||
if (_mydata.qiandao.includes(i)) continue
|
||||
_res.show = true;
|
||||
return _res;
|
||||
@ -724,15 +737,15 @@ export class HuoDongHongDianFun {
|
||||
return _res;
|
||||
}
|
||||
let zhanling = _hdCon.zhanling
|
||||
for (let indexzhanling = 0; indexzhanling < zhanling.length; indexzhanling++){
|
||||
if (!_mydata.pt.includes(indexzhanling)){
|
||||
for (let indexzhanling = 0; indexzhanling < zhanling.length; indexzhanling++) {
|
||||
if (!_mydata.pt.includes(indexzhanling)) {
|
||||
_res.show = true;
|
||||
return _res;
|
||||
}
|
||||
if (_mydata.pay && !_mydata.gj.includes(indexzhanling)){
|
||||
_res.show = true;
|
||||
if (_mydata.pay && !_mydata.gj.includes(indexzhanling)) {
|
||||
_res.show = true;
|
||||
return _res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _res;
|
||||
|
@ -16,6 +16,7 @@ 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";
|
||||
|
||||
export type gEventType = {
|
||||
/**玩家断开连接 */
|
||||
@ -23,7 +24,7 @@ export type gEventType = {
|
||||
/**玩家修改名字 */
|
||||
PLAYER_CHANGE_NAME: (gud: player, name: string) => void;
|
||||
/**玩家充值 */
|
||||
PLAYER_PAY: (gud: player, payId: string, type: 'user' | 'system') => void;
|
||||
PLAYER_PAY: (gud: player, payId: string, type: 'user' | 'system', call) => void;
|
||||
/**玩家发生api调用 */
|
||||
API_CALL: (node: { call: ApiCall, return: ApiReturn<any>; }) => void;
|
||||
/**玩家每日首次登陆 */
|
||||
@ -166,13 +167,14 @@ export function addListener() {
|
||||
}
|
||||
});
|
||||
|
||||
G.on('PLAYER_PAY', async (player, payId, payArgs) => {
|
||||
G.on('PLAYER_PAY', async (player, payId, payArgs,call) => {
|
||||
let conf: any = await PayFun.getConf(payId, payArgs);
|
||||
ActionLog.addDayLog(player.uid, { key: 'pay', val: conf.payExp[0].n });
|
||||
ActionLog.addRetainLog(player.uid, { key: 'pay', val: conf.payExp[0].n });
|
||||
|
||||
if (payId == G.gc.zhanling.payId) payZhanLing(player);
|
||||
|
||||
//圣诞节活动充值
|
||||
Christmasfun.payChristmas(payId, call);
|
||||
let payEmailConf = G.gc.payEmail[payId] as _gcType['payEmail']['caifutequan'];
|
||||
if (payEmailConf?.length > 0) {
|
||||
let sendEmailConfs = payEmailConf;
|
||||
@ -202,18 +204,17 @@ export function addListener() {
|
||||
ActionLog.addRetainLog(gud.uid, { key: 'login_day', val: 1 });
|
||||
ZhanLingTasks.clearLog(gud.uid, 'day');
|
||||
PayFun.checkGiftDayEmail(gud, lastTime, curTime);
|
||||
|
||||
reissuePrize(gud, lastTime, curTime);
|
||||
addDay(gud);
|
||||
|
||||
// 任务累计登录天数
|
||||
let call = PayFun.getCall(gud);
|
||||
|
||||
G.emit("Class_task_135", 'Class_task_135', call, 1, 0);
|
||||
// 七日登录活动计数
|
||||
qiRiDengLuAddDay(call);
|
||||
// 周末礼包检测刷新
|
||||
checkResetBuyLog(call)
|
||||
checkResetBuyLog(call);
|
||||
|
||||
});
|
||||
|
||||
G.on('API_CALL', node => {
|
||||
|
@ -5,7 +5,7 @@ export default {
|
||||
/**是否开发模式 */
|
||||
debug: true,
|
||||
/**消息服socket端口*/
|
||||
msgPort: 7778,
|
||||
msgPort: 7785,
|
||||
/**http端口 msg服专用*/
|
||||
// httpPort: 7779,
|
||||
/**跨服socket端口 */
|
||||
@ -13,7 +13,7 @@ export default {
|
||||
/**跨服 ws url */
|
||||
corssWsUrl: "ws://10.0.1.20:10003",
|
||||
/**服务器id */
|
||||
serverId: 0,
|
||||
serverId: 1001,
|
||||
/**redis url */
|
||||
redisUrl: 'redis://:lyMaple525458@10.0.1.20:6379/0',
|
||||
/**mongodb url */
|
||||
@ -27,7 +27,7 @@ export default {
|
||||
/**服务器时间 */
|
||||
time: '',
|
||||
/**开服时间 */
|
||||
openTime: '2022-10-10 1:0:0',
|
||||
openTime: '2023-12-11 1:0:0',
|
||||
/**项目名称 */
|
||||
projectName: 'heijiao',
|
||||
/**加密key */
|
||||
|
@ -7,16 +7,43 @@ import {HeroShared} from '../shared/public/hero';
|
||||
import {PlayerShared} from '../shared/public/player';
|
||||
import {HeroFun} from './hero';
|
||||
import {UserFun} from './user';
|
||||
import {re} from "mathjs";
|
||||
import {re, string} from "mathjs";
|
||||
import {getGud} from './gud';
|
||||
import {PushGiftFun} from "./pushgift";
|
||||
|
||||
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross';
|
||||
|
||||
|
||||
let fights:{[key:string]:FightControl} = {
|
||||
|
||||
};
|
||||
function clearFights (){
|
||||
//定时清理战斗
|
||||
setInterval(()=>{
|
||||
let now = Date.now();
|
||||
for (let key in fights){
|
||||
if (now - fights[key].startTime > 30000){
|
||||
console.log("清理战斗",key);
|
||||
try{
|
||||
fights[key].release();
|
||||
}catch(e){
|
||||
console.error(e);
|
||||
}
|
||||
delete fights[key];
|
||||
}
|
||||
}
|
||||
},5000);
|
||||
}
|
||||
clearFights();
|
||||
|
||||
export class FightFun {
|
||||
static fightIndex:number = 0;
|
||||
|
||||
static fight(data: joinFightData[], maxRoundNums = 30, fightType: "pvp" | "pve" = 'pvp') {
|
||||
return new FightControl(data, maxRoundNums, fightType).getResult();
|
||||
this.fightIndex++;
|
||||
fights[this.fightIndex] = new FightControl(data, maxRoundNums, fightType);
|
||||
|
||||
return fights[this.fightIndex].getResult();
|
||||
}
|
||||
|
||||
/**获取玩家数据 */
|
||||
|
@ -271,7 +271,7 @@ export class PayFun {
|
||||
}
|
||||
});
|
||||
|
||||
G.emit('PLAYER_PAY', player, payId, payArgs);
|
||||
G.emit('PLAYER_PAY', player, payId, payArgs, call);
|
||||
G.emit("Class_task_116", 'Class_task_116', call, 1, 0);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import * as BuffClass from './fightBuff/buffExtends';
|
||||
import { FightControl } from "./fightCntrol";
|
||||
import { getSkillConf, randNumber, randomSkill } from "./fightFun";
|
||||
import { buffDataType, dpsinfoType, joinFightData, modifyHpType, roleDataType } from "./fightType";
|
||||
import { PassiveSkillBase } from "./passiveSkill/passiveSkillBase";
|
||||
import { runPassiveSkillBase } from "./passiveSkill/runPassiveSkill";
|
||||
import { SkillBase } from "./skill/skillBase";
|
||||
|
||||
@ -24,6 +25,23 @@ export class Player {
|
||||
get lockHp() { return false; }
|
||||
get rolePlayer() { return this }
|
||||
|
||||
release(){
|
||||
for(let buffid in this.buffs){
|
||||
this.buffs[buffid].release();
|
||||
}
|
||||
for(let passiveid in this.passiveSkills){
|
||||
this.passiveSkills[passiveid].release();
|
||||
}
|
||||
this.curAtkSkill?.release();
|
||||
this.curAtkSkill = null;
|
||||
this.skillTargets = null;
|
||||
this.lastSkillTargets = null;
|
||||
this.lastSkillId = null;
|
||||
this.lastHitMe = null;
|
||||
this.buffs = null;
|
||||
this.passiveSkills = null;
|
||||
}
|
||||
|
||||
skillIdx = 0;
|
||||
skillLv = 1;
|
||||
hudunzhi = 0;
|
||||
|
@ -20,6 +20,7 @@ import {
|
||||
import {runPassiveSkillBase} from "./passiveSkill/runPassiveSkill";
|
||||
import {SkillBase} from "./skill/skillBase";
|
||||
import { PublicShared } from "../public/public";
|
||||
import { PassiveSkillBase } from "./passiveSkill/passiveSkillBase";
|
||||
|
||||
export class Role {
|
||||
rid: string;
|
||||
@ -37,6 +38,23 @@ export class Role {
|
||||
hudunzhi = 0;
|
||||
addpkNum = 0;
|
||||
|
||||
release(){
|
||||
for(let buffid in this.buffs){
|
||||
this.buffs[buffid].release();
|
||||
}
|
||||
for(let passiveid in this.passiveSkills){
|
||||
this.passiveSkills[passiveid].release();
|
||||
}
|
||||
this.curAtkSkill?.release();
|
||||
this.curAtkSkill = null;
|
||||
this.skillTargets = null;
|
||||
this.lastSkillTargets = null;
|
||||
this.lastSkillId = null;
|
||||
this._lastHitMe = null;
|
||||
this.buffs = null;
|
||||
this.passiveSkills = null;
|
||||
}
|
||||
|
||||
get skillId() {
|
||||
let heroId = this.roleData.heroId;
|
||||
let jieji = this.roleData.jieji || 0;
|
||||
@ -102,6 +120,8 @@ export class Role {
|
||||
// fromRole行动的角色
|
||||
// skillConf 使用的技能
|
||||
// toRole 目标
|
||||
//上一个指针release
|
||||
this.curAtkSkill?.release();
|
||||
this.curAtkSkill = this.runSkillClass();
|
||||
this.bloodReturn();
|
||||
this.debug(() => {
|
||||
|
@ -17,6 +17,13 @@ export class BuffBase {
|
||||
this._BuffId = 'BuffId_' + idx;
|
||||
this.startRound = this.role.fightControl.roundNums;
|
||||
}
|
||||
|
||||
release(){
|
||||
this.clear('release');
|
||||
this.altAttr = null;
|
||||
this.role = null;
|
||||
}
|
||||
|
||||
start() {
|
||||
let skillConf = this.data.skillConf;
|
||||
this.remainingRounds = skillConf.round;
|
||||
@ -119,17 +126,19 @@ export class BuffBase {
|
||||
buffType = Object.keys(this.data.skillConf.xiaoguocanshu).join(',');
|
||||
}
|
||||
// 字符串以逗号分隔转换为数组
|
||||
let buffTypeArr = buffType.split(',')
|
||||
buffTypeArr.forEach(buffTypeStr => {
|
||||
this.role.fightControl.record({
|
||||
act: 'delBuff',
|
||||
fromRole: this.role.rid,
|
||||
skillId: this.data.buffid,
|
||||
buffType: buffTypeStr,
|
||||
buffId: this._BuffId,
|
||||
why: when
|
||||
});
|
||||
})
|
||||
if(when != "release"){
|
||||
let buffTypeArr = buffType.split(',')
|
||||
buffTypeArr.forEach(buffTypeStr => {
|
||||
this.role.fightControl.record({
|
||||
act: 'delBuff',
|
||||
fromRole: this.role.rid,
|
||||
skillId: this.data.buffid,
|
||||
buffType: buffTypeStr,
|
||||
buffId: this._BuffId,
|
||||
why: when
|
||||
});
|
||||
})
|
||||
}
|
||||
this.willClear();
|
||||
// this.role.fightControl.event.emit('fight_buffClear', this.data);
|
||||
let buffid = this.data.buffid;
|
||||
|
@ -6,9 +6,10 @@ import { Player } from "./Player";
|
||||
import { Role } from "./Role";
|
||||
|
||||
export class FightControl {
|
||||
//所有战斗成员
|
||||
startTime: number = Date.now();
|
||||
//所有战斗成员,包含双方的所有“伙伴”
|
||||
fightRoles: k_v<Role> = {};
|
||||
|
||||
//所有战斗对象,包含了双方的“伙伴”和“主角”
|
||||
fightRolesArr: FightObj[] = [];
|
||||
fightOver = false;
|
||||
roundNums = 0;
|
||||
@ -18,6 +19,7 @@ export class FightControl {
|
||||
initial: joinFightData[];
|
||||
winSide: number;
|
||||
totalDamage = { "0": 0, "1": 0 };
|
||||
//战斗统计
|
||||
fightStatistics: { [k: string]: { [k: string]: number; }; } = {};
|
||||
player_0: FightObj = null;
|
||||
player_1: FightObj = null;
|
||||
@ -29,6 +31,26 @@ export class FightControl {
|
||||
this.startTurnRound();
|
||||
}
|
||||
|
||||
/**
|
||||
* 释放内存资源
|
||||
*/
|
||||
release(){
|
||||
this.fightRolesArr.map( obj =>{
|
||||
obj?.release();
|
||||
});
|
||||
this.fightRoles = null;
|
||||
this.fightRolesArr = null;
|
||||
this.recordData = null;
|
||||
this.event.removeAllListeners();
|
||||
this.event = null;
|
||||
this.initial = null;
|
||||
this.fightStatistics = null;
|
||||
this.player_0 = null;
|
||||
this.player_1 = null;
|
||||
this.recordSkillDps = null;
|
||||
this.DATA = null;
|
||||
}
|
||||
|
||||
initControl() {
|
||||
// this.event.setMaxListeners(1000);
|
||||
}
|
||||
|
@ -103,6 +103,11 @@ export class PassiveSkillBase {
|
||||
this._passiveId = 'passiveSkill_' + idx;
|
||||
this.skillConf = this.skillInfo.skillConf;
|
||||
}
|
||||
release(){
|
||||
this.clear('release');
|
||||
this.skillConf = null;
|
||||
this._timers = null;
|
||||
}
|
||||
|
||||
start() {
|
||||
this._initEvent();
|
||||
@ -112,10 +117,10 @@ export class PassiveSkillBase {
|
||||
_initEvent() {
|
||||
let _when = this.skillConf.chkdata.when;
|
||||
let toRole = this.skillInfo.toRole;
|
||||
if (_when == 'ontime') {
|
||||
//定时触发 或者 频率触发
|
||||
this._whenOntime();
|
||||
} else {
|
||||
// if (_when == 'ontime') {
|
||||
// //定时触发 或者 频率触发
|
||||
// this._whenOntime();
|
||||
// } else {
|
||||
this._checkFunc = (emitData) => {
|
||||
toRole.debug(() => {
|
||||
console.log('### passiveskill checkEmit', 'fightEvent_' + _when, this.skillConf.skillid);
|
||||
@ -123,7 +128,7 @@ export class PassiveSkillBase {
|
||||
this.checkEmit(emitData);
|
||||
};
|
||||
toRole.fightControl.event.on('fightEvent_' + _when, this._checkFunc.bind(this), this);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
checkEmit(emitData: EmitDataType) {
|
||||
@ -161,21 +166,22 @@ export class PassiveSkillBase {
|
||||
this.remainingRounds--;
|
||||
}
|
||||
|
||||
_whenOntime() {
|
||||
let time = this.skillConf.chkdata.time;
|
||||
if (!time) return;
|
||||
this._timers.push(setTimeout(() => {
|
||||
this.doAtk();
|
||||
}, time));
|
||||
}
|
||||
//不能也不应该有这样的逻辑,这是个回合制游戏!
|
||||
// _whenOntime() {
|
||||
// let time = this.skillConf.chkdata.time;
|
||||
// if (!time) return;
|
||||
// this._timers.push(setTimeout(() => {
|
||||
// this.doAtk();
|
||||
// }, time));
|
||||
// }
|
||||
|
||||
_doNextOntime() {
|
||||
let pinlvtime = this.skillConf.chkdata.pinlvtime;
|
||||
if (!pinlvtime) return;
|
||||
this._timers.push(setTimeout(() => {
|
||||
this.doAtk();
|
||||
}, pinlvtime));
|
||||
}
|
||||
// _doNextOntime() {
|
||||
// let pinlvtime = this.skillConf.chkdata.pinlvtime;
|
||||
// if (!pinlvtime) return;
|
||||
// this._timers.push(setTimeout(() => {
|
||||
// this.doAtk();
|
||||
// }, pinlvtime));
|
||||
// }
|
||||
|
||||
/** 清除执行次数限制的被动 */
|
||||
_clearOnceSkill() {
|
||||
@ -188,7 +194,7 @@ export class PassiveSkillBase {
|
||||
doAtk(emitData?: EmitDataType) {
|
||||
this._triggerCount++;
|
||||
this._clearOnceSkill();
|
||||
this._doNextOntime();
|
||||
//this._doNextOntime();
|
||||
}
|
||||
|
||||
clear(why: string) {
|
||||
|
@ -11,6 +11,11 @@ export class SkillBase {
|
||||
this.checkAtk();
|
||||
}
|
||||
|
||||
release(){
|
||||
this.clear();
|
||||
this.toRole = null;
|
||||
}
|
||||
|
||||
onRoleClear(why?: string) {
|
||||
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ export type christmas = {
|
||||
taskval: { [id: string]: number }
|
||||
/**任务领取标识 */
|
||||
taskfinish: string[]
|
||||
/**小游戏挑战次数 */
|
||||
gamenum: number
|
||||
/**普通战令奖励集合 奖励id */
|
||||
pt: number[]
|
||||
/**高级战令奖励集合 奖励id */
|
||||
@ -36,7 +38,7 @@ export type christmas = {
|
||||
/**装扮值 */
|
||||
val: number
|
||||
/**签到标识 */
|
||||
qiandao:string[],
|
||||
qiandao:number[],
|
||||
/**刷新时间 */
|
||||
refresh: number
|
||||
}
|
@ -2,11 +2,11 @@
|
||||
"hdid" : 91029302193,
|
||||
"htype" : 8,
|
||||
"stype" : 800,
|
||||
"ttype" : 1,
|
||||
"stime" : 60,
|
||||
"rtime" : 90,
|
||||
"etime" : 90,
|
||||
"name" : "xinfupeiyang",
|
||||
"ttype" : 0,
|
||||
"stime" : 1702396800,
|
||||
"rtime" : 1703088000,
|
||||
"etime" : 1703088000,
|
||||
"name" : "christmas",
|
||||
"icon" : "icon_xfdj",
|
||||
"showtime" : "根据玩家注册时间,游戏返回时复写",
|
||||
"data" : {
|
||||
@ -52,24 +52,51 @@
|
||||
}
|
||||
},
|
||||
"gameneed": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"game": [0,1,2,3,4,5],
|
||||
"zhanling":[
|
||||
{
|
||||
"val": 1,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 2,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 3,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
}
|
||||
],
|
||||
"game": [0,1, 2, 3, 4, 5],
|
||||
"gamefree": 3,
|
||||
"zhanling":[{
|
||||
"val": 1,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 2,
|
||||
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
|
||||
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 3,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},{
|
||||
"val": 4,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 5,
|
||||
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
|
||||
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 6,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},{
|
||||
"val": 7,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 8,
|
||||
"pt": [{"a": "attr", "t":"rmbmoney", "n": 100}],
|
||||
"gj": [{"a": "attr", "t":"rmbmoney", "n": 100},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
},
|
||||
{
|
||||
"val": 9,
|
||||
"pt": [{"a": "attr", "t":"jinbi", "n": 1}],
|
||||
"gj": [{"a": "attr", "t":"jinbi", "n": 1},{"a": "attr", "t":"jinbi", "n": 1}]
|
||||
}],
|
||||
"zlpayid":"ycmb_1_1",
|
||||
"libao": {
|
||||
"1": {
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
/**
|
||||
* 获取红点
|
||||
*/
|
||||
@ -13,10 +11,47 @@ export const conf = {
|
||||
timeIntervalLimit: 0
|
||||
};
|
||||
|
||||
export type hongdianKey = 'jiuba' | 'jiaotang' | 'shouchong' | 'dixiaqianzhuanghd' | 'taskhd' | 'xstaskhd' | 'gonghuihd' | 'jjchd' | 'hbzbhd' |
|
||||
'clslhd' | 'lingzhulaixihd' | 'dxlthd' | 'wzcjhd' | 'slzdhd' | 'qjzzdhd' | 'kuangdonghd' | 'qiandaohd' | 'kaifukuanghuanhd' | 'jijinhd' | 'zhuishalinghd' |
|
||||
'yibaichouhd' | 'huobanzhaomuhd' | 'qirileichonghd' | 'jierihd' | 'kbzzhd' | 'wzryhd' | 'yuedujijin' | 'patahd' |
|
||||
'mingdao' | 'heishihd' |'jitianhaoli'| 'huodonghd' | 'renown' | 'heishiMrjx' | 'weixiuchang' | 'kaifujingsai';
|
||||
export type hongdianKey =
|
||||
'jiuba'
|
||||
| 'jiaotang'
|
||||
| 'shouchong'
|
||||
| 'dixiaqianzhuanghd'
|
||||
| 'taskhd'
|
||||
| 'xstaskhd'
|
||||
| 'gonghuihd'
|
||||
| 'jjchd'
|
||||
| 'hbzbhd'
|
||||
|
|
||||
'clslhd'
|
||||
| 'lingzhulaixihd'
|
||||
| 'dxlthd'
|
||||
| 'wzcjhd'
|
||||
| 'slzdhd'
|
||||
| 'qjzzdhd'
|
||||
| 'kuangdonghd'
|
||||
| 'qiandaohd'
|
||||
| 'kaifukuanghuanhd'
|
||||
| 'jijinhd'
|
||||
| 'zhuishalinghd'
|
||||
|
|
||||
'yibaichouhd'
|
||||
| 'huobanzhaomuhd'
|
||||
| 'qirileichonghd'
|
||||
| 'jierihd'
|
||||
| 'kbzzhd'
|
||||
| 'wzryhd'
|
||||
| 'yuedujijin'
|
||||
| 'patahd'
|
||||
|
|
||||
'mingdao'
|
||||
| 'heishihd'
|
||||
| 'jitianhaoli'
|
||||
| 'huodonghd'
|
||||
| 'renown'
|
||||
| 'heishiMrjx'
|
||||
| 'weixiuchang'
|
||||
| 'kaifujingsai'
|
||||
| 'zhoumolibao';
|
||||
|
||||
|
||||
export type hongdianVal = {
|
||||
|
@ -8652,6 +8652,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"name": "gamenum",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"name": "pt",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
@ -8661,7 +8668,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"name": "gj",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
@ -8671,14 +8678,14 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"name": "pay",
|
||||
"type": {
|
||||
"type": "Boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"name": "libao",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
@ -8691,7 +8698,7 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"name": "select",
|
||||
"type": {
|
||||
"type": "Interface",
|
||||
@ -8710,24 +8717,24 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"id": 11,
|
||||
"name": "val",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"id": 12,
|
||||
"name": "qiandao",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
"elementType": {
|
||||
"type": "String"
|
||||
"type": "Number"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"id": 13,
|
||||
"name": "refresh",
|
||||
"type": {
|
||||
"type": "Number"
|
||||
@ -14904,6 +14911,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"type": "Literal",
|
||||
"literal": "kaifujingsai"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 36,
|
||||
"type": {
|
||||
"type": "Literal",
|
||||
"literal": "zhoumolibao"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user