教程
  1. 插件播报教程
教程
  • 自挂教程
  • dulu框架NT自挂教程
  • 常见问题回答
  • 代挂网址登录教程
  • 命令上传福利教程
  • NT安装教程
    • LLOneBot-单服务器(非常稳定)
    • 萌QNT自挂方法(单服务器1 可选)部分号稳定
    • 萌QNT自挂方法(单服务器2 可选)目前测试非常稳定
    • 唯一NT自挂方法
  • 插件播报教程
    • 组合史诗首爆教程
    • 组合消息转发教程
    • 组合史诗播报教程
  1. 插件播报教程

组合史诗播报教程

组合史诗播报教程#

📌
自行根据下方教程 组合消息内容即可
配套Frida由大佬724735780 整理提供
Tips.此方法适合有一定基础的,至少要知道,什么代码放什么地方!!!!

1.新建robot_message表#

搜索init_db或者是建表 基本上就能找到初始化数据库的模块
在初始化数据库中 增加新建robot_message表语句
//建表 frida.robot_message
api_MySQL_exec(mysql_frida, `
        CREATE TABLE frida.robot_message (
            id int(20) NOT NULL AUTO_INCREMENT,
            \`type\` int(5) NULL,
            chara_no int(20) NULL,
            message varchar(600) NULL,
            create_time datetime NULL,
            send_flag int(5) DEFAULT 0,
            PRIMARY KEY (id)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
    `);
📌
注释:
api_MySQL_exec 意思是执行sql语句
mysql_frida 数据库连接句柄 这里要根据你的frida里实际情况修改
sql语句中的frida库和robot_message表为固定值 机器人固定读取该表内容 无法修改

2.新增sendRobot函数加载#

在你的frida脚本中任意位置 新增sendRobot函数加载
//机器人组合消息传输到robot_message表
function sendRobot(type,user,msg){
  log(msg);
  if(type == 1){
    //获取用户
    var charNo = CUserCharacInfo_getCurCharacNo(user);
    api_MySQL_exec(mysql_frida, "insert into frida.robot_message (type,chara_no,message,send_flag) values (" + type + "," + charNo + ",'" + msg + "',0);");
  }else{
    api_MySQL_exec(mysql_frida, "insert into frida.robot_message (type,message,send_flag) values (" + type + ",'" + msg + "',0);");
  }
}
💡
注释:
api_MySQL_exec 意思是执行sql语句
mysql_frida 数据库连接句柄 这里要根据你的frida里实际情况修改
后续的语句为在robot_message表中新增数据 便于机器人读取
sendRobot函数可以自行修改,前提条件是 这里修改了函数 那么下面的调用sendRobot就也要同步的修改

3.转换消息处理字符串#

在组合消息内容之前 还需要将消息字符串处理一下
这里以初六的龙神Frida为例
搜索api_SendHyperLinkChatMsg_emoji函数
下方代码中我们可以看到
在第11行位置 新增了var msg = ""; //意思就是 增加了一个msg的变量 并且将其初始化为空的
在第17行位置 新增了msg = msg + msgstr; //意思就是消息内容 = 消息内容 + msgstr
在最后一行 新增了return msg; //意思就是结束执行 将结果返回到msg中
这里的msgstr要根据你实际的frida里消息的内容去填写
function api_SendHyperLinkChatMsg_emoji(user, strarr, msgtype, type, Symbol) {
	const bufferSize = 255;
	const strptr = Memory.alloc(bufferSize);
	let startlen = 0;
	let cnt = 0;
	// 准备表情符号数据
	const emojiBytes = Symbol >= 1 ? [0xc2, 0x80, 0x20, 0x1e, 0x20, Symbol, 0x1f] : [0xc2, 0x80, 0x20];
	strptr.add(startlen).writeByteArray(emojiBytes);
	startlen += emojiBytes.length;
	// 处理消息字符串数组
	var msg = "";   //意思就是 增加了一个msg的变量 并且将其初始化为空的
	for (const item of strarr) {
		const [strtype, msgContent, flags] = item;
		strptr.add(startlen).writeByteArray([0xc2, 0x80]);
		startlen += 2; // 更新起始长度
		const msgstr = (strtype === 'str') ? msgContent : '[' + api_CItem_getItemName(msgContent) + ']';
		msg = msg + msgstr;  //意思就是消息内容 = 消息内容 + msgstr
		const str_ptr = Memory.allocUtf8String(msgstr);
		const str_len = strlen(str_ptr);
		strptr.add(startlen).writeByteArray(str_ptr.readByteArray(str_len));
		startlen += str_len;

		// 检查是否需要添加额外的字节
		if (flags[3] === 255) {
			strptr.add(startlen).writeByteArray([0xc2, 0x80]);
			startlen += 2;
			cnt++;
		}
	}
	// 结束字符串并准备数据包
	strptr.add(startlen).writeByteArray([0xc2, 0x80]);
	startlen += 2;
	const packet_guard = api_PacketGuard_PacketGuard();
	InterfacePacketBuf_put_header(packet_guard, 0, 370);
	InterfacePacketBuf_put_byte(packet_guard, msgtype);
	InterfacePacketBuf_put_short(packet_guard, 0);
	InterfacePacketBuf_put_byte(packet_guard, 0);
	InterfacePacketBuf_put_int(packet_guard, startlen);
	InterfacePacketBuf_put_str(packet_guard, strptr, startlen);
	InterfacePacketBuf_put_byte(packet_guard, cnt);
	// 处理附加信息
	for (const item of strarr) {
		const [_, msgtype, flags] = item;
		if (flags[3] === 255) {
			const RbgInfoptr = Memory.alloc(104);
			RbgInfoptr.writeByteArray(flags);
			// 处理消息类型
			if (typeof msgtype === 'number') {
				RbgInfoptr.add(0x4).writeU32(msgtype);
				const Citem = CDataManager_find_item(G_CDataManager(), msgtype);
				if (!CItem_is_stackable(Citem)) {
					RbgInfoptr.add(0x8).writeU32(get_rand_int(0));
					RbgInfoptr.add(0xe).writeU16(CEquipItem_get_endurance(Citem));
				}
			}
			InterfacePacketBuf_put_binary(packet_guard, RbgInfoptr, 104);
		}
	}
	// 完成数据包
	InterfacePacketBuf_finalize(packet_guard, 1);
	// 根据类型发送数据包
	if (type === 1) {
		CUser_SendPacket(user, 1, packet_guard);
	}
	else {
		GameWorld_send_all_with_state(G_gameWorld(), packet_guard, 3); // 只给状态 >= 3 的玩家发送公告
	}
	// 清理数据包
	Destroy_PacketGuard_PacketGuard(packet_guard);
	
	return msg;  //意思就是结束执行 将结果返回到msg中
}

4.组合消息内容并将结果发送到sendRobot函数#

修改api_CUser_Rarity_Item函数
这个是获取装备品级的函数 在js中搜索api_CUser_Rarity_Item
📌
在第5行位置 新增 var msg = ""; //意思就是 增加了一个msg的变量 并且将其初始化为空的
在第7/16/25/34/43/52行 api_SendHyperLinkChatMsg_emoji
前面新增 msg = api_SendHyperLinkChatMsg_emoji
原来是没有msg = 的 这里我们新增一个
意思就是 消息内容=api_SendHyperLinkChatMsg_emoji函数获取的实际内容
在最下方 新增 return msg;
function api_CUser_Rarity_Item(user, args, item_id, item_nu) {
	var itemData = CDataManager_find_item(G_CDataManager(), item_id);
	var needLevel = CItem_getUsableLevel(itemData);  //等级
	var Rarity = CItem_getRarity(itemData); // 稀有度
	var msg = "";
	if (Rarity == 0) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [230, 200, 156,255]],
				['item', item_id, [255, 255, 255, 255]],
				['str', '' + item_nu + '个', [230, 200, 156,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	if (Rarity == 1) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [255, 255, 0,255]],
				['item', item_id, [255, 255, 0, 255]],
				['str', '' + item_nu + '个', [255, 255, 0,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	if (Rarity == 2) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [255, 255, 0,255]],
				['item', item_id, [255, 255, 0, 255]],
				['str', '' + item_nu + '个', [255, 255, 0,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	if (Rarity == 3) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [255, 255, 0,255]],
				['item', item_id, [255, 255, 0, 255]],
				['str', '' + item_nu + '个', [255, 255, 0,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	if (Rarity == 4) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [255, 255, 0,255]],
				['item', item_id, [255, 255, 0, 255]],
				['str', '' + item_nu + '个', [255, 255, 0,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	if (Rarity == 5) {
		msg = api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', args, [255, 255, 0,255]],
				['item', item_id, [255, 255, 0, 255]],
				['str', '' + item_nu + '个', [255, 255, 0,255]],
			], 14, 0, 0);
		api_CUser_AddItem(user, item_id, item_nu)
	}
	return msg;
}

修改Prompt_end_of_dungeon函数#

这个是获取角色名称以及爆装奖励的函数
在js中搜索Prompt_end_of_dungeon 按照下方的代码
💡
在14行位置新增var msg = "";
在api_SendHyperLinkChatMsg_emoji前面 增加msg +=
例子msg += api_SendHyperLinkChatMsg_emoji
这个就是组合玩家名称 副本名称 如果你就是初六的frida 那么可以直接复制下面的代码 替换掉你的
这样 下面的一个步骤就不需要组合了
function Prompt_end_of_dungeon(user) {
	var charac_no = CUserCharacInfo_getCurCharacNo(user); // 获取当前角色编号
	var hasAcquiredItems = globalData.acquiredItems[charac_no] && Object.keys(globalData.acquiredItems[charac_no]).length > 0;

	var totalEpicCount = 0;
	if (globalData.epicItems[charac_no]) {
		for (var epicItemName in globalData.epicItems[charac_no]) {
			if (globalData.epicItems[charac_no].hasOwnProperty(epicItemName)) {
				totalEpicCount += globalData.epicItems[charac_no][epicItemName];
			}
		}
	}
	var hasEpicItems = totalEpicCount >= 1;
	var msg = "";
	if (hasAcquiredItems || hasEpicItems) {
		msg += api_SendHyperLinkChatMsg_emoji(user,
			[
				['str', '玩家 : ', [255, 255, 0, 255]],
				['str', '[' + api_CUserCharacInfo_getCurCharacName(user) + ']', [255, 0, 255, 255]],
				['str', ' 在 ', [255, 255, 0, 255]],
				['str', '[' + api_CDungeon_getDungeonName(DGN_ID[charac_no]) + ']', [255, 0, 128, 255]],
			], 14, 0, 0);
		msg += "\n";
		if (hasAcquiredItems) {
			var firstItem = true;

			for (var item_id in globalData.acquiredItems[charac_no]) {
				if (globalData.acquiredItems[charac_no].hasOwnProperty(item_id)) {
					if (firstItem) {
						msg += api_SendHyperLinkChatMsg_emoji(user,
							[
								['str', '爆出 : ', [255, 255, 0, 255]],
								['item', parseInt(item_id), [255, 170, 0, 255]],
								['str', ' x' + globalData.acquiredItems[charac_no][item_id] + '', [255, 255, 0, 255]]
							], 14, 0, 0);
						firstItem = false;
						msg += "\n";
					}
					else {
						msg += api_SendHyperLinkChatMsg_emoji(user,
							[
								['str', '     - ', [255, 255, 0, 255]],
								['item', parseInt(item_id), [255, 170, 0, 255]],
								['str', ' x' + globalData.acquiredItems[charac_no][item_id] + '', [255, 255, 0, 255]]
							], 14, 0, 0);
						msg += "\n";
					}
				}
			}
		}
		if (hasEpicItems) {

			//史诗大比拼
			writeEpicNum(user,totalEpicCount);
			if (totalEpicCount == 2) //SS数量
			{
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 0, 255]],
						['str', '点卷', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 1);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 3) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点卷', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 2);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 4) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点券', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 3);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 5) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点券', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 4);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 6) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点券', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 5);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 7) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点券', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 6);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
			if (totalEpicCount == 8) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点券', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 7);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
		}
	}
}

组合爆装奖励模块#

📌
以下方双簧奖励微例子
在api_SendHyperLinkChatMsg_emoji前面增加msg +=
下一行增加msg += "\n"; 这个意思就是换行
在api_CUser_Rarity_Item前面增加msg += 下一行一样是换行
在尾部增加一个
sendRobot(0,null,msg); //这个就是将上述的msg发送到机器人函数内
其他部分就由机器人函数处理了
这样你就可以完整的使用 机器人转发群内爆装提示消息
			if (totalEpicCount == 3) {
				msg += api_SendHyperLinkChatMsg_emoji(user,
					[
						['str', '奖励', [230, 200, 156,255]],
						['str', '' + (totalEpicCount * 50) + '', [255, 255, 255, 255]],
						['str', '点卷', [230, 200, 156,255]]
					], 14, 0, 0);
				msg += "\n";
				api_recharge_cash_cera(user, (totalEpicCount * 50))//点卷数量

				//奖励道具
				msg += api_CUser_Rarity_Item(user, '奖励', 2023889182, 2);
				msg += "\n";
				totalEpicCount = 0;
				//发送到机器人
				sendRobot(0,null,msg);
			}
修改于 2025-07-19 05:21:33
上一页
组合消息转发教程
Built with