// ==UserScript==
// @name hwm_change_class
// @namespace http://tampermonkey.net/
// @version 1.0
// @author Лосось
// @description change class in one click
// @match /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(home|castle).php*/
// @include /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(home|castle).php*/
// @license MIT
// @grant none
// ==/UserScript==
(function () {
'use strict';
let links = ['https://my.lordswm.com', 'https://heroeswm.ru'];
let link = location.href.slice(0,22) === 'https://my.lordswm.com' ? links[0] : links[1];
let block = document.createElement('div');
block.style = 'position: absolute; top: 50px; left: 50px; display: flex; flex-direction: column;'
const classes = [
{name: 'knight', imgHref: 'https://cfcdn.lordswm.com/i/f/r1.png?v=1.1', href: `${link}/castle.php?change_clr_to=1&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'light_knight', imgHref: 'https://cfcdn.lordswm.com/i/f/r101.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=101&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'necr', imgHref: 'https://cfcdn.lordswm.com/i/f/r2.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=2&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'nps', imgHref: 'https://cfcdn.lordswm.com/i/f/r102.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=102&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'mage', imgHref: 'https://cfcdn.lordswm.com/i/f/r3.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=3&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'mage_destroyer', imgHref: 'https://cfcdn.lordswm.com/i/f/r103.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=103&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'elf', imgHref: 'https://cfcdn.lordswm.com/i/f/r4.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=4&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'blue_elf', imgHref: 'https://cfcdn.lordswm.com/i/f/r104.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=104&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'barb', imgHref: 'https://cfcdn.lordswm.com/i/f/r5.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=5&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'blood_barb', imgHref: 'https://cfcdn.lordswm.com/i/f/r105.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=105&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'witch_barb', imgHref: 'https://cfcdn.lordswm.com/i/f/r205.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=205&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'dark_elf', imgHref: 'https://cfcdn.lordswm.com/i/f/r6.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=6&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'dark_elf_tamer', imgHref: 'https://cfcdn.lordswm.com/i/f/r106.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=106&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'demon', imgHref: 'https://cfcdn.lordswm.com/i/f/r7.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=7&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'dark_demon', imgHref: 'https://cfcdn.lordswm.com/i/f/r107.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=107&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'dwarf', imgHref: 'https://cfcdn.lordswm.com/i/f/r8.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=8&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'flame_dwarf', imgHref: 'https://cfcdn.lordswm.com/i/f/r108.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=108&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'steppe_barb', imgHref: 'https://cfcdn.lordswm.com/i/f/r9.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=9&sign=f3d87a91771aff57e9627686e2e3deaa`},
{name: 'pharaon', imgHref: 'https://cfcdn.lordswm.com/i/f/r10.png?v=1.1', href: `https://my.lordswm.com/castle.php?change_clr_to=10&sign=f3d87a91771aff57e9627686e2e3deaa`},
];
classes.forEach(el => {
let link = document.createElement('a');
link.innerHTML = `<a href='${el.href}'><img src=${el.imgHref} alt=${el.name}/></a>`;
block.appendChild(link);
})
document.body.appendChild(block);
if (location.href.match(/fr_changed_to/gi).length !== 0) {
location.replace(`${link}/home.php`);
}
})();