Banderi / Dark Souls Tooltip Helper

// ==UserScript==
// @name         Dark Souls Tooltip Helper
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Banderi
// @match        *://*.reddit.com/r/darksouls/*
// @match        *://*.reddit.com/r/DarkSoulsMods/*
// @match        *://*.reddit.com/r/DarkSouls2/*
// @match        *://*.reddit.com/r/darksouls3/*
// @grant        none
// @run-at document-end
// @license MIT
// @copyright 2018, Banderi (https://openuserjs.org//users/Banderi)
// @require      https://code.jquery.com/jquery-3.1.1.min.js
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);
$.noConflict();

let words = [
  'Aggro',
  'AoE',
  'BP',
  'BS',
  'Caster',
  'Farming',
  'Fishing',
  'Ganker',
  'Giant MoM',
  'Giant Dad',
  'Gonker',
  'Griefer',
  'Grinding',
  'Jumping',
  'NG+',
  'Oki',
  'Praise the Sun!',
  'PTD',
  'PTDE',
  'Pulling',
  'PvE',
  'PvP',
  'SL',
  'Spam',
  'SS',
  'Tank',
  'Twinking',
  'Whiff',
  'ASS',
  'Bcat',
  'BEO',
  'BK',
  'BKGA',
  'BKGS',
  'BKH',
  'BKS',
  'BSS',
  'BTR',
  'BTSR',
  'CGSR',
  'CMW',
  'CPR',
  'CSSR',
  'CREO',
  'CSS',
  'Ctal',
  'DBF',
  'Dcat',
  'DGA',
  'DGH',
  'DGM',
  'DKGA',
  'DMB',
  'DMT',
  'DSGB',
  'DSS',
  'DWG',
  'DWGR',
  'EF',
  'GC',
  'GCFB',
  'GCS',
  'GFB',
  'GHE',
  'GHSA',
  'GLS',
  'GMB',
  'GMW',
  'GPR',
  'GSA',
  'HCSM',
  'HSA',
  'HSM',
  'HSW',
  'HW',
  'Icat',
  'Ital',
  'KJ',
  'Mcat',
  'MoM',
  'MotM',
  'MLBH',
  'MLGS',
  'MSGS',
  'NLR',
  'Ocat',
  'OIC',
  'PW',
  'REO',
  'RoEE',
  'RotEE',
  'RoF',
  'RoS',
  'RoSF',
  'RotSF',
  'RoSP',
  'RoFaP',
  'RotSP',
  'RPR',
  'RRoS',
  'RTR',
  'RTSR',
  'Scat',
  'SKS',
  'SKSS',
  'SLB',
  'SLS',
  'SoA',
  'SSS',
  'Stal',
  'TBC',
  'TCC',
  'TDC',
  'ToG',
  'Ttal',
  'TWoP',
  'VoD',
  'VR',
  'VT',
  'WDB',
  'WoG',
  'WotG',
  'WP'
];
let defs = [
  'Possibly short for Aggravate, it is the action of provoking an enemy or NPC into attempting to engage combat with the player. While this usually means walking within a certain distance of a monster\'s line of sight, it can also refer to pulling a monster from afar, or attacking certain non-hostile NPCs (which turns them hostile, and provokes them into fighting you).',
  'Area of effect; refers to attacks that only affect those within a specifc target range or distance',
  'Stands for Black Phantom. A borrowed phrase from Demon\'s Souls referring to the hostile phantom form of an NPC or the phantom form of invading players. The Dark Souls equivalent of the Demon\'s Souls\' Black Phantom is Dark Spirit.',
  'Stands for Backstab',
  'Descriptor for a player who relies on spells for combat, typically has sacrificed HP and defense for high Intelligence and Attunement. Does well in ranged combat but can do well in close quarters given the proper spells.',
  'Exploring a particular area to hopefully grab many rare items from enemies or collect souls. Many players will repetitively travel throughout certain areas of the game in hopes of gathering a rare item from a particular enemy such as Humanities.',
  'Seeking to perform one action rather than fighting as normal, typically multiple times in a row. Common examples are backstab fishing (usually by circling around an enemy or waiting for them to attack) and parry fishing (either baiting out certain attacks, or simply spamming parry). Fishing is typically frowned upon in P​vP, and can trivialize P​vE fairly easily.',
  'Players who brought allies to a P​vP situation, hoping to win by number advantage. In Dark Souls, this terminology usually applies to host players who summon phantom(s) and deliberately waits for an invasion to happen so that the invader usually ends up in a 1v2 or 1v3 situation.',
  'Sometimes a derogatory term, it refers to players who use the combination of the Giant Set with the Mask of the Mother. This armor combination is considered to endow the most overall survivability in the game, while also giving a very desirable amount of poise. The immense mathematical incentive to wear this armor has been met with controversy, sometimes being blamed for inhibiting aesthetic creativity and diversity.',
  'Similar to "G​iant M​oM"; an often-derogatory term denoting players who combine the Giant Set with the Mask of the Father. This armor set provides marginally less survivability than its Mask of the Mother counterpart, but raises the player\'s equip burden, allowing for easier fast-rolls and Dark Wood Grain Ring use while wearing an extremely protective suit of armor. Much like its counterpart, this armor set is often criticized for reducing variation in equipment and playstyle due to its statistical excellence.',
  'Similar to "G​anker"; denotes players who team up on an invader while playing through P​vE. The immediate difference between the two is a G​anker sets out with allies specifically to team up on other players, while a Gonker is simply progressing through the game and happens to be invaded.',
  'Players who take pleasure in bringing grief to other player, even if the griefer does not gain significant gameplay reward or even at a disadvantage. In Dark Souls, it is usually a player that uses high level gear on a low level character (so that it matches the online level range) to invade people. They mostly invade people on Undead Burg and other starting areas to easily win fights against novice players.',
  'Doing repeated activity (such as killing enemies) to gain experience points in order to level up faster. In Dark Souls, this basically means soul farming as souls is used for levelling up.',
  'When being invaded/invading, you attack the invader/are attacked by the host immediately after spawning (i.e. getting a jump on the invader/host).',
  'Stands for New Game Plus',
  'Short for Okizeme, which is the Japanese term for the tactical situation that is present against an enemy that is rising up off the ground, typically against someone who is recovering from being knocked down. Example of okizeme attacks (often themselves referred to as okizemes or okis) in Dark Souls is swinging your heavy weapon (or casting a spell) while the opponent are getting up (and thus unable to do anything) and timed it so that the attack connects right after the opponent\'s invincibility wears off. Another example is the chain backstab. Also commonly referred to as a wakeup or wakeup attack.',
  'A common message seen throughout to indicate approval or loyalty of an object, view, or covenant. It is just a mere phrase that is put to show happiness or just because the player felt like putting something down.',
  'Stands for Prepare To Die Edition, and refers to content that is available for the PS3 and Xbox 360 through the purchase of Artorias of the Abyss (DLC), and content on the PC that was not featured on the original release of Dark Souls.',
  'Stands for Prepare To Die Edition, and refers to content that is available for the PS3 and Xbox 360 through the purchase of Artorias of the Abyss (DLC), and content on the PC that was not featured on the original release of Dark Souls.',
  'A method used to draw out an enemy for tactical purposes, like separating an enemy from a group, or luring them into a more preferable terrain. This is commonly done with bows, but can be done with a variety of long-ranged attacks, including the use of spells and consumables.',
  'Stands for Player vs Environment.',
  'Stands for Player vs Player.',
  'Stands for Soul Level',
  'A repeated action (usually an attack) done generally to dish out large amounts of damage in disregard to one\'s safety. (e.g. spamming Great Combustion)',
  'Stands for Soul/Summon Sign',
  'Used to describe a player in heavy armor and shield. Tends to have high HP, Defense and Poise. Unsubtle, but definitely not inconsiderable in combat.',
  'The act of bringing mid/late-game, upgraded equipment to an early-game, low level environment for the purpose of securing easy wins in P​vP. Commonly performed using chaos weapons, as they have no stat-based scaling and may kill lower level players in one hit. Twinks are frowned upon by most people, with the act of twinking generally considered cheap and unchallenging.',
  'Refers to an attack that fails to connect with the opponent. Whether it misses them completely, or actually hits a character, but because that character was in the middle of a dodge-roll at the time, the attack does no damage. Whiffing an attack usually makes your character open to counter attacks. In Dark Souls, some weapons have special whiff animations that makes the player slower to recover when missing an attack, making whiffing more dangerous (e.g. most axes, halberds, greataxes)',
  'Stands for the weapon Astora\'s Straight Sword.',
  'Stands for the catalyst Beatrice\'s Catalyst',
  'Stands for the consumable Blue Eye Orb',
  'Stands for the weapon Bandit\'s Knife, although it can stand for the weapon Butcher Knife in specific contexts.',
  'Stands for the weapon Black Knight Greataxe',
  'Stands for the weapon Black Knight Greatsword',
  'Stands for the weapon Black Knight Halberd',
  'Stands for the weapon Black Knight Sword and sometimes the shield Black Knight Shield',
  'Stands for the weapon Balder Side Sword, although it can stand for the weapon Barbed Straight Sword in specific contexts.',
  'Stands for the ring Blue Tearstone Ring',
  'Stands for the ring Blue Tearstone Ring',
  'Stands for the ring Covetous Gold Serpent Ring',
  'Stands for the miracle Crystal Magic Weapon',
  'Stands for the consumable Charcoal Pine Resin',
  'Stands for the ring Covetous Silver Serpent Ring',
  'Stands for the consumable Cracked Red Eye Orb',
  'Stands for the miracle Crystal Soul Spear',
  'Stands for the talisman Canvas Talisman',
  'Stands for the weapon Dragon Bone Fist',
  'Stands for the catalyst Demon\'s Catalyst',
  'Stands for the weapon Demon\'s Greataxe',
  'Stands for the weapon Demon\'s Great Hammer',
  'Stands for the weapon Demon Great Machete',
  'Stands for the weapon Dragon King Greataxe',
  'Stands for the miracle Darkmoon Blade, although it can stand for the weapon Darkmoon Bow in specific contexts.',
  'Stands for the talisman Darkmoon Talisman',
  'Stands for the weapon Dragonslayer Greatbow',
  'Stands for the weapon Dragonslayer Spear',
  'Stands for the ring Dark Wood Grain Ring, also known as the Flip Ring',
  'Stands for the ring Dark Wood Grain Ring, also known as the Flip Ring',
  'Stands for the miracle Emit Force',
  'Stands for the pyromancy Great Combustion, although it can stand for the weapon Great Club in specific contexts.',
  'Stands for the pyromancy Great Chaos Fireball',
  'Stands for the shield Grass Crest Shield',
  'Stands for the pyromancy Great Fireball',
  'Stands for the miracle Great Heal Excerpt',
  'Stands for the sorcery Great Heavy Soul Arrow',
  'Stands for the miracle Great Lightning Spear',
  'Stands for the miracle Great Magic Barrier',
  'Stands for the sorcery Great Magic Weapon',
  'Stands for the consumable Gold Pine Resin',
  'Stands for the sorcery Great Soul Arrow',
  'Stands for the sorcery Homing Crystal Soulmass',
  'Stands for the sorcery Heavy Soul Arrow',
  'Stands for the sorcery Homing Soulmass',
  'Stands for the leggings Hollow Soldier Waistcloth',
  'Stands for the sorcery Hidden Weapon',
  'Stands for the catalyst Izalith Catalyst',
  'Stands for the talisman Ivory Talisman',
  'Stands for the miracle Karmic Justice',
  'Stands for the catalyst Manus Catalyst',
  'Stands for the headpiece Mask of the Mother',
  'Stands for the headpiece Mask of the Mother',
  'Stands for the weapon Moonlight Butterfly Horn',
  'Stands for the weapon: Moonlight Greatsword',
  'Stands for the weapon: Man Serpent Greatsword',
  'Stands for the area New Londo Ruins',
  'Stands for the catalyst Oolacile Catalyst',
  'Stands for the catalyst Oolacile Ivory Catalyst',
  'Stands for the pyromancy Power Within',
  'Stands for the consumable Red Eye Orb',
  'Stands for the ring Ring of the Evil Eye',
  'Stands for the ring Ring of the Evil Eye',
  'Stands for the ring Ring of Fog',
  'Stands for the ring Ring of Sacrifice',
  'Stands for the ring Ring of the Sun\'s Firstborn',
  'Stands for the ring Ring of the Sun\'s Firstborn',
  'Stands for the ring Ring of Steel Protection',
  'Stands for the ring Ring of Favor and Protection',
  'Stands for the ring Ring of the Sun Princess',
  'Stands for the consumable Rotten Pine Resin',
  'Stands for the ring Rare Ring of Sacrifice',
  'Stands for the ring Red Tearstone Ring',
  'Stands for the ring Red Tearstone Ring',
  'Stands for the catalyst Sorcerer\'s Catalyst',
  'Stands for the weapon Silver Knight Spear, although it can stand for the shield Silver Knight Shield in specific contexts.',
  'Stands for the weapon Silver Knight Straight Sword',
  'Stands for the miracle Sunlight Blade',
  'Stands for the miracle Sunlight Spear',
  'Stands for the headpiece Symbol of Avarice',
  'Stands for the weapon Sunlight Straight Sword',
  'Stands for the talisman Sunlight Talisman',
  'Stands for the catalyst Tin Banishment Catalyst',
  'Stands for the catalyst: Tin Crystallization Catalyst',
  'Stands for the catalyst Tin Darkmoon Catalyst',
  'Stands for the area Tomb of the Giants',
  'Stands for the talisman Thorolund Talisman',
  'Stands for the miracle Tranquil Walk of Peace',
  'Stands for the area Valley of Drakes',
  'Stands for the weapon Velka\'s Rapier',
  'Stands for the talisman Velka\'s Talisman',
  'Stands for the sorcery White Dragon Breath',
  'Stands for the miracle Wrath of the Gods',
  'Stands for the miracle Wrath of the Gods',
  'Stands for the weapon Washing Pole'
];

$(document).ready(function () {
  'use strict';

  $(".usertext-body").each(function () {
    if (this) {
      var c = $(this).html();
      for (let i = 0; i < words.length; i++) {
        let word = words[i];
        let def = defs[i];
        if (word == 'NG+')
          word = 'NG';
        let wreg = ' ' + word;
        c = c.replace(new RegExp(wreg, 'g'), '<span title="' + def + '">' + wreg + '</span>');
      }
      $(this).html(c);
    }
  })

})();