最近在刷 GTA5 佩里科岛抢劫,在前置任务中需要对岛上信号塔进行侦察,侦察方式为入侵信号箱连线,计算三个数与右侧的乘积和,加起来满足目标分数。

本人玩游戏时注意力分配不合理,经常一时脑子转不过来导致计算出错。为了方便计算,特地写了个在线小工具使用。

预览

访问 https://www.azimiao.com/gta5_cal_1 使用小工具。

使用方法

在输入处输入三个基础数值,在面板符号处输入面板符号,目标分数处输入目标分数,之后点击计算即可。

如计算成功,会提示每个数值应该连接的字符;如果不成功,则会有警告提示。

源码

非常简单的代码,就不过多描述了。

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>GTA海岛入侵信号箱数值计算工具</title>
    <style>
        .inputNumberTest {
            width: 4em;
        }
    </style>
</head>

<body>
    <table>
        <tr>
            <td>数字</td>
            <td>面板符号</td>
        </tr>
        <tr>
            <td>
                <input type="number" onchange="clearResult()" class="inputNumberTest" name="t1" id="num1" value="5">
            </td>
            <td>
                <select name="" id="select1">
                    <option value="1" selected="select">中</option>
                    <option value="2">艹</option>
                    <option value="10">X</option>
                    <option value="-1">请选择面板项</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                <input type="number" onchange="clearResult()" class="inputNumberTest" name="t2" id="num2" value="2">
            </td>
            <td>
                <select name="" id="select2">
                    <option value="1">中</option>
                    <option value="2" selected="select">艹</option>
                    <option value="10">X</option>
                    <option value="-1">请选择面板项</option>

                </select>
            </td>
        </tr>
        <tr>
            <td>
                <input type="number" onchange="clearResult()" class="inputNumberTest" name="t3" id="num3" value="5">
            </td>
            <td>
                <select name="" id="select3">
                    <option value="1">中</option>
                    <option value="2">艹</option>
                    <option value="10" selected="select">X</option>
                    <option value="-1">请选择面板项</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>
                目标分数:
            </td>
            <td>
                <input type="number" onchange="clearResult()" class="inputNumberTest" name="t4" id="targetnum"
                    value="59">
            </td>
        </tr>
        <tr>
            <td><button onclick="calNumber()">计算</button></td>
        </tr>
    </table>

    <script>

        function calNumber() {
            let num1 = parseInt(document.getElementById("num1").value);
            let num2 = parseInt(document.getElementById("num2").value);
            let num3 = parseInt(document.getElementById("num3").value);

            let select1 = document.getElementById("select1");
            let select2 = document.getElementById("select2");
            let select3 = document.getElementById("select3");

            let select1Num = parseInt(select1.value);

            let select2Num = parseInt(select2.value);

            let select3Num = parseInt(select3.value);


            let c = [
                [
                    select1Num,
                    select2Num,
                    select3Num
                ],
                [
                    select1Num,
                    select3Num,
                    select2Num,
                ],
                [
                    select2Num,
                    select1Num,
                    select3Num
                ],
                [
                    select2Num,
                    select3Num,
                    select1Num,
                ],
                [
                    select3Num,
                    select1Num,
                    select2Num
                ],
                [
                    select3Num,
                    select2Num,
                    select1Num,
                ],

            ];

            let res = parseInt(document.getElementById("targetnum").value);

            let value = [num1, num2, num3];
            let count = c.length;
            for (let i = 0; i < count; i++) {
                let kk = c[i];
                let resT = 0;

                let count2 = kk.length;
                for (let j = 0; j < count2; j++) {
                    resT += (value[j] * kk[j]);
                }
                if (resT == res) {

                    OutPut(value, kk);
                    return;
                }
            }
            OutPut(null, null);

        }

        function OutPut(a, b) {

            if (a == null || b == null || !Array.isArray(a) || !Array.isArray(b) || a.length != 3 || b.length != 3) {
                alert("输入有误或结果未知");
                this.clearResult();
                return;
            }
            let str = "结果为";

            for (let i = 0; i < a.length; i++) {
                str += '\r';
                str += a[i].toString();
                str += "----";
                str += GetTypeNameByNum(b[i]);
            }


            // select1.value = b[0];
            // select2.value = b[1];
            // select3.value = b[2];



            alert(str);
        }

        function GetTypeNameByNum(n) {
            switch (n) {
                case 1: return "中";
                case 2: return "艹";
                case 10: return "X";
                default: return "未知";
            }
        }

        function clearResult() {
            // select2.value = select1.value = select3.value = -1;
        }

        //百度统计
        var _hmt = _hmt || [];
        (function () {
            var hm = document.createElement("script");
            hm.src = "//hm.baidu.com/hm.js?d11e4c02ad54b801226b1a8e376851c4";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
</body>
</html>

关联

GTA5佩里科岛侦察连线在线计算数值 GTA5海岛前置任务侦察怎么做

梓喵出没博客(azimiao.com)版权所有,转载请注明链接:https://www.azimiao.com/7575.html
欢迎加入梓喵出没博客交流群:313732000

我来吐槽

*

*

0位绅士参与评论

  1. M02-23 13:09 (4天前)回复

    实际上大部分情况下看数字填数字再选符号的时间比自己凭直觉连的时间还长。。