pbr Game Scout statslib - New Gen

description

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/473623/1238871/pbr%20Game%20Scout%20statslib%20-%20New%20Gen.js

  1. // ==UserScript==
  2. // @name pbr Game Scout statslib - New Gen
  3. // @description description
  4. // @namespace pbr
  5. // @copyright 2008, pabst
  6. // @include https://glb.warriorgeneral.com/game/replay.pl?game_id=*&pbp_id=*
  7. // @license (CC) Attribution Share Alike; http://creativecommons.org/licenses/by-sa/3.0/
  8. // @version 22.08.22
  9. //updated to work with the new GLB domain
  10. // ==/UserScript==
  11.  
  12. function Stats() {
  13. this.toString = function() {
  14. return this.team_name[0]+" ("+this.team_id[0]+") vs. "+this.team_name[1]+" ("+this.team_id[1]+")";
  15. }
  16. this.team_name = [];
  17. this.team_id = [];
  18. this.team_possession = [0,0,0,0,0,0,0,0,0,0,0,0];
  19. this.team_penalty = [0,0,0,0,0,0,0,0,0,0,0,0];
  20. this.team_att = [0,0,0,0,0,0,0,0,0,0];
  21. this.team_yards = [0,0,0,0,0,0,0,0,0,0];
  22. this.team_success = [0,0,0,0,0,0,0,0,0,0];
  23. this.team_firsts = [0,0,0,0,0,0,0,0,0,0];
  24. this.team_lyards = [0,0,0,0,0,0,0,0,0,0];
  25. this.team_pass_att = [0,0,0,0,0,0];
  26. this.team_pass_comp = [0,0,0,0,0,0];
  27. this.team_pass_yards = [0,0,0,0,0,0];
  28. this.team_pass_firsts = [0,0,0,0,0,0];
  29.  
  30. this.team_att_down = [0,0,0,0,0,0,0,0];
  31. this.team_yards_down = [0,0,0,0,0,0,0,0];
  32. this.team_success_down = [0,0,0,0,0,0,0,0];
  33. this.team_firsts_down = [0,0,0,0,0,0,0,0];
  34. this.team_lyards_down = [0,0,0,0,0,0,0,0];
  35.  
  36. this.team_pass_att_down = [0,0,0,0,0,0,0,0];
  37. this.team_pass_comp_down = [0,0,0,0,0,0,0,0];
  38. this.team_pass_yards_down = [0,0,0,0,0,0,0,0];
  39. this.team_pass_firsts_down = [0,0,0,0,0,0,0,0];
  40. this.team_pass_pressure_down = [0,0,0,0,0,0,0,0];
  41.  
  42. this.team_quarter_totals = new Array(6);
  43. for (var i=0; i<6; i++) {
  44. this.team_quarter_totals[i] = [0,0,0,0,0,0,0,0,0,0,0,0,0,0];
  45. }
  46.  
  47. this.playerRushingName = [[],[]];
  48. this.playerRushingStats = [[],[]]; //[att,yard,long,succ,fd,brtk]
  49. this.playerRushingStatsCombine = [true,true,false,true,true,true];
  50.  
  51. this.playerPassingName = [[],[]];
  52. this.playerPassingStats = [[],[]]; //[comp,att,yard,td,int,pd,drop,bad,hurry]
  53. this.playerPassingStatsCombine = [true,true,true,true,true,true,true,true,true];
  54.  
  55. this.playerReceivingName = [[],[]];
  56. this.playerReceivingStats = [[],[]]; //[comp,att,drop,yard,long,yac,pd,fd,brtk.kl]
  57. this.playerReceivingStatsCombine = [true,true,true,true,false,true,true,true,true,true];
  58.  
  59. this.playerDefensiveName = [[],[]];
  60. this.playerDefensiveStats = [[],[]]; //[tot,rtack,rmiss,ptack,pmiss,sttack,stmiss]
  61. this.playerDefensiveStatsCombine = [true,true,true,true,true,true,true,true];
  62.  
  63. this.playerDefensiveRushName = [[],[]];
  64. this.playerDefensiveRushStats = [[],[]]; //tack,miss,yards,stop,defeat,ff
  65. this.playerDefensivePassName = [[],[]];
  66. this.playerDefensivePassStats = [[],[]]; //tack,miss,yards,stop,defeat,ff,int,pd,kl
  67. this.playerDefensiveSTName = [[],[]];
  68. this.playerDefensiveSTStats = [[],[]]; //tack,miss,yards,ff
  69. this.playerKickingName = [[],[]];
  70. this.playerKickingStats = [[],[]]; //[ko,yards,long,tb,in20,net]
  71. this.playerKickingStatsCombine = [true,true,false,true,true,true];
  72.  
  73. this.playerPuntingName = [[],[]];
  74. this.playerPuntingStats = [[],[]]; //[p,yards,long,tb,in20,net]
  75. this.playerPuntingStatsCombine = [true,true,false,true,true,true];
  76.  
  77. this.playerKickReturnStats = [[],[]];
  78. this.playerKickReturnName = [[],[]]; //[kr,yards,long,td,brtk,dst]
  79. this.playerKickReturnStatsCombine = [true,true,false,true,true,true];
  80.  
  81. this.playerPuntReturnStats = [[],[]];
  82. this.playerPuntReturnName = [[],[]]; //[pr,yards,long,td,brtk,dst]
  83. this.playerPuntReturnStatsCombine = [true,true,false,true,true,true];
  84.  
  85. this.playerPenaltyName = [[],[]];
  86. this.playerPenaltyStats = [[],[]]; //[false start, offsides, encroachment]
  87. this.playerPenaltyStatsCombine = [true,true,true];
  88. this.distanceStats = new Array(4);
  89. for (var i=0; i<4; i++) {
  90. this.distanceStats[i]=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
  91. //>0cay - >5cay - >15cay
  92. }
  93.  
  94. this.driveList = [[],[]];
  95. }
  96.  
  97. function Drive() {
  98. this.teamName;
  99. this.quarter;
  100. this.startTime;
  101. this.endTime;
  102. this.driveBegan;
  103. this.driveEnded;
  104. this.numOfPlays = 0;
  105. this.netYards = 0;
  106. this.result;
  107.  
  108. this.toString = function() {
  109. return this.quarter+" : "+this.startTime+" : "+this.endTime+" : " +
  110. this.timePoss+" : "+this.driveBegan+" : " +
  111. this.driveEnded+" : "+this.numOfPlays+" : " +
  112. yardDiff(this.driveBegan,this.driveEnded) +
  113. " : "+this.result;
  114. }
  115. }
  116.  
  117. function addition(left,right) {
  118. var stats = new Stats();
  119. var aligned = false;
  120.  
  121. //console.log("addition start");
  122. /*
  123. if ((left.team_id[0] == right.team_id[0]) ||
  124. (left.team_id[1] == right.team_id[1])) {
  125. aligned = true;
  126. }
  127. else if ((left.team_name[0] == right.team_name[0]) ||
  128. (left.team_name[1] == right.team_name[1])) {
  129. aligned = true;
  130. }
  131. else {
  132. aligned = false;
  133. }
  134. */
  135. try {
  136. //if (left.team_id[0].indexOf(parseFloat(right.team_id[0])) != -1) {
  137. if (parseFloat(left.team_id[0]) == parseFloat(right.team_id[0])) {
  138. aligned = true;
  139. }
  140. else if ((left.team_name[0] == right.team_name[0]) ||
  141. (left.team_name[1] == right.team_name[1])) {
  142. aligned = true;
  143. }
  144. //else if (left.team_id[1].indexOf(parseFloat(right.team_id[1])) != -1) {
  145. else if (parseFloat(left.team_id[1]) == parseFloat(right.team_id[1])) {
  146. aligned = true;
  147. }
  148. else {
  149. aligned = false;
  150. }
  151. }
  152. catch (err) {
  153. //console.log("addition() says: "+err);
  154. if ((left.team_id[0] == right.team_id[0]) ||
  155. (left.team_id[1] == right.team_id[1])) {
  156. aligned = true;
  157. }
  158. else if ((left.team_name[0] == right.team_name[0]) ||
  159. (left.team_name[1] == right.team_name[1])) {
  160. aligned = true;
  161. }
  162. else {
  163. aligned = false;
  164. }
  165. }
  166.  
  167. //console.log(left.team_id+" -- "+right.team_id+" -- "+aligned);
  168.  
  169. var len = left.team_possession.length
  170. for (var i=0; i<len; i++) {
  171. if (aligned == true) idx = i;
  172. else idx = (i+len/2)%len;
  173. stats.team_possession[i] = left.team_possession[i] +
  174. right.team_possession[idx];
  175. }
  176. len = left.team_penalty.length
  177. for (var i=0; i<len; i++) {
  178. if (aligned == true) idx = i;
  179. else idx = (i+len/2)%len;
  180. stats.team_penalty[i] = left.team_penalty[i] +
  181. right.team_penalty[idx];
  182. }
  183. len = left.team_att.length;
  184. for (var i=0; i<len; i++) {
  185. if (aligned == true) idx = i;
  186. else idx = (i+len/2)%len;
  187. stats.team_att[i] = left.team_att[i] +
  188. right.team_att[idx];
  189. stats.team_yards[i] = left.team_yards[i] +
  190. right.team_yards[idx];
  191. stats.team_success[i] = left.team_success[i] +
  192. right.team_success[idx];
  193. stats.team_firsts[i] = left.team_firsts[i] +
  194. right.team_firsts[idx];
  195. stats.team_lyards[i] = left.team_lyards[i] +
  196. right.team_lyards[idx];
  197. }
  198. len = left.team_pass_comp.length;
  199. for (var i=0; i<len; i++) {
  200. if (aligned == true) idx = i;
  201. else idx = (i+len/2)%len;
  202. stats.team_pass_comp[i] = left.team_pass_comp[i] +
  203. right.team_pass_comp[idx];
  204. stats.team_pass_att[i] = left.team_pass_att[i] +
  205. right.team_pass_att[idx];
  206. stats.team_pass_yards[i] = left.team_pass_yards[i] +
  207. right.team_pass_yards[idx];
  208. stats.team_pass_firsts[i] = left.team_pass_firsts[i] +
  209. right.team_pass_firsts[idx];
  210. }
  211. len = left.team_att_down.length;
  212. for (var i=0; i<len; i++) {
  213. if (aligned == true) idx = i;
  214. else idx = (i+len/2)%len;
  215. stats.team_att_down[i] = left.team_att_down[i] +
  216. right.team_att_down[idx];
  217. stats.team_yards_down[i] = left.team_yards_down[i] +
  218. right.team_yards_down[idx];
  219. stats.team_success_down[i] = left.team_success_down[i] +
  220. right.team_success_down[idx];
  221. stats.team_firsts_down[i] = left.team_firsts_down[i] +
  222. right.team_firsts_down[idx];
  223. stats.team_lyards_down[i] = left.team_lyards_down[i] +
  224. right.team_lyards_down[idx];
  225. }
  226. len = left.team_pass_comp_down.length;
  227. for (var i=0; i<len; i++) {
  228. if (aligned == true) idx = i;
  229. else idx = (i+len/2)%len;
  230. stats.team_pass_comp_down[i] = left.team_pass_comp_down[i] +
  231. right.team_pass_comp_down[idx];
  232. stats.team_pass_att_down[i] = left.team_pass_att_down[i] +
  233. right.team_pass_att_down[idx];
  234. stats.team_pass_yards_down[i] = left.team_pass_yards_down[i] +
  235. right.team_pass_yards_down[idx];
  236. stats.team_pass_firsts_down[i] = left.team_pass_firsts_down[i] +
  237. right.team_pass_firsts_down[idx];
  238. stats.team_pass_pressure_down[i] = left.team_pass_pressure_down[i] +
  239. right.team_pass_pressure_down[idx];
  240. }
  241. for (var i=0; i<6; i++) {
  242. len = left.team_quarter_totals[i].length;
  243. for (var j=0; j<len; j++) {
  244. if (aligned == true) idx = j;
  245. else idx = (j+len/2)%len;
  246. stats.team_quarter_totals[i][j] = left.team_quarter_totals[i][j] +
  247. right.team_quarter_totals[i][idx];
  248. }
  249. }
  250. for (var i=0; i<4; i++) {
  251. len = left.distanceStats[i].length;
  252. for (var j=0; j<len; j++) {
  253. if (aligned == true) idx = j;
  254. else idx = (j+len/2)%len;
  255. stats.distanceStats[i][j] = left.distanceStats[i][j] +
  256. right.distanceStats[i][idx];
  257. }
  258. }
  259.  
  260. var x = left;
  261. if (x.team_id[0] == null) {
  262. x = right;
  263. }
  264. //console.log(left.team_id+" -- "+right.team_id+" -- "+x.team_id);
  265. //console.log(left.team_id+":"+left.team_name+" -- "+right.team_id+":"+right.team_name);
  266. stats.team_name[0] = x.team_name[0];
  267. stats.team_id[0] = x.team_id[0];
  268. stats.team_name[1] = x.team_name[1];
  269. stats.team_id[1] = x.team_id[1];
  270.  
  271. var i=0;
  272. if (aligned == false) {
  273. i++;
  274. }
  275. stats.driveList[0] = right.driveList[i];
  276. stats.driveList[1] = right.driveList[(i+1)%2];
  277. stats.playerRushingName = [[],[]];
  278. stats.playerRushingStats = [[],[]];
  279. combineRushing(stats,left,right,aligned);
  280.  
  281. stats.playerReceivingName = [[],[]];
  282. stats.playerReceivingStats = [[],[]];
  283. combineReceiving(stats,left,right,aligned);
  284.  
  285. stats.playerPassingName = [[],[]];
  286. stats.playerPassingStats = [[],[]];
  287. combinePassing(stats,left,right,aligned);
  288.  
  289. stats.playerDefensiveName = [[],[]];
  290. stats.playerDefensiveStats = [[],[]];
  291. combineDefensive(stats,left,right,aligned);
  292.  
  293. stats.playerKickingName = [[],[]];
  294. stats.playerKickingStats = [[],[]];
  295. combineKicking(stats,left,right,aligned);
  296.  
  297. stats.playerPuntingName = [[],[]];
  298. stats.playerPuntingStats = [[],[]];
  299. combinePunting(stats,left,right,aligned);
  300.  
  301. stats.playerKickReturnName = [[],[]];
  302. stats.playerKickReturnStats = [[],[]];
  303. combineKickReturn(stats,left,right,aligned);
  304.  
  305. stats.playerPuntReturnName = [[],[]];
  306. stats.playerPuntReturnStats = [[],[]];
  307. combinePuntReturn(stats,left,right,aligned);
  308.  
  309. stats.playerPenaltyName = [[],[]];
  310. stats.playerPenaltyStats = [[],[]];
  311. combinePenalty(stats,left,right,aligned);
  312.  
  313. //console.log("addition end");
  314. return stats;
  315. }
  316.  
  317. function combineRushing(total, left, right, align) {
  318. combineArrays(total.playerRushingName,total.playerRushingStats,
  319. left.playerRushingName, left.playerRushingStats,
  320. right.playerRushingName,right.playerRushingStats,
  321. align,total.playerRushingStatsCombine);
  322. }
  323.  
  324. function combineReceiving(total, left, right, align) {
  325. combineArrays(total.playerReceivingName,total.playerReceivingStats,
  326. left.playerReceivingName, left.playerReceivingStats,
  327. right.playerReceivingName,right.playerReceivingStats,
  328. align,total.playerReceivingStatsCombine);
  329. }
  330.  
  331. function combinePassing(total, left, right, align) {
  332. combineArrays(total.playerPassingName,total.playerPassingStats,
  333. left.playerPassingName, left.playerPassingStats,
  334. right.playerPassingName,right.playerPassingStats,
  335. align,total.playerPassingStatsCombine);
  336. }
  337.  
  338. function combineDefensive(total, left, right, align) {
  339. combineArrays(total.playerDefensiveRushName,total.playerDefensiveRushStats,
  340. left.playerDefensiveRushName, left.playerDefensiveRushStats,
  341. right.playerDefensiveRushName,right.playerDefensiveRushStats,
  342. align,total.playerDefensiveStatsCombine);
  343. combineArrays(total.playerDefensivePassName,total.playerDefensivePassStats,
  344. left.playerDefensivePassName, left.playerDefensivePassStats,
  345. right.playerDefensivePassName,right.playerDefensivePassStats,
  346. align,total.playerDefensiveStatsCombine);
  347. combineArrays(total.playerDefensiveSTName,total.playerDefensiveSTStats,
  348. left.playerDefensiveSTName, left.playerDefensiveSTStats,
  349. right.playerDefensiveSTName,right.playerDefensiveSTStats,
  350. align,total.playerDefensiveStatsCombine);
  351. //console.log(total.playerDefensivePassStats+"=="+left.playerDefensivePassStats+"++"+right.playerDefensivePassStats);
  352. }
  353.  
  354. function combineKicking(total, left, right, align) {
  355. combineArrays(total.playerKickingName,total.playerKickingStats,
  356. left.playerKickingName, left.playerKickingStats,
  357. right.playerKickingName,right.playerKickingStats,
  358. align,total.playerKickingStatsCombine);
  359. }
  360.  
  361. function combinePunting(total, left, right, align) {
  362. combineArrays(total.playerPuntingName,total.playerPuntingStats,
  363. left.playerPuntingName, left.playerPuntingStats,
  364. right.playerPuntingName,right.playerPuntingStats,
  365. align,total.playerPuntingStatsCombine);
  366. }
  367.  
  368. function combineKickReturn(total, left, right, align) {
  369. combineArrays(total.playerKickReturnName,total.playerKickReturnStats,
  370. left.playerKickReturnName, left.playerKickReturnStats,
  371. right.playerKickReturnName,right.playerKickReturnStats,
  372. align,total.playerKickReturnStatsCombine);
  373. }
  374.  
  375. function combinePuntReturn(total, left, right, align) {
  376. combineArrays(total.playerPuntReturnName,total.playerPuntReturnStats,
  377. left.playerPuntReturnName, left.playerPuntReturnStats,
  378. right.playerPuntReturnName,right.playerPuntReturnStats,
  379. align,total.playerPuntReturnStatsCombine);
  380. }
  381.  
  382. function combinePenalty(total, left, right, align) {
  383. combineArrays(total.playerPenaltyName,total.playerPenaltyStats,
  384. left.playerPenaltyName, left.playerPenaltyStats,
  385. right.playerPenaltyName,right.playerPenaltyStats,
  386. align, total.playerPenaltyStatsCombine);
  387. }
  388.  
  389. function combineArrays(totalName, totalStats, leftName, leftStats,
  390. rightName, rightStats, align, combine) {
  391. for (var t=0; t<leftName.length; t++) {
  392. for (var i=0; i<leftName[t].length; i++) {
  393. totalName[t].push(leftName[t][i]);
  394. totalStats[t].push(leftStats[t][i]);
  395. }
  396. }
  397.  
  398. for (var t=0; t<2; t++) {
  399. if (align == true) tidx = t;
  400. else tidx = (t+1)%2;
  401.  
  402. if (rightName[tidx] == null) continue;
  403. for (var i=0; i<rightName[tidx].length; i++) {
  404. var idx = totalName[t].indexOf(rightName[tidx][i]);
  405. if (idx == -1) {
  406. totalName[t].push(rightName[tidx][i]);
  407. totalStats[t].push(rightStats[tidx][i]);
  408. }
  409. else {
  410. for (var j=0; j<rightStats[tidx][i].length; j++) {
  411. if (combine[j] == true) {
  412. totalStats[t][idx][j] += rightStats[tidx][i][j];
  413. }
  414. else {
  415. totalStats[t][idx][j] = Math.max(totalStats[t][idx][j],
  416. rightStats[tidx][i][j]);
  417. }
  418. }
  419. }
  420. }
  421. try {
  422. if (showEverything == false) return;
  423. }
  424. catch (err) {
  425. }
  426. }
  427. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址