仙灵

仙灵 角色导入

  1. // ==UserScript==
  2. // @name 仙灵
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description 仙灵 角色导入
  6. // @author hhzxxx
  7. // @include *seelie.inmagi.com*
  8. // @match https://seelie.inmagi.com/
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=inmagi.com
  10. // @require https://cdn.staticfile.org/jquery/1.12.4/jquery.min.js
  11. // @run-at document-end
  12. // @grant GM_setValue
  13. // @grant GM_getValue
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. $(document).ready(function(){
  18. var i, c, fl, fk, x, a, b, mo = 0,
  19. glzs = 0,
  20. ver=0;
  21.  
  22. setInterval(() => {
  23. for (let index = 0; index < document.getElementsByTagName('a').length; index++) {
  24. document.getElementsByTagName('a')[index].setAttribute('rel','noreferrer')
  25. }
  26. },300)
  27.  
  28.  
  29.  
  30.  
  31. //--------------左下角按钮--设置界面------ 111-------
  32. let wdstyle = document.createElement('style');
  33. wdstyle.innerHTML = `
  34. .xfsz {
  35. transition: all 0.3s;
  36. height:60px;
  37. width: 60px;
  38. position: fixed;
  39. z-index: 10;
  40. opacity: 0;
  41. left: 0px;
  42. bottom: 0px;
  43. }
  44. .xfsz:hover{
  45. opacity: 1;
  46. }
  47. .xfck {
  48. display: none;
  49. background: #222;
  50. width: 300px;
  51. height: 100px;
  52. text-align: center;
  53. position: fixed;
  54. left: 50%;
  55. top: 50%;
  56. transform: translate(-50%, -50%);
  57. color: #fff;
  58. z-index: 99999;
  59. border: solid 3px #000000;
  60. }
  61. .xfsc {
  62. background: #444;
  63. right: 20px;
  64. border-radius: 35px;
  65. margin-bottom: 13px;
  66. margin-right: 10px;
  67. margin-left: 10px;
  68. cursor: pointer;
  69. border: solid 5px #444;
  70. white-space: nowrap;
  71. float: left;
  72. }
  73. .xfsc:hover {
  74. background: #000;
  75. border: solid 5px #000;
  76. }
  77. .xfan {
  78. width: 100px;
  79. height: 40px;
  80. }
  81. .xfyy {
  82. overflow: auto;
  83. width: 700px;
  84. height: 430px;
  85. margin: auto;
  86. }
  87. #xf_sr {
  88. width: 580px;
  89. height: 32px;
  90. margin: auto;
  91. }
  92. #xf_dc {
  93. margin-left: 40px;
  94. margin-right: 40px;
  95. }
  96. .xfgb {
  97. position: absolute;
  98. right: 3px;
  99. top: 3px;
  100. cursor: pointer;
  101. font-size: 40px;
  102. width: 40px;
  103. height: 40px;
  104. line-height: 40px;
  105. }
  106. .xfgb:hover {
  107. background: #f00;
  108. }
  109. .tabbox ul {
  110. list-style: none;
  111. display: table;
  112. margin: 0;
  113. padding-left: 70px;
  114. width: 1000px;
  115. }
  116. .tabbox ul li {
  117. float: left;
  118. width: 120px;
  119. height: 50px;
  120. line-height: 50px;
  121. font-size: 12px;
  122. border: 1px solid #aaccff;
  123. cursor: pointer;
  124. margin-left: 10px;
  125. margin-right: 10px;
  126. }
  127.  
  128. .tabbox ul li:hover{
  129. background-color: #111;
  130. color: white;
  131. font-weight: bold;
  132. }
  133. .tabbox ul li.active {
  134. background-color: #004f69;
  135. color: white;
  136. font-weight: bold;
  137. }
  138. .xfan,
  139. #xf_sr {
  140. background: #333;
  141. color: #ddd;
  142. }
  143. .xfan:hover,
  144. #xf_sr:focus {
  145. background: #111;
  146. color: #fff;
  147. }
  148.  
  149.  
  150. .xfsz_an {
  151. pointer-events:auto;
  152. left: 10px;
  153. bottom:10px;
  154. cursor: pointer;
  155. --glow-color: rgb(217, 176, 255);
  156. --glow-spread-color: rgba(191, 123, 255, 0.781);
  157. --enhanced-glow-color: rgb(231, 206, 255);
  158. --btn-color: rgb(100, 61, 136);
  159. border: 3px solid var(--glow-color);
  160. color: var(--glow-color);
  161. font-size: 16px;
  162. font-weight: bold;
  163. background-color: var(--btn-color);
  164. border-radius: 50%;
  165. text-align: center;
  166. outline: none;
  167. box-shadow: 0 0 1em .25em var(--glow-color),
  168. 0 0 4em 1em var(--glow-spread-color),
  169. inset 0 0 .75em .25em var(--glow-color);
  170. text-shadow: 0 0 .5em var(--glow-color);
  171. position:absolute;
  172. display: block;
  173. transition: all 0.3s;
  174. width:40px;
  175. height:40px;
  176. line-height: 40px;
  177. }
  178.  
  179. .xfsz_an:hover {
  180. color: var(--btn-color);
  181. background-color: var(--glow-color);
  182. box-shadow: 0 0 1em .25em var(--glow-color),
  183. 0 0 4em 2em var(--glow-spread-color),
  184. inset 0 0 .75em .25em var(--glow-color);
  185. }
  186.  
  187. .xfsz_an:active {
  188. box-shadow: 0 0 0.6em .25em var(--glow-color),
  189. 0 0 2.5em 2em var(--glow-spread-color),
  190. inset 0 0 .5em .25em var(--glow-color);
  191. }
  192. `;
  193. let wddiv = `
  194. <div class="xfsz">
  195. <div class="xfsz_an xfsz_sz" title="过滤设置">0</div>
  196.  
  197. </div>
  198. <div class="xfck">
  199. <div>仙灵角色上传 GOOD导入</div>
  200. <div class="xfgb">X
  201. </div>
  202. <div>
  203. <input type="file" id="files" class="xfan" value="导入">
  204. </div>
  205. </div>
  206. `;
  207.  
  208.  
  209. document.body.appendChild(wdstyle);
  210. setTimeout(() => {
  211. document.querySelector("body").innderHTML += wddiv;
  212. $(wddiv).appendTo($("body"));
  213. //关闭
  214. $(".xfgb").click(function () {
  215. $(".xfck").toggle();
  216. })
  217. $(".xfsz_an").click(function () {
  218. $(".xfck").toggle();
  219. });
  220.  
  221. var inputElement = document.getElementById("files");
  222. inputElement.addEventListener("change", handleFiles, false);
  223. function handleFiles() {
  224. var selectedFile = document.getElementById("files").files[0];//获取读取的File对象
  225. var name = selectedFile.name;//读取选中文件的文件名
  226. var size = selectedFile.size;//读取选中文件的大小
  227. console.log("文件名:"+name+"大小:"+size);
  228. var reader = new FileReader();//这里是核心!!!读取操作就是由它完成的。
  229. reader.readAsText(selectedFile);//读取文件的内容
  230. let levelTextList = {
  231. 0:"1",
  232. 10:"1",
  233. 20:"20",
  234. 21:"20 A",
  235. 31:"20 A",
  236. 41:"40",
  237. 42:"40 A",
  238. 52:"50",
  239. 53:"50 A",
  240. 63:"60",
  241. 64:"60 A",
  242. 74:"70",
  243. 75:"70 A",
  244. 85:"80",
  245. 86:"80 A",
  246. 96:"90"
  247. }
  248.  
  249. let levelList = [1,1,20,20,40,50,60,70,80,90]
  250. reader.onload = function(){
  251. let json = JSON.parse(this.result);
  252. if(json.characters){
  253. let goals = JSON.parse(localStorage.getItem('main-goals'))
  254. let newGoals = []
  255. let id = 1
  256. let character = null
  257. let nameList = []
  258. json.characters.filter(a => a.key != "TravelerDendro").forEach(c => {
  259. //久七人 九条沙罗
  260. let name = c.key.toLowerCase().replace("kukishinobu","shinobu").replace("kujousara","sara").replace("raidenshogun","shogun")
  261. if(nameList.indexOf(name) < 0){
  262. nameList.push(name)
  263. }
  264. character = {
  265. "type": "character",
  266. "character": name,
  267. "current": {
  268. "level": Math.round(c.level/10)*10,
  269. "asc": c.ascension,
  270. "text": levelTextList[Math.round(c.level/10)*10+c.ascension]
  271. },
  272. "goal": {
  273. "level": Math.round(c.level/10)*10,
  274. "asc": c.ascension,
  275. "text": levelTextList[Math.round(c.level/10)*10+c.ascension]
  276. },
  277. "cons": c.constellation,
  278. "id":id
  279. }
  280. let talent= {
  281. "type": "talent",
  282. "character": name,
  283. "normal": {
  284. "current": c.talent.auto,
  285. "goal": c.talent.auto
  286. },
  287. "skill": {
  288. "current": c.talent.skill,
  289. "goal": c.talent.skill
  290. },
  291. "burst": {
  292. "current": c.talent.burst,
  293. "goal": c.talent.burst
  294. },
  295. "id":id+1
  296. }
  297. let weapon = null
  298. if(goals){
  299. let existGoals = goals.filter(g => {
  300. return g.character == name
  301. }).forEach(e => {
  302. if(e.type == "character"){
  303. if((e.goal.level + e.goal.asc) > (character.goal.level + character.goal.asc)){
  304. character.goal = e.goal
  305. }
  306. }
  307. if(e.type == "talent"){
  308. talent.normal.goal = Math.max(e.normal.goal,talent.normal.goal)
  309. talent.skill.goal = Math.max(e.skill.goal,talent.skill.goal)
  310. talent.burst.goal = Math.max(e.burst.goal,talent.burst.goal)
  311. }
  312. if(e.type == "weapon"){
  313. weapon = e
  314. weapon.id = id+2
  315. }
  316. })
  317. }
  318.  
  319. character.current.level = levelList[Math.round(character.current.level/10)]
  320. character.goal.level = levelList[Math.round(character.goal.level/10)]
  321. newGoals.push(character)
  322. newGoals.push(talent)
  323.  
  324. id = id + 2
  325. if(weapon != null){
  326. newGoals.push(weapon)
  327. id = id + 1
  328. }
  329. })
  330. if(goals){
  331. let existGoals = goals.filter(g => {
  332. return nameList.indexOf(g.character) < 0
  333. }).forEach(e => {
  334. e.id = id
  335. newGoals.push(e)
  336. console.log(e,"old");
  337. id++
  338. })
  339. }
  340. console.log(newGoals);
  341. localStorage.setItem('main-goals',JSON.stringify(newGoals))
  342. setTimeout(() => {
  343. location.reload()
  344. }, 1000);
  345. }
  346.  
  347. };
  348.  
  349. }
  350.  
  351. }, 1000);
  352. });