|
|
本帖最后由 星之子 于 2025-6-16 20:39 编辑
动机
今年的周年活动是挑战世界BOSS,打赢了可以开勋章系统的格子简直爽欸!毕竟抽奖活动即使抽到绝版,顶天儿无非也就是1.0收益还要占格子,但开格子可是实打实的全属性提升。
碰巧之前的追随神器 一键三连评分按钮也是出自我,于是紧急调教DeepSeek参考之前的写了下面这个新脚本。
功能
脚本会识别形如“/thread-帖子UID-*.html”、“/forum.php?mod=viewthread&tid=帖子UID”的页面,在右下角添加一个显眼的、正在不断浮动的【只看BOSS】红色按钮,点击即可跳转到BOSS的“只看该作者”页面。
在该页面下按钮内容会变成【攻击BOSS!】,点击一下即可打出5 血液 + 1 净化 + 1 堕落的伤害;如果评分不足则能打多少打多少,打光子弹!
代码
@Name @Match @Icon
- // ==UserScript==
- // @name 狄文卡德我们来了喔!
- // @version 2.1
- // @description 世界BOSS活动专用:只看楼主+最大化评分
- // @author Étoiles
- // @match https://www.gamemale.com/thread-*-*.html
- // @match https://www.gamemale.com/forum.php?mod=viewthread&tid=*
- // @grant GM_addStyle
- // ==/UserScript==
- (function() {
- 'use strict';
- // 配置参数
- const config = {
- authorId: '736182', // 要查看的作者ID(BOSS活动发起者)
- targetScores: [5, 1, 1], // 目标评分 [金币, 血液, 追随]
- reason: '全力攻击BOSS!(╯°□°)╯︵ ┻━┻' // 评分理由
- };
- // 获取当前帖子的TID
- function getThreadId() {
- const threadMatch1 = window.location.href.match(/thread-(\d+)/);
- if (threadMatch1 && threadMatch1[1]) return threadMatch1[1];
- const threadMatch2 = window.location.href.match(/[?&]tid=(\d+)/);
- if (threadMatch2 && threadMatch2[1]) return threadMatch2[1];
- return null;
- }
- // 检查是否在"只看楼主"页面
- function isAuthorViewPage() {
- return window.location.href.includes('&authorid=' + config.authorId);
- }
- // 创建活动专用按钮
- function createBossAttackButton() {
- const tid = getThreadId();
- if (!tid) return;
- const button = document.createElement('a');
- button.href = `https://www.gamemale.com/forum.php?mod=viewthread&tid=${tid}&page=1&authorid=${config.authorId}`;
- button.textContent = isAuthorViewPage() ? '攻击BOSS!' : '只看BOSS';
- button.id = 'gm-boss-attack-btn';
- GM_addStyle(`
- #gm-boss-attack-btn {
- position: fixed;
- right: 20px;
- bottom: 20px;
- padding: 12px 18px;
- background-color: #e74c3c;
- color: white;
- border-radius: 5px;
- text-decoration: none;
- font-weight: bold;
- z-index: 9999;
- box-shadow: 0 2px 5px rgba(0,0,0,0.3);
- font-size: 16px;
- text-transform: uppercase;
- animation: pulse 2s infinite;
- }
- #gm-boss-attack-btn:hover {
- background-color: #c0392b;
- animation: none;
- }
- @keyframes pulse {
- 0% { transform: scale(1); }
- 50% { transform: scale(1.05); }
- 100% { transform: scale(1); }
- }
- `);
- // 如果在BOSS页面,点击按钮执行最大化评分
- if (isAuthorViewPage()) {
- button.onclick = function(e) {
- e.preventDefault();
- attackBoss();
- return false;
- };
- }
- document.body.appendChild(button);
- }
- // 攻击BOSS(最大化评分)
- function attackBoss() {
- // 找到第一个评分按钮
- const rateButton = document.querySelector('a[onclick^="showWindow(\'rate\'"]');
- if (!rateButton) {
- alert('未找到BOSS攻击点!(找不到评分按钮)');
- return;
- }
- // 模拟点击评分按钮
- rateButton.click();
- // 等待评分窗口加载
- const checkInterval = setInterval(function() {
- const score3 = document.getElementById('score3');
- const score4 = document.getElementById('score4');
- const score8 = document.getElementById('score8');
- const reason = document.getElementById('reason');
- if (score3 && score4 && score8 && reason) {
- clearInterval(checkInterval);
- // 获取可用的最大评分值
- const max3 = parseInt(score3.nextElementSibling.nextElementSibling.innerText) || 0;
- const max4 = parseInt(score4.nextElementSibling.nextElementSibling.innerText) || 0;
- const max8 = parseInt(score8.nextElementSibling.nextElementSibling.innerText) || 0;
- // 计算实际能给的最高分(不超过可用积分)
- const actualScores = [
- Math.min(config.targetScores[0], max3),
- Math.min(config.targetScores[1], max4),
- Math.min(config.targetScores[2], max8)
- ];
- // 填写评分(能多高就多高)
- score3.value = actualScores[0];
- score4.value = actualScores[1];
- score8.value = actualScores[2];
- reason.value = config.reason;
- // 提交评分
- const submitButton = document.querySelector('button[name="ratesubmit"]');
- if (submitButton) {
- submitButton.click();
- }
- }
- }, 100);
- }
- // 页面加载完成后执行
- window.addEventListener('load', function() {
- createBossAttackButton();
- // 如果在BOSS页面,可以添加额外功能
- if (isAuthorViewPage()) {
- // 可以在这里添加其他BOSS战相关功能
- }
- });
- })();
复制代码
来自群组: 星象占卜 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|