<?php
ini_set("display_errors", "on");
error_reporting(E_ALL ^ E_NOTICE);
require ('commonFunctions.php');

$jobListIn = array('WAR', 'MNK', 'WHM', 'BLM', 'RDM', 'THF', 'PLD', 'DRK', 'BST', 'BRD', 'RNG', 'SAM', 'NIN', 'DRG', 'SMN', 'BLU', 'COR', 'PUP', 'DNC', 'SCH');
$jobListOut = array();
foreach ($jobListIn as $job) {
    array_push($jobListOut, "[[$job]]");
}
$jobSetList = array('Armor', 'Attire', 'Attire', 'Attire', 'Armor', 'Attire', 'Armor', 'Armor', 'Armor', 'Attire', 'Attire', 'Armor', 'Garb', 'Armor', 'Attire', 'Attire', 'Attire', 'Attire', 'Attire', 'Attire');
$artifactArmorIn = array("Fighter's", "Temple", "Healer's", "Wizard's", "Warlock's", "Rogue's", "Gallant", "Chaos", "Beast", "Choral", "Hunter's", "Myochin", "Ninja", "Drachen", "Evoker's", "Magus", "Corsair's", "Puppetry", "Dancer's", "Scholar's");
$relicArmorIn = array("Warrior's", 'Melee', "Cleric's", "Sorcerer's", "Duelist's", "Assassin's", 'Valor', 'Abyss', 'Monster', "Bard's", "Scout's", 'Saotome', 'Koga', 'Wyrm', "Summoner's", 'Mirage', 'Commodore', 'Pantin', 'Etoile', 'Argute');
$empyreanArmorIn = array("Ravager's", "Tantra", "Orison", "Goetia", "Estoqueur's", "Raider's", "Creed", "Bale", "Ferine", "Aoidos'", "Sylvan", "Unkai", "Iga", "Lancer's", "Caller's", "Mavi", "Navarch's", "Cirque", "Charis",  "Savant's");

$artifactArmorList = array("Fighter's Mask", "Fighter's Lorica", "Fighter's Mufflers", "Fighter's Cuisses", "Fighter's Calligae", "Temple Crown", "Temple Cyclas", "Temple Gloves", "Temple Hose", "Temple Gaiters", "Healer's Cap", "Healer's Briault", "Healer's Mitts", "Healer's Pantaloons", "Healer's Duckbills", "Wizard's Petasos", "Wizard's Coat", "Wizard's Gloves", "Wizard's Tonban", "Wizard's Sabots", "Warlock's Chapeau", "Warlock's Tabard", "Warlock's Gloves", "Warlock's Tights", "Warlock's Boots", "Rogue's Bonnet", "Rogue's Vest", "Rogue's Armlets", "Rogue's Culottes", "Rogue's Poulaines", "Gallant Coronet", "Gallant Surcoat", "Gallant Gauntlets", "Gallant Breeches", "Gallant Leggings", "Chaos Burgeonet", "Chaos Cuirass", "Chaos Gauntlets", "Chaos Flanchard", "Chaos Sollerets", "Beast Helm", "Beast Jackcoat", "Beast Gloves", "Beast Trousers", "Beast Gaiters", "Choral Roundlet", "Choral Justaucorps", "Choral Cuffs", "Choral Cannions", "Choral Slippers", "Hunter's Beret", "Hunter's Jerkin",
    "Hunter's Bracers", "Hunter's Braccae", "Hunter's Socks", "Myochin Kabuto", "Myochin Domaru", "Myochin Kote", "Myochin Haidate", "Myochin Sune-Ate", "Ninja Hatsuburi", "Ninja Chainmail", "Ninja Tekko", "Ninja Hakama", "Ninja Kyahan", "Drachen Armet", "Drachen Mail", "Drachen Finger Gauntlets", "Drachen Brais", "Drachen Greaves", "Evoker's Horn", "Evoker's Doublet", "Evoker's Bracers", "Evoker's Spats", "Evoker's Pigaches", "Magus Keffiyeh", "Magus Jubbah", "Magus Bazubands", "Magus Shalwar", "Magus Charuqs", "Corsair's Tricorne", "Corsair's Frac", "Corsair's Gants", "Corsair's Culottes", "Corsair's Bottes", "Puppetry Taj", "Puppetry Tobe", "Puppetry Dastanas", "Puppetry Churidars", "Puppetry Babouches", "Dancer's Tiara", "Dancer's Casaque", "Dancer's Bangles", "Dancer's Tights", "Dancer's Toe Shoes", "Scholar's Mortarboard", "Scholar's Gown", "Scholar's Bracers", "Scholar's Pants", "Scholar's Loafers");
$relicArmorList = array("Warrior's Mask", "Warrior's Lorica", "Warrior's Mufflers", "Warrior's Cuisses", "Warrior's Calligae", 'Melee Crown', 'Melee Cyclas', 'Melee Gloves', 'Melee Hose', 'Melee Gaiters', "Cleric's Cap", "Cleric's Briault", "Cleric's Mitts", "Cleric's Pantaloons", "Cleric's Duckbills", "Sorcerer's Petasos", "Sorcerer's Coat", "Sorcerer's Gloves", "Sorcerer's Tonban", "Sorcerer's Sabots", "Duelist's Chapeau", "Duelist's Tabard", "Duelist's Gloves", "Duelist's Tights", "Duelist's Boots", "Assassin's Bonnet", "Assassin's Vest", "Assassin's Armlets", "Assassin's Culottes", "Assassin's Poulaines", 'Valor Coronet', 'Valor Surcoat', 'Valor Gauntlets', 'Valor Breeches', 'Valor Leggings', 'Abyss Burgeonet', 'Abyss Cuirass', 'Abyss Gauntlets', 'Abyss Flanchard', 'Abyss Sollerets', 'Monster Helm', 'Monster Jackcoat', 'Monster Gloves', 'Monster Trousers', 'Monster Gaiters', "Bard's Roundlet", "Bard's Justaucorps", "Bard's Cuffs", "Bard's Cannions", "Bard's Slippers", "Scout's Beret", "Scout's Jerkin",
    "Scout's Bracers", "Scout's Braccae", "Scout's Socks", 'Saotome Kabuto', 'Saotome Domaru', 'Saotome Kote', 'Saotome Haidate', 'Saotome Sune-Ate', 'Koga Hatsuburi', 'Koga Chainmail', 'Koga Tekko', 'Koga Hakama', 'Koga Kyahan', 'Wyrm Armet', 'Wyrm Mail', 'Wyrm Finger Gauntlets', 'Wyrm Brais', 'Wyrm Greaves', "Summoner's Horn", "Summoner's Doublet", "Summoner's Bracers", "Summoner's Spats", "Summoner's Pigaches", 'Mirage Keffiyeh', 'Mirage Jubbah', 'Mirage Bazubands', 'Mirage Shalwar', 'Mirage Charuqs', 'Commodore Tricorne', 'Commodore Frac', 'Commodore Gants', 'Commodore Culottes', 'Commodore Bottes', 'Pantin Taj', 'Pantin Tobe', 'Pantin Dastanas', 'Pantin Churidars', 'Pantin Babouches', 'Etoile Tiara', 'Etoile Casaque', 'Etoile Bangles', 'Etoile Tights', 'Etoile Toe Shoes', 'Argute Mortarboard', 'Argute Gown', 'Argute Bracers', 'Argute Pants', 'Argute Loafers');
$empyreanArmorList = array("Ravager's Mask", "Ravager's Lorica", "Ravager's Mufflers", "Ravager's Cuisses", "Ravager's Calligae", "Tantra Crown", "Tantra Cyclas", "Tantra Gloves", "Tantra Hose", "Tantra Gaiters", "Orison Cap", "Orison Bliaud", "Orison Mitts", "Orison Pantaloons", "Orison Duckbills", "Goetia Petasos", "Goetia Coat", "Goetia Gloves", "Goetia Chausses", "Goetia Sabots", "Estoqueur's Chappel", "Estoqueur's Sayon", "Estoqueur's Gantherots", "Estoqueur's Fuseau", "Estoqueur's Houseaux", "Raider's Bonnet", "Raider's Vest", "Raider's Armlets", "Raider's Culottes", "Raider's Poulaines", "Creed Armet", "Creed Cuirass", "Creed Gauntlets", "Creed Cuisses", "Creed Sabatons", "Bale Burgeonet", "Bale Cuirass", "Bale Gauntlets", "Bale Flanchard", "Bale Sollerets", "Ferine Cabasset", "Ferine Gausape", "Ferine Manoplas", "Ferine Quijotes", "Ferine Ocreae", "Aoidos' Calot", "Aoidos' Hongreline", "Aoidos' Manchettes", "Aoidos' Rhingrave", "Aoidos' Cothurnes", "Sylvan Gapette", "Sylvan Caban",
    "Sylvan Glovelettes", "Sylvan Bragues", "Sylvan Bottillons", "Unkai Kabuto", "Unkai Domaru", "Unkai Kote", "Unkai Haidate", "Unkai Sune-Ate", "Iga Zukin", "Iga Ningi", "Iga Tekko", "Iga Hakama", "Iga Kyahan", "Lancer's Mezail", "Lancer's Plackart", "Lancer's Vambraces", "Lancer's Cuissots", "Lancer's Schynbalds", "Caller's Horn", "Caller's Doublet", "Caller's Bracers", "Caller's Spats", "Caller's Pigaches", "Mavi Kavuk", "Mavi Mintan", "Mavi Bazuband", "Mavi Tayt", "Mavi Basmak", "Navarch's Tricorne", "Navarch's Frac", "Navarch's Gants", "Navarch's Culottes", "Navarch's Bottes", "Cirque Capello", "Cirque Farsetto", "Cirque Guanti", "Cirque Pantaloni", "Cirque Scarpe", "Charis Tiara", "Charis Casaque", "Charis Bangles", "Charis Tights", "Charis Toeshoes", "Savant's Bonnet", "Savant's Gown", "Savant's Bracers", "Savant's Pants", "Savant's Loafers");

$relicAugment = array("Adds \"Enhances 'Savagery' effect\"", "Adds \"Enhances 'Aggressive Aim' effect\"", "Adds \"Enhances 'Mighty Strikes' effect\"", "Adds \"Enhances 'Warrior's Charge' effect\"", "Adds \"Enhances 'Tomahawk' effect\"", "Adds \"Enhances 'Penance' effect\"", "Adds \"Enhances 'Formless Strikes' effect\"", "Adds \"Enhances 'Invigorate' effect\"", "Adds \"Enhances 'Hundred Fists' effect\"", "Adds \"Enhances 'Mantra' effect\"", "Adds \"Enhances 'Devotion V' effect\"", "Adds \"Enhances 'Benediction' effect\"", "Adds \"Enhances 'Martyr V' effect\"", "Adds \"Enhances 'Shellra V' effect\"", "Adds \"Enhances 'Protectra V' effect\"", "Adds \"Increases Ancient Magic II damage\"", "Adds \"Enhances 'Manafont' effect\"", "Adds \"Reduces Ancient Magic II casting time\"", "Adds \"Increases Ancient Magic II accuracy\"", "Adds \"Reduces Ancient Magic II MP cost\"", "Adds \"Enhances 'Dia III' effect\" and \"Enhances 'Slow II' effect\"", "Adds \"Enhances 'Chainspell' effect\"",
"Adds \"Enhances 'Phalanx II' effect\"", "Adds \"Enhances 'Bio III' effect\" and \"Enhances 'Blind II' effect\"", "Adds \"Enhances 'Paralyze II' effect\"", "Adds \"Enhances 'Aura Steal' effect\"", "Adds \"Enhances 'Ambush' effect\"", "Adds \"Enhances 'Perfect Dodge' effect\"", "Adds \"Enhances 'Feint' effect\"", "Adds \"Enh. 'Assassin's Charge' effect\"", "Adds \"Enhances 'Iron Will' effect\"", "Adds \"Enhances 'Fealty' effect\"", "Adds \"Enhances 'Chivalry' effect\"", "Adds \"Enhances 'Invincible' effect\"", "Adds \"Enhances 'Guardian' effect\"", "Adds \"Enhances 'Dark Seal' effect\"", "Adds \"Enhances 'Blood Weapon' effect\"", "Adds \"Enhances 'Diabolic Eye' effect\"", "Adds \"Enhances 'Muted Soul' effect\"", "Adds \"Enhances 'Desperate Blows' effect\"", "Adds \"Enhances 'Killer Instinct' effect\"", "Adds \"Enhances 'Feral Howl' effect\"", "Adds \"Enhances 'Beast Affinity' effect\"", "Adds \"Enhances 'Familiar' effect\"", "Adds \"Enhances 'Beast Healer' effect\"",
"Adds \"Enhances 'Foe Sirvente' effect\"", "Adds \"Enhances 'Troubador' effect\"", "Adds \"Enh. 'Adventurer's Dirge' effect\"", "Adds \"Enhances 'Soul Voice' effect\"", "Adds \"Enhances 'Nightingale' effect\"", "Adds \"Enhances 'Recycle' effect\"", "Adds \"Enhances 'Snapshot' effect\"", "Adds \"Enhances 'Flashy Shot' effect\"", "Adds \"Enhances 'Eagle Eye Shot' effect\"", "Adds \"Enhances 'Stealth Shot' effect\"", "Adds \"Enhances 'Ikishoten' effect\"", "Adds \"Enhances 'Overwhelm' effect\"", "Adds \"Enhances 'Blade Bash' effect\"", "Adds \"Enhances 'Shikikoyo' effect\"", "Adds \"Enhances 'Meikyo Shisui' effect\"", "Adds \"Increases elem. ninjutsu III damage\"", "Adds \"Enhances 'Sange' effect\"", "Adds \"Enh. 'Ninja Tool Expertise' effect\"", "Adds \"Enhances 'Mijin Gakure' effect\"", "Adds \"Reduces elem. ninjutsu III cast time\"", "Adds \"Enhances 'Deep Breathing' effect\"", "Adds \"Enhances 'Spirit Surge' effect\"", "Adds \"Enhances 'Angon' effect\"", "Adds \"Enhances 'Strafe' effect\"",
"Adds \"Enhances 'Empathy' effect\"", "Adds \"Enhances 'Astral Flow' effect\"", "Adds \"Reduces Sp. 'Blood Pact' MP cost\"", "Adds \"Inc. Sp. 'Blood Pact magic burst dmg.\"", "Adds \"Increases Sp. 'Blood Pact accuracy\"", "Adds \"Increases Sp. 'Blood Pact crit. dmg.\"", "Adds \"Enhances 'Convergence' effect\"", "Adds \"Enhances 'Enchainment' effect\"", "Adds \"Enhances 'Azure Lore' effect\"", "Adds \"Enhances 'Assimilation' effect\"", "Adds \"Enhances 'Diffusion' effect\"", "Adds \"Enhances 'Winning Streak' effect\"", "Adds \"Enhances '' effect\"", "Adds \"Enhances '' effect\"", "Adds \"Enhances 'Snake Eye' effect\"", "Adds \"Enhances 'Wild Card' effect\"", "Adds \"Enhances 'Optimization' effect\"", "Adds \"Enhances 'Overdrive' effect\"", "Adds \"Enhances 'Fine-Tuning' effect\"", "Adds \"Enhances 'Ventriloquy' effect\"", "Adds \"Enhances 'Role Reversal' effect\"", "Adds \"Enhances 'Trance' effect\"", "Adds \"Enhances 'No Foot Rise' effect\"", "Adds \"Enhances 'Fan Dance' effect\"",
"Adds \"Enhances 'Saber Dance' effect\"", "Adds \"Enhances 'Closed Position' effect\"", "Adds \"Enh. 'Altruism' and 'Focalization'\"", "Adds \"Enhances 'Enlightenment' effect\"", "Adds \"Enh. 'Tranquility' and 'Equanimity'\"", "Adds \"Enhances 'Tabula Rasa' effect\"", "Adds \"Enhances 'Stormsurge' effect\"");



function hotlink($x) {
    $statIn = array("STR", "INT", "VIT", "MND", "DEX", "AGI", "CHR", "HP", "MP");
    $statOut = array("[[STR]]", "[[INT]]", "[[VIT]]", "[[MND]]", "[[DEX]]", "[[AGI]]", "[[CHR]]", "[[HP]]", "[[MP]]");
    $elementIn = array("?Element: Fire?", "?Element: Ice?", "?Element: Wind?", "?Element: Earth?", "?Element: Thunder?", "?Element: Water?", "?Element: Light?", "?Element: Dark?", "?Element: Air?");
    $elementOut = array("{{Fire}}", "{{Ice}}", "{{Wind}}", "{{Earth}}", "{{Thunder}}", "{{Water}}", "{{Light}}", "{{Dark}}", "{{Wind}}");
    $otherIn = array("HP, MP, or TP Drain", "HP drain", "MP Drain", "TP Drain", "Breath damage taken", "Magic damage taken", "Physical damage taken", "Damage taken", "HP and MP recovered while healing", "MP recovered while healing", "HP recovered while healing", "Absorbs HP", "Absorbs MP", "Accuracy Bonus", "Evasion Bonus", "Attack Bonus", "Kick Attacks", "Triple Attack", "Double Attack", "Quadruple Attack", "Sneak Attack", "Trick Attack", "Impairs evasion", "Weapon Skill Accuracy", "Magic Accuracy", "Ranged Accuracy", "Ranged Attack", "Accuracy", "Delay", "Attack", "Evasion skill", "Evasion", "DEF", "DMG", "Enchantment", "Additional effect", "Critical hit rate", "Magic Atk. Bonus", "Magic Def. Bonus");
    $otherOut = array("[[H*P|H*P drain]], [[M*P|M*P Drain]], or [[T*P Drain]]", "[[H*P drain]]", "[[M*P Drain]]", "[[T*P Drain]]", "[[Breath d**age taken]]", "[[Magic d**age taken]]", "[[Physical d**age taken]]", "[[Damage taken]]", "[[H*P recovered while healing|H*P]] and [[M*P recovered while healing]]", "[[M*P recovered while healing]]", "[[H*P recovered while healing]]", "[[H*P Drain|Absorbs H*P]]", "[[M*P Drainracy Bonus]]", "[[A**uracy Bonus]]", "[[E**sion Bonus]]", "[[A**ack Bonus]]", "[[Kick A**acks]]", "[[Triple A**ack]]", "[[Double A**ack]]", "[[Quadruple A**ack]]", "[[Sneak A**ack]]", "[[Trick A**ack]]", "[[Impairs e**sion]]", "[[Weapon Skill A**uracy]]", "[[Magic A**uracy]]", "[[Ranged A**uracy]]", "[[Ranged A**ack]]", "[[A**uracy]]", "[[Delay]]", "[[A**ack]]", "[[E**sion skill]]", "[[E**sion]]", "[[Defense|DEF]]", "[[Damage|DMG]]", "[[Enchantment]]", "[[Additional effect]]", "[[Critical Hit|Critical hit rate]]", "[[Magic A**ack Bonus|Magic Atk. Bonus]]", "[[Magic D**ense Bonus|Magic Def. Bonus]]");
    $otherIn0 = array("Activated", "In Dynamis", "Besieged", "Assault", "Latent effect", "In areas outside own nation's control", "In areas under own nation's control", "TP Bonus", "Enmity", "Haste", "Spell interruption rate", "Weakens defense", "\"Cure\" potency");
    $otherOut0 = array("Ac*iva*ed", "[[:Category:Dynamis|In Dynamis]]", "[[:Category:Besieged|Besieged]]", "[[:Category:A**ault|A**ault]]", "[[Latent effect]]", "[[In areas outside own nation's control]]", "[[In areas under own nation's control]]", "[[TP Bonus]]", "[[Enmity]]", "[[Haste (Status)|Haste]]", "[[Spell interruption rate]]", "[[Weakens defense]]", "[[Cure Formula|\"Cure\" potency]]");
    $otherIn1 = array("Synthesis image support", "Experience point bonus", "Sword enhancement spell duration", "Sword enhancement spell damage", "Salvage", "Garrison", "Slow", "Reduces clamming \"incidents\"", "Wyvern", "wyvern", "Fellow", "Movement speed", "Increases movement speed", "Automaton", "Daytime", "Nighttime", "Dispense", "Adds \"Refresh\" effect", "Adds \"Regen\" effect", "Set:", "Song spellcasting time", "Increases rate of critical hits", "Decreases movement speed", "Avatar perpetuation cost", "perpetuation cost", "\"Blood Pact\" ability delay", "Blood Pact: Rage", "Blood Pact: Ward", "Blood Pact", "Regain", "Campaign", "Aftermath");
    $otherOut1 = array("[[Synthesis image support]]", "[[Experience point bonus]]", "[[Enspell|Sword enhancement spell duration]]", "[[Enspell|Sword enhancement spell damage]]", "[[:Category:Salvage|Salvage]]", "[[:Category:Garrison|Garrison]]", "[[Slow (Status)|Slow]]", "[[Clamming|Reduces clamming \"incidents\"]]", "[[W**ern]]", "[[W**ern|w**ern]]", "[[Adventuring Fellow|Fellow]]", "[[Movement speed]]", "[[Movement speed|Increases movement speed]]", "[[Automaton]]", "[[Daytime]]", "[[Nighttime]]", "[[Dispense]]", "[[Refresh (Status)|Adds \"Refresh\" effect]]", "[[Regen (Status)|Adds \"Regen\" effect]]", "[[:Category:Armor Set|Set]]:", "[[Song spellcasting time]]", "[[Critical hit|Increases rate of critical hits]]", "[[Decreases movement speed]]", "[[Avatar p**petuation cost]]", "[[perpetuation cost]]", "[[\"Bl00d Pact\" ability delay]]", "[[Bl00d Pact: Rage]]", "[[Bl00d Pact: Ward]]", "[[Bl00d Pact]]", "[[Regain (Status)|Regain]]", "[[:Category:Campaign|Capmaign]]", "[[Aftermath]]");
    $otherIn2 = array("Ac*iva*ed", "K**ana", "A*$", "Sw**d", "S**w", "W**ern", "w**ern", "B**st", "E**sion", "e**sion", "A**uracy", "A**ack", "H*P", "M*P", "T*P", "St**l", "D**ense", "A**ault", "d**age", "D**age", "p**petuation", "Bl00d Pact");
    $otherOut2 = array("Activated", "Katana", "Axe", "Sword", "Slow", "Wyvern", "wyvern", "Boost", "Evasion", "evasion", "Accuracy", "Attack", "HP", "MP", "TP", "Steal", "Defense", "Assault", "damage", "Damage", "perpetuation", "Blood Pact");
    $monsterListIn = array("beasts", "lizards", "vermin", "plantoids", "aquans", "amorphs", "birds", "undead", "arcana", "dragons", "demons", "elementals", "Quadov", "gigas", "Orcs", "Yagudo");
    $abilityListIn = array("Accomplice", "Activate", "Addendum: Black", "Addendum: White", "Afflatus Solace", "Aggressor", "Alacrity", "Allies' Roll", "Ancient Circle", "Angon", "Arcane Circle", "Assassin's Charge", "Assault", "Astral Flow", "Avatar's Favor", "Azure Lore", "Barrage", "Beast Roll", "Benediction", "Berserk", "Blade Bash", "Blitzer's Roll", "Blood Rage", "Blood Weapon", "Boost", "Bounty Shot", "Burst Affinity", "Call Beast", "Call Wyvern", "Camouflage", "Caster's Roll", "Celerity", "Chain Affinity", "Chainspell", "Chakra", "Chaos Roll", "Charm", "Chi Blast", "Chivalry", "Choral Roll", "Climactic Flourish", "Collaborator", "Composure", "Conspirator", "Convergence", "Corsair's Roll", "Counterstance", "Courser's Roll", "Cover", "Dark Arts", "Dark Maneuver", "Dark Seal", "Dark Shot", "Deactivate", "Deep Breathing", "Defender", "Deploy", "Despoil", "Devotion", "Diabolic Eye", "Diffusion", "Dismiss", "Divine Caress", "Divine Emblem",
"Divine Seal", "Dodge", "Double Shot", "Double-Up", "Drachen Roll", "Eagle Eye Shot", "Earth Maneuver", "Earth Shot", "Ebullience", "Efflux", "Elemental Seal", "Elemental Siphon", "Enmity Douse", "Enrage", "Evoker's Roll", "Familiar", "Fealty", "Feather Step", "Feint", "Feral Howl", "Fight", "Fighter's Roll", "Fire Maneuver", "Fire Shot", "Flashy Shot", "Flee", "Focus", "Fold", "Footwork", "Formless Strikes", "Futae", "Gallant's Roll", "Gauge", "Hasso", "Healer's Roll", "Heel", "Hide", "High Jump", "Holy Circle", "Hundred Fists", "Hunter's Roll", "Ice Maneuver", "Ice Shot", "Immanence", "Impetus", "Innin", "Invincible", "Jump", "Killer Instinct", "Last Resort", "Leave", "Light Arts", "Light Maneuver", "Light Shot", "Magus's Roll", "Mana Cede", "Mana Wall", "Manafont", "Mantra", "Martyr", "Meditate", "Meikyo Shisui", "Mighty Strikes", "Mijin Gakure", "Monk's Roll", "Mug", "Nether Void", "Nightingale", "Ninja Roll", "Overdrive", "Parsimony", "Penury", "Perfect Counter",
"Perfect Dodge", "Perpetuance", "Pet commands", "Phantom Roll", "Provoke", "Puppet Roll", "Quick Draw", "Rampart", "Random Deal", "Rapture", "Ready", "Release", "Repair", "Restraint", "Retaliation", "Retreat", "Retrieve", "Reverse Flourish", "Reward", "Rogue's Roll", "Role Reversal", "Saboteur", "Samurai Roll", "Sange", "Scavenge", "Seigan", "Sekkanoki", "Sengikori", "Sentinel", "Shadowbind", "Sharpshot", "Shield Bash", "Shikikoyo", "Sic", "Snake Eye", "Snapshot", "Sneak Attack", "Soul Jump", "Soul Voice", "Souleater", "Spirit Jump", "Spirit Link", "Spirit Surge", "Spur", "Stay", "Steal", "Stealth Shot", "Striking Flourish", "Sublimation", "Super Jump", "Tactical Guard", "Tactical Parry", "Tactical Switch", "Tactician's Roll", "Tame", "Third Eye", "Thunder Maneuver", "Thunder Shot", "Tomahawk", "Trick Attack", "Triple Shot", "Troubadour", "Unlimited Shot", "Velocity Shot", "Ventriloquy", "Violent Flourish", "Warcry", "Warding Circle", "Warlock's Roll", "Warrior's Charge", "Water Maneuver",
"Water Shot"," Weapon Bash", "Wild Card", "Wind Maneuver", "Wind Shot", "Wizard's Roll", "Yonin");
    $killerListIn = array("Amorph Killer", "Aquan Killer", "Arcana Killer", "Beast Killer", "Bird Killer", "Demon Killer", "Dragon Killer", "Elemental Killer", "Empty Killer", "Lizard Killer", "Plantoid Killer", "Undead Killer", "Vermin Killer");
    $resistListIn = array("Resist Amnesia", "Resist Bind", "Resist Blind", "Resist Charm", "Resist Curse", "Resist Gravity", "Resist Paralyze", "Resist Petrify", "Resist Poison", "Resist Silence", "Resist Sleep", "Resist Slow", "Resist Stun", "Resist Virus");
    $relicWSListIn = array("Ascetic's Fury", "Atonement", "Blade: Hi", "Blade: Kamu", "Blade: Metsu", "Camlann's Torment", "Catastrophe", "Chant du Cygne", "Cloudsplitter", "Coronach", "Dagan", "Death Blossom", "Drakesbane", "Expiacion", "Final Heaven", "Garland of Bliss", "Gate of Tartarus", "Geirskogul", "Glory Slash", "Insurgency", "Jishnu's Radiance", "King's Justice", "Knights of Round", "Leaden Salute", "Mandalic Stab", "Mercy Stroke", "Metatron Torment", "Mordant Rime", "Myrkr", "Mystic Boon", "Namas Arrow", "Omniscience", "Onslaught", "Primal Rend", "Pyrrhic Kleos", "Quietus", "Randgrith", "Rudra's Storm", "Scourge", "Stringing Pummel", "Tachi: Fudo", "Tachi: Kaiten", "Tachi: Rana", "Tartarus Torpor", "Torcleaver", "Trueflight", "Ukko's Fury", "Uriel Blade", "Victory Smite", "Vidohunir", "Wildfire");
    $traitListIn = array("Aggressive Aim", "Alertness", "Ambush", "Assassin", "Assimilation", "Aura Steal", "Auto Refresh", "Auto Regen", "Beast Affinity ", "Beast Healer", "Blood Boon", "Clear Mind", "Conserve MP", "Conserve TP", "Counter", "Courtly Measure", "Defense Bonus", "Desperate Blows", "Divine Benison", "Divine Veil", "Dual Wield", "Empathy", "Enchainment", "Fast Cast", "Fencer", "Fine-Tuning", "Gilfinder", "Guardian", "Ikishoten", "Invigorate", "Iron Will", "Loaded Deck", "Martial Arts", "Max HP Boost", "Max MP Boost", "Military Parade", "Muted Soul", "Ninja tool expertise", "Occult Acumen", "Optimization", "Overwhelm", "Penance", "Rapid Shot", "Recycle", "Savagery", "Shield Def. Bonus", "Shield Mastery", "Skillchain Bonus", "Stealth", "Store TP", "Stout Servant", "Strafe", "Subtle Blow", "Treasure Hunter", "True Shot", "Winning Streak", "Zanshin");
    $spellSkill = array("Blue", "Dark", "Divine", "Elemental", "Enfeebling", "Enhancing", "Healing", "Summoning", "Blue");
    $spellSkillIn = array();
    $spellSkillOut = array();
    $magicSkill = array("Ninjutsu", "Singing", "String instrument", "Wind instrument");
    $magicSkillIn = array();
    $magicSkillOut = array();
    $combatSkill = array("Hand-to-Hand", "Dagger", "Great Sword", "Sword", "Great Axe", "Axe", "Scythe", "Polearm", "Great Katana", "Katana", "Staff", "Club", "Archery", "Marksmanship", "Throwing", "Shield", "Parrying", "Guarding", "Evasion");
    $craftSkill = array("Fishing", "Woodworking", "Smithing", "Goldsmithing", "Clothcraft", "Leathercraft", "Bonecraft", "Alchemy", "Cooking");
    $combatSkillIn = array();
    $combatSkillOut = array();
    $craftSkillIn = array();
    $craftSkillOut = array();
    $dayList = array("Firesday", "Earthsday", "Watersday", "Windsday", "Iceday", "Lightningday", "Lightsday", "Darksday");
    $dayListIn = array();
    $dayListOut = array();
    foreach ($spellSkill as $spell) {
        array_push($spellSkillIn, "$spell magic skill");
        array_push($spellSkillOut, "[[:Category:$spell Magic|$spell magic skill]]");
    }
    foreach ($magicSkill as $magic) {
        array_push($magicSkillIn, "$magic skill");
        array_push($magicSkillOut, "[[:Category:$magic|$magic skill]]");
    }
    foreach ($combatSkill as $combat) {
        array_push($combatSkillIn, "$combat skill");
        $combat = str_replace($otherOut2, $otherIn2, $combat);
        array_push($combatSkillOut, "[[$combat|$combat skill]]");
    }
    foreach ($craftSkill as $craft) {
        array_push($craftSkillIn, "$craft skill");
        array_push($craftSkillOut, "[[$craft|$craft skill]]");
    }
    foreach ($dayList as $day) {
        array_push($dayListIn, $day."s");
        array_push($dayListOut, "[[$day|".$day."s]]");
    }
    $monsterListOut = array();
    foreach ($monsterListIn as $monster) {
        array_push($monsterListOut, "[[:Category:".ucwords($monster)."|$monster]]");
    }
    $abilityListOut = array();
    $traitListOut = array();
    $killerListOut = array();
    $resistListOut = array();
    $relicWSListOut = array();
    $propertyListIn = array($abilityListIn, $traitListIn, $killerListIn, $resistListIn, $relicWSListIn);
    $propertyListOut = array();

    for ($i=0; $i<count($propertyListIn); $i++) {
        $propertyListOut[$i] = array();
        for ($j=0; $j<count($propertyListIn[$i]); $j++) {
            $propertyListIn[$i][$j] = str_replace($otherOut2, $otherIn2, $propertyListIn[$i][$j]);
            $propertyListOut[$i][$j] = '[['.$propertyListIn[$i][$j].']]';
       }
       //print_r ($propertyListOut[$i]);
       //print "\r\n<br />";
    }

    $abilityListOut = $propertyListOut[0];
    $traitListOut = $propertyListOut[1];
    $killerListOut = $propertyListOut[2];
    $resistListOut = $propertyListOut[3];
    $relicWSListOut = $propertyListOut[4];
    
    $x = str_replace('[br]', "<br />", $x);
    $x = trim($x);
    $x = str_replace("<br />", "&lt;br /&gt;", $x);
    $x = str_replace($otherIn0, $otherOut0, $x);
    $x = str_replace($otherIn, $otherOut, $x);
    $x = str_replace($elementIn, $elementOut, $x);
    $x = str_replace($monsterListIn, $monsterListOut, $x);
    $x = str_replace($traitListIn, $traitListOut, $x);
    $x = str_replace($abilityListIn, $abilityListOut, $x);
    $x = str_replace($killerListIn, $killerListOut, $x);
    $x = str_replace($resistListIn, $resistListOut, $x);
    $x = str_replace($relicWSListIn, $relicWSListOut, $x);
    $x = str_replace($spellSkillIn, $spellSkillOut, $x);
    $x = str_replace($magicSkillIn, $magicSkillOut, $x);
    $x = str_replace($combatSkillIn, $combatSkillOut, $x);
    $x = str_replace($craftSkillIn, $craftSkillOut, $x);
    $x = str_replace($dayListIn, $dayListOut, $x);
    $x = str_replace($otherIn1, $otherOut1, $x);
    $x = str_replace($statIn, $statOut, $x);
    $x = str_replace($otherIn2, $otherOut2, $x);
    return $x;
}

$action = $_GET['action'];
$head = $_GET['Head'];
$body = $_GET['Body'];
$hands = $_GET['Hands'];
$legs = $_GET['Legs'];
$feet = $_GET['Feet'];
$set = $_POST['set'];
$doAugment = $_GET['doAugment'];

$setGroup = array("Head", "Hands", "Legs", "Feet");
$ampIn = array('+', ' & ', ' &', '& ', '&');
$ampOut = array('Plus ', ' and ', ' and ', ' and ', ' and ');

$bodyNameIn = array('dalmatica', 'plastron +1', 'plastron', 'chasuble');
$bodyNameOut = array('zenith', 'onyx', 'black', 'wise');
$headNameIn = array("Commodore's");
$headNameOut = array("Commodore");

$armorList = array();
$armorList['Head'] = 1;
$armorList["Neck"] = 2;
$armorList["Body"] = 3;
$armorList["Hands"] = 4;
$armorList["Waist"] = 5;
$armorList["Back"] = 6;
$armorList["Rings"] = 7;
$armorList["Ears"] = 8;
$armorList["Legs"] = 9;
$armorList["Feet"] = 10;
$armorList["Sub"] = 11;

if (strlen($action) == 0) {
    print "<a href=\"Set-O-Matic.php?action=getCustom\">Fill in custom set.</a><br />\r\n<a href=\"Set-O-Matic.htm\">Choose set from the auto-generated list.</a><br />\r\n<a href=\"Set-O-Matic.php?action=special\">Make Relic Set Wikilinks.</a><br />\r\n<a href=\"Set-O-Matic.php?&action=generate\">Generated list. (Please don't do this if you aren't Septimus.)</a>";
} elseif ($action == 'special') {
    foreach ($relicArmorIn as $key => $rname) {
        print "* [[" . $rname . " " . $jobSetList[$key] . " Set]]\r\n<br />";
    }
    foreach ($relicArmorIn as $key => $rname) {
        print "* [[" . $rname . " " . $jobSetList[$key] . " Set +1]]\r\n<br />";
    }
    foreach ($relicArmorIn as $key => $rname) {
        print "* [[" . $rname . " " . $jobSetList[$key] . " Set +2]]\r\n<br />";
    }
    foreach ($relicArmorIn as $key => $rname) {
        print "* [[" . $rname . " " . $jobSetList[$key] . " (Augmented) Set +2]]\r\n<br />";
    }
} elseif ($action == 'generate') {
    $array = @file('armorData.txt');
    $jobArr = array();
    $data = array();
    $setList = array();
    foreach ($array as $key => $currow) {
        $datum = explode('|', $currow);
        if ($datum[11] == "Body" || $datum[11] == "Head" || $datum[11] == "Hands" || $datum[11] == "Legs" || $datum[11] == "Feet") {
            if ($datum[2] == "Commodore's Tricorn +2") {
                $currow = str_replace($hedListIn, $headListOut, $data);
                $datum = explode('|', $currow);
            }
            if ($jobArr[$datum[13]] == null) {
                $jobArr[$datum[13]] = array();
                $jobArr[$datum[13]][$datum[11]] = array();
            } elseif ($jobArr[$datum[13]][$datum[11]] == null) {
                $jobArr[$datum[13]][$datum[11]] = array();
            }
            array_push($jobArr[$datum[13]][$datum[11]], $datum);
            array_push($data, $datum);
        }
    }
    /*Dearest future Septimus,
    If by chance you have to uncomment the lines to test for naughty sets that
    aren't setting properly, please remember to make a much smaller version of
    the ArmorData.txt file so as not to bog down the processing.
    XXX, OOO,
    Past Septimus*/
    foreach ($jobArr as $newArr) {
        //print_r ($jobArr);
        //print "\r\n<br />";
        if (count($newArr) > 3 && count($newArr['Body']) > 0) {
            foreach ($newArr['Body'] as $bodArr) {
                $curSet = array("[[".$bodArr[2]."]]");
                $setAdd = "&Body=".$bodArr[1];
                $plus = '';
                $checker = str_replace($bodyNameIn, $bodyNameOut, $bodArr[4]);
                
                if (strpos($checker, '+') !== false) {
                    $splode = explode('+', $bodArr[2]);
                    $plus = trim($splode[1]);
                }
                $addAugment = false;
                $specialTest = str_replace($relicArmorIn, 'RelicArmor', ucitem($bodArr[4]));
                //print "$specialTest | $plus\r\n<br />";
                if (strpos($specialTest, 'RelicArmor') !== false && $plus == 2) {
                    $addAugment = true;
                }
                $splode = explode(' ', $checker);
                $check = strtolower(trim($splode[0]));
                $mtest = array();
                foreach ($setGroup as $sg) {
                    if (count($newArr[$sg]) > 0) {
                        $mtest[$sg] = false;
                        foreach ($newArr[$sg] as $l => $sr) {
                            //print "$check | " . $sr[4] . " | " . stripos($sr[4], $check) . " | " . $mtest[$sg] . "\r\n<br />";
                            if (stripos($sr[4], $check) !== false && $mtest[$sg] == false) {
                                if ((strlen($plus) > 0 && strpos($sr[4], $plus) !== false) || (strlen($plus) == 0) && strpos($sr[4], '+') === false) {
                                    array_push($curSet, "[[".$sr[2]."]]");
                                    $setAdd .= "&$sg=".$sr[1];
                                    $mtest[$sg] = true;
                                }
                            }
                        }
                    }
                }
                //print_r ($curSet);
                //print "\r\n<br />";
                if (count($curSet) > 3) {
                    $setList[ucitem($bodArr[4])] = "<a href=\"Set-O-Matic.php?action=set$setAdd\">".ucitem($bodArr[4])." set</a>: ".implode(", ", $curSet);
                    if ($addAugment == true) {
                        $setList[ucitem($bodArr[4])." Aug"] = "<a href=\"Set-O-Matic.php?action=set$setAdd&doAugment=true\">".ucitem($bodArr[4])." set (Augmented)</a>: ".implode(", ", $curSet);
                    }
                }
            }
        }
    }
    ksort($setList, SORT_STRING);
    foreach ($setList as $currow) {
        print $currow."<br />\r\n";
    }
} elseif ($action == 'getCustom') {
    print "This form is for the input of sets of armor that do not have
    a matching name structure, such as the ones for claim slips.<br /><br />
    <form id=\"form1\" name=\"form1\" method=\"post\" action=\"Set-O-Matic.php?action=custom\">
  <label>Item List<br />
  <textarea name=\"set\" id=\"set\" cols=\"45\" rows=\"5\"></textarea>
  </label>
  <p>
    <label>
    <input type=\"submit\" name=\"Submit\" id=\"Submit\" value=\"Submit\" />
    </label>
    <label>
    <input type=\"reset\" name=\"Reset\" id=\"Reset\" value=\"Reset\" />
    </label>
  </p>
</form>";
} elseif ($action == 'set') {
    $array = @file('armorData.txt');
    $data = array();
    foreach ($array as $key => $currow) {
        $datum = explode('|', $currow);
        $data[$datum[1]] = $datum;
    }
    $bodySet = $data[$body];
    $headSet = (strlen($head) > 0) ? $data[$head] : '';
    $handsSet = (strlen($hands) > 0) ? $data[$hands] : '';
    $legsSet = $data[$legs];
    $feetSet = $data[$feet];
    $bodyAug = '';
    $headAug = '';
    $handsAug = '';
    $legsAug = '';
    $feetAug = '';
    $longWikiName = str_replace($ampIn, $ampOut, $bodySet[4]);

    $setName = ucitem($longWikiName)." Set";

    $plus = '';
    if (strpos($bodySet[4], '+') !== false) {
        $splode = explode('+', $bodySet[4]);
        $plus = trim($splode[1]);
        $armor = ucitem(trim($splode[0]));
    }
    $category = '';
    $image = "{{PAGENAME}}";
    $specialTest = str_replace($relicArmorIn, 'Relic', ucitem($bodySet[4]));
    $specialTest = str_replace($artifactArmorIn, 'Artifact', $specialTest);
    $specialTest = str_replace($empyreanArmorIn, 'Empyrean', $specialTest);
    $specialCheck = ($specialTest != ucitem($bodySet[4])) ? true : false;
    if ($specialCheck == true) {
        $spSp = explode(' ', $specialTest);
        $spCh = trim($spSp[0]);
        $ty = 'Attire';
        $arName = explode(" ", $bodySet[4]);
        $armor = ucitem(trim($arName[0]));
        if ($spCh == 'Relic') {
            $ty = $jobSetList[array_search($armor, $relicArmorIn)];
        } elseif ($spCh == 'Artifact') {
            $ty = $jobSetList[array_search($armor, $artifactArmorIn)];
        } else {
            $ty = $jobSetList[array_search($armor, $empyreanArmorIn)];
        }
        $image = "$armor $ty Set";
        $category .= " [[Category:$spCh Armor";
        if ($plus != '') {
            $category .= " +$plus";
        }
        $category .= ']]';
    }
    if (strpos($bodySet[13], ', ') === false) {
        $jobList = "(".$bodySet[13]." only)";
    } else {
        $jobList = "(".$bodySet[13].")";
    }
    $jobList = str_replace($jobListIn, $jobListOut, $jobList);
    if (strpos($bodySet[7], 'Set:') === false) {
        $set = '';
    } else {
        $splode = explode("Set:", $bodySet[7]);
        $set = trim($splode[1]);
        $bodySet[7] = trim($splode[0]);
        if (strlen($head) > 0) {
            $splode = explode("Set:", $headSet[7]);
            $headSet[7] = trim($splode[0]);
        }
        $splode = explode("Set:", $handsSet[7]);
        $handsSet[7] = trim($splode[0]);
        $splode = explode("Set:", $legsSet[7]);
        $legsSet[7] = trim($splode[0]);
        $splode = explode("Set:", $feetSet[7]);
        $feetSet[7] = trim($splode[0]);
    }
    if (strlen($doAugment) > 0) {
        if (array_search($armor, $relicArmorList) !== false) {
            $bodyAug = "\r\n<br />'''" . $relicAugment[array_search($armor, $relicArmorList)] . "'''";
        }
        $splode = explode('+', $headSet[4]);
        $armor = ucitem(trim($splode[0]));
        if (array_search($armor, $relicArmorList) !== false) {
            $headAug = "\r\n<br />'''" . $relicAugment[array_search($armor, $relicArmorList)] . "'''";
        }
        $splode = explode('+', $handsSet[4]);
        $armor = ucitem(trim($splode[0]));
        if (array_search($armor, $relicArmorList) !== false) {
            $handsAug = "\r\n<br />'''" . $relicAugment[array_search($armor, $relicArmorList)] . "'''";
        }
        $splode = explode('+', $legsSet[4]);
        $armor = ucitem(trim($splode[0]));
        if (array_search($armor, $relicArmorList) !== false) {
            $legsAug = "\r\n<br />'''" . $relicAugment[array_search($armor, $relicArmorList)] . "'''";
        }
        $splode = explode('+', $feetSet[4]);
        $armor = ucitem(trim($splode[0]));
        if (array_search($armor, $relicArmorList) !== false) {
            $feetAug = "<br />'''" . $relicAugment[array_search($armor, $relicArmorList)] . "'''";
        }
    }
    print "[[Image:$image.jpg|right|thumb|250px|{{PAGENAME}}]]
<br />{| border=\"0\" cellpadding=\"1\" style=\"background-color:#000878; text-align:center\" width=\"600px\"
<br />! BGCOLOR=\"#C3C6DD\" colspan=\"2\" align=\"center\"|'''{{PAGENAME}}&lt;br /&gt;$jobList'''";
    if (strlen($head) > 0) {
        if ($headSet[2] != ucitem($headSet[4])) {
            $headName = $headSet[2]."|".ucitem($headSet[4]);
        } else {
            $headName = $headSet[2];
        }
        $headDesc = hotlink($headSet[7]);
        print "<br />|- BGCOLOR=\"#FFFFFF\"
<br />| BGCOLOR=\"#CEE0F2\" |'''Head'''&lt;br /&gt;
<br />| '''[[$headName]]'''&lt;br /&gt$headDesc$headAug";
    }
    if ($bodySet[2] != ucitem($bodySet[4])) {
        $bodyName = $bodySet[2]."|".ucitem($bodySet[4]);
    } else {
        $bodyName = $bodySet[2];
    }
    $bodyDesc = hotlink($bodySet[7]);
    $handTxt = '';
    if (strlen($hands) > 0) {
        if ($handsSet[2] != ucitem($handsSet[4])) {
            $handsName = $handsSet[2]."|".ucitem($handsSet[4]);
        } else {
            $handsName = $handsSet[2];
        }
        $handsDesc = hotlink($handsSet[7]);
        $handText =  "\r\n<br />|- BGCOLOR=\"#FFFFFF\"\r\n<br />| BGCOLOR=\"#CEE0F2\" |'''Hands'''&lt;br /&gt;
<br />| '''[[$handsName]]'''&lt;br /&gt$handsDesc$handsAug";
    }
    if ($legsSet[2] != ucitem($legsSet[4])) {
        $legsName = $legsSet[2]."|".ucitem($legsSet[4]);
    } else {
        $legsName = $legsSet[2];
    }
    $legsDesc = hotlink($legsSet[7]);
    if ($feetSet[2] != ucitem($feetSet[4])) {
        $feetName = $feetSet[2]."|".ucitem($feetSet[4]);
    } else {
        $feetName = $feetSet[2];
    }
    $feetDesc = hotlink($feetSet[7]);
    print "<br />|- BGCOLOR=\"#FFFFFF\"
<br />| BGCOLOR=\"#CEE0F2\" |'''Body'''&lt;br /&gt;
<br />| '''[[$bodyName]]'''&lt;br /&gt;$bodyDesc$bodyAug$handText
<br />|- BGCOLOR=\"#FFFFFF\"
<br />| BGCOLOR=\"#CEE0F2\" |'''Legs'''&lt;br /&gt;
<br />| '''[[$legsName]]'''&lt;br /&gt;$legsDesc$legsAug
<br />|- BGCOLOR=\"#FFFFFF\"
<br />| BGCOLOR=\"#CEE0F2\" |'''Feet'''&lt;br /&gt;
<br />| '''[[$feetName]]'''&lt;br /&gt;$feetDesc$feetAug";
    if (strlen($set) > 0) {
        $set = hotlink($set);
        print "<br />|- BGCOLOR=\"#FFFFFF\"\r\n<br />| colspan=\"2\" align=\"center\" | [[Set|Set:]] $set";
    }
    print"<br />|-\r\n<br />|}
<br />[[Category:Armor Set]]$category";
} elseif ($action == 'custom') {
    $array = @file('armorData.txt');
    $data = array();
    foreach ($array as $key => $currow) {
        $datum = explode('|', $currow);
        $array[$key] = $datum;
        $data[$datum[3]] = $key;
        if ($dataum[3] != ucitem($datum[4])) {
            $data[ucitem($datum[4])] = $key;
        }
    }
    $setList = explode("\r", $set);
    $setData = array();
    $setType = array();
    foreach($setList as $n => $item) {
        $item = trim($item);
        if (strlen($data[$item]) > 0) {
            array_push($setData, $array[$data[$item]]);
            array_push($setType, $array[$data[$item][11]]);
        }
    }
    array_multisort($setType, SORT_ASC, $setData);

    $setName = ucitem($longWikiName)." Set";
    if (strpos($setData[0][13], ', ') === false) {
        $jobList = "(".$setData[0][13]." only)";
    } else {
        $jobList = "(".$setData[0][13].")";
    }
    if (strpos($setData[0][7], 'Set:') === false) {
        $set = '';
    } else {
        $splode = explode("Set:", $setData[0][7]);
        $set = trim($splode[1]);
    }
    print "[[Image:{{PAGENAME}}.jpg|right|thumb|250px|{{PAGENAME}}]]
<br />{| border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=60% style=\"text-align:center;\"
<br />! BGCOLOR=\"#cee0f2\" colspan=\"4\" align=\"center\"|'''{{PAGENAME}}&lt;br /&gt;$jobList'''
<br />|-";
    foreach ($setData as $m => $armor) {
        if ($armor[2] != ucitem($armor[4])) {
            $name = $armor[2]."|".ucitem($armor[4]);
        } else {
            $name = $armor[2];
        }
        if ($set != '') {
            $splode = explode("Set:", $armor[7]);
            $desc = trim($armor[7]);
            $desc = hotlink($desc);
        } else {
            $desc = hotlink($armor[7]);
        }
        $slot = $armor[11];
        print "\r\n<br />|'''$slot'''&lt;br /&gt;
<br />| '''[[$name]]'''&lt;br /&gt$desc
<br />|-";
    }
    if (strlen($set) > 0) {
        $set = hotlink($set);
        print "<br />| colspan=\"2\" align=\"center\" | [[Set|Set:]] $set
<br />|-";
    }
    print"<br />|}
<br />[[Category:Armor Set]]";
}

?>
