Giter Site home page Giter Site logo

撤退胜利科技示例 about anyproxy-fgo-rule HOT 7 OPEN

attt avatar attt commented on June 8, 2024 2
撤退胜利科技示例

from anyproxy-fgo-rule.

Comments (7)

ZizhuoWang avatar ZizhuoWang commented on June 8, 2024

fork出去可能没人看得到,所以发在这里吧。
改request比改response简单很多。
elapsedTurn我这个基本没做处理,这个数值我觉得可能不是越大越好。通关时间短,elapsedTurn却很大,反而容易被怀疑。
有一些关卡敌人打不死,这里直接清空了aliveUniqueIds不知道会有什么后果。
开挂本就逆天而行,被封号也很正常.jpg😂😂😂

from anyproxy-fgo-rule.

ZizhuoWang avatar ZizhuoWang commented on June 8, 2024

你要替换成“xx科技,xx元/月,唯一QQ群xxx”这样的图片吧。。。
我对此没啥感想其实😂只是说着玩
你这个科技跟老铁,以及影之国群里那个差不多啊,都是用ss或者ssr,难道他们没告诉你怎么放?
其实不用那么麻烦,你只需要把这个请求替换成你的图床里的图片的链接就行。不一定要改response,改request效果一样。

from anyproxy-fgo-rule.

ZizhuoWang avatar ZizhuoWang commented on June 8, 2024

不好意思,错怪你了,我看见你在贴吧发得科技了,谢谢你给更多的人带来快乐😂

from anyproxy-fgo-rule.

einnse avatar einnse commented on June 8, 2024

if (oSession.url.Contains("ac.php")){
        oSession["ui-color"] = "red";
        var str = oSession.GetRequestBodyAsString();
        if(str.Contains("battleResult%22%3a3"))
                {
                var tmp = Math.random()*8+3;
                var val = tmp.toFixed(0);
                var turn = /elapsedTurn%22%3a\d+/ig;
                str = str.replace(turn,"elapsedTurn%22%3a" + val);
                }
                str = str.replace("battleResult%22%3a3", "battleResult%22%3a1");
                var regex1 = /aliveUniqueIds%22%3a%5b([\d+,%2c]+)%5d/gi;
                str = str.replace(regex1,"aliveUniqueIds%22%3a%5b%5d");
                oSession.utilSetRequestBody(str);
                }
}
增加了修改战斗请求的判断逻辑:正常胜利或正常失败的话不作修改,撤退的话会改为判定胜利,并将elapsedTurn改为3-10之间的随机数,且清空aliveUniqueIds。这是我在吾爱上看的别人代码,跟兄弟代码对比下。

from anyproxy-fgo-rule.

einnse avatar einnse commented on June 8, 2024

@EndPoem 谢谢啊我再试试

from anyproxy-fgo-rule.

ZizhuoWang avatar ZizhuoWang commented on June 8, 2024
module.exports = { 
	*beforeSendRequest(requestDetail) {
		if ((requestDetail.url.indexOf('ac.php') != -1) && requestDetail.requestData.indexOf('key=battleresult')!=-1) {
			var newRequestData = requestDetail.requestData;
			var newReqBodyStr = newRequestData.toString();
			if(newReqBodyStr.indexOf('battleResult%22%3a3')!=-1){
				newReqBodyStr = newReqBodyStr.replace('elapsedTurn%22%3a1','elapsedTurn%22%3a3');
				newReqBodyStr = newReqBodyStr.replace('elapsedTurn%22%3a2','elapsedTurn%22%3a3');
				newReqBodyStr = newReqBodyStr.replace("battleResult%22%3a3", "battleResult%22%3a1");
				var regex1 = /aliveUniqueIds%22%3a%5b([\d+,%2c]+)%5d/gi;
				newReqBodyStr = newReqBodyStr.replace(regex1, "aliveUniqueIds%22%3a%5b%5d");
			}
			var b = new Buffer(newReqBodyStr);
			newRequestData = b;
			return {
				requestData: newRequestData
			};
		}
	},
	*beforeSendResponse(requestDetail, responseDetail) {
		// 带key=battlesetup,battleresume参数分别为新建战斗和战斗重开
		if ((requestDetail.url.indexOf('ac.php') != -1) && (requestDetail.requestData.indexOf('key=battlesetup') != -1 || requestDetail.requestData.indexOf('key=battleresume') != -1)) {
			const newResponse = responseDetail.response;
			var newbodyString = newResponse.body.toString();

			var dec = new Buffer(newbodyString.replace(/%3D/g, '='), 'base64').toString();
			var decJson = JSON.parse(dec);
			if (decJson['cache']['replaced']['battle']) {
				var svts = decJson['cache']['replaced']['battle'][0]['battleInfo']['userSvt'];
				//var count = 0;
				for (var i = 0; i < svts.length; i++) {

					// 筛选所有敌方从者
					if (svts[i]['hpGaugeType'] != undefined) {
						// 修改血量 1/3
						var eohp = Number(svts[i]['hp']);
						ehp = parseInt(1);
						if (typeof svts[i]['hp'] === 'number') {
							svts[i]['hp'] = String(ehp);
						} else {
							svts[i]['hp'] = ehp;
						}

						// 最大1动
						svts[i]['maxActNum'] = 1;
						// 充能6格
						svts[i]['chargeTurn'] = 6;
					}
					// 筛选所有己方从者
					if (svts[i]['status'] != undefined && svts[i]['userId'] != undefined && svts[i]['userId'] != '0' && svts[i]['userId'] != 0) {
						// 原始数据中好友从者HP为string类型,需先转换为number
						var ohp = Number(svts[i]['hp']);
						hp = ohp + 100000;
						if (typeof svts[i]['hp'] === 'number') {
							svts[i]['hp'] = String(hp);
						} else {
							svts[i]['hp'] = hp;
						}

						svts[i]['skillLv1'] = '10';
						svts[i]['skillLv2'] = '10';
						svts[i]['skillLv3'] = '10';
						svts[i]['treasureDeviceLv'] = '5';
						//console.log('原始血量:'+ ohp + ' 新血量:' + svts[i]['hp']);
						//count = i;
					}
				}
				decJson['cache']['replaced']['battle'][0]['battleInfo']['userSvt'] = svts;
				//console.log('改后JSON对象中血量:第'+ count +'个 ' + decJson['cache']['replaced']['battle'][0]['battleInfo']['userSvt'][count]['hp']);
				var encStr = JSON.stringify(decJson);

				//JSON.stringify(JSON.parse(?))组合拳会将内容进行两次转义
				//以下操作将转义后的字符串还原回转义前,以防止客户端报错
				var preStr = '\\u';
				// 转换中文到unicode
				var cnReg = /[\u0391-\uFFE5]/gm;
				if (cnReg.test(encStr)) {
					var encStr = encStr.replace(cnReg,
					function(str) {
						return preStr + str.charCodeAt(0).toString(16)
					});
				}
				// 转换转义字符
				encStr = encStr.replace(/\//g, '\\\/');
				// base64加密
				var enc = new Buffer(encStr).toString('base64');
				// 替换URI字符
				enc = enc.replace(/=/g, '%3D');
				// 重建buffer
				var b = new Buffer(enc);
				newResponse.body = b;
				return {
					response: newResponse
				};
			}
		}
	},
};

这样写没问题

from anyproxy-fgo-rule.

einnse avatar einnse commented on June 8, 2024

@ZizhuoWang 谢谢老兄我再试试,我贴的太乱了删了。成功了我也去分享下吧

from anyproxy-fgo-rule.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.