TibiaWiki
m (Rappy 4187 moved page MediaWiki:LootStatistics.js to MediaWiki:LootStatistics-Checker.js without leaving a redirect)
m (removing unused tags)
Line 1: Line 1:
//<noinclude>{{protected|this page contains javascript and therefore VERY vulnerable to vandalism or hackers}}</noinclude><pre id="pre_lootchecker">
 
 
/*jslint devel: true, browser: true, plusplus: true, white: true */
 
/*jslint devel: true, browser: true, plusplus: true, white: true */
 
/*global $ */
 
/*global $ */
Line 774: Line 773:
 
});
 
});
 
}());
 
}());
//</pre>
 

Revision as of 05:33, 9 May 2019

/*jslint devel: true, browser: true, plusplus: true, white: true */
/*global $ */

(function () {
  'use strict';
  var sysop = false,
  main_function = function () {
    var current_tibia_version = '8.6',
    //this variable is the same as in loot parser but more specific, split in 'changed' and 'new'
    lootparser_versions_ex =
      {'8.6': {
        'changed': {
          'Crazed Winter Vanguard': '12.03',
          'The Percht Queen': '12.03',
          'The Scourge of Oblivion': '12.00',
          'Guardian of Tales': '11.94',
          'Burning Book': '11.94',
          'Rage Squid': '11.94',
          'Icecold Book': '11.94',
          'Squid Warden': '11.94',
          'Animated Feather': '11.94',
          'Cursed Book': '11.94',
          'Ink Blob': '11.94',
          'Brain Squid': '11.94',
          'Energetic Book': '11.94',
          'Knowledge Elemental': '11.94',
          'Biting Book': '11.94',
          'Deathling Scout': '11.83',
          'Deathling Spellsinger': '11.83',
          'Falcon Knight': '11.83',
          'Falcon Paladin': '11.83',
          'True Dawnfire Asura': '11.83',
          'True Frost Flower Asura': '11.83',
          'True Midnight Asura': '11.83',
          'Deepworm': '11.52',
          'Diremaw': '11.52',
          'Putrid Mummy': '11.50',
          'Werebadger': '11.50',
          'Werebear': '11.50',
          'Wereboar': '11.50',
          'Enfeebled Silencer': '11.41',
          'High Voltage Elemental': '11.41',
          'Instable Sparkion': '11.41',
          'Massive Energy Elemental': '11.41',
          'Sparkion': '11.41',
          'Weakened Frazzlemaw': '11.41',
          'Cyclops': '11.02',
          'Ghoul': '11.02',
          'Orc': '11.02',
          'Orc Shaman': '11.02',
          'Orc Spearman': '11.02',
          'Orc Warrior': '11.02',
          'Skeleton': '11.02',
          'Troll': '11.02',
          'Ancient Scarab': '10.8',
          'Choking Fear': '10.8',
          'Corym Charlatan': '10.8',
          'Corym Skirmisher': '10.8',
          'Corym Vanguard': '10.8',
          'Elder Bonelord': '10.8',
          'Kongra': '10.8',
          'Lizard Sentinel': '10.8',
          'Massive Water Elemental': '10.8',
          'Orc Berserker': '10.8',
          'Retching Horror': '10.8',
          'Waspoid': '10.8',
          'Water Elemental': '10.8',
          'Werewolf': '10.8',
          'Wild Warrior': '10.8',
          'Devourer': '10.7',
          'Glooth Anemone': '10.7',
          'Glooth Golem': '10.7',
          'Metal Gargoyle': '10.7',
          'Rustheap Golem': '10.7',
          'Terofar': '10.5',
          'Zavarash': '10.5',
          'Chakoya Toolshaper': '10.37',
          'Chakoya Tribewarden': '10.37',
          'Chakoya Windcaller': '10.37',
          'Demon': '10.37',
          'Hellhound': '10.37',
          'Juggernaut': '10.3',
          'Demon Skeleton': '10.1',
          'Lich': '10.1',
          'Nightfiend': '10.1',
          'Vampire': '10.1',
          'Betrayed Wraith': '9.86',
          'Blightwalker': '9.86',
          'Crystal Spider': '9.86',
          'Deathbine': '9.86',
          'Gargoyle': '9.86',
          'Hand of Cursed Fate': '9.86',
          'Hide': '9.86',
          'Ice Golem': '9.86',
          'Lost Soul': '9.86',
          'Mammoth': '9.86',
          'Phantasm': '9.86',
          'Quara Constrictor Scout': '9.86',
          'Quara Hydromancer Scout': '9.86',
          'Quara Mantassin Scout': '9.86',
          'Quara Pincher Scout': '9.86',
          'Quara Predator Scout': '9.86',
          'Stone Golem': '9.86',
          'Terramite': '9.86',
          'The Bloodtusk': '9.86',
          'Thornback Tortoise': '9.86',
          'Tortoise': '9.86',
          'Swamp Troll': '9.8',
          'Bug': '9.63',
          'Poison Spider': '9.63',
          'Rat': '9.63',
          'Spider': '9.63',
          'Young Troll': '9.63',
          'Massive Fire Elemental': '9.6',
          'Behemoth': '9.5',
          'Dark Torturer': '9.5',
          'Defiler': '9.5',
          'Draken Spellweaver': '9.5',
          'Eternal Guardian': '9.5',
          'Ethershreck': '9.5',
          'Ghastly Dragon': '9.5',
          'Giant Spider': '9.5',
          'Gnarlhound': '9.5',
          'Gorgo': '9.5',
          'Hydra': '9.5',
          'Kerberos': '9.5',
          'Killer Caiman': '9.5',
          'Lizard Zaogun': '9.5',
          'Mutated Tiger': '9.5',
          'Quara Constrictor': '9.5',
          'Quara Hydromancer': '9.5',
          'Quara Mantassin': '9.5',
          'Quara Pincher': '9.5',
          'Sea Serpent': '9.5',
          'Stonecracker': '9.5',
          'Undead Dragon': '9.5',
          'Wailing Widow': '9.5',
          'Wyvern': '9.5',
          'Esmeralda': '9.2',
          'Leviathan': '9.2',
          'Shardhead': '9.2',
          'The Many': '9.2',
          'The Noxious Spawn': '9.2',
          'The Old Widow': '9.2',
          'The Snapper': '9.2',
          'Thul': '9.2',
          'Blazing Fire Elemental': '9.1',
          'Blistering Fire Elemental': '9.1',
          'Carrion Worm': '9.1',
          'Draken Abomination': '9.1',
          'Dwarf Guard': '9.1',
          'Earth Elemental': '9.1',
          'Fire Overlord': '9.1',
          'Hellfire Fighter': '9.1',
          'Jagged Earth Elemental': '9.1',
          'Muddy Earth Elemental': '9.1',
          'Tarantula': '9.1',
          'Witch': '9.1',
          'Worker Golem': '9.1'
        },
        'new': {
          'Arachnophobica': '12.00',
          'Burster Spectre': '12.00',
          'Crazed Summer Rearguard': '12.00',
          'Crazed Summer Vanguard': '12.00',
          'Crazed Winter Rearguard': '12.00',
          'Crazed Winter Vanguard': '12.00',
          'Gazer Spectre': '12.00',
          'Hibernal Moth': '12.00',
          'Insane Siren': '12.00',
          'Lacewing Moth': '12.00',
          'Lucifuga Aranea': '12.00',
          'Lumbering Carnivor': '12.00',
          'Menacing Carnivor': '12.00',
          'Ripper Spectre': '12.00',
          'Soul-Broken Harbinger': '12.00',
          'Spiky Carnivor': '12.00',
          'Thanatursus': '12.00',
          'Alptramun': '12.00',
          'Faceless Bane': '12.00',
          'Izcandar Champion of Summer': '12.00',
          'Izcandar Champion of Winter': '12.00',
          'Izcandar the Banished': '12.00',
          'Malofur Mangrinder': '12.00',
          'Maxxenius': '12.00',
          'Plagueroot': '12.00',
          'The Nightmare Beast': '12.00',
          'Cave Devourer': '11.50',
          'Chasm Spawn': '11.50',
          'Tunnel Tyrant': '11.50',
          'Dawnfire Asura': '10.8',
          'Ekatrix': '10.8',
          'Elder Forest Fury': '10.8',
          'Feroxa': '10.8',
          'Feroxa (Gloom Wolf)': '10.8',
          'Feroxa (Killable Werewolf)': '10.8',
          'Feroxa (Werewolf)': '10.8',
          'Ghost Wolf': '10.8',
          'Gloom Wolf': '10.8',
          'Mahatheb': '10.8',
          'Midnight Asura': '10.8',
          'Omnivora': '10.8',
          'Oodok Witchmaster': '10.8',
          'Owin': '10.8',
          'Redeemed Soul': '10.8',
          'Renegade Knight': '10.8',
          'Tainted Soul': '10.8',
          'The Flaming Orchid': '10.8',
          'The Manhunter': '10.8',
          'The Mean Masher': '10.8',
          'Tzumrah the Dazzler': '10.8',
          'Vicious Squire': '10.8',
          'Vile Grandmaster': '10.8',
          'Abyssal Calamary': '10.7',
          'Control Tower': '10.7',
          'Deep Terror': '10.7',
          'Depowered Minotaur': '10.7',
          'Empowered Glooth Horror': '10.7',
          'Energy Pulse': '10.7',
          'Feeble Glooth Horror': '10.7',
          'Glooth Bandit': '10.7',
          'Glooth Battery': '10.7',
          'Glooth Bomb': '10.7',
          'Glooth Brigand': '10.7',
          'Glooth Horror': '10.7',
          'Glooth Masher': '10.7',
          'Glooth Powered Minotaur': '10.7',
          'Glooth Slasher': '10.7',
          'Glooth Trasher': '10.7',
          'Glooth-Generator': '10.7',
          'Minotaur Commander': '10.7',
          'Minotaur Invader': '10.7',
          'Minotaur Totem': '10.7',
          'Minotaur Wallbreaker': '10.7',
          'Moohtant Wallbreaker': '10.7',
          'Noble Lion': '10.7',
          'Professor Maxxen': '10.7',
          'Renegade Quara Constrictor': '10.7',
          'Renegade Quara Hydromancer': '10.7',
          'Renegade Quara Mantassin': '10.7',
          'Renegade Quara Pincher': '10.7',
          'Renegade Quara Predator': '10.7',
          'Roaring Lion': '10.7',
          'Seacrest Serpent': '10.7',
          'Strong Glooth Horror': '10.7',
          'Tentacle of the Deep Terror': '10.7',
          'Tremor Worm': '10.7',
          'Unstable Tunnel': '10.7',
          'Weakened Glooth Horror': '10.7',
          'Brittle Skeleton': '10.55',
          'Crazed Dwarf': '10.55',
          'Dawn Scorpion': '10.55',
          'Dawnfly': '10.55',
          'Juvenile Cyclops': '10.55',
          'Lesser Fire Devil': '10.55',
          'Meadow Strider': '10.55',
          'Minotaur Bruiser': '10.55',
          'Minotaur Occultist': '10.55',
          'Minotaur Poacher': '10.55',
          'Mountain Troll': '10.55',
          'Muglex Clan Assassin': '10.55',
          'Muglex Clan Footman': '10.55',
          'Muglex Clan Scavenger': '10.55',
          'Sacred Snake': '10.55',
          'Salamander Trainer': '10.55',
          'Scar Tribe Shaman': '10.55',
          'Scar Tribe Warrior': '10.55',
          'Troll-Trained Salamander': '10.55',
          'Woodling': '10.55',
          'Blood Beast': '10.5',
          'Bullwark': '10.5',
          'Death Priest Shargon': '10.5',
          'Execowtioner': '10.5',
          'Glooth Blob': '10.5',
          'Glooth Fairy': '10.5',
          'Lisa': '10.5',
          'Minotaur Amazon': '10.5',
          'Minotaur Hunter': '10.5',
          'Mooh\'Tah Warrior': '10.5',
          'Moohtant': '10.5',
          'Rot Elemental': '10.5',
          'The Ravager': '10.5',
          'Walker': '10.5',
          'Worm Priestess': '10.5',
          'Demon Outcast': '10.3',
          'Feversleep': '10.3',
          'Frazzlemaw': '10.3',
          'Gaz\'Haragoth': '10.3',
          'Gaz\'haragoth': '10.3',
          'Guzzlemaw': '10.3',
          'Horadron': '10.3',
          'Mawhawk': '10.3',
          'Omrafir': '10.3',
          'Prince Drazzak': '10.3',
          'Shiversleep': '10.3',
          'Shock Head': '10.3',
          'Sight of Surrender': '10.3',
          'Silencer': '10.3',
          'Terrorsleep': '10.3',
          'Enraged Soul': '10.2',
          'Furyosa': '10.2',
          'Hirintror': '10.2',
          'Ocyakao': '10.2',
          'Shlorg': '10.2',
          'The Pale Count': '10.2',
          'The Welter': '10.2',
          'Tyrn': '10.2',
          'Weakened Shlorg': '10.2',
          'White Pale': '10.2',
          'Zushuka': '10.2',
          'Blood Hand': '10.1',
          'Blood Priest': '10.1',
          'Elder Wyrm': '10.1',
          'Forest Fury': '10.1',
          'Gravedigger': '10.1',
          'Leaf Golem': '10.1',
          'Rorc': '10.1',
          'Shadow Pupil': '10.1',
          'Tarnished Spirit': '10.1',
          'Vampire Viscount': '10.1',
          'Vicious Manbat': '10.1',
          'White Shade': '10.1',
          'Wilting Leaf Golem': '10.1',
          'Adventurer': '9.8',
          'Angry Adventurer': '9.8',
          'Drillworm': '9.8',
          'Emerald Damselfly': '9.8',
          'Little Corym Charlatan': '9.8',
          'Lost Basher': '9.8',
          'Lost Husher': '9.8',
          'Lost Thrower': '9.8',
          'Marsh Stalker': '9.8',
          'Party Skeleton': '9.8',
          'Pigeon': '9.8',
          'Salamander': '9.8',
          'Swampling': '9.8',
          'Water Buffalo': '9.8',
          'Abyssador': '9.6',
          'Armadile': '9.6',
          'Bibby Bloodbath': '9.6',
          'Cliff Strider': '9.6',
          'Crystalcrusher': '9.6',
          'Damaged Crystal Golem': '9.6',
          'Deathstrike': '9.6',
          'Dragonling': '9.6',
          'Enraged Crystal Golem': '9.6',
          'Enslaved Dwarf': '9.6',
          'Gnomevil': '9.6',
          'Hideous Fungus': '9.6',
          'Humongous Fungus': '9.6',
          'Humorless Fungus': '9.6',
          'Ironblight': '9.6',
          'Lava Golem': '9.6',
          'Lost Berserker': '9.6',
          'Magma Crawler': '9.6',
          'Modified Gnarlhound': '9.6',
          'Mushroom Sniffer': '9.6',
          'Orewalker': '9.6',
          'Stone Devourer': '9.6',
          'Versperoth': '9.6',
          'Vesperoth': '9.6',
          'Vulcongra': '9.6',
          'Weeper': '9.6',
          'Wiggler': '9.6',
          'Bretzecutioner': '9.5',
          'Bruise Payne': '9.5',
          'Chopper': '9.5',
          'Fazzrah': '9.5',
          'Fleshslicer': '9.5',
          'Hemming': '9.5',
          'Maw': '9.5',
          'Mindmasher': '9.5',
          'Paiz the Pauperizer': '9.5',
          'Rotspit': '9.5',
          'Shadowstalker': '9.5',
          'Tormentor': '9.5',
          'Tromphonyte': '9.5',
          'Zanakeph': '9.5',
          'Calamary': '9.4',
          'Crawler': '9.4',
          'Deepling Guard': '9.4',
          'Deepling Spellsinger': '9.4',
          'Deepling Warrior': '9.4',
          'Deepling Worker': '9.4',
          'Fish': '9.4',
          'Floor Blob': '9.4',
          'Hive Pore': '9.4',
          'Insectoid Worker': '9.4',
          'Jaul': '9.4',
          'Jellyfish': '9.4',
          'Kollos': '9.4',
          'Lady Bug': '9.4',
          'Ladybug': '9.4',
          'Lesser Swarmer': '9.4',
          'Manta Ray': '9.4',
          'Northern Pike': '9.4',
          'Obujos': '9.4',
          'Shark': '9.4',
          'Slippery Northern Pike': '9.4',
          'Spidris': '9.4',
          'Spidris Elite': '9.4',
          'Spitter': '9.4',
          'Swarmer': '9.4',
          'Swarmer Hatchling': '9.4',
          'Tanjis': '9.4',
          'Flameborn': '9.2',
          'Fleshcrawler': '9.2',
          'Ribstride': '9.2',
          'Sulphur Scuttler': '9.2',
          'The Bloodweb': '9.2',
          'Askarak Demon': '9.1',
          'Askarak Lord': '9.1',
          'Askarak Prince': '9.1',
          'Bog Frog': '9.1',
          'Clay Guardian': '9.1',
          'Crystal Wolf': '9.1',
          'Death Priest': '9.1',
          'Deepling Scout': '9.1',
          'Desperate White Deer': '9.1',
          'Diamond Servant': '9.1',
          'Donkey': '9.1',
          'Dromedary': '9.1',
          'Elder Mummy': '9.1',
          'Elf Overseer': '9.1',
          'Energized Raging Mage': '9.1',
          'Enraged White Deer': '9.1',
          'Feverish Citizen': '9.1',
          'Filth Toad': '9.1',
          'Firestarter': '9.1',
          'Ghoulish Hyaena': '9.1',
          'Golden Servant': '9.1',
          'Grave Guard': '9.1',
          'Groam': '9.1',
          'Honour Guard': '9.1',
          'Horestis': '9.1',
          'Horse': '9.1',
          'Insectoid Scout': '9.1',
          'Iron Servant': '9.1',
          'Kraknaknork': '9.1',
          'Kraknaknork\'s Demon': '9.1',
          'Mad Mage': '9.1',
          'Raging Mage': '9.1',
          'Sacred Spider': '9.1',
          'Sandstone Scorpion': '9.1',
          'Shaburak Demon': '9.1',
          'Shaburak Lord': '9.1',
          'Shaburak Prince': '9.1',
          'Slug': '9.1',
          'Spider Queen': '9.1',
          'Starving Wolf': '9.1',
          'Thornfire Wolf': '9.1',
          'Tomb Servant': '9.1',
          'Weakened Demon': '9.1',
          'White Deer': '9.1',
          'Yielothax': '9.1'
        }
    } },
    //same as in loot parser
    lootparser_creature_special_names = {
      'Arkhothep': 'Arkhothep (Creature)',
      'Armenius': 'Armenius (Creature)',
      'Avalanche': 'Avalanche (Creature)',
      'Fish': 'Fish (Creature)',
      'Gamemaster': 'Gamemaster (Creature)',
      'Hacker': 'Hacker (Creature)',
      'Nomad': 'Nomad (Basic)',
      'Northern Pike': 'Northern Pike (Creature)',
      'Owin': 'Owin (Creature)',
      'Pythius the Rotten': 'Pythius the Rotten (Creature)',
      'Thief': 'Thief (Creature)',
      'The Sinister Hermit': 'The Sinister Hermit (Blue)',
      'Yalahari': 'Yalahari (Creature)'
    },
    //same as in loot parser
    creature_items_name_change = {
      'Acolyte of the Cult': {'Book': 'Book (Orange)', 'Music Sheet': 'Music Sheet (Second Verse)'},
      'Adept of the Cult': {'Book': 'Book (Orange)', 'Music Sheet': 'Music Sheet (Third Verse)'},
      'Annihilon': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Barbarian Brutetamer': {'Book': 'Book (Grey)'},
      'Blue Djinn': {'Book': 'Book (Blue)'},
      'Brain Squid': {'Inkwell': 'Inkwell (Black)'},
      'Chopper': {'Dung Ball': 'Dung Ball (Quest)'},
      'Crazed Beggar': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Crazed Summer Rearguard': {'Egg With Dream Essence': 'Egg with Dream Essence'},
      'Crazed Summer Vanguard': {'Egg With Dream Essence': 'Egg with Dream Essence'},
      'Crazed Winter Rearguard': {'Egg With Dream Essence': 'Egg with Dream Essence', 'Ice Flower': 'Ice Flower (Item)'},
      'Crazed Winter Vanguard': {'Egg With Dream Essence': 'Egg with Dream Essence', 'Ice Flower': 'Ice Flower (Item)'},
      'Damaged Worker Golem': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Deepling Scout': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Demodras': {'Book': 'Book (Gemmed)'},
      'Dharalion': {'Parchment': 'Parchment (Rewritable)'},
      'Dragon Lord': {'Book': 'Book (Gemmed)'},
      'Earth Elemental': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Enlightened of the Cult': {'Book': 'Book (Orange)', 'Music Sheet': 'Music Sheet (Fourth Verse)'},
      'Falcon Knight': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Green)'},
      'Falcon Paladin': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Green)'},
      'Fleshslicer': {'Dung Ball': 'Dung Ball (Quest)'},
      'Frost Dragon': {'Book': 'Book (Gemmed)'},
      'Fury': {'Rusty Legs': 'Rusty Legs (Rare)', 'Jalapeño Pepper': 'Jalapeno Pepper', 'Jalapeńo Pepper': 'Jalapeno Pepper', 'Jalape�o Pepper': 'Jalapeno Pepper'},
      'Furyosa': {'Jalapeño Pepper': 'Jalapeno Pepper', 'Jalapeńo Pepper': 'Jalapeno Pepper', 'Jalape�o Pepper': 'Jalapeno Pepper'},
      'Ghastly Dragon': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Ghost': {'Book': 'Book (Orange)'},
      'Glooth Brigand': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Green)'},
      'Green Djinn': {'Book': 'Book (Green)'},
      'Grim Reaper': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Groam': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Grynch Clan Goblin': {'Picture': 'Picture (Landscape)'},
      'Hand of Cursed Fate': {'Book': 'Book (Orange)'},
      'Hellgorak': {'Rusty Armor': 'Rusty Armor (Rare)', 'Rusty Legs': 'Rusty Legs (Rare)'},
      'Horestis': { 'Rusty Legs': 'Rusty Legs (Rare)' },
      'Ink Blob': {'Inkwell': 'Inkwell (Black)', 'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Brown)'},
      'Insane Siren': {'Egg With Dream Essence': 'Egg with Dream Essence'},
      'Iron Servant': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Juggernaut': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Kollos': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Brown)'},
      'Leviathan': {'Rusty Armor': 'Rusty Armor (Semi-Rare)', 'Rusty Legs': 'Rusty Legs (Semi-Rare)'},
      'Madareth': {'Rusty Armor': 'Rusty Armor (Rare)', 'Rusty Legs': 'Rusty Legs (Rare)'},
      'Massive Earth Elemental': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Massive Energy Elemental': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Massive Fire Elemental': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Maw': {'Dung Ball': 'Dung Ball (Quest)'},
      'Medusa': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Mindmasher': {'Dung Ball': 'Dung Ball (Quest)'},
      'Mutated Human': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Novice of the Cult': {'Book': 'Book (Orange)', 'Music Sheet': 'Music Sheet (First Verse)'},
      'Ogre Brute': {'Rusty Helmet': 'Rusty Helmet (Semi-Rare)'},
      'Ogre Savage': {'Jalapeño Pepper': 'Jalapeno Pepper', 'Jalapeńo Pepper': 'Jalapeno Pepper', 'Jalape�o Pepper': 'Jalapeno Pepper'},
      'Orc Shaman': {'Book': 'Book (Grey)'},
      'Piñata Dragon': {'Costume Bag': 'Costume Bag (Retro)'},
      'Pirate Buccaneer': {'Treasure Map': 'Treasure Map (Pirate)'},
      'Pirate Cutthroat': {'Treasure Map': 'Treasure Map (Pirate)'},
      'Pirate Ghost': {'Parchment': 'Parchment (Rewritable)'},
      'Pirate Marauder': {'Treasure Map': 'Treasure Map (Pirate)'},
      'Plaguesmith': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Priestess': {'Book': 'Book (Orange)'},
      'Prince Drazzak': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Brown)'},
      'Rage Squid': {'Inkwell': 'Inkwell (Black)'},
      'Rotspit': {'Dung Ball': 'Dung Ball (Quest)'},
      'Rustheap Golem': {'Rusty Armor': 'Rusty Armor (Rare)', 'Rusty Legs': 'Rusty Legs (Rare)'},
      'Seacrest Serpent': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Green)'},
      'Shadowpelt': {'Giant Shimmering Pearl': 'Giant Shimmering Pearl (Brown)'},
      'Shadowstalker': {'Dung Ball': 'Dung Ball (Quest)'},
      'Shaper Matriarch': {'Rusty Helmet': 'Rusty Helmet (Semi-Rare)'},
      'Soul-Broken Harbinger': {'Egg With Dream Essence': 'Egg with Dream Essence', 'Ice Flower': 'Ice Flower (Item)'},
      'Squid Warden': {'Inkwell': 'Inkwell (Black)'},
      'Tarnished Spirit': {'Book': 'Book (Orange)'},
      'Thawing Dragon Lord': {'Ice Cream Cone': 'Ice Cream Cone (Blue-Barian)'},
      'The Many': {'Egg of the Many': 'Egg of The Many'},
      'The Percht Queen': {'Icicle': 'Icicle (Percht)', 'Fly Agaric': 'Fly Agaric (Item)'},
      'Thieving Squirrel': {'Flask With Beaver Bait': 'Flask with Beaver Bait'},
      'Ushuriel': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Vampire Bride': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'War Golem': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Werewolf': {'Rusty Armor': 'Rusty Armor (Semi-Rare)'},
      'Worker Golem': {'Rusty Armor': 'Rusty Armor (Semi-Rare)', 'Rusty Legs': 'Rusty Legs (Semi-Rare)'},
      'Zanakeph': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Zombie': {'Rusty Armor': 'Rusty Armor (Common)'},
      'Zorvorax': {'Rusty Armor': 'Rusty Armor (Rare)'},
      'Zugurosh': {'Rusty Armor': 'Rusty Armor (Rare)', 'Rusty Legs': 'Rusty Legs (Rare)'},
      'Zulazza the Corruptor': {'Rusty Armor': 'Rusty Armor (Rare)'}
    },
    creature_items_name_paren = {},
    requests_to_do, total_requests, x, y,
    requests_to_do_minus = function () {
      $('#stats_doing1').html('Checking');
      $('#stats_doing2').html(String(Math.abs(requests_to_do - total_requests)) + '/' + String(total_requests));
      requests_to_do--;
      if (requests_to_do <= 0) {
        $('#stats_data').parents('div:first').find('input').removeAttr('disabled');
        $('#stats_doing2').html('Complete');
      }
    },
    check_all = function (filter_function) {
      var dook = function ($a) {
        $a.parent().remove();
      },
      doajax = function (id, redirect_amount) {
        if (typeof redirect_amount !== 'number') { redirect_amount = 0; }
        var $this = $(this), page_name = $this.text().replace('Loot Statistics:', ''), t = $.trim(page_name.replace(/ /g, '_'));
        $.ajax({cache: false, async: true, url: '/index.php?title=Loot_Statistics:' + t + '&action=raw', success: function (r) {
          if (r === '') { window.setTimeout(function () { doajax.call($this[0], id, redirect_amount); }, 3000); }
          else {
            var error_list = [], creature, is_redirect;
/*jslint regexp: true*/
            is_redirect = r.match(/#REDIRECT \[\[Loot Statistics:(.*?)\]\]/);
/*jslint regexp: false*/
            if (is_redirect) {
              redirect_amount++;
              if (redirect_amount > 1) {
                error_list.push('Too many redirects');
              }
              else {
                $this.text('Loot Statistics:' + is_redirect[1]);
                doajax.call($this[0], id, redirect_amount);
                return;
              }
            }
            else {
/*jslint regexp: true*/
              creature = r.match(/name\s*=([^|{}]*)/);
/*jslint regexp: false*/
              creature = (creature ? $.trim(creature[1]).replace(/_/g, ' ') : '');
              creature = $.trim(creature.replace(/\(Creature\)/, ''));
              if (!creature) { error_list.push('Could not find creature name'); }
              else if (creature !== page_name && page_name !== lootparser_creature_special_names[creature]) {
                error_list.push('Possible incorrect name: ' + creature + '/' + (lootparser_creature_special_names[creature] || creature));
              }
              error_list.push.apply(error_list, filter_function(r, creature));
            }
            if (error_list.length) {
              $this.parent().append('<br />');
/*jslint unparam: true*/
              $.each(error_list, function (i, v) { $this.parent().append(v + '<br />'); });
/*jslint unparam: false*/
            }
            else {
              dook($this);
            }
            requests_to_do_minus();
          }
        }, error: function (a, b, c) {
          if (a.status !== 404) {
            alert('Error loading Loot_Statistics:' + t + '\n' + [a.status, b, c].join(', ')); window.setTimeout(function () { doajax.call($this[0], id, redirect_amount); }, 3000); }
          else { requests_to_do_minus(); }
        }
        });
      };
      $('#stats_data').parents('div:first').find('input').attr('disabled', 'disabled');
      $('#stats_result').html($('#stats_data').html());
      $('#stats_result').find('a.new').parent().remove();
      total_requests = requests_to_do = $('#stats_result').find('a').each(doajax).length;
    };

    for (x in creature_items_name_change) { if (creature_items_name_change.hasOwnProperty(x)) {
      for (y in creature_items_name_change[x]) { if (creature_items_name_change[x].hasOwnProperty(y)) {
        if (creature_items_name_change[x][y].match(/\(/) !== null) {
          if (!creature_items_name_paren.hasOwnProperty(x)) { creature_items_name_paren[x] = {}; }
          creature_items_name_paren[x][creature_items_name_change[x][y]] = 0;
        }
      } }
    } }

    $('#stats_data').closest('table').prev().remove();

    $('#stats_data').closest('table').before(
      $('<table>').append(
        $('<tr>').append(
          $('<td>').html('List pages that have wrong parameters or versions<br /><span style="font-size:xx-small;">Please note this only does some checks</span>'),
          $('<td>').append(
            $('<input />', {'value': 'Check', 'type': 'button'}).click(function () { check_all(function (r, creature) {
/*jslint regexp: true*/
              var tt, item, times, amount, total, x2, y2, ret = [], tmpt, tmps,
              tmp = r.match(/\{\{\s*Loot2[\s\|]*version\s*=\s*(?:\d+\.\d+)[\s\|]*[^}]*/g), tmpa = [],
              versions = r.match(/\{\{\s*Loot2[\s\|]*version\s*=\s*\d+\.\d+/g), versions_n = [], tmpv;
/*jslint regexp: false*/
              if (versions !== null) {
                for (x2 = 0; x2 < versions.length; x2++) {
                  y2 = 0;
                  while (versions[x2].substr(y2 - 1, 1).match(/\d|\./)) { y2--; }
                  versions_n[x2] = parseFloat(versions[x2].substr(y2), 10);
                }
                //possible incorrect version
                for (x2 = 0; x2 < versions_n.length; x2++) { for (y2 = 0; y2 < versions_n.length; y2++) {
                  if (x2 !== y2 && versions_n[x2] === versions_n[y2]) {
                    ret.push('Repeated template version:' + versions_n[x2]);
                  }
                } }
                if (lootparser_versions_ex[current_tibia_version].changed.hasOwnProperty(creature)) {
                  tmpv = parseFloat(lootparser_versions_ex[current_tibia_version].changed[creature], 10);
                  for (x2 = 0; x2 < versions_n.length; x2++) {
                    if (versions_n[x2] > tmpv) { ret.push('Possible incorrect version:' + versions_n[x2]); }
                  }
                }
                if (lootparser_versions_ex[current_tibia_version]['new'].hasOwnProperty(creature)) {
                  tmpv = parseFloat(lootparser_versions_ex[current_tibia_version]['new'][creature], 10);
                  for (x2 = 0; x2 < versions_n.length; x2++) {
                    if (versions_n[x2] !== tmpv) { ret.push('Possible incorrect version:' + versions_n[x2]); }
                  }
                }
                //possible non existing version
                for (x2 = 0; x2 < versions_n.length; x2++) {
                  if (
                    versions_n[x2] > current_tibia_version &&
                    !lootparser_versions_ex[current_tibia_version]['new'].hasOwnProperty(creature) &&
                    !lootparser_versions_ex[current_tibia_version].changed.hasOwnProperty(creature)
                  ) { ret.push('Possible non existing version:' + versions_n[x2]); }
                }
                //repeated template version
                for (x2 = 0; x2 < versions_n.length; x2++) { for (y2 = 0; y2 < versions_n.length; y2++) {
                  if (x2 !== y2 && versions_n[x2] === versions_n[y2]) {
                    ret.push('Repeated template version:' + versions_n[x2]);
                  }
                } }
              }
              //wrong parameters
              if (tmp !== null) { for (x2 = 0; x2 < tmp.length; x2++) {
                tmpa[x2] = tmp[x2].split(/[\r\n|]+/);
                for (y2 = 0; y2 < tmpa[x2].length; y2++) {
                  tmpt = $.trim(tmpa[x2][y2]);
                  if (tmpt.indexOf(',') !== -1) {
/*jslint regexp: true*/
                    tt = tmpt.match(/(.*?\(.*?)\s*,/);
/*jslint regexp: false*/
                    if (tt !== null) {
                      item = tt[1];
                      if (
                        !creature_items_name_paren.hasOwnProperty(creature) ||
                        !creature_items_name_paren[creature].hasOwnProperty(item)
                      ) { ret.push(tmpt + ' - (non listed item with parenthesis)'); }
                    }

                    if (tmpt.match(/,/g).length !== 1 && tmpt.match(/,/g).length !== 3) { ret.push(tmpt + ' - (wrong number of parameters )'); }
                    else if (tmpt.match(/,/g).length === 3) {
/*jslint regexp: true*/
                      tt = tmpt.match(/(.*?)\s*,\s*times\s*:\s*(\d*)\s*,\s*amount\s*:\s*([\d\-]*)\s*,\s*total\s*:\s*(\d*)/);
/*jslint regexp: false*/
                      if (tt !== null) {
                        item = tt[1];
                        if (item === 'Empty') { ret.push(tmpt + ' - (wrong "Empty")'); }
                        else {
                          tmps = item.match(/\s+(?:boots|legs)$/i);
                          if (tmps !== null) {
                            ret.push(tmpt + ' - (wrong "' + tmps + '", non countable)');
                          }
                          else {
                            times = (parseInt(tt[2], 10) || 0);
                            amount = tt[3];
                            total = (parseInt(tt[4], 10) || 0);
                            if (times > total) { ret.push(tmpt + ' - (wrong "times" or "total")'); }
                            else if (amount.indexOf('-') === -1 && ((parseInt(amount, 10) || 0) * times) !== total) {
                              ret.push(tmpt + ' - (wrong "times" or "total")');
                            }
                            if (amount.indexOf('-') > -1 && times === total) {
                              ret.push(tmpt + ' - (wrong "times", "amount" or "total")');
                            }
                          }
                        }
                      }
                    }
                  }
                  else if (tmpt.indexOf('=') === -1 && tmpt.indexOf('Loot2') === -1 && tmpt !== '') {
                    ret.push(tmpt + ' - (missing parameters)');
                  }
                }
              } }

              return ret;
            }); })
          )
        ),
        $('<tr>').append(
          $('<td>', {'id': 'stats_doing1'}).html('&nbsp;'),
          $('<td>', {'id': 'stats_doing2'}).html('&nbsp;')
        )
      )
    );
  };
  $.ajax({
    url: '/api.php', type: 'GET', dataType: 'json',
    data : {
      'action': 'query', 'format': 'json',
      'meta': 'userinfo', 'uiprop': 'groups'
    },
    success: function (obj) {
      var x;
      if (obj && obj.query && obj.query.userinfo && obj.query.userinfo.groups) {
        for (x in obj.query.userinfo.groups) { if (obj.query.userinfo.groups.hasOwnProperty(x)) {
          if ((obj.query.userinfo.groups[x]) === 'sysop') { sysop = true; break; }
        } }
      }
      if (sysop) { main_function(); }
    }
  });
}());