zeeSpecialTypes

Show if physical or virtual for all special types.

当前为 2020-05-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name zeeSpecialTypes
  3. // @namespace none
  4. // @version 2020.05.29.0315ß
  5. // @description Show if physical or virtual for all special types.
  6. // @author technical13
  7. // @supportURL https://discord.me/TheShoeStore
  8. // @match https://www.munzee.com/specials*
  9. // @match https://www.munzee.com/map*
  10. // @grant none
  11. // ==/UserScript==
  12. // jshint esversion: 6
  13.  
  14. var isDebug = false;
  15. var intVerbosity = 0;
  16. const ver = '2020.05.29.0315ß';
  17. const scriptName = 'zeeSpecialTypes v' + ver;
  18.  
  19. function log( intV, strConsole, strLog, ...arrArgs ) {
  20. if ( strConsole === undefined ) { strConsole = 'log'; }
  21. if ( strLog === undefined ) { strLog = '%o'; }
  22. if ( intVerbosity >= intV && ( strConsole === 'groupEnd' ) ) { console[ strConsole ](); }
  23. if ( intV === 0 || ( isDebug && intVerbosity >= intV ) ) { console[ strConsole ]( '[%i]: %s: ' + strLog, intV, scriptName, ...arrArgs ); }
  24. }
  25.  
  26. const intParamsStart = ( document.URL.indexOf( '?' ) + 1 );
  27. const strParams = document.URL.substr( intParamsStart );
  28. const arrParamSets = strParams.split( '&' );
  29. var objParams = {};
  30. arrParamSets.forEach( function( strParam ) {
  31. let arrParam = strParam.split( '=' );
  32. let strParamName = ( arrParam[ 0 ].toLowerCase() || '' );
  33. if ( strParamName === 'verbosity' ) {
  34. isDebug = toBoolean( arrParam[ 1 ] );
  35. intVerbosity = ( arrParam[ 1 ] ? ( parseInt( arrParam[ 1 ] ) < 0 ? 0 : ( parseInt( arrParam[ 1 ] ) > 9 ? 9 : parseInt( arrParam[ 1 ] ) ) ) : 9 );
  36. } else if ( strParamName === 'debug' ) {
  37. isDebug = toBoolean( arrParam[ 1 ] );
  38. intVerbosity = 1;
  39. }
  40. } );
  41.  
  42. log( 1, 'warn', 'Debug mode is on with verbosity level: %o', intVerbosity );
  43. log( 1, 'groupCollapsed', 'Verbosity options: (click to expand)' );
  44. log( 1, 'log', '1) Summary\n2) Parameters retrieved from URL\n3) Variables set to objParams\n4) Function returns\n9) ALL debugging info and this notice.' );
  45. log( 1, 'groupEnd' );
  46.  
  47. function toBoolean( val ) {
  48. const arrTrue = [ undefined, null, '', true, 'true', 1, '1', 'on', 'yes' ];
  49. val = ( typeof( val ) === 'string' ? val.toLowerCase() : val );
  50.  
  51. log( 4, 'log', 'toBoolean() is returning: %o', ( arrTrue.indexOf( val ) !== -1 ? true : false ) );
  52. return ( arrTrue.indexOf( val ) !== -1 ? true : false );
  53. }
  54.  
  55. const objTypes = {// laupereseller
  56. 0: 'physical',// munzee - greenie
  57. 4: 'physical',// premium
  58. 40: 'physical',// diamond
  59. 52: 'physical',// mace
  60. 53: 'physical',// longsword
  61. 131: 'physical',// ruby
  62. 140: 'physical',// battleaxe
  63. 218: 'physical',// aquamarine
  64. 242: 'physical',// topaz
  65. 280: 'physical',// mystery
  66. 290: 'virtual',// virtual_amethyst
  67. 306: 'virtual',// crossbow
  68. 535: 'virtual',// flatrob
  69. 441: 'physical',// shamrock
  70. 510: 'physical',// munzeemadnessreseller
  71. 511: 'physical',// geostuffreseller
  72. 512: 'physical',// geohobbiesreseller
  73. 513: 'physical',// ddcardsreseller
  74. 514: 'physical',// negsreseller
  75. 515: 'physical',// geologgersreseller
  76. 516: 'physical',// mmcocoabeachreseller
  77. 532: 'physical',// firemystery
  78. 550: 'physical',// rujareseller
  79. 584: 'physical',// pinkdiamond
  80. 651: 'physical',// icemystery
  81. 681: 'virtual',// virtual_sapphire
  82. 696: 'physical',// scgsreseller
  83. 851: 'physical',// earthmystery
  84. 998: 'physical',// thehammer
  85. 1015: 'virtual',// flatmatt
  86. 1020: 'physical',// watermystery
  87. 1057: 'physical',// treasurechest
  88. 1086: 'virtual',// airmystery
  89. 1248: 'virtual',// catapult
  90. 1271: 'physical',// dogchinesezodiac
  91. 1272: 'physical',// pigchinesezodiac
  92. 1273: 'physical',// ratchinesezodiac
  93. 1274: 'physical',// oxchinesezodiac
  94. 1275: 'physical',// tigerchinesezodiac
  95. 1276: 'physical',// rabbitchinesezodiac
  96. 1277: 'physical',// dragonchinesezodiac
  97. 1278: 'physical',// snakechinesezodiac
  98. 1279: 'physical',// horsechinesezodiac
  99. 1280: 'physical',// goatchinesezodiac
  100. 1281: 'physical',// monkeychinesezodiac
  101. 1282: 'physical',// roosterchinesezodiac
  102. 1338: 'virtual',// flatlou
  103. 1409: 'virtual',// virtual
  104. 1410: 'virtual',// virtual_rainbow
  105. 1411: 'virtual',// virtual_timberwolf
  106. 1412: 'virtual',// virtual_silver
  107. 1413: 'virtual',// virtual_gray
  108. 1414: 'virtual',// virtual_black
  109. 1415: 'virtual',// virtual_orchid
  110. 1416: 'virtual',// virtual_wisteria
  111. 1417: 'virtual',// virtual_purple_mountains_majesty
  112. 1418: 'virtual',// virtual_violet
  113. 1419: 'virtual',// virtual_plum
  114. 1420: 'virtual',// virtual_blue_violet
  115. 1421: 'virtual',// virtual_blue
  116. 1423: 'virtual',// virtual_cadet_blue
  117. 1424: 'virtual',// virtual_periwinkle
  118. 1425: 'virtual',// virtual_cornflower
  119. 1426: 'virtual',// virtual_blue_green
  120. 1427: 'virtual',// virtual_pacific_blue
  121. 1428: 'virtual',// virtual_cerulean
  122. 1429: 'virtual',// virtual_robin_egg_blue
  123. 1430: 'virtual',// virtual_indigo
  124. 1431: 'virtual',// virtual_turquoise_blue
  125. 1432: 'virtual',// virtual_sea_green
  126. 1433: 'virtual',// virtual_granny_smith_apple
  127. 1434: 'virtual',// virtual_green
  128. 1435: 'virtual',// virtual_forest_green
  129. 1436: 'virtual',// virtual_asparagus
  130. 1437: 'virtual',// virtual_olive_green
  131. 1438: 'virtual',// virtual_yellow_green
  132. 1439: 'virtual',// virtual_green_yellow
  133. 1440: 'virtual',// virtual_spring_green
  134. 1441: 'virtual',// virtual_gold
  135. 1442: 'virtual',// virtual_yellow
  136. 1443: 'virtual',// virtual_goldenrod
  137. 1444: 'virtual',// virtual_dandelion
  138. 1445: 'virtual',// virtual_orange
  139. 1446: 'virtual',// virtual_burnt_orange
  140. 1448: 'virtual',// virtual_melon
  141. 1449: 'virtual',// virtual_pink
  142. 1450: 'virtual',// virtual_carnation_pink
  143. 1451: 'virtual',// virtual_mauvelous
  144. 1452: 'virtual',// virtual_salmon
  145. 1453: 'virtual',// virtual_tickle_me_pink
  146. 1454: 'virtual',// virtual_magenta
  147. 1455: 'virtual',// virtual_wild_strawberry
  148. 1456: 'virtual',// virtual_violet_red
  149. 1457: 'virtual',// virtual_red_violet
  150. 1458: 'virtual',// virtual_apricot
  151. 1459: 'virtual',// virtual_peach
  152. 1460: 'virtual',// virtual_macaroni_and_cheese
  153. 1461: 'virtual',// virtual_tan
  154. 1462: 'virtual',// virtual_burnt_sienna
  155. 1463: 'virtual',// virtual_bittersweet
  156. 1464: 'virtual',// virtual_red_orange
  157. 1465: 'virtual',// virtual_scarlet
  158. 1466: 'virtual',// virtual_red
  159. 1467: 'virtual',// virtual_brick_red
  160. 1468: 'virtual',// virtual_mahogany
  161. 1469: 'virtual',// virtual_chestnut
  162. 1470: 'virtual',// virtual_tumbleweed
  163. 1471: 'virtual',// virtual_raw_sienna
  164. 1473: 'virtual',// virtual_brown
  165. 1581: 'virtual',// flathammock
  166. 2361: 'virtual',// virtual_citrine
  167. 2362: 'virtual',// virtual_onyx
  168. 2391: 'virtual'// electricmystery
  169. };
  170.  
  171. const arrUndefinedTypes = [
  172. 'ametust', 'oniks', 'smaragd',// Funfinity Stones
  173. 'banshee', 'gorgon', 'retiredbanshee',// Banshee
  174. 'limebutterfly', 'monarchbutterfly', 'morphobutterfly',// Butterly
  175. 'cyclops', 'balorcyclops', 'minotaurcyclops', 'ogre', 'retiredcyclops',// Cyclops
  176. 'cherub',// Cherub
  177. 'chinesedragon', 'wyverndragon',// Dragon
  178. 'dryadfairy', 'fairy', 'fairygodmother', 'retiredfairy', 'wildfirefairy',// Fairy
  179. 'centaurfaun', 'krampusfaun',// Faun
  180. // 'face-offflatmatt', 'footyflatmatt', 'matt\'erupflatmatt',// haven't found the icon variants on the website yet.// Flat Matt
  181. // 'beachflatrob', 'coldflatrob', 'tuxflatrob',// haven't found the icon variants on the website yet.// Flat Rob
  182. 'hadavale',// Hadaval
  183. 'hedgehog',// Hedgehog
  184. 'chimera', 'cthulhuhydra',// Hydra
  185. 'dwarfleprechaun', 'goblinleprechaun',// Leprechaun
  186. 'magnetus',// Magnetus
  187. 'melusinemermaid',// Mermaid
  188. 'motherearth',// Mother Earth
  189. 'elfnymph', 'nymph', 'vampirenymph',// Nymph
  190. 'owlet',// Owlet
  191. 'alicornpegasus', 'firepegasus', 'griffinpegasus',// Pegasus
  192. 'pimedus',// Pimedus
  193. 'polarbear'// Polar Bear
  194. ];
  195.  
  196. ( function() {
  197. 'use strict';
  198.  
  199. setTimeout( () => {
  200. for ( var ndxMarker in mapMarkers ) {
  201. var intBaseType = parseInt( mapMarkers[ ndxMarker ].capture_type_id );
  202. var arrMarkerType = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.match( /"https:\/\/((.*)?\/([\w]*)\.([\a-z0-9]{3,4}))\"/i );
  203. var strMarkerType = arrMarkerType[ 3 ];
  204. if ( arrUndefinedTypes.indexOf( strMarkerType ) !== -1 ) {
  205. let strDefinedType = '';
  206. switch ( objTypes[ intBaseType ] ) {
  207. case 'physical':
  208. case 'virtual':
  209. strDefinedType = strMarkerType + '_' + objTypes[ intBaseType ];
  210. break;
  211. case 'utl':
  212. strDefinedType = 'maintenance';
  213. console.info( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  214. break;
  215. default:
  216. strDefinedType = 'owned';
  217. console.error( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  218. }
  219.  
  220. mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.replace( strMarkerType, strDefinedType );
  221. }
  222. }
  223. }, 3000 );
  224.  
  225. map.on( 'move', mapChanged => {
  226. log( 2, 'log', 'map.changed: %o', mapChanged );
  227. setTimeout( () => {
  228. for ( var ndxMarker in mapMarkers ) {
  229. var intBaseType = mapMarkers[ ndxMarker ].capture_type_id;
  230. var arrMarkerType = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.match( /"https:\/\/((.*)?\/([\w]*)\.([\a-z0-9]{3,4}))\"/i );
  231. var strMarkerType = arrMarkerType[ 3 ];
  232. if ( arrUndefinedTypes.indexOf( strMarkerType ) !== -1 ) {
  233. let strDefinedType = '';
  234. switch ( objTypes[ intBaseType ] ) {
  235. case 'physical':
  236. case 'virtual':
  237. strDefinedType = strMarkerType + '_' + objTypes[ intBaseType ];
  238. break;
  239. case 'utl':
  240. strDefinedType = 'maintenance';
  241. console.info( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  242. break;
  243. default:
  244. strDefinedType = 'owned';
  245. console.error( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  246. }
  247.  
  248. mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.replace( strMarkerType, strDefinedType );
  249. }
  250. }
  251. }, 2250 );
  252. } );
  253.  
  254. map.on( 'zoom', mapChanged => {
  255. log( 2, 'log', 'map.changed: %o', mapChanged );
  256. setTimeout( () => {
  257. for ( var ndxMarker in mapMarkers ) {
  258. var intBaseType = mapMarkers[ ndxMarker ].capture_type_id;
  259. var arrMarkerType = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.match( /"https:\/\/((.*)?\/([\w]*)\.([\a-z0-9]{3,4}))\"/i );
  260. var strMarkerType = arrMarkerType[ 3 ];
  261. if ( arrUndefinedTypes.indexOf( strMarkerType ) !== -1 ) {
  262. let strDefinedType = '';
  263. switch ( objTypes[ intBaseType ] ) {
  264. case 'physical':
  265. case 'virtual':
  266. strDefinedType = strMarkerType + '_' + objTypes[ intBaseType ];
  267. break;
  268. case 'utl':
  269. strDefinedType = 'maintenance';
  270. console.info( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  271. break;
  272. default:
  273. strDefinedType = 'owned';
  274. console.error( 'base: %i;Marker: %s', intBaseType, strMarkerType );
  275. }
  276.  
  277. mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue = mapMarkers[ ndxMarker ]._element.attributes.style.nodeValue.replace( strMarkerType, strDefinedType );
  278. }
  279. }
  280. }, 1300 );
  281. } );
  282. } )();