// ==UserScript==
// @name My Character Analysis tool
// @namespace None
// @version 1.1.1
// @author RhandR
// @description Your lib description
// @copyright 2022, RhandR
// @match *://xyq.cbg.163.com/*
// @license MIT
// ==/UserScript==
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "./src/data/DataCalculationHelper.ts":
/*!*******************************************!*\
!*** ./src/data/DataCalculationHelper.ts ***!
\*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DataCalculationHelper\": () => (/* binding */ DataCalculationHelper)\n/* harmony export */ });\nclass DataCalculationHelper {\r\n static getQiangZhuangShenSuToPrice(currentLevel) {\r\n // 满强壮神速 一共需要33340 w 梦幻币\r\n // 可以用储备点 系数0.65\r\n const target = 16670;\r\n const current = DataCalculationHelper.qiangZhuangShenSuCost.slice(0, currentLevel)\r\n .reduce((a, b) => a + b, 0);\r\n return (target - current) / 1250 * 100 * 0.65;\r\n }\r\n static petTrainingToPrice(petTraining) {\r\n // 基准: 攻法修炼25 双防修炼20\r\n // 宠修经验无差别,所以算总等级即可\r\n // 如果不足以上标准, 折算系数为 0.9\r\n // 如果超过, 折算系数为 0.65\r\n const totalPetTrainingExp = Object.values(petTraining)\r\n .map(level => DataCalculationHelper.petTrainingExp[level])\r\n .reduce((pre, nxt) => pre + nxt, 0);\r\n const totalExpDelta = totalPetTrainingExp - DataCalculationHelper.petTrainingExp[20] * 2 - DataCalculationHelper.petTrainingExp[25] * 2;\r\n const factor = totalExpDelta > 0 ? 0.65 : 0.9;\r\n return totalExpDelta / 150 * 72 / 1250 * 100 * factor;\r\n }\r\n // 可以用储备点,系数0.65\r\n static mainSkillLevelToPrice(level) {\r\n if (level >= 150)\r\n return 0;\r\n const baseCost = 38646689;\r\n return (baseCost - DataCalculationHelper.mainSkillCost[level - 1]) / 12500000 * 100 * 0.65;\r\n }\r\n static characterTrainingToPrice(training) {\r\n const defTrainingDelta = (8740 * 2 - (this.defTrainingCost[training.抗法修炼] + this.defTrainingCost[training.防御修炼])) / 1250 * 100 * 0.9;\r\n const attackTrainingLevel = Math.max(training.攻击修炼, training.法术修炼);\r\n const attackTrainingDelta = (12705 - this.attackTrainingCost[attackTrainingLevel]) / 1250 * 100 * 0.9;\r\n return defTrainingDelta + attackTrainingDelta;\r\n }\r\n}\r\nDataCalculationHelper.qiangZhuangShenSuCost = [43, 49.5, 57, 65.5, 75, 85.5, 97, 109.5, 123, 137.5, 153, 169.5, 187, 205.5,\r\n 225, 245.5, 267, 289.5, 313, 337.5, 363, 389.5, 417, 445.5, 475, 505.5, 537, 569.5, 603, 637.5,\r\n 673, 709.5, 747, 785.5, 825, 907, 949.5, 993.0, 1037.5];\r\nDataCalculationHelper.petTrainingExp = [0, 150, 360, 650, 1040, 1550, 2200, 3010, 4000, 5190, 6600, 8250, 10160, 12350, 14840,\r\n 17650, 20800, 24310, 28200, 32490, 37200, 42350, 47960, 54050, 60640, 67750];\r\nDataCalculationHelper.mainSkillCost = [6, 18, 37, 65, 103, 154, 221, 307, 417, 556, 730, 946, 1212, 1537, 1930, 2402, 2965, 3632, 4418, 5337,\r\n 6407, 7645, 9071, 10707, 12575, 14699, 17103, 19817, 22867, 26287, 30107, 34362, 39087, 44321, 50104, 56478, 63487, 71177, 79596,\r\n 88795, 98827, 109747, 121612, 134483, 148421, 163491, 179761, 197301, 216183, 236482, 258277, 281648, 306679, 333456, 362069,\r\n 392610, 425175, 459862, 496773, 536013, 577689, 621913, 668799, 718465, 771033, 826628, 885377, 947413, 1012871, 1081890,\r\n 1154613, 1231187, 1311762, 1396492, 1485535, 1579053, 1677213, 1780184, 1888140, 2001259, 2119724, 2243722, 2373443, 2509083,\r\n 2650841, 2798921, 2953532, 3114887, 3283203, 3458703, 3641613, 3832164, 4030593, 4237141, 4452054, 4675583, 4907983, 5149516,\r\n 5400447, 5661046, 5931590, 6212360, 6503643, 6805730, 7118918, 7443510, 7779813, 8128141, 8488813, 8862152, 9248489, 9648160,\r\n 10061506, 10488874, 10930617, 11387094, 11858670, 12345715, 12848606, 13367726, 13903463, 14456212, 15026375, 15614359,\r\n 16220577, 16845450, 17489404, 18152872, 18836293, 19540112, 20264783, 21010764, 21778521, 22568526, 23381259, 24217206,\r\n 25076859, 25960719, 26869292, 27803091, 28762638, 29748460, 30761093, 31801079, 32868967, 33965314, 35090685, 36245650,\r\n 37430789, 38646689];\r\nDataCalculationHelper.attackTrainingCost = [0, 45, 108, 195, 312, 465, 660, 903, 1200, 1557, 1980, 2475, 3048, 3705, 4452, 5295, 6240, 7293, 8460, 9747, 11160, 12705, 14388, 16125, 18192, 20325];\r\nDataCalculationHelper.defTrainingCost = [0, 30, 72, 130, 208, 310, 440, 602, 800, 1038, 1320, 1650, 2032, 2470, 2968, 3530, 4160, 4862, 5640, 6498, 7440, 8740, 9592, 10810, 12128, 13550];\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/data/DataCalculationHelper.ts?");
/***/ }),
/***/ "./src/feature/control_panel/index.ts":
/*!********************************************!*\
!*** ./src/feature/control_panel/index.ts ***!
\********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ControlPanel\": () => (/* binding */ ControlPanel)\n/* harmony export */ });\n/* harmony import */ var _types_type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../types/type */ \"./src/types/type.ts\");\n/* harmony import */ var _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/EquipAnalysisUtil */ \"./src/utils/EquipAnalysisUtil.ts\");\n/* harmony import */ var _data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../data/DataCalculationHelper */ \"./src/data/DataCalculationHelper.ts\");\n/* harmony import */ var _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/RemoteLogger */ \"./src/utils/RemoteLogger.ts\");\n/* harmony import */ var _equip_estimation_Equip__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../equip_estimation/Equip */ \"./src/feature/equip_estimation/Equip.ts\");\n\r\n\r\n\r\n\r\n\r\nclass ControlPanel {\r\n constructor() {\r\n try {\r\n this.init();\r\n this.create();\r\n }\r\n catch (e) {\r\n console.log(\"人物分析器初始化失败\", e);\r\n }\r\n }\r\n init() {\r\n this.pageHeader = document.getElementsByClassName(ControlPanel.headerClassName)[0];\r\n this.calculationHelper = new _data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_2__.DataCalculationHelper();\r\n this.initCharacter();\r\n this.initInformationText();\r\n this.initLogButton();\r\n this.initAnalysisButton();\r\n }\r\n initCharacter() {\r\n const characterClass = this.pullClass();\r\n this.character = new _types_type__WEBPACK_IMPORTED_MODULE_0__.Character(characterClass);\r\n // 人物基本信息\r\n this.switchToTab(\"basic\");\r\n this.character.setPetTraining(this.pullCharacterDescription());\r\n this.character.setCharacterTraining(this.pullCharacterTrainingDescription());\r\n this.character.setupPrice(this.pullCharacterPriceTagFromInfoPanel());\r\n this.character.setEmpowerPotentialCount(this.getEmpowerPotentialCount());\r\n this.character.location = document\r\n .getElementsByClassName('names')[0]\r\n // @ts-ignore\r\n .innerText\r\n .match(/[\\u4e00-\\u9fa50-9]+--[\\u4e00-\\u9fa50-9]+/)[0]\r\n .replace(\"--\", \"\\n\");\r\n this.character.id = window.location.href.match(/eid=[a-zA-Z0-9_.-]*/)[0];\r\n const finalIndex = window.location.href.indexOf(this.character.id) + this.character.id.length;\r\n this.character.url = window.location.href.slice(0, finalIndex);\r\n this.character.characterType = document.getElementById(\"role_info_box\").innerText.match(/角色:[\\u4e00-\\u9fa5]+/)[0].replace(\"角色:\", \"\");\r\n // 更新装备信息\r\n this.switchToTab(\"equips\");\r\n this.character.setNecklace(this.pullNecklace());\r\n // 更新背包和武器信息\r\n const equips = this.getAllEquipsInBagIncludingWeapon();\r\n // 更新技能信息\r\n this.switchToTab(\"skill\");\r\n this.setupSideSkills();\r\n this.setupMainSkills();\r\n // 更新坐骑信息\r\n this.switchToTab(\"riders\");\r\n this.setupCharacterMount();\r\n this.character.equipsInBag = equips;\r\n // 计算估价\r\n this.character.setupEstimatePrice();\r\n this.character.setupBestWeapon();\r\n }\r\n initInformationText() {\r\n this.informationBox = document.createElement(\"textarea\");\r\n }\r\n initLogButton() {\r\n this.logButton = document.createElement(\"button\");\r\n this.logButton.innerText = \"保存这个角色\";\r\n this.logButton.onclick = () => _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_3__.RemoteLogger.logActor(this.character);\r\n }\r\n initAnalysisButton() {\r\n this.analysisButton = document.createElement(\"button\");\r\n this.analysisButton.innerText = \"跳转到分析页面\";\r\n const url = \"https://xyq-analysis.evereleven.top/analysis/user/\" + _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_3__.RemoteLogger.USER_ID;\r\n this.analysisButton.onclick = () => window.open(url, '_blank');\r\n }\r\n create() {\r\n this.pageHeader.appendChild(this.informationBox);\r\n this.pageHeader.appendChild(this.logButton);\r\n this.pageHeader.appendChild(this.analysisButton);\r\n let text = \"\";\r\n text += \"\\n 项链初灵:\" + this.character.getNecklaceInitialSpirituality();\r\n text += \"\\n \" + this.character.bestEquipDescription;\r\n this.informationBox.innerText = text;\r\n document.querySelector(\"#info_panel\").innerHTML += `<li> <strong>大象估价:</strong> <span class=\"price fB\"><span class=\"p10000\">¥${this.character.getEstimatePrice().toFixed(2)}(元)</span></span> </li>`;\r\n }\r\n switchToTab(tabName) {\r\n var _a;\r\n const tabElementId = `role_${tabName}`;\r\n (_a = document.getElementById(tabElementId)) === null || _a === void 0 ? void 0 : _a.click();\r\n }\r\n pullClass() {\r\n try {\r\n const infoList = document.getElementById(\"info_panel\")\r\n .getElementsByTagName(\"ul\")[0]\r\n .getElementsByTagName(\"li\");\r\n for (let i = 0; i < infoList.length; i++) {\r\n if (infoList[i].innerHTML.indexOf(\"类型\") >= 0) {\r\n return infoList[i].innerHTML.replaceAll(\"\\t\", \"\")\r\n .replaceAll(/<strong>(.*?)<\\/strong>/g, \"\")\r\n .trim();\r\n }\r\n }\r\n }\r\n catch (e) {\r\n console.log(\"获取门派失败, 使用默认门派 null\", e);\r\n return undefined;\r\n }\r\n }\r\n pullNecklace() {\r\n if (document.getElementById(\"role_using_equip_4\") === null) {\r\n return {\r\n currentSpirituality: 0,\r\n initialSpirituality: 0,\r\n gemLevel: 0,\r\n level: 0,\r\n };\r\n }\r\n const description = document.getElementById(\"role_using_equip_4\")\r\n .getAttribute(\"data_equip_desc\");\r\n const level = _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__.EquipAnalysisUtil.getEquipLevel(description);\r\n const gemLevel = _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__.EquipAnalysisUtil.getEquipGemLevel(description);\r\n const currentSpirituality = _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__.EquipAnalysisUtil.getCurrentSpirituality(description);\r\n const initialSpirituality = currentSpirituality - 6 * gemLevel;\r\n return {\r\n currentSpirituality: currentSpirituality,\r\n initialSpirituality: initialSpirituality,\r\n gemLevel: gemLevel,\r\n level: level,\r\n bond: {\r\n spiritualityReduce: _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__.EquipAnalysisUtil.getBondSpiritualityReduce(description),\r\n bondToClass: _utils_EquipAnalysisUtil__WEBPACK_IMPORTED_MODULE_1__.EquipAnalysisUtil.getBondClass(description)\r\n }\r\n };\r\n }\r\n pullCharacterDescription() {\r\n return document.querySelector(\"#role_info_box\")\r\n .querySelectorAll(\".cols\")[1]\r\n .querySelectorAll(\".tb02\")[1]\r\n // @ts-ignore\r\n .innerText\r\n .split(\"\\n\");\r\n }\r\n pullCharacterTrainingDescription() {\r\n return document.querySelector(\"#role_info_box\")\r\n .querySelectorAll(\".cols\")[1]\r\n .querySelectorAll(\".tb02\")[0]\r\n // @ts-ignore\r\n .innerText\r\n .split(\"\\n\");\r\n }\r\n pullCharacterPriceTagFromInfoPanel() {\r\n const items = document.getElementById(\"info_panel\")\r\n .getElementsByTagName(\"ul\")[0]\r\n .getElementsByTagName(\"li\");\r\n for (let i = 0; i < items.length; i++) {\r\n if (items[i].innerText.indexOf(\"价格\") >= 0) {\r\n return items[i].innerText;\r\n }\r\n }\r\n }\r\n getEmpowerPotentialCount() {\r\n const countString = document.getElementsByClassName(\"tb02 role_basic_attr_table\")[0]\r\n .getElementsByTagName(\"tbody\")[0]\r\n .getElementsByTagName(\"tr\")[13]\r\n .innerText.match(/新版乾元丹数量:(\\d?)/)[1];\r\n return parseInt(countString);\r\n }\r\n pullSkillLevel(skillName) {\r\n // @ts-ignore\r\n const fullDes = document.getElementsByClassName(\"skillTb\")[0].innerText;\r\n const skillDesIndex = fullDes.indexOf(skillName);\r\n if (skillDesIndex == -1) {\r\n return 0;\r\n }\r\n return parseInt(fullDes.substring(skillDesIndex - 8, skillDesIndex).match(/\\d+/)[0]);\r\n }\r\n setupSideSkills() {\r\n const skills = [\"强身术\", \"冥想\", \"中药医理\", \"烹饪技巧\", \"强壮\", \"神速\"];\r\n for (const skill of skills) {\r\n const level = this.pullSkillLevel(skill);\r\n this.character.setSideSkillLevel(skill, level);\r\n }\r\n }\r\n setupMainSkills() {\r\n const mainSkillElements = document.getElementsByClassName(\"skill\")[document.getElementsByClassName(\"skill\").length - 1].getElementsByTagName(\"li\");\r\n // @ts-ignore\r\n for (const element of mainSkillElements) {\r\n const level = element.innerText.match(/\\d+/);\r\n if (!!level) {\r\n this.character.mainSkills.push(parseInt(level[0]));\r\n }\r\n }\r\n }\r\n setupCharacterMount() {\r\n // @ts-ignore\r\n const count = document.querySelector(\"#RoleRiders\").children[0].rows[0].cells.length;\r\n for (let i = 0; i < count; i++) {\r\n // @ts-ignore\r\n let nextMount = document.querySelector(\"#RoleRiders\").children[0].rows[0].cells[i].children[0];\r\n if (typeof nextMount === 'undefined')\r\n break;\r\n nextMount.click();\r\n let riderTelant = document\r\n .evaluate(\"//th[contains(.,'成长')]\", document, null, XPathResult.ANY_TYPE, null)\r\n .iterateNext()\r\n // @ts-ignore\r\n .getParent()\r\n .textContent\r\n .match(/\\d+\\.\\d+/)[0];\r\n if (parseFloat(riderTelant) >= 2.2) {\r\n this.character.hasMount = true;\r\n }\r\n }\r\n }\r\n pullEquip(description, name) {\r\n // 借助五行来判断是不是装备\r\n if (description.indexOf(\"五行\") == -1) {\r\n return null;\r\n }\r\n const level = parseInt(description.match(/(?<=等级) \\d+/)[0]);\r\n const hitRate = !!description.match(/(?<=命中) \\+\\d+/) ? parseInt(description.match(/(?<=命中) \\+\\d+/)[0]) : 0;\r\n const damage = !!description.match(/(?<=伤害) \\+\\d+/) ? parseInt(description.match(/(?<=伤害) \\+\\d+/)[0]) : 0;\r\n const def = !!description.match(/(?<=防御) \\+\\d+/) ? parseInt(description.match(/(?<=防御) \\+\\d+/)[0]) : 0;\r\n const viceAttr = {\r\n \"力量\": !!description.match(/(?<=力量) (\\+|-)\\d+/) ? parseInt(description.match(/(?<=力量) (\\+|-)\\d+/)[0]) : 0,\r\n \"体质\": !!description.match(/(?<=体质) (\\+|-)\\d+/) ? parseInt(description.match(/(?<=体质) (\\+|-)\\d+/)[0]) : 0,\r\n \"魔力\": !!description.match(/(?<=魔力) (\\+|-)\\d+/) ? parseInt(description.match(/(?<=魔力) (\\+|-)\\d+/)[0]) : 0,\r\n \"耐力\": !!description.match(/(?<=耐力) (\\+|-)\\d+/) ? parseInt(description.match(/(?<=耐力) (\\+|-)\\d+/)[0]) : 0,\r\n \"敏捷\": !!description.match(/(?<=敏捷) (\\+|-)\\d+/) ? parseInt(description.match(/(?<=敏捷) (\\+|-)\\d+/)[0]) : 0,\r\n };\r\n const meltAttr = {\r\n \"力量\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=力量)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=力量)/)[1]) : 0,\r\n \"体质\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=体质)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=体质)/)[1]) : 0,\r\n \"魔力\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=魔力)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=魔力)/)[1]) : 0,\r\n \"耐力\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=耐力)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=耐力)/)[1]) : 0,\r\n \"敏捷\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=敏捷)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=敏捷)/)[1]) : 0,\r\n \"防御\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=防御)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=防御)/)[1]) : 0,\r\n \"灵力\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=灵力)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=灵力)/)[1]) : 0,\r\n \"气血\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=气血)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=气血)/)[1]) : 0,\r\n \"速度\": !!description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=速度)/) ? parseInt(description.match(/(?<=熔炼效果:).+([\\+|-]\\d+)(?=速度)/)[1]) : 0,\r\n };\r\n const equip = new _equip_estimation_Equip__WEBPACK_IMPORTED_MODULE_4__.Equip();\r\n equip.viceAttr = viceAttr;\r\n equip.meltAttr = meltAttr;\r\n equip.def = def;\r\n equip.damage = damage;\r\n equip.hitRate = hitRate;\r\n equip.gemLevel = parseInt(!!description.match(/(?<=锻炼等级) \\d+/) ? description.match(/(?<=锻炼等级) \\d+/)[0] : \"0\");\r\n equip.gemType = (!!description.match(/(?<=镶嵌宝石) [\\u4e00-\\u9fa5]+/) ? description.match(/(?<=镶嵌宝石) [\\u4e00-\\u9fa5]+/)[0].trim() : null);\r\n equip.level = level;\r\n equip.name = name;\r\n equip.isSubLevel = description.indexOf(\"简易\") >= 0;\r\n return equip;\r\n }\r\n getAllEquipsInBagIncludingWeapon() {\r\n // @ts-ignore\r\n const rowCount = document.getElementById(\"RoleStoreEquips\").rows.length;\r\n const equips = [];\r\n for (let i = 0; i < rowCount; i++) {\r\n // @ts-ignore\r\n const row = document.getElementById(\"RoleStoreEquips\").rows[i];\r\n for (let j = 0; j < row.cells.length; j++) {\r\n const cell = row.cells[j];\r\n if (cell.innerHTML == \"\")\r\n continue;\r\n const description = cell.getElementsByTagName(\"img\")[0].getAttribute(\"data_equip_desc\");\r\n const name = cell.getElementsByTagName(\"img\")[0].getAttribute(\"data_equip_name\");\r\n const equip = this.pullEquip(description, name);\r\n if (!!equip)\r\n equips.push(equip);\r\n }\r\n }\r\n const weaponOn = document.getElementById(\"role_using_equip_6\");\r\n if (!!weaponOn) {\r\n const description = weaponOn.getAttribute(\"data_equip_desc\");\r\n const name = weaponOn.getAttribute(\"data_equip_name\");\r\n const equip = this.pullEquip(description, name);\r\n if (!!equip)\r\n equips.push(equip);\r\n }\r\n return equips;\r\n }\r\n}\r\nControlPanel.headerClassName = \"header area hasLayout clearfix\";\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/feature/control_panel/index.ts?");
/***/ }),
/***/ "./src/feature/equip_estimation/Equip.ts":
/*!***********************************************!*\
!*** ./src/feature/equip_estimation/Equip.ts ***!
\***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Equip\": () => (/* binding */ Equip),\n/* harmony export */ \"PROPERTY_TO_POINT_MAP\": () => (/* binding */ PROPERTY_TO_POINT_MAP)\n/* harmony export */ });\nconst PROPERTY_TO_POINT_MAP = {\r\n \"力量\": 0.5,\r\n \"体质\": 0.4,\r\n \"魔力\": 0.7,\r\n \"耐力\": 0.3,\r\n \"敏捷\": 0.7,\r\n \"防御\": 1 / 1.5 * 0.7,\r\n \"灵力\": 1,\r\n \"气血\": 0,\r\n \"速度\": 0,\r\n};\r\nclass Equip {\r\n constructor() {\r\n this.damage = 0;\r\n this.hitRate = 0;\r\n this.level = 0;\r\n this.isSubLevel = false;\r\n this.spirituality = 0;\r\n this.gemLevel = 0;\r\n this.gemType = null;\r\n this.def = 0;\r\n this.viceAttr = {\r\n \"力量\": 0.,\r\n \"体质\": 0.,\r\n \"魔力\": 0.,\r\n \"耐力\": 0.,\r\n \"敏捷\": 0.,\r\n };\r\n this.meltAttr = {\r\n \"力量\": 0,\r\n \"体质\": 0,\r\n \"魔力\": 0,\r\n \"耐力\": 0,\r\n \"敏捷\": 0,\r\n \"防御\": 0,\r\n \"灵力\": 0,\r\n \"气血\": 0,\r\n \"速度\": 0,\r\n };\r\n this.price = 0.1;\r\n this.id = undefined;\r\n }\r\n /*\r\n 装备估价方案\r\n 所有装备属性,附加属性,统统换算成 属性点 per 元, 例如, 每元钱1.1 属性点, 此项越高越好\r\n 目前均以法伤为换算标准\r\n 武器 换算 基础伤害/4\r\n 属性计算: 体质 * 0.4 + 魔力 *0.7 + 力量 * 0.5 + 耐力 * 0.3\r\n 防御计算: 防御值 / 1.5 * 0.7\r\n\r\n */\r\n getEstimationPoint() {\r\n return Math.round(this.getTotalRawEnhancement() / this.price * 100);\r\n }\r\n getTotalRawEnhancement() {\r\n if (this.level == 120 || (this.level == 130 && this.isSubLevel)) {\r\n const bonusPoint = this.getBonusPoint();\r\n const meltBonusPoint = this.getMeltBonusPoint();\r\n const initDamage = this.damage - (this.gemType === \"太阳石\" ? this.gemLevel * 8 : 0);\r\n const initDef = this.def - (this.gemType === \"月亮石\" ? this.gemLevel * 12 : 0);\r\n let initSpirituality = this.spirituality - (this.gemType === \"舍利子\" ? this.gemLevel * 6 : 0);\r\n initSpirituality = Math.max(0, initSpirituality);\r\n return Math.round(initDamage / 4 + initSpirituality + initDef / 1.5 * 0.7 + bonusPoint + meltBonusPoint);\r\n }\r\n return 0;\r\n }\r\n getTotalEnhancement() {\r\n const bonusPoint = this.getBonusPoint();\r\n const meltBonusPoint = this.getMeltBonusPoint();\r\n return Math.round(this.damage / 4 + this.spirituality + this.def / 1.5 * 0.7 + bonusPoint + meltBonusPoint);\r\n }\r\n getBonusPoint() {\r\n return Object.entries(this.viceAttr)\r\n .map(([key, value]) => PROPERTY_TO_POINT_MAP[key] * value)\r\n .reduce((a, b) => a + b, 0);\r\n }\r\n getMeltBonusPoint() {\r\n return Object.entries(this.meltAttr)\r\n .map(([key, value]) => PROPERTY_TO_POINT_MAP[key] * value)\r\n .reduce((a, b) => a + b, 0);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/feature/equip_estimation/Equip.ts?");
/***/ }),
/***/ "./src/feature/equip_estimation/index.ts":
/*!***********************************************!*\
!*** ./src/feature/equip_estimation/index.ts ***!
\***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EquipEstimation\": () => (/* binding */ EquipEstimation)\n/* harmony export */ });\n/* harmony import */ var _Equip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Equip */ \"./src/feature/equip_estimation/Equip.ts\");\n/* harmony import */ var _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/RemoteLogger */ \"./src/utils/RemoteLogger.ts\");\n\r\n\r\nclass EquipEstimation {\r\n constructor() {\r\n try {\r\n this.createButton();\r\n this.scanItems();\r\n }\r\n catch (e) {\r\n console.log(\"初始化装备扫描器失败\", e);\r\n }\r\n }\r\n scanItems() {\r\n if (window.location.href.indexOf(\"equipquery.py\") === -1)\r\n return;\r\n const allEquips = document.getElementById(\"soldList\").getElementsByTagName(\"tr\");\r\n for (let i = 1; i < allEquips.length; i++) {\r\n const equip = this.pullOneItem(allEquips[i]);\r\n console.log(equip);\r\n _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_1__.RemoteLogger.logEquip(equip);\r\n const innerHtml = `裸法伤: ${equip.getTotalRawEnhancement()}<br> 总法伤: ${equip.getTotalEnhancement()}`;\r\n const summary = document.createElement(\"td\");\r\n summary.innerHTML = innerHtml;\r\n allEquips[i].appendChild(summary);\r\n }\r\n }\r\n createButton() {\r\n const btn = document.createElement(\"button\");\r\n btn.innerHTML = \"换算数值\";\r\n document.getElementsByClassName(\"searchSbmt hasLayout\")[0].appendChild(btn);\r\n btn.onclick = () => {\r\n window[\"equipTool\"].scanItems();\r\n };\r\n const url = \"https://xyq-analysis.evereleven.top/analysis/user/\" + _utils_RemoteLogger__WEBPACK_IMPORTED_MODULE_1__.RemoteLogger.USER_ID;\r\n const btn2 = document.createElement(\"button\");\r\n btn2.innerHTML = \"打开分析页面\";\r\n document.getElementsByClassName(\"searchSbmt hasLayout\")[0].appendChild(btn2);\r\n btn2.onclick = () => {\r\n window.open(url, '_blank');\r\n };\r\n }\r\n pullOneItem(equipElement) {\r\n let equip = new _Equip__WEBPACK_IMPORTED_MODULE_0__.Equip();\r\n equip.level = 120;\r\n const name = equipElement.getElementsByTagName(\"img\")[0].getAttribute(\"data_equip_name\");\r\n const id = equipElement.getElementsByTagName(\"img\")[0].getAttribute(\"data_equipid\");\r\n equip.name = name;\r\n equip.id = id;\r\n const rawUrl = equipElement.getElementsByTagName(\"td\")[14].getElementsByTagName(\"a\")[0].getAttribute(\"href\");\r\n const id_ = rawUrl.match(/eid=[a-zA-Z0-9_.-]*/)[0];\r\n const index = rawUrl.indexOf(id_) + id_.length;\r\n equip.url = rawUrl.slice(0, index);\r\n equip.location = equipElement.getElementsByTagName(\"td\")[13].innerText;\r\n const property = JSON.parse(equipElement.getElementsByTagName(\"textarea\")[0].innerText);\r\n // 双加属性\r\n if (property.vice_attrs) {\r\n property.vice_attrs.forEach(valuePair => {\r\n equip.viceAttr[valuePair[0]] = parseInt(valuePair[1]);\r\n });\r\n }\r\n property.main_attrs.forEach(valuePair => {\r\n if (valuePair[0] == \"命中\") {\r\n equip.hitRate = parseInt(valuePair[1]);\r\n }\r\n if (valuePair[0] == \"伤害\") {\r\n equip.damage = parseInt(valuePair[1]);\r\n }\r\n if (valuePair[0] == \"灵力\") {\r\n equip.spirituality = parseInt(valuePair[1]);\r\n }\r\n if (valuePair[0] == \"防御\") {\r\n equip.def = parseInt(valuePair[1]);\r\n }\r\n });\r\n // 熔炼属性\r\n if (property.melt_attrs) {\r\n property.melt_attrs.forEach(valuePair => {\r\n equip.meltAttr[valuePair[0]] = parseInt(valuePair[1]);\r\n });\r\n }\r\n // 套装\r\n if (property.desc.indexOf(\"变身术\") >= 0) {\r\n const setName = property.desc.match(/变身术之.{1,5}/)[0].replace(/[^\\u4e00-\\u9fa5]+/, \"\");\r\n equip.set = setName;\r\n }\r\n equip.gemLevel = property.gem_level || 0;\r\n if (equip.gemLevel > 0) {\r\n equip.gemType = this.findGemType(property);\r\n }\r\n equip.price = parseInt(equipElement.getElementsByTagName('td')[12].getElementsByTagName(\"span\")[1].innerHTML.slice(1));\r\n return equip;\r\n }\r\n findGemType(property) {\r\n const index = property.desc.indexOf(\"镶嵌宝石\");\r\n return property.desc.slice(index + 5, index + 8);\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/feature/equip_estimation/index.ts?");
/***/ }),
/***/ "./src/index.ts":
/*!**********************!*\
!*** ./src/index.ts ***!
\**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"MyCharacterEstimation\": () => (/* binding */ MyCharacterEstimation)\n/* harmony export */ });\n/* harmony import */ var _feature_control_panel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./feature/control_panel */ \"./src/feature/control_panel/index.ts\");\n/* harmony import */ var _feature_equip_estimation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./feature/equip_estimation */ \"./src/feature/equip_estimation/index.ts\");\n\r\n\r\nclass MyCharacterEstimation {\r\n constructor() {\r\n this.controlPanel = new _feature_control_panel__WEBPACK_IMPORTED_MODULE_0__.ControlPanel();\r\n }\r\n}\r\nwindow[\"tool\"] = new MyCharacterEstimation();\r\nwindow[\"equipTool\"] = new _feature_equip_estimation__WEBPACK_IMPORTED_MODULE_1__.EquipEstimation();\r\nconsole.log(window[\"tool\"]);\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/index.ts?");
/***/ }),
/***/ "./src/types/type.ts":
/*!***************************!*\
!*** ./src/types/type.ts ***!
\***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Character\": () => (/* binding */ Character),\n/* harmony export */ \"Equips\": () => (/* binding */ Equips)\n/* harmony export */ });\n/* harmony import */ var _data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../data/DataCalculationHelper */ \"./src/data/DataCalculationHelper.ts\");\n\r\nclass Equips {\r\n}\r\nclass Character {\r\n constructor(characterClass) {\r\n this.characterClass = characterClass;\r\n this.equips = new Equips();\r\n this.price = 0;\r\n this.estimatePrice = 0;\r\n // @ts-ignore\r\n this.sideSkills = {};\r\n this.hasMount = false;\r\n this.petTraining = {\r\n 攻击控制力: 0,\r\n 抗法控制力: 0,\r\n 法术控制力: 0,\r\n 防御控制力: 0\r\n };\r\n this.mainSkills = [];\r\n this.equipsInBag = [];\r\n this.bestEquipDescription = null;\r\n }\r\n getNecklaceInitialSpirituality() {\r\n var _a, _b;\r\n if (!this.equips.necklace.bond) {\r\n return this.equips.necklace.initialSpirituality;\r\n }\r\n const boundReduce = (_a = this.equips.necklace.bond) === null || _a === void 0 ? void 0 : _a.spiritualityReduce;\r\n const boundMismatch = ((_b = this.equips.necklace.bond) === null || _b === void 0 ? void 0 : _b.bondToClass) != this.characterClass ? 1 : 0;\r\n return this.equips.necklace.initialSpirituality - boundMismatch * boundReduce;\r\n }\r\n setNecklace(necklace) {\r\n this.equips.necklace = necklace;\r\n }\r\n pullTraining(description) {\r\n let trainings = {};\r\n for (let row of description) {\r\n let key = row.split(\":\")[0];\r\n let value = parseInt(row.match(/\\d+/g)[0]);\r\n if (key === \"育兽术\")\r\n continue;\r\n trainings[key] = value;\r\n }\r\n return trainings;\r\n }\r\n pullCharacterTraining(description) {\r\n let trainings = {};\r\n for (let row of description) {\r\n let key = row.split(\":\")[0];\r\n let value = parseInt(row.split(\":\")[1].replace(\"\\t\", \"\").split(\"/\")[0]);\r\n trainings[key] = value;\r\n }\r\n return trainings;\r\n }\r\n setPetTraining(description) {\r\n this.petTraining = this.pullTraining(description);\r\n }\r\n setCharacterTraining(description) {\r\n this.characterTraining = this.pullCharacterTraining(description);\r\n }\r\n setupPrice(description) {\r\n this.price = parseInt(description.match(/\\d+/)[0]);\r\n }\r\n setupEstimatePrice() {\r\n const petTrainingDelta = _data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__.DataCalculationHelper.petTrainingToPrice(this.petTraining);\r\n const empowerPotentialCountDelta = this.empowerPotentialCount === 5 ? 0 : -700;\r\n const sideSkillDeltas = this.getSideSkillDeltas();\r\n const mountDeltas = this.hasMount ? 0 : -300;\r\n const mainSkillCost = -this.getMainSkillDeltas();\r\n const mainTrainingCost = -_data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__.DataCalculationHelper.characterTrainingToPrice(this.characterTraining);\r\n console.log(\"宠物修炼折算\", petTrainingDelta);\r\n console.log(\"乾元丹折算\", empowerPotentialCountDelta);\r\n console.log(\"辅助技能折算\" + sideSkillDeltas, this.sideSkills);\r\n console.log(\"坐骑成长折算\" + mountDeltas);\r\n console.log(\"师门技能折算\" + mainSkillCost);\r\n console.log(\"人物修炼折算\" + mainTrainingCost);\r\n this.estimatePrice = this.price - petTrainingDelta - empowerPotentialCountDelta - sideSkillDeltas - mountDeltas - mainTrainingCost - mainSkillCost;\r\n }\r\n getEstimatePrice() {\r\n return this.estimatePrice;\r\n }\r\n setEmpowerPotentialCount(count) {\r\n this.empowerPotentialCount = count;\r\n }\r\n setSideSkillLevel(name, level) {\r\n this.sideSkills[name] = level;\r\n }\r\n setupBestWeapon() {\r\n let bestScore = 0;\r\n for (let i = 0; i < this.equipsInBag.length; i++) {\r\n const equip = this.equipsInBag[i];\r\n if (equip.damage == 0 || equip.viceAttr.魔力 == 0)\r\n continue;\r\n if (equip.getTotalRawEnhancement() >= bestScore) {\r\n bestScore = equip.getTotalRawEnhancement();\r\n this.bestEquipDescription = \"武器折算法伤: \" + bestScore;\r\n }\r\n }\r\n }\r\n getSideSkillDeltas() {\r\n let delta = 0;\r\n delta += this.sideSkills[\"强身术\"] >= 140 ? 0 : -300;\r\n delta += this.sideSkills[\"中药医理\"] >= 140 || this.sideSkills[\"烹饪技巧\"] >= 140 ? 0 : -200;\r\n delta += -_data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__.DataCalculationHelper.getQiangZhuangShenSuToPrice(this.sideSkills['神速']);\r\n delta += -_data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__.DataCalculationHelper.getQiangZhuangShenSuToPrice(this.sideSkills['强壮']);\r\n return delta;\r\n }\r\n getMainSkillDeltas() {\r\n let cost = 0;\r\n const topSkills = this.mainSkills.sort().reverse().slice(0, 5);\r\n for (const skill of topSkills) {\r\n cost += _data_DataCalculationHelper__WEBPACK_IMPORTED_MODULE_0__.DataCalculationHelper.mainSkillLevelToPrice(skill);\r\n }\r\n return cost;\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/types/type.ts?");
/***/ }),
/***/ "./src/utils/EquipAnalysisUtil.ts":
/*!****************************************!*\
!*** ./src/utils/EquipAnalysisUtil.ts ***!
\****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"EquipAnalysisUtil\": () => (/* binding */ EquipAnalysisUtil)\n/* harmony export */ });\nclass EquipAnalysisUtil {\r\n static getEquipLevel(description) {\r\n return parseInt(description.match(/等级(.+) #r/)[1].trim());\r\n }\r\n static getEquipGemLevel(description) {\r\n return description.indexOf(\"锻炼等级\") >= 0 ? parseInt(description.match(/锻炼等级(.+)/)[1].trim()) : 0;\r\n }\r\n static getCurrentSpirituality(description) {\r\n return parseInt(description.match(/灵力(.+)/)[1].trim()) + this.getEmpoweredSpirituality(description);\r\n }\r\n static getEmpoweredSpirituality(description) {\r\n const empoweredDescription = description.match(/熔炼效果(.+)灵力/);\r\n if (empoweredDescription) {\r\n return parseInt(empoweredDescription[1].match(/\\d+/)[0]);\r\n }\r\n return 0;\r\n }\r\n static getBondClass(description) {\r\n const bondDescription = description.match(/非(.+?)使用/);\r\n if (bondDescription) {\r\n return bondDescription[1];\r\n }\r\n return null;\r\n }\r\n static getBondSpiritualityReduce(description) {\r\n const bondSpiritualityDescription = description.match(/非.+灵力/);\r\n if (bondSpiritualityDescription) {\r\n const boundReduce = parseInt(bondSpiritualityDescription[0].match(/\\d+/)[0]);\r\n return boundReduce;\r\n }\r\n return 0;\r\n }\r\n}\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/utils/EquipAnalysisUtil.ts?");
/***/ }),
/***/ "./src/utils/RemoteLogger.ts":
/*!***********************************!*\
!*** ./src/utils/RemoteLogger.ts ***!
\***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RemoteLogger\": () => (/* binding */ RemoteLogger)\n/* harmony export */ });\nvar _a;\r\nclass RemoteLogger {\r\n static logEquip(equip) {\r\n fetch(RemoteLogger.LOG_EQUIP_URL, {\r\n method: \"POST\",\r\n body: JSON.stringify(Object.assign(Object.assign({}, equip), { roleId: this.USER_ID, timestamp: new Date().getTime(), rawEnhancement: equip.getTotalRawEnhancement(), totalEnhancement: equip.getTotalEnhancement() }))\r\n });\r\n }\r\n static logActor(actor) {\r\n fetch(RemoteLogger.LOG_ACTOR_URL, {\r\n method: \"POST\",\r\n body: JSON.stringify(Object.assign(Object.assign({}, actor), { roleId: this.USER_ID, timestamp: new Date().getTime() }))\r\n });\r\n }\r\n static getCookieValue(name) {\r\n var _b;\r\n return ((_b = document.cookie.match('(^|;)\\\\s*' + name + '\\\\s*=\\\\s*([^;]+)')) === null || _b === void 0 ? void 0 : _b.pop()) || '';\r\n }\r\n}\r\n_a = RemoteLogger;\r\nRemoteLogger.LOG_EQUIP_URL = \"https://xyq-analysis.evereleven.top/equip\";\r\nRemoteLogger.LOG_ACTOR_URL = \"https://xyq-analysis.evereleven.top/actor\";\r\nRemoteLogger.USER_ID = _a.getCookieValue(\"last_login_roleid\");\r\n\n\n//# sourceURL=webpack://my-character-estimation/./src/utils/RemoteLogger.ts?");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module can't be inlined because the eval devtool is used.
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
/******/
/******/ })()
;