hwmOptimalRepairAtMarket

Цена боя и оптимальный слом на рынке

目前為 2023-04-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name           hwmOptimalRepairAtMarket
// @author         Tamozhnya1
// @namespace      Tamozhnya1
// @description    Цена боя и оптимальный слом на рынке
// @version        4.0
// @encoding        utf-8
// @include        *heroeswm.ru/auction.php*
// @include        *lordswm.com/auction.php*
// @include        *heroeswm.ru/art_info.php*
// @include        *lordswm.com/art_info.php*
// @include        *heroeswm.ru/mod_workbench.php*
// @include        *lordswm.com/mod_workbench.php*
// @include        *heroeswm.ru/inventory.php*
// @include        *lordswm.com/inventory.php*
// @include        *heroeswm.ru/object-info.php*
// @include        *lordswm.com/object-info.php*
// @include        *heroeswm.ru/shop.php*
// @include        *lordswm.com/shop.php*
// @include        *heroeswm.ru/ecostat_details.php*
// @include        *lordswm.com/ecostat_details.php*
// @include        *heroeswm.ru/home.php*
// @include        *lordswm.com/home.php*
// @include        *heroeswm.ru/pl_info.php*
// @include        *lordswm.com/pl_info.php*
// @grant          GM_deleteValue
// @grant          GM_getValue
// @grant          GM_listValues
// @grant          GM_setValue
// @grant          GM_addStyle
// @grant          GM_log
// @grant          GM_openInTab
// @license        MIT
// ==/UserScript==

const ScriptName = "hwmOptimalRepairAtMarket";
const LastBestLotDataName = "LastBestLotData_";
const OptimalRepairAtMarketSmithLevelName = "OptimalRepairAtMarketSmithLevel";
const OptimalRepairAtMarketSmithRewardPercentName = "OptimalRepairAtMarketSmithRewardPercent";
const ShopArtFactoryPriceName = "ShopArtFactoryPrice_";
const ArtPriceSettingsName = "ArtPriceSettings";
const windowObject = window.wrappedJSObject || unsafeWindow;
var CombatCostBestDeviation = parseInt(GM_getValue("CombatCostBestDeviation", 1)); // percent
var CombatCostGoodDeviation = parseInt(GM_getValue("CombatCostGoodDeviation", 10)); // percent
var ShowAfterRepairBattleCostInInventory = GM_getValue("ShowAfterRepairBattleCostInInventory", "true") == "true";
var SmithLevel = parseInt(GM_getValue(OptimalRepairAtMarketSmithLevelName, 9));
var SmithRewardPercent = parseInt(GM_getValue(OptimalRepairAtMarketSmithRewardPercentName, 0));

const SortType = { Text: 1, Number: 2 };

const ArtifactInfo = { "staff": { Strength: 40, RepairCost: 2527 }, "sword18": { Strength: 70, RepairCost: 17755 }, "wood_sword": { Strength: 7, RepairCost: 133 }, "long_bow": { Strength: 50, RepairCost: 6317 }, "dagger_dex": { Strength: 40, RepairCost: 3230 }, "dagger": { Strength: 30, RepairCost: 912 }, "dagger20": { Strength: 60, RepairCost: 9291 }, "dagger16": { Strength: 60, RepairCost: 9120 }, "shortbow": { Strength: 20, RepairCost: 342 }, "gnome_hammer": { Strength: 25, RepairCost: 294 }, "bow14": { Strength: 65, RepairCost: 9946 }, "bow17": { Strength: 65, RepairCost: 10108 }, "power_sword": { Strength: 80, RepairCost: 9775 }, "requital_sword": { Strength: 40, RepairCost: 2527 }, "firsword15": { Strength: 70, RepairCost: 17670 }, "ssword16": { Strength: 46, RepairCost: 6051 }, "ssword8": { Strength: 40, RepairCost: 3838 }, "ssword10": { Strength: 45, RepairCost: 4854 }, "broad_sword": { Strength: 60, RepairCost: 4721 }, "def_sword": { Strength: 40, RepairCost: 1292 }, "dagger_myf": { Strength: 60, RepairCost: 8626 }, "mif_sword": { Strength: 70, RepairCost: 16957 }, "mif_staff": { Strength: 70, RepairCost: 16387 }, "ssword13": { Strength: 50, RepairCost: 5985 }, "mstaff13": { Strength: 40, RepairCost: 4797 }, "mstaff8": { Strength: 30, RepairCost: 2888 }, "smstaff16": { Strength: 37, RepairCost: 4883 }, "staff18": { Strength: 70, RepairCost: 17746 }, "sor_staff": { Strength: 50, RepairCost: 6118 }, "ffstaff15": { Strength: 70, RepairCost: 17679 }, "mstaff10": { Strength: 35, RepairCost: 3781 }, "mm_sword": { Strength: 70, RepairCost: 17195 }, "mm_staff": { Strength: 70, RepairCost: 16986 }, "composite_bow": { Strength: 55, RepairCost: 8246 }, "steel_blade": { Strength: 30, RepairCost: 465 }, "large_shield": { Strength: 70, RepairCost: 9576 }, "hauberk": { Strength: 40, RepairCost: 2289 }, "boots2": { Strength: 35, RepairCost: 1026 }, "armor15": { Strength: 70, RepairCost: 9310 }, "marmor17": { Strength: 70, RepairCost: 9310 }, "sarmor16": { Strength: 44, RepairCost: 4351 }, "armor17": { Strength: 70, RepairCost: 9490 }, "leather_shiled": { Strength: 18, RepairCost: 266 }, "leatherhat": { Strength: 12, RepairCost: 171 }, "leatherboots": { Strength: 14, RepairCost: 199 }, "leatherplate": { Strength: 30, RepairCost: 1358 }, "hunter_boots": { Strength: 30, RepairCost: 912 }, "leather_helm": { Strength: 30, RepairCost: 627 }, "wizard_cap": { Strength: 35, RepairCost: 1596 }, "chain_coif": { Strength: 40, RepairCost: 1539 }, "xymhelmet15": { Strength: 70, RepairCost: 6612 }, "mhelmetzh13": { Strength: 70, RepairCost: 6384 }, "round_shiled": { Strength: 7, RepairCost: 104 }, "mif_light": { Strength: 70, RepairCost: 6251 }, "mif_lboots": { Strength: 55, RepairCost: 7153 }, "mif_lhelmet": { Strength: 70, RepairCost: 5244 }, "sarmor9": { Strength: 40, RepairCost: 2479 }, "miff_plate": { Strength: 75, RepairCost: 9842 }, "sarmor13": { Strength: 50, RepairCost: 4322 }, "boots13": { Strength: 70, RepairCost: 8502 }, "zxhelmet13": { Strength: 70, RepairCost: 6384 }, "shield13": { Strength: 70, RepairCost: 10174 }, "mage_armor": { Strength: 50, RepairCost: 4465 }, "robewz15": { Strength: 70, RepairCost: 9310 }, "wiz_robe": { Strength: 70, RepairCost: 9376 }, "sboots12": { Strength: 35, RepairCost: 2992 }, "shelm12": { Strength: 40, RepairCost: 2660 }, "sboots16": { Strength: 30, RepairCost: 3239 }, "boots15": { Strength: 70, RepairCost: 8559 }, "boots17": { Strength: 70, RepairCost: 8683 }, "mboots17": { Strength: 70, RepairCost: 8683 }, "mboots14": { Strength: 70, RepairCost: 8825 }, "sboots9": { Strength: 30, RepairCost: 2137 }, "ciras": { Strength: 70, RepairCost: 4455 }, "steel_helmet": { Strength: 70, RepairCost: 3676 }, "s_shield": { Strength: 15, RepairCost: 266 }, "full_plate": { Strength: 75, RepairCost: 9243 }, "steel_boots": { Strength: 70, RepairCost: 5785 }, "shoe_of_initiative": { Strength: 40, RepairCost: 2384 }, "wiz_boots": { Strength: 65, RepairCost: 8008 }, "mif_hboots": { Strength: 65, RepairCost: 7752 }, "mif_hhelmet": { Strength: 70, RepairCost: 6298 }, "shelm16": { Strength: 40, RepairCost: 2774 }, "mage_helm": { Strength: 50, RepairCost: 3277 }, "shelm8": { Strength: 30, RepairCost: 1197 }, "myhelmet15": { Strength: 70, RepairCost: 6583 }, "helmet17": { Strength: 70, RepairCost: 7239 }, "mhelmet17": { Strength: 70, RepairCost: 7239 }, "knowledge_hat": { Strength: 25, RepairCost: 978 }, "dragon_shield": { Strength: 70, RepairCost: 8778 }, "shield16": { Strength: 70, RepairCost: 10298 }, "sshield17": { Strength: 35, RepairCost: 4018 }, "shield19": { Strength: 70, RepairCost: 10469 }, "sshield5": { Strength: 40, RepairCost: 2888 }, "sshield11": { Strength: 40, RepairCost: 3876 }, "defender_shield": { Strength: 40, RepairCost: 1130 }, "sshield14": { Strength: 38, RepairCost: 3923 }, "wzzamulet16": { Strength: 65, RepairCost: 10972 }, "mmzamulet16": { Strength: 65, RepairCost: 10972 }, "smamul17": { Strength: 30, RepairCost: 4389 }, "bafamulet15": { Strength: 65, RepairCost: 10811 }, "amulet_of_luck": { Strength: 25, RepairCost: 959 }, "samul14": { Strength: 30, RepairCost: 4370 }, "wzzamulet13": { Strength: 60, RepairCost: 9975 }, "warring13": { Strength: 60, RepairCost: 10279 }, "ring19": { Strength: 65, RepairCost: 11305 }, "wwwring16": { Strength: 65, RepairCost: 11238 }, "dring5": { Strength: 40, RepairCost: 3496 }, "warriorring": { Strength: 40, RepairCost: 6697 }, "mmmring16": { Strength: 65, RepairCost: 11238 }, "i_ring": { Strength: 10, RepairCost: 171 }, "smring10": { Strength: 30, RepairCost: 2859 }, "dring18": { Strength: 70, RepairCost: 14820 }, "mring19": { Strength: 65, RepairCost: 11390 }, "circ_ring": { Strength: 50, RepairCost: 6507 }, "dring15": { Strength: 70, RepairCost: 14534 }, "powerring": { Strength: 40, RepairCost: 5187 }, "bring14": { Strength: 60, RepairCost: 10374 }, "sring4": { Strength: 15, RepairCost: 579 }, "doubt_ring": { Strength: 12, RepairCost: 1064 }, "dring21": { Strength: 70, RepairCost: 15104 }, "rashness_ring": { Strength: 30, RepairCost: 1928 }, "darkring": { Strength: 50, RepairCost: 8379 }, "sring17": { Strength: 30, RepairCost: 2907 }, "warrior_pendant": { Strength: 50, RepairCost: 8046 }, "mamulet19": { Strength: 65, RepairCost: 11039 }, "power_pendant": { Strength: 60, RepairCost: 7381 }, "amulet19": { Strength: 65, RepairCost: 11039 }, "magic_amulet": { Strength: 50, RepairCost: 8379 }, "cloack17": { Strength: 65, RepairCost: 9975 }, "cloackwz15": { Strength: 65, RepairCost: 9614 }, "scroll18": { Strength: 70, RepairCost: 10307 }, "scloack8": { Strength: 30, RepairCost: 2052 }, "bravery_medal": { Strength: 25, RepairCost: 560 }, "mmzamulet13": { Strength: 60, RepairCost: 9975 }, "dring12": { Strength: 65, RepairCost: 13356 }, "soul_cape": { Strength: 30, RepairCost: 1197 }, "wiz_cape": { Strength: 60, RepairCost: 8711 }, "samul17": { Strength: 30, RepairCost: 4389 }, "smamul14": { Strength: 30, RepairCost: 4370 }, "verve_ring": { Strength: 18, RepairCost: 1577 }, "dring9": { Strength: 50, RepairCost: 10032 }, "smring17": { Strength: 30, RepairCost: 2907 }, "magring13": { Strength: 60, RepairCost: 10279 }, "scloack16": { Strength: 30, RepairCost: 3192 }, "powercape": { Strength: 40, RepairCost: 5339 }, "scoutcloack": { Strength: 20, RepairCost: 304 }, "energy_scroll": { Strength: 70, RepairCost: 9044 }, "samul8": { Strength: 30, RepairCost: 3391 }, "sring10": { Strength: 30, RepairCost: 2859 }, "antiair_cape": { Strength: 60, RepairCost: 2926 }, "antimagic_cape": { Strength: 50, RepairCost: 4949 }, "d_spray": { Strength: 15, RepairCost: 3325 }, "bfly": { Strength: 50, RepairCost: 49875 }, "bril_pendant": { Strength: 50, RepairCost: 23275 }, "warmor": { Strength: 50, RepairCost: 16625 }, "flowers3": { Strength: 15, RepairCost: 3325 }, "flowers1": { Strength: 10, RepairCost: 332 }, "flowers4": { Strength: 25, RepairCost: 4987 }, "flowers2": { Strength: 10, RepairCost: 332 }, "roses": { Strength: 40, RepairCost: 8312 }, "flowers5": { Strength: 25, RepairCost: 4987 }, "half_heart_m": { Strength: 25, RepairCost: 4987 }, "half_heart_w": { Strength: 25, RepairCost: 4987 }, "venok": { Strength: 10, RepairCost: 332 }, "defender_dagger": { Strength: 15, RepairCost: 1330 }, "goldciras": { Strength: 50, RepairCost: 13300 }, "koltsou": { Strength: 40, RepairCost: 23275 }, "bril_ring": { Strength: 40, RepairCost: 33250 }, "wboots": { Strength: 50, RepairCost: 16625 }, "flower_heart": { Strength: 20, RepairCost: 1662 }, "protazan": { Strength: 40, RepairCost: 8312 }, "whelmet": { Strength: 50, RepairCost: 16625 }, "shpaga": { Strength: 60, RepairCost: 26600 }, "coldamul": { Strength: 75, RepairCost: 11000 }, "sun_armor": { Strength: 85, RepairCost: 9500 }, "super_dagger": { Strength: 75, RepairCost: 10400 }, "clover_amul": { Strength: 75, RepairCost: 11000 }, "ring2013": { Strength: 50, RepairCost: 800 }, "sun_ring": { Strength: 75, RepairCost: 6400 }, "coldring_n": { Strength: 75, RepairCost: 6400 }, "lbow": { Strength: 85, RepairCost: 10100 }, "cold_sword2014": { Strength: 85, RepairCost: 17600 }, "finecl": { Strength: 80, RepairCost: 10000 }, "sun_boots": { Strength: 85, RepairCost: 8700 }, "sun_helm": { Strength: 85, RepairCost: 7400 }, "wshield": { Strength: 65, RepairCost: 4000 }, "shield_14y": { Strength: 70, RepairCost: 14000 }, "cold_shieldn": { Strength: 85, RepairCost: 10400 }, "n_amul": { Strength: 40, RepairCost: 2000 }, "n_boots": { Strength: 40, RepairCost: 2000 }, "n_armor": { Strength: 40, RepairCost: 2000 }, "n_ringa": { Strength: 40, RepairCost: 2000 }, "n_ringd": { Strength: 40, RepairCost: 2000 }, "n_sword": { Strength: 40, RepairCost: 2000 }, "n_clk": { Strength: 40, RepairCost: 2000 }, "n_helmet": { Strength: 40, RepairCost: 2000 }, "n_shield": { Strength: 40, RepairCost: 2000 }, "neut_amulet": { Strength: 20, RepairCost: 10000 }, "forest_armor": { Strength: 1, RepairCost: 10000 }, "forest_dagger": { Strength: 1, RepairCost: 20000 }, "forest_blade": { Strength: 1, RepairCost: 20000 }, "neut_ring": { Strength: 1, RepairCost: 10000 }, "les_cl": { Strength: 20, RepairCost: 10000 }, "forest_bow": { Strength: 20, RepairCost: 10000 }, "forest_boots": { Strength: 1, RepairCost: 10000 }, "forest_helm": { Strength: 1, RepairCost: 10000 }, "shieldofforest": { Strength: 1, RepairCost: 10000 }, "hunter_pendant1": { Strength: 10, RepairCost: 400 }, "hunter_bow1": { Strength: 10, RepairCost: 400 }, "hunter_gloves1": { Strength: 10, RepairCost: 400 }, "hunter_jacket1": { Strength: 10, RepairCost: 400 }, "hunter_boots1": { Strength: 10, RepairCost: 400 }, "hunter_sword1": { Strength: 10, RepairCost: 400 }, "hunter_hat1": { Strength: 10, RepairCost: 400 }, "hunter_shield1": { Strength: 10, RepairCost: 400 }, "hunter_amulet1": { Strength: 10, RepairCost: 800 }, "hunter_armor1": { Strength: 10, RepairCost: 800 }, "hunterdagger": { Strength: 10, RepairCost: 800 }, "hunter_ring2": { Strength: 10, RepairCost: 800 }, "hunter_ring1": { Strength: 10, RepairCost: 800 }, "hunter_roga1": { Strength: 10, RepairCost: 800 }, "huntersword2": { Strength: 10, RepairCost: 800 }, "hunter_boots3": { Strength: 10, RepairCost: 800 }, "hunter_bow2": { Strength: 10, RepairCost: 800 }, "hunter_mask1": { Strength: 10, RepairCost: 800 }, "hunterdsword": { Strength: 10, RepairCost: 800 }, "hunter_boots2": { Strength: 10, RepairCost: 800 }, "hunter_arrows1": { Strength: 10, RepairCost: 800 }, "hunter_helm": { Strength: 10, RepairCost: 800 }, "huntershield2": { Strength: 10, RepairCost: 800 }, "gm_amul": { Strength: 10, RepairCost: 1200 }, "gm_arm": { Strength: 10, RepairCost: 1200 }, "gm_rring": { Strength: 10, RepairCost: 1200 }, "gm_kastet": { Strength: 10, RepairCost: 1200 }, "gm_sring": { Strength: 10, RepairCost: 1200 }, "gm_abow": { Strength: 10, RepairCost: 1200 }, "gm_protect": { Strength: 10, RepairCost: 1200 }, "gm_sword": { Strength: 10, RepairCost: 1200 }, "gm_spdb": { Strength: 10, RepairCost: 1200 }, "gm_3arrows": { Strength: 10, RepairCost: 1200 }, "gm_hat": { Strength: 10, RepairCost: 1200 }, "gm_defence": { Strength: 10, RepairCost: 1200 }, "sh_amulet2": { Strength: 15, RepairCost: 2400 }, "sh_armor": { Strength: 15, RepairCost: 2400 }, "sh_ring1": { Strength: 15, RepairCost: 2400 }, "sh_ring2": { Strength: 15, RepairCost: 2400 }, "sh_spear": { Strength: 15, RepairCost: 2400 }, "sh_bow": { Strength: 15, RepairCost: 2400 }, "sh_cloak": { Strength: 15, RepairCost: 2400 }, "sh_sword": { Strength: 15, RepairCost: 2400 }, "sh_boots": { Strength: 15, RepairCost: 2400 }, "sh_4arrows": { Strength: 15, RepairCost: 2400 }, "sh_helmet": { Strength: 15, RepairCost: 2400 }, "sh_shield": { Strength: 15, RepairCost: 2400 }, "thief_neckl": { Strength: 60, RepairCost: 8000 }, "thief_arb": { Strength: 60, RepairCost: 8000 }, "thief_goodarmor": { Strength: 60, RepairCost: 8000 }, "thief_ml_dagger": { Strength: 60, RepairCost: 8000 }, "ring_of_thief": { Strength: 60, RepairCost: 8000 }, "thief_msk": { Strength: 60, RepairCost: 8000 }, "thief_cape": { Strength: 60, RepairCost: 8000 }, "thief_fastboots": { Strength: 60, RepairCost: 8000 }, "tm_amulet": { Strength: 60, RepairCost: 24000 }, "tm_arb": { Strength: 60, RepairCost: 24000 }, "tm_armor": { Strength: 60, RepairCost: 24000 }, "tm_knife": { Strength: 60, RepairCost: 24000 }, "tm_mring": { Strength: 60, RepairCost: 24000 }, "tm_wring": { Strength: 60, RepairCost: 24000 }, "tm_msk": { Strength: 60, RepairCost: 24000 }, "tm_cape": { Strength: 60, RepairCost: 24000 }, "tm_boots": { Strength: 60, RepairCost: 24000 }, "r_warriorsamulet": { Strength: 70, RepairCost: 36000 }, "r_m_amulet": { Strength: 70, RepairCost: 36000 }, "r_zarmor": { Strength: 70, RepairCost: 36000 }, "r_dagger": { Strength: 70, RepairCost: 36000 }, "r_magicsring": { Strength: 70, RepairCost: 36000 }, "r_warring": { Strength: 70, RepairCost: 36000 }, "r_bow": { Strength: 70, RepairCost: 36000 }, "r_bigsword": { Strength: 70, RepairCost: 36000 }, "r_clck": { Strength: 70, RepairCost: 36000 }, "r_magy_staff": { Strength: 70, RepairCost: 36000 }, "r_bootsmb": { Strength: 70, RepairCost: 36000 }, "r_goodscroll": { Strength: 70, RepairCost: 36000 }, "r_helmb": { Strength: 70, RepairCost: 36000 }, "tact1w1_wamulet": { Strength: 75, RepairCost: 40000 }, "tactcv1_armor": { Strength: 75, RepairCost: 40000 }, "tactsm0_dagger": { Strength: 75, RepairCost: 40000 }, "tactspw_mring": { Strength: 75, RepairCost: 40000 }, "tactwww_wring": { Strength: 75, RepairCost: 40000 }, "tact765_bow": { Strength: 75, RepairCost: 40000 }, "tactms1_mamulet": { Strength: 75, RepairCost: 40000 }, "tactpow_cloack": { Strength: 75, RepairCost: 40000 }, "tactmag_staff": { Strength: 75, RepairCost: 40000 }, "tactzl4_boots": { Strength: 75, RepairCost: 40000 }, "tactaz_axe": { Strength: 75, RepairCost: 40000 }, "tacthapp_helmet": { Strength: 75, RepairCost: 40000 }, "tactdff_shield": { Strength: 75, RepairCost: 40000 }, "v_1armor": { Strength: 90, RepairCost: 48000 }, "verb11_sword": { Strength: 90, RepairCost: 48000 }, "verbboots": { Strength: 90, RepairCost: 48000 }, "ve_helm": { Strength: 90, RepairCost: 48000 }, "vrb_shild": { Strength: 90, RepairCost: 48000 }, "tl_medal1": { Strength: 50, RepairCost: 32000 }, "tl_medal2": { Strength: 40, RepairCost: 16000 }, "tl_medal3": { Strength: 30, RepairCost: 6000 }, "bwar1": { Strength: 1, RepairCost: 60000 }, "kwar1": { Strength: 1, RepairCost: 60000 }, "gnomewar1": { Strength: 70, RepairCost: 60000 }, "bwar2": { Strength: 1, RepairCost: 48000 }, "kwar2": { Strength: 1, RepairCost: 48000 }, "gnomewar2": { Strength: 65, RepairCost: 48000 }, "kwar3": { Strength: 1, RepairCost: 36000 }, "gnomewar3": { Strength: 60, RepairCost: 36000 }, "bwar3": { Strength: 1, RepairCost: 36000 }, "bwar4": { Strength: 1, RepairCost: 28000 }, "kwar4": { Strength: 1, RepairCost: 28000 }, "gnomewar4": { Strength: 55, RepairCost: 28000 }, "bwar5": { Strength: 1, RepairCost: 20000 }, "kwar5": { Strength: 1, RepairCost: 20000 }, "gnomewar5": { Strength: 50, RepairCost: 20000 }, "bwar6": { Strength: 1, RepairCost: 16000 }, "kwar6": { Strength: 1, RepairCost: 16000 }, "gnomewar6": { Strength: 45, RepairCost: 16000 }, "bwar7": { Strength: 1, RepairCost: 12000 }, "kwar7": { Strength: 1, RepairCost: 12000 }, "gnomewar7": { Strength: 40, RepairCost: 12000 }, "bunt_medal1": { Strength: 60, RepairCost: 40000 }, "bunt_medal2": { Strength: 50, RepairCost: 20000 }, "bunt_medal3": { Strength: 40, RepairCost: 10000 }, "bwar_splo": { Strength: 50, RepairCost: 28000 }, "gnomewar_splo": { Strength: 50, RepairCost: 28000 }, "kwar_splo": { Strength: 50, RepairCost: 28000 }, "kwar_stoj": { Strength: 25, RepairCost: 28000 }, "bwar_stoj": { Strength: 30, RepairCost: 28000 }, "gnomewar_stoj": { Strength: 50, RepairCost: 28000 }, "bwar_takt": { Strength: 50, RepairCost: 28000 }, "gnomewar_takt": { Strength: 50, RepairCost: 28000 }, "kwar_takt": { Strength: 50, RepairCost: 28000 }, "necrwar1st": { Strength: 70, RepairCost: 56000 }, "necrwar2st": { Strength: 60, RepairCost: 36000 }, "necrwar3st": { Strength: 50, RepairCost: 20000 }, "necrwar4st": { Strength: 40, RepairCost: 10000 }, "necrwar5st": { Strength: 30, RepairCost: 4000 }, "warthief_medal1": { Strength: 70, RepairCost: 18000 }, "warthief_medal2": { Strength: 60, RepairCost: 14000 }, "warthief_medal3": { Strength: 50, RepairCost: 10000 }, "warthief_medal4": { Strength: 40, RepairCost: 6000 }, "warthief_medal5": { Strength: 30, RepairCost: 2000 }, "elfwar1": { Strength: 80, RepairCost: 60000 }, "elfwar2": { Strength: 70, RepairCost: 40000 }, "elfwar3": { Strength: 60, RepairCost: 32000 }, "elfwar4": { Strength: 50, RepairCost: 20000 }, "elfwar5": { Strength: 40, RepairCost: 10000 }, "elfwar6": { Strength: 30, RepairCost: 4000 }, "magewar1": { Strength: 80, RepairCost: 52000 }, "magewar2": { Strength: 70, RepairCost: 40000 }, "magewar3": { Strength: 60, RepairCost: 32000 }, "magewar4": { Strength: 50, RepairCost: 20000 }, "magewar5": { Strength: 35, RepairCost: 12000 }, "demwar1": { Strength: 80, RepairCost: 60000 }, "demwar2": { Strength: 70, RepairCost: 44000 }, "demwar3": { Strength: 60, RepairCost: 36000 }, "demwar4": { Strength: 50, RepairCost: 24000 }, "demwar5": { Strength: 40, RepairCost: 16000 }, "demwar6": { Strength: 30, RepairCost: 8000 }, "barb_armor": { Strength: 100, RepairCost: 40000 }, "barb_club": { Strength: 100, RepairCost: 40000 }, "barb_boots": { Strength: 100, RepairCost: 40000 }, "barb_helm": { Strength: 100, RepairCost: 40000 }, "barb_shield": { Strength: 100, RepairCost: 40000 }, "necr_amulet": { Strength: 100, RepairCost: 40000 }, "necr_helm": { Strength: 100, RepairCost: 40000 }, "necr_staff": { Strength: 100, RepairCost: 40000 }, "necr_robe": { Strength: 100, RepairCost: 40000 }, "merc_armor": { Strength: 100, RepairCost: 40000 }, "merc_dagger": { Strength: 100, RepairCost: 40000 }, "merc_sword": { Strength: 100, RepairCost: 40000 }, "merc_boots": { Strength: 100, RepairCost: 40000 }, "elfamulet": { Strength: 100, RepairCost: 50000 }, "elfbow": { Strength: 100, RepairCost: 50000 }, "elfshirt": { Strength: 100, RepairCost: 50000 }, "elfboots": { Strength: 100, RepairCost: 50000 }, "darkelfkaska": { Strength: 100, RepairCost: 50000 }, "darkelfciras": { Strength: 100, RepairCost: 50000 }, "darkelfpendant": { Strength: 100, RepairCost: 50000 }, "darkelfcloack": { Strength: 100, RepairCost: 50000 }, "darkelfstaff": { Strength: 100, RepairCost: 50000 }, "darkelfboots": { Strength: 100, RepairCost: 50000 }, "dem_amulet": { Strength: 100, RepairCost: 50000 }, "dem_armor": { Strength: 100, RepairCost: 50000 }, "dem_bootshields": { Strength: 100, RepairCost: 50000 }, "dem_axe": { Strength: 100, RepairCost: 50000 }, "dem_helmet": { Strength: 100, RepairCost: 50000 }, "dem_shield": { Strength: 100, RepairCost: 50000 }, "mage_cape": { Strength: 100, RepairCost: 60000 }, "mage_staff": { Strength: 100, RepairCost: 60000 }, "mage_robe": { Strength: 100, RepairCost: 60000 }, "mage_boots": { Strength: 100, RepairCost: 60000 }, "mage_scroll": { Strength: 100, RepairCost: 60000 }, "mage_hat": { Strength: 100, RepairCost: 60000 }, "gnomearmor": { Strength: 100, RepairCost: 44000 }, "gnomehammer": { Strength: 100, RepairCost: 44000 }, "gnomeboots": { Strength: 100, RepairCost: 44000 }, "gnomehelmet": { Strength: 100, RepairCost: 44000 }, "gnomeshield": { Strength: 100, RepairCost: 44000 }, "gnomem_amulet": { Strength: 100, RepairCost: 64000 }, "gnomem_armor": { Strength: 100, RepairCost: 64000 }, "gnomem_hammer": { Strength: 100, RepairCost: 64000 }, "gnomem_boots": { Strength: 100, RepairCost: 64000 }, "gnomem_helmet": { Strength: 100, RepairCost: 64000 }, "gnomem_shield": { Strength: 100, RepairCost: 64000 }, "gmage_crown": { Strength: 100, RepairCost: 64000 }, "gmage_cloack": { Strength: 100, RepairCost: 64000 }, "gmage_staff": { Strength: 100, RepairCost: 64000 }, "gmage_armor": { Strength: 100, RepairCost: 64000 }, "gmage_boots": { Strength: 100, RepairCost: 64000 }, "gmage_scroll": { Strength: 100, RepairCost: 64000 }, "welfarmor": { Strength: 100, RepairCost: 44000 }, "welfbow": { Strength: 100, RepairCost: 44000 }, "welfsword": { Strength: 100, RepairCost: 44000 }, "welfboots": { Strength: 100, RepairCost: 44000 }, "welfhelmet": { Strength: 100, RepairCost: 44000 }, "welfshield": { Strength: 100, RepairCost: 44000 }, "druid_amulet": { Strength: 100, RepairCost: 64000 }, "druid_cloack": { Strength: 100, RepairCost: 64000 }, "druid_staff": { Strength: 100, RepairCost: 64000 }, "druid_armor": { Strength: 100, RepairCost: 64000 }, "druid_boots": { Strength: 100, RepairCost: 64000 }, "knightarmor": { Strength: 100, RepairCost: 44000 }, "knightsword": { Strength: 100, RepairCost: 44000 }, "knightboots": { Strength: 100, RepairCost: 44000 }, "knighthelmet": { Strength: 100, RepairCost: 44000 }, "knightshield": { Strength: 100, RepairCost: 44000 }, "paladin_bow": { Strength: 100, RepairCost: 64000 }, "paladin_armor": { Strength: 100, RepairCost: 64000 }, "paladin_sword": { Strength: 100, RepairCost: 64000 }, "paladin_boots": { Strength: 100, RepairCost: 64000 }, "paladin_helmet": { Strength: 100, RepairCost: 64000 }, "paladin_shield": { Strength: 100, RepairCost: 64000 }, "sv_arb": { Strength: 100, RepairCost: 64000 }, "sv_body": { Strength: 100, RepairCost: 64000 }, "sv_weap": { Strength: 100, RepairCost: 64000 }, "sv_boot": { Strength: 100, RepairCost: 64000 }, "sv_helm": { Strength: 100, RepairCost: 64000 }, "sv_shield": { Strength: 100, RepairCost: 64000 }, "nv_body": { Strength: 100, RepairCost: 56000 }, "nv_weap": { Strength: 100, RepairCost: 56000 }, "nv_boot": { Strength: 100, RepairCost: 56000 }, "nv_helm": { Strength: 100, RepairCost: 56000 }, "nv_shield": { Strength: 100, RepairCost: 56000 }, "kn_body": { Strength: 100, RepairCost: 44000 }, "kn_weap": { Strength: 100, RepairCost: 44000 }, "kn_helm": { Strength: 100, RepairCost: 44000 }, "kn_shield": { Strength: 100, RepairCost: 44000 }, "inq_body": { Strength: 100, RepairCost: 64000 }, "inq_cl": { Strength: 100, RepairCost: 64000 }, "inq_weap": { Strength: 100, RepairCost: 64000 }, "inq_boot": { Strength: 100, RepairCost: 64000 }, "inq_helm": { Strength: 100, RepairCost: 64000 }, "amf_body": { Strength: 100, RepairCost: 64000 }, "amf_cl": { Strength: 100, RepairCost: 64000 }, "amf_boot": { Strength: 100, RepairCost: 64000 }, "amf_weap": { Strength: 100, RepairCost: 64000 }, "amf_scroll": { Strength: 100, RepairCost: 64000 }, "amf_helm": { Strength: 100, RepairCost: 64000 }, "8amul_inf": { Strength: 8, RepairCost: 12000 }, "quest_pendant1": { Strength: 20, RepairCost: 600 }, "9amu_let": { Strength: 9, RepairCost: 18000 }, "trinitypendant": { Strength: 50, RepairCost: 6400 }, "sunart2": { Strength: 20, RepairCost: 28000 }, "a_mallet": { Strength: 10000, RepairCost: 40 }, "buben2": { Strength: 1, RepairCost: 12800 }, "totem1": { Strength: 70, RepairCost: 9600 }, "icesphere1": { Strength: 1, RepairCost: 16000 }, "mechanic_glasses1": { Strength: 1, RepairCost: 8000 }, "buben1": { Strength: 1, RepairCost: 16000 }, "anomal_ring1": { Strength: 1, RepairCost: 20000 }, "mart8_ring1": { Strength: 8, RepairCost: 400 }, "mart8_flowers1": { Strength: 8, RepairCost: 8000 }, "wolfjacket": { Strength: 15, RepairCost: 800 }, "sharik": { Strength: 1, RepairCost: 4000 }, "thief_paper": { Strength: 1, RepairCost: 0 }, "magneticarmor": { Strength: 1, RepairCost: 36000 }, "dragonstone": { Strength: 70, RepairCost: 12000 }, "dubina": { Strength: 30, RepairCost: 40000 }, "ogre_bum": { Strength: 1, RepairCost: 36000 }, "gdubina": { Strength: 30, RepairCost: 14000 }, "lizard_armor": { Strength: 15, RepairCost: 800 }, "hopesh1": { Strength: 1, RepairCost: 10000 }, "mgear": { Strength: 1, RepairCost: 9600 }, "5years_star": { Strength: 10, RepairCost: 5000 }, "mirror": { Strength: 1, RepairCost: 16000 }, "znamya1": { Strength: 70, RepairCost: 8000 }, "krest2": { Strength: 1, RepairCost: 9000 }, "znamya2": { Strength: 70, RepairCost: 8000 }, "kznamya1": { Strength: 70, RepairCost: 10000 }, "kznamya2": { Strength: 70, RepairCost: 10000 }, "ankh1": { Strength: 70, RepairCost: 12000 }, "zub": { Strength: 30, RepairCost: 40000 }, "tunnel_kirka": { Strength: 25, RepairCost: 4000 }, "bludgeon": { Strength: 30, RepairCost: 28000 }, "brush": { Strength: 70, RepairCost: 19824 }, "windsword": { Strength: 1, RepairCost: 22000 }, "pit_sword1": { Strength: 1, RepairCost: 16000 }, "pit_sword2": { Strength: 1, RepairCost: 13200 }, "kniga": { Strength: 40, RepairCost: 9600 }, "skill_book11": { Strength: 1, RepairCost: 40000 }, "anomal_ring2": { Strength: 1, RepairCost: 18000 }, "commander_ring": { Strength: 70, RepairCost: 20000 }, "testring": { Strength: 30, RepairCost: 40000 }, "thief_premiumring1": { Strength: 70, RepairCost: 24000 }, "thief_premiumring2": { Strength: 65, RepairCost: 18000 }, "thief_premiumring3": { Strength: 60, RepairCost: 12000 }, "ttring": { Strength: 1, RepairCost: 10800 }, "blackring": { Strength: 40, RepairCost: 8000 }, "student_armor": { Strength: 30, RepairCost: 2000 }, "pegaskop": { Strength: 1, RepairCost: 36000 }, "sunart1": { Strength: 20, RepairCost: 14000 }, "kopie": { Strength: 30, RepairCost: 28000 }, "pika": { Strength: 30, RepairCost: 28000 }, "trogloditkop": { Strength: 1, RepairCost: 5600 }, "dragon_crown": { Strength: 50, RepairCost: 6800 }, "necrohelm2": { Strength: 10, RepairCost: 16000 }, "dem_kosa": { Strength: 30, RepairCost: 40000 }, "pouch": { Strength: 70, RepairCost: 12000 }, "cubed": { Strength: 45, RepairCost: 4800 }, "bal_cube": { Strength: 45, RepairCost: 4800 }, "cubes": { Strength: 50, RepairCost: 6400 }, "cubeg": { Strength: 60, RepairCost: 9600 }, "bshield3": { Strength: 1, RepairCost: 8000 }, "icesphere2": { Strength: 1, RepairCost: 14400 }, "goblin_bow": { Strength: 1, RepairCost: 16000 }, "centaurbow": { Strength: 30, RepairCost: 16000 }, "sniperbow": { Strength: 1, RepairCost: 36000 }, "totem3": { Strength: 70, RepairCost: 8400 }, "10scroll": { Strength: 1, RepairCost: 40000 }, "sunart3": { Strength: 20, RepairCost: 32000 }, "sword5": { Strength: 30, RepairCost: 4000 }, "blacksword": { Strength: 10, RepairCost: 20000 }, "sunart4": { Strength: 20, RepairCost: 36000 }, "dem_dmech": { Strength: 30, RepairCost: 14000 }, "blacksword1": { Strength: 1, RepairCost: 10000 }, "slayersword": { Strength: 30, RepairCost: 40000 }, "meshok": { Strength: 2012, RepairCost: 2012 }, "meshok2": { Strength: 2012, RepairCost: 2012 }, "molot_tan": { Strength: 30, RepairCost: 40000 }, "13coin": { Strength: 1, RepairCost: 40000 }, "snowjinka": { Strength: 40, RepairCost: 4000 }, "sosulka": { Strength: 40, RepairCost: 4000 }, "obereg": { Strength: 50, RepairCost: 20000 }, "castle_orden": { Strength: 60, RepairCost: 16000 }, "order_griffin": { Strength: 70, RepairCost: 16000 }, "order_manticore": { Strength: 70, RepairCost: 16000 }, "eg_order1": { Strength: 1, RepairCost: 22000 }, "eg_order2": { Strength: 1, RepairCost: 20000 }, "eg_order3": { Strength: 1, RepairCost: 16000 }, "ord_light": { Strength: 75, RepairCost: 18000 }, "ord_dark": { Strength: 75, RepairCost: 18000 }, "mechanic_glasses2": { Strength: 1, RepairCost: 7400 }, "pen": { Strength: 70, RepairCost: 19824 }, "sandglass": { Strength: 70, RepairCost: 12000 }, "inq_ring1": { Strength: 1, RepairCost: 16000 }, "battlem_cape": { Strength: 1, RepairCost: 28000 }, "stalkercl": { Strength: 1, RepairCost: 8000 }, "totem2": { Strength: 70, RepairCost: 9600 }, "2year_amul_lords": { Strength: 10, RepairCost: 4000 }, "7ka": { Strength: 10, RepairCost: 4000 }, "3year_amul": { Strength: 10, RepairCost: 4000 }, "icesphere3": { Strength: 1, RepairCost: 12800 }, "inq_ring2": { Strength: 1, RepairCost: 12000 }, "krest3": { Strength: 1, RepairCost: 8400 }, "anomal_ring3": { Strength: 1, RepairCost: 16000 }, "buben3": { Strength: 1, RepairCost: 9600 }, "mechanic_glasses3": { Strength: 1, RepairCost: 6800 }, "rog_demon": { Strength: 30, RepairCost: 40000 }, "runkam": { Strength: 50, RepairCost: 9600 }, "lizard_boots": { Strength: 15, RepairCost: 800 }, "torg_boots": { Strength: 1, RepairCost: 20000 }, "krest1": { Strength: 1, RepairCost: 9600 }, "thief_unique_secretops": { Strength: 200, RepairCost: 0 }, "ankh2": { Strength: 70, RepairCost: 10000 }, "compass": { Strength: 40, RepairCost: 8000 }, "statue": { Strength: 70, RepairCost: 12000 }, "nefrit2": { Strength: 1, RepairCost: 9000 }, "nefrit3": { Strength: 1, RepairCost: 8400 }, "nefrit1": { Strength: 1, RepairCost: 9600 }, "cat_statue": { Strength: 70, RepairCost: 8000 }, "bear_statue": { Strength: 70, RepairCost: 8000 }, "ru_statue": { Strength: 20, RepairCost: 2009 }, "dog_statue": { Strength: 70, RepairCost: 8000 }, "msphere": { Strength: 60, RepairCost: 9600 }, "3year_art": { Strength: 10, RepairCost: 4000 }, "znak5": { Strength: 1, RepairCost: 10000 }, "znak8": { Strength: 1, RepairCost: 10000 }, "znak7": { Strength: 1, RepairCost: 10000 }, "znak3": { Strength: 1, RepairCost: 10000 }, "znak2": { Strength: 1, RepairCost: 10000 }, "znak1": { Strength: 1, RepairCost: 10000 }, "znak6": { Strength: 1, RepairCost: 10000 }, "znak9": { Strength: 1, RepairCost: 10000 }, "znak4": { Strength: 1, RepairCost: 10000 }, "firehammer": { Strength: 1, RepairCost: 32000 }, "topor_drov": { Strength: 40, RepairCost: 16000 }, "dem_dtopor": { Strength: 30, RepairCost: 48000 }, "taskaxe": { Strength: 1, RepairCost: 10000 }, "orc_axe": { Strength: 1, RepairCost: 28000 }, "topor_skelet": { Strength: 30, RepairCost: 14000 }, "sea_trident": { Strength: 15, RepairCost: 4000 }, "bshield1": { Strength: 1, RepairCost: 16000 }, "dudka": { Strength: 1, RepairCost: 6000 }, "flyaga": { Strength: 1, RepairCost: 60000 }, "antifire_cape": { Strength: 40, RepairCost: 16000 }, "hopesh2": { Strength: 1, RepairCost: 7200 }, "12hron": { Strength: 1, RepairCost: 40000 }, "4year_klever": { Strength: 10, RepairCost: 4000 }, "6ring": { Strength: 10, RepairCost: 15000 }, "lizard_helm": { Strength: 15, RepairCost: 800 }, "ogre_helm": { Strength: 1, RepairCost: 24000 }, "orc_hat": { Strength: 1, RepairCost: 20000 }, "necrohelm3": { Strength: 10, RepairCost: 24000 }, "necrohelm1": { Strength: 10, RepairCost: 10000 }, "gargoshield": { Strength: 1, RepairCost: 16000 }, "bshield2": { Strength: 1, RepairCost: 12000 }, "e_shield2": { Strength: 1, RepairCost: 7200 }, "e_shield1": { Strength: 1, RepairCost: 10000 }, "elfdagger": { Strength: 1, RepairCost: 36000 }, "dun_amul2": { Strength: 1, RepairCost: 16000 }, "dun_bow2": { Strength: 1, RepairCost: 16000 }, "drak_armor1": { Strength: 1, RepairCost: 20000 }, "dun_boots1": { Strength: 1, RepairCost: 20000 }, "dun_amul1": { Strength: 1, RepairCost: 20000 }, "dun_bow1": { Strength: 1, RepairCost: 20000 }, "dun_armor1": { Strength: 1, RepairCost: 20000 }, "dun_dagger1": { Strength: 1, RepairCost: 20000 }, "dun_sword1": { Strength: 1, RepairCost: 20000 }, "dun_ring1": { Strength: 1, RepairCost: 20000 }, "dun_cloak1": { Strength: 1, RepairCost: 18000 }, "dung_axe1": { Strength: 1, RepairCost: 18000 }, "hm2": { Strength: 1, RepairCost: 20000 }, "dun_shield1": { Strength: 1, RepairCost: 20000 }, "dun_armor2": { Strength: 1, RepairCost: 16000 }, "dun_dagger2": { Strength: 1, RepairCost: 16000 }, "dering": { Strength: 1, RepairCost: 24000 }, "drak_armor2": { Strength: 1, RepairCost: 16000 }, "dun_boots3": { Strength: 1, RepairCost: 12000 }, "dun_armor3": { Strength: 1, RepairCost: 12000 }, "dun_shield3": { Strength: 1, RepairCost: 12000 }, "drak_armor3": { Strength: 1, RepairCost: 12000 }, "dun_bow3": { Strength: 1, RepairCost: 12000 }, "dun_dagger3": { Strength: 1, RepairCost: 12000 }, "dun_sword3": { Strength: 1, RepairCost: 12000 }, "dung_axe3": { Strength: 1, RepairCost: 12000 }, "dun_sword2": { Strength: 1, RepairCost: 16000 }, "dun_ring2": { Strength: 1, RepairCost: 16000 }, "dun_cloak2": { Strength: 1, RepairCost: 15000 }, "crystal": { Strength: 1, RepairCost: 16000 }, "dun_amul3": { Strength: 1, RepairCost: 12000 }, "dun_cloak3": { Strength: 1, RepairCost: 12000 }, "dun_ring3": { Strength: 1, RepairCost: 12000 }, "dun_boots2": { Strength: 1, RepairCost: 16000 }, "dung_axe2": { Strength: 1, RepairCost: 15000 }, "hm1": { Strength: 1, RepairCost: 14400 }, "dun_shield2": { Strength: 1, RepairCost: 16000 }, "ramul1": { Strength: 1, RepairCost: 16000 }, "rarmor1": { Strength: 1, RepairCost: 16000 }, "rdagger1": { Strength: 1, RepairCost: 16000 }, "rogring1": { Strength: 1, RepairCost: 16000 }, "rarmor2": { Strength: 1, RepairCost: 8000 }, "rboots2": { Strength: 1, RepairCost: 8000 }, "rhelm2": { Strength: 1, RepairCost: 8000 }, "rsword2": { Strength: 1, RepairCost: 8000 }, "raxe2": { Strength: 1, RepairCost: 8000 }, "rbow1": { Strength: 1, RepairCost: 16000 }, "rsword1": { Strength: 1, RepairCost: 16000 }, "rcloak1": { Strength: 1, RepairCost: 16000 }, "rogring2": { Strength: 1, RepairCost: 8000 }, "ramul2": { Strength: 1, RepairCost: 8000 }, "rdagger2": { Strength: 1, RepairCost: 8000 }, "rbow2": { Strength: 1, RepairCost: 8000 }, "rcloak2": { Strength: 1, RepairCost: 8000 }, "rshield2": { Strength: 1, RepairCost: 8000 }, "rboots1": { Strength: 1, RepairCost: 16000 }, "sumka": { Strength: 1, RepairCost: 12000 }, "raxe1": { Strength: 1, RepairCost: 16000 }, "rhelm1": { Strength: 1, RepairCost: 16000 }, "rshield1": { Strength: 1, RepairCost: 16000 }, "surv_halberdzg": { Strength: 1, RepairCost: 24000 }, "surv_wamuletik": { Strength: 1, RepairCost: 28000 }, "surv_crossbowsurv": { Strength: 1, RepairCost: 32000 }, "surv_armorsu": { Strength: 1, RepairCost: 28000 }, "surv_wring2o": { Strength: 1, RepairCost: 20000 }, "surv_daggermd": { Strength: 1, RepairCost: 36000 }, "surv_sword2sd": { Strength: 1, RepairCost: 20000 }, "surv_mring2fpg": { Strength: 1, RepairCost: 20000 }, "surv_wring1my": { Strength: 1, RepairCost: 28000 }, "surv_mbootsbb": { Strength: 1, RepairCost: 28000 }, "surv_mamulka": { Strength: 1, RepairCost: 28000 }, "surv_marmoroz": { Strength: 1, RepairCost: 28000 }, "surv_mhelmetcv": { Strength: 1, RepairCost: 28000 }, "surv_mring1fd": { Strength: 1, RepairCost: 28000 }, "surv_mcloacksv": { Strength: 1, RepairCost: 28000 }, "surv_sword_surv": { Strength: 1, RepairCost: 36000 }, "surv_cloacksrv": { Strength: 1, RepairCost: 28000 }, "surv_staffik": { Strength: 1, RepairCost: 36000 }, "surv_bootsurv": { Strength: 1, RepairCost: 28000 }, "surv_scrollcd": { Strength: 1, RepairCost: 28000 }, "surv_axes": { Strength: 1, RepairCost: 36000 }, "surv_helmetpi": { Strength: 1, RepairCost: 28000 }, "surv_shieldvv": { Strength: 1, RepairCost: 28000 }, "tj_magam2": { Strength: 1, RepairCost: 20000 }, "mtcloak1": { Strength: 1, RepairCost: 24000 }, "tmarmor1": { Strength: 1, RepairCost: 24000 }, "sph1": { Strength: 1, RepairCost: 24000 }, "tj_mtuf1": { Strength: 1, RepairCost: 24000 }, "vbow1": { Strength: 1, RepairCost: 24000 }, "mhelmv1": { Strength: 1, RepairCost: 24000 }, "vtmsword1": { Strength: 1, RepairCost: 24000 }, "vtjcloak1": { Strength: 1, RepairCost: 24000 }, "staff_v1": { Strength: 1, RepairCost: 24000 }, "vscroll-1": { Strength: 1, RepairCost: 24000 }, "vtmaxe1": { Strength: 1, RepairCost: 24000 }, "vmring1": { Strength: 1, RepairCost: 24000 }, "tjarmor2": { Strength: 1, RepairCost: 20000 }, "vrdagger2": { Strength: 1, RepairCost: 20000 }, "v-ring2": { Strength: 1, RepairCost: 20000 }, "tjam2": { Strength: 1, RepairCost: 20000 }, "mtcloak3": { Strength: 1, RepairCost: 16000 }, "vtjcloak3": { Strength: 1, RepairCost: 16000 }, "staff_v3": { Strength: 1, RepairCost: 16000 }, "tmarmor3": { Strength: 1, RepairCost: 16000 }, "tj_vboots3": { Strength: 1, RepairCost: 16000 }, "tj_mtuf3": { Strength: 1, RepairCost: 16000 }, "tjarmor3": { Strength: 1, RepairCost: 16000 }, "vrdagger3": { Strength: 1, RepairCost: 16000 }, "vbow3": { Strength: 1, RepairCost: 16000 }, "mhelmv3": { Strength: 1, RepairCost: 16000 }, "vtmsword3": { Strength: 1, RepairCost: 16000 }, "vtmaxe3": { Strength: 1, RepairCost: 16000 }, "tj_helmet3": { Strength: 1, RepairCost: 16000 }, "tj-shield3": { Strength: 1, RepairCost: 16000 }, "vbow2": { Strength: 1, RepairCost: 20000 }, "mhelmv2": { Strength: 1, RepairCost: 20000 }, "vmring2": { Strength: 1, RepairCost: 20000 }, "v-ring3": { Strength: 1, RepairCost: 16000 }, "tj_magam3": { Strength: 1, RepairCost: 16000 }, "tjam3": { Strength: 1, RepairCost: 16000 }, "vbolt3": { Strength: 1, RepairCost: 16000 }, "vscroll-3": { Strength: 1, RepairCost: 16000 }, "mtcloak2": { Strength: 1, RepairCost: 20000 }, "vtmsword2": { Strength: 1, RepairCost: 20000 }, "v-ring1": { Strength: 1, RepairCost: 24000 }, "tj_magam1": { Strength: 1, RepairCost: 24000 }, "vrdagger1": { Strength: 1, RepairCost: 24000 }, "tjam1": { Strength: 1, RepairCost: 24000 }, "vbolt1": { Strength: 1, RepairCost: 24000 }, "vbolt2": { Strength: 1, RepairCost: 20000 }, "vtjcloak2": { Strength: 1, RepairCost: 20000 }, "staff_v2": { Strength: 1, RepairCost: 20000 }, "sph3": { Strength: 1, RepairCost: 16000 }, "vmring3": { Strength: 1, RepairCost: 16000 }, "tmarmor2": { Strength: 1, RepairCost: 20000 }, "tj_vboots2": { Strength: 1, RepairCost: 20000 }, "vscroll-2": { Strength: 1, RepairCost: 20000 }, "sph2": { Strength: 1, RepairCost: 20000 }, "vtmaxe2": { Strength: 1, RepairCost: 20000 }, "tj_mtuf2": { Strength: 1, RepairCost: 20000 }, "tj_vboots1": { Strength: 1, RepairCost: 24000 }, "tjarmor1": { Strength: 1, RepairCost: 24000 }, "tj_helmet1": { Strength: 1, RepairCost: 24000 }, "tj-shield1": { Strength: 1, RepairCost: 24000 }, "tj_helmet2": { Strength: 1, RepairCost: 20000 }, "tj-shield2": { Strength: 1, RepairCost: 20000 }, "p_amulet2": { Strength: 1, RepairCost: 16000 }, "p_amulet1": { Strength: 1, RepairCost: 20000 }, "piratehat3": { Strength: 1, RepairCost: 12000 }, "pir_armor1": { Strength: 1, RepairCost: 20000 }, "p_dag2": { Strength: 1, RepairCost: 16000 }, "p_dag1": { Strength: 1, RepairCost: 20000 }, "p_sword3": { Strength: 1, RepairCost: 12000 }, "pn_ring2": { Strength: 1, RepairCost: 16000 }, "pn_ring1": { Strength: 1, RepairCost: 20000 }, "p_compas2": { Strength: 1, RepairCost: 16000 }, "p_compas1": { Strength: 1, RepairCost: 20000 }, "pn_ring3": { Strength: 1, RepairCost: 12000 }, "piring2": { Strength: 1, RepairCost: 16000 }, "piring1": { Strength: 1, RepairCost: 20000 }, "pir_armor3": { Strength: 1, RepairCost: 12000 }, "pir_armor2": { Strength: 1, RepairCost: 16000 }, "p_pistol2": { Strength: 1, RepairCost: 16000 }, "p_pistol1": { Strength: 1, RepairCost: 16000 }, "p_cloak2": { Strength: 1, RepairCost: 16000 }, "p_cloak1": { Strength: 1, RepairCost: 20000 }, "p_amulet3": { Strength: 1, RepairCost: 12000 }, "p_dag3": { Strength: 1, RepairCost: 12000 }, "p_compas3": { Strength: 1, RepairCost: 12000 }, "piring3": { Strength: 1, RepairCost: 12000 }, "p_pistol3": { Strength: 1, RepairCost: 12000 }, "p_cloak3": { Strength: 1, RepairCost: 12000 }, "p_sword2": { Strength: 1, RepairCost: 16000 }, "p_boots2": { Strength: 1, RepairCost: 16000 }, "p_boots1": { Strength: 1, RepairCost: 20000 }, "p_boots3": { Strength: 1, RepairCost: 12000 }, "piratehat2": { Strength: 1, RepairCost: 16000 }, "piratehat1": { Strength: 1, RepairCost: 20000 }, "p_sword1": { Strength: 1, RepairCost: 20000 }, "polk_sword1": { Strength: 1, RepairCost: 16000 }, "polk_armor2": { Strength: 1, RepairCost: 12000 }, "gring": { Strength: 1, RepairCost: 24000 }, "polk_armor3": { Strength: 1, RepairCost: 8000 }, "polkboots3": { Strength: 1, RepairCost: 8000 }, "polk_sword3": { Strength: 1, RepairCost: 8000 }, "polk__helm3": { Strength: 1, RepairCost: 8000 }, "polk_sword2": { Strength: 1, RepairCost: 12000 }, "gringd": { Strength: 1, RepairCost: 24000 }, "polkboots2": { Strength: 1, RepairCost: 12000 }, "polk_armor1": { Strength: 1, RepairCost: 16000 }, "polkboots1": { Strength: 1, RepairCost: 16000 }, "polk__helm1": { Strength: 1, RepairCost: 16000 }, "polk__helm2": { Strength: 1, RepairCost: 12000 }, "m_amul2": { Strength: 1, RepairCost: 16000 }, "ocean_boots1": { Strength: 1, RepairCost: 20000 }, "m_amul1": { Strength: 1, RepairCost: 20000 }, "m_armor1": { Strength: 1, RepairCost: 20000 }, "ocean_dgr1": { Strength: 1, RepairCost: 20000 }, "ocean_bw1": { Strength: 1, RepairCost: 20000 }, "ocean_sword1": { Strength: 1, RepairCost: 20000 }, "ocean_per1": { Strength: 1, RepairCost: 20000 }, "ocean_cl1": { Strength: 1, RepairCost: 20000 }, "ocean_hlm1": { Strength: 1, RepairCost: 20000 }, "ocean_m_shield1": { Strength: 1, RepairCost: 20000 }, "ocean_ring1": { Strength: 1, RepairCost: 20000 }, "ocean_eye1": { Strength: 1, RepairCost: 20000 }, "m_armor2": { Strength: 1, RepairCost: 16000 }, "ocean_dgr2": { Strength: 1, RepairCost: 16000 }, "ocean_ring2": { Strength: 1, RepairCost: 16000 }, "m_armor3": { Strength: 1, RepairCost: 12000 }, "ocean_boots3": { Strength: 1, RepairCost: 12000 }, "ocean_dgr3": { Strength: 1, RepairCost: 12000 }, "ocean_sword3": { Strength: 1, RepairCost: 12000 }, "ocean_hlm3": { Strength: 1, RepairCost: 12000 }, "ocean_m_shield3": { Strength: 1, RepairCost: 12000 }, "ocean_bw2": { Strength: 1, RepairCost: 16000 }, "ocean_sword2": { Strength: 1, RepairCost: 16000 }, "ocean_eye2": { Strength: 1, RepairCost: 16000 }, "ocean_per2": { Strength: 1, RepairCost: 16000 }, "ocean_cl2": { Strength: 1, RepairCost: 16000 }, "ocean_ring3": { Strength: 1, RepairCost: 12000 }, "ocean_eye3": { Strength: 1, RepairCost: 12000 }, "m_amul3": { Strength: 1, RepairCost: 12000 }, "ocean_bw3": { Strength: 1, RepairCost: 12000 }, "ocean_per3": { Strength: 1, RepairCost: 12000 }, "ocean_cl3": { Strength: 1, RepairCost: 12000 }, "ocean_boots2": { Strength: 1, RepairCost: 16000 }, "ocean_hlm2": { Strength: 1, RepairCost: 16000 }, "ocean_m_shield2": { Strength: 1, RepairCost: 16000 }, "adv_neck1": { Strength: 1, RepairCost: 16000 }, "adv_armor1": { Strength: 1, RepairCost: 16000 }, "a_dagger1": { Strength: 1, RepairCost: 16000 }, "adv_fring1": { Strength: 1, RepairCost: 16000 }, "adv_armor2": { Strength: 1, RepairCost: 10000 }, "adv_boot2": { Strength: 1, RepairCost: 10000 }, "adv_hm2": { Strength: 1, RepairCost: 10000 }, "adv_shild2": { Strength: 1, RepairCost: 10000 }, "adv_saber2": { Strength: 1, RepairCost: 10000 }, "adv_longbow1": { Strength: 1, RepairCost: 16000 }, "adv_clk1": { Strength: 1, RepairCost: 16000 }, "adv_sumk2": { Strength: 1, RepairCost: 10000 }, "adv_fring2": { Strength: 1, RepairCost: 10000 }, "adv_neck2": { Strength: 1, RepairCost: 10000 }, "adv_longbow2": { Strength: 1, RepairCost: 10000 }, "a_dagger2": { Strength: 1, RepairCost: 10000 }, "adv_clk2": { Strength: 1, RepairCost: 10000 }, "adv_boot1": { Strength: 1, RepairCost: 16000 }, "adv_sumk1": { Strength: 1, RepairCost: 16000 }, "adv_hm1": { Strength: 1, RepairCost: 16000 }, "adv_shild1": { Strength: 1, RepairCost: 16000 }, "adv_saber1": { Strength: 1, RepairCost: 16000 }, "mir_am2": { Strength: 1, RepairCost: 20000 }, "mir_am1": { Strength: 1, RepairCost: 24000 }, "mh_sword1": { Strength: 1, RepairCost: 24000 }, "mir_armor2": { Strength: 1, RepairCost: 20000 }, "mir_armor3": { Strength: 1, RepairCost: 16000 }, "mir_boots3": { Strength: 1, RepairCost: 16000 }, "mh_sword3": { Strength: 1, RepairCost: 16000 }, "mir_shld3": { Strength: 1, RepairCost: 16000 }, "mh_sword2": { Strength: 1, RepairCost: 20000 }, "mir_am3": { Strength: 1, RepairCost: 16000 }, "mir_boots2": { Strength: 1, RepairCost: 20000 }, "mir_armor1": { Strength: 1, RepairCost: 24000 }, "mir_shld1": { Strength: 1, RepairCost: 24000 }, "mir_boots1": { Strength: 1, RepairCost: 24000 }, "mir_shld2": { Strength: 1, RepairCost: 20000 }, "ed_mbook1": { Strength: 1, RepairCost: 16000 }, "ed_armr1": { Strength: 1, RepairCost: 16000 }, "ed_elfbow1": { Strength: 1, RepairCost: 16000 }, "ed_bsword1": { Strength: 1, RepairCost: 16000 }, "ed_ring1": { Strength: 1, RepairCost: 16000 }, "ed_armr2": { Strength: 1, RepairCost: 14000 }, "ed_mbook2": { Strength: 1, RepairCost: 14000 }, "ed_ring2": { Strength: 1, RepairCost: 14000 }, "ed_armr3": { Strength: 1, RepairCost: 12000 }, "ed_bsword3": { Strength: 1, RepairCost: 12000 }, "ed_elfbow2": { Strength: 1, RepairCost: 14000 }, "ed_bsword2": { Strength: 1, RepairCost: 14000 }, "ed_mbook3": { Strength: 54, RepairCost: 12000 }, "ed_ring3": { Strength: 1, RepairCost: 12000 }, "ed_elfbow3": { Strength: 1, RepairCost: 12000 }, "stalker_crsb2": { Strength: 1, RepairCost: 12800 }, "stalker_crsb1": { Strength: 1, RepairCost: 16000 }, "stalker_hlm1": { Strength: 1, RepairCost: 16000 }, "stalker_dagger1": { Strength: 1, RepairCost: 16000 }, "stalker_hlm2": { Strength: 1, RepairCost: 12800 }, "stalker_dagger2": { Strength: 1, RepairCost: 12800 }, "stalker_crsb3": { Strength: 1, RepairCost: 10000 }, "stalker_hlm3": { Strength: 1, RepairCost: 10000 }, "stalker_dagger3": { Strength: 1, RepairCost: 10000 }, "imp_amul": { Strength: 80, RepairCost: 60000 }, "imp_crossbow": { Strength: 80, RepairCost: 40000 }, "imp_armor": { Strength: 80, RepairCost: 36000 }, "imp_dagger": { Strength: 80, RepairCost: 36000 }, "imp_ring": { Strength: 80, RepairCost: 28000 }, "imp_sword": { Strength: 80, RepairCost: 40000 }, "imp_cloak": { Strength: 80, RepairCost: 36000 }, "imp_boots": { Strength: 80, RepairCost: 36000 }, "imp_helmet": { Strength: 80, RepairCost: 36000 }, "imp_shield": { Strength: 80, RepairCost: 36000 }, "dark_amul": { Strength: 80, RepairCost: 60000 }, "dark_armor": { Strength: 80, RepairCost: 36000 }, "dark_dagger": { Strength: 80, RepairCost: 36000 }, "dark_ring": { Strength: 80, RepairCost: 28000 }, "dark_bow": { Strength: 80, RepairCost: 40000 }, "dark_cloak": { Strength: 80, RepairCost: 36000 }, "dark_boots": { Strength: 80, RepairCost: 36000 }, "dark_axe": { Strength: 80, RepairCost: 40000 }, "dark_helmet": { Strength: 80, RepairCost: 36000 }, "dark_shield": { Strength: 80, RepairCost: 36000 }, "heaven_helm": { Strength: 80, RepairCost: 36000 }, "heaven_clk": { Strength: 80, RepairCost: 36000 }, "heaven_bts": { Strength: 80, RepairCost: 36000 }, "heaven_armr": { Strength: 80, RepairCost: 36000 }, "heaven_staff": { Strength: 80, RepairCost: 40000 }, "potion01": { Strength: 1, RepairCost: 0 }, "potion02": { Strength: 1, RepairCost: 0 }, "potion03": { Strength: 1, RepairCost: 0 }, "potion04": { Strength: 1, RepairCost: 0 }, "potion05": { Strength: 1, RepairCost: 0 }, "potion06": { Strength: 1, RepairCost: 0 }, "potion07": { Strength: 1, RepairCost: 0 }, "potion08": { Strength: 1, RepairCost: 0 } , "16amul": { Strength: 16, RepairCost: 16161 }, "forest_crossbow": { Strength: 1, RepairCost: 10000 }, "icecr1": { Strength: 1, RepairCost: 16000 }, "drak_crown1": { Strength: 1, RepairCost: 20000 }, "ed_pendant1": { Strength: 1, RepairCost: 16000 }, "arm_armor1": { Strength: 1, RepairCost: 16000 }, "arm_cap1": { Strength: 1, RepairCost: 16000 }, "eddem_ring1": { Strength: 1, RepairCost: 16000 }, "stalker_cl1": { Strength: 1, RepairCost: 16000 }, "arm_armor2": { Strength: 1, RepairCost: 12800 }, "arm_cap2": { Strength: 1, RepairCost: 12800 }, "drak_crown2": { Strength: 1, RepairCost: 16000 }, "arm_cap3": { Strength: 1, RepairCost: 10000 }, "mir_helmt3": { Strength: 1, RepairCost: 16000 }, "icecr2": { Strength: 1, RepairCost: 14400 }, "icecr3": { Strength: 1, RepairCost: 12800 }, "eddem_ring2": { Strength: 1, RepairCost: 14000 }, "stalker_cl2": { Strength: 1, RepairCost: 12800 }, "ed_pendant2": { Strength: 1, RepairCost: 14000 }, "sun_staff": { Strength: 85, RepairCost: 17600 }, "drak_crown3": { Strength: 1, RepairCost: 12000 }, "ed_pendant3": { Strength: 1, RepairCost: 12000 }, "arm_armor3": { Strength: 1, RepairCost: 10000 }, "eddem_ring3": { Strength: 1, RepairCost: 12000 }, "stalker_cl3": { Strength: 1, RepairCost: 10000 }, "wind_boots": { Strength: 85, RepairCost: 8700 }, "mir_helmt1": { Strength: 1, RepairCost: 24000 }, "wind_helm": { Strength: 85, RepairCost: 7400 }, "mir_helmt2": { Strength: 1, RepairCost: 20000 } };
 
const Strings = {
            "ru": {
                Lot: ustring("Товар"),
                Cost: ustring("Цена"),
                TimeLeft: ustring("Завершение"),
                BattlePrice: ustring("Цена за бой"),
                Strength: ustring("Прочность"),
                RestStrength: ustring("Оставшаяся прочность"),
                OptimalStrength: ustring("До прочности"),
                Combats: ustring("Боев"),
                Options: ustring("Настройки"),
                BestApproach: ustring("Лучшее приближение к минимальной цене (%)"),
                GoodApproach: ustring("Хорошее приближение к минимальной цене (%)"),
                BuyInfo: ustring("Информация о покупке"),
                ShowAfterRepairBattleCostInInventory: ustring("Показывать в инвентаре стоимость боя после ремонта"),
                SmithLevel: ustring("Уровень кузнеца (0-9)"),
                SmithRewardPercent: "Вознаграждение кузнецу (0%-10%)",
                EditLotInfo: "О покупке"
            },
            "en": {
                Lot: "Lot",
                Cost: "Cost",
                TimeLeft: "Time left",
                BattlePrice: "Battle price",
                Strength: "Strength",
                RestStrength: "Rest strength",
                OptimalStrength: "Optimal strength",
                Combats: "Combats",
                Options: "Options",
                BestApproach: "Best approach to min price (%)",
                GoodApproach: "Good approach to min price (%)",
                BuyInfo: "Buy info",
                ShowAfterRepairBattleCostInInventory: "Show afterRepairBattleCost in inventory",
                SmithLevel: "Smith level (0-9)",
                SmithRewardPercent: "Smith reward (0%-10%)",
                EditLotInfo: "Lot info"
            }
        };
const LocalizedString = Strings[document.documentElement.lang];
const StockArtifactIds = [ "finecl", "super_dagger", "sun_staff", "cold_sword2014", "wind_boots", "wind_helm", "cold_shieldn", "coldring_n", "coldamul", "sun_boots", "sun_armor", "sun_helm", "sun_ring", "clover_amul", "lbow" ];
const SmithRecoveryEfficiency = [10, 20, 30, 40, 50, 60, 70, 80, 90, 90];
function uchar(s) {
    switch (s[0]) {case "А": return "\u0410"; case "Б": return "\u0411"; case "В": return "\u0412"; case "Г": return "\u0413"; case "Д": return "\u0414"; case "Е": return "\u0415"; case "Ж": return "\u0416"; case "З": return "\u0417"; case "И": return "\u0418"; case "Й": return "\u0419"; case "К": return "\u041a"; case "Л": return "\u041b"; case "М": return "\u041c"; case "Н": return "\u041d"; case "О": return "\u041e"; case "П": return "\u041f"; case "Р": return "\u0420"; case "С": return "\u0421"; case "Т": return "\u0422"; case "У": return "\u0423"; case "Ф": return "\u0424"; case "Х": return "\u0425"; case "Ц": return "\u0426"; case "Ч": return "\u0427"; case "Ш": return "\u0428"; case "Щ": return "\u0429"; case "Ъ": return "\u042a"; case "Ы": return "\u042b"; case "Ь": return "\u042c"; case "Э": return "\u042d"; case "Ю": return "\u042e"; case "Я": return "\u042f"; case "а": return "\u0430"; case "б": return "\u0431"; case "в": return "\u0432"; case "г": return "\u0433"; case "д": return "\u0434"; case "е": return "\u0435"; case "ж": return "\u0436"; case "з": return "\u0437"; case "и": return "\u0438"; case "й": return "\u0439"; case "к": return "\u043a"; case "л": return "\u043b"; case "м": return "\u043c"; case "н": return "\u043d"; case "о": return "\u043e"; case "п": return "\u043f"; case "р": return "\u0440"; case "с": return "\u0441"; case "т": return "\u0442"; case "у": return "\u0443"; case "ф": return "\u0444"; case "х": return "\u0445"; case "ц": return "\u0446"; case "ч": return "\u0447"; case "ш": return "\u0448"; case "щ": return "\u0449"; case "ъ": return "\u044a"; case "ы": return "\u044b"; case "ь": return "\u044c"; case "э": return "\u044d"; case "ю": return "\u044e"; case "я": return "\u044f"; case "Ё": return "\u0401"; case "ё": return "\u0451"; default: return s[0];}}
function ustring(s) {
    s = String(s);
    var result = "";
    for (var i = 0; i < s.length; i++)
        result += uchar(s[i]);
    return result;
}
function round00(value) { return Math.round(value * 100) / 100; }
function getAfterRepairRestStrength(strength, smithLevel) {  return Math.floor(strength * SmithRecoveryEfficiency[smithLevel || 9] / 100); }
function optimalRepair(marketPrice, repairCost, strength, restStrength) {
    restStrength = restStrength || strength;
    let totalSpending = marketPrice;
    let currentRestStrength = restStrength;
    let totalCombatsAmount = currentRestStrength;
    let currentStrength = strength;
    
    let currentCombatCost = totalSpending / totalCombatsAmount; // Начальная стоимость боя
    //console.log(`currentStrength: ${currentStrength}, currentRestStrength: ${currentRestStrength}, totalSpending: ${totalSpending}, totalCombatsAmount: ${totalCombatsAmount}, newCombatCost: ${currentCombatCost}`);
    for(currentStrength = strength; currentStrength > 0; currentStrength--) {
        currentRestStrength = getAfterRepairRestStrength(currentStrength, SmithLevel);
        totalSpending += repairCost * (100 + SmithRewardPercent) / 100;
        
        let newCombatCost = totalSpending / (totalCombatsAmount + currentRestStrength);
        //console.log(`currentStrength: ${currentStrength}, currentRestStrength: ${currentRestStrength}, totalSpending: ${totalSpending}, totalCombatsAmount: ${totalCombatsAmount + currentRestStrength}, newCombatCost: ${newCombatCost}`); 
        if(newCombatCost > currentCombatCost) {
            break;
        }
        totalCombatsAmount += currentRestStrength;
        currentCombatCost = newCombatCost;
    }
    return { Strength: currentStrength, CombatCost: round00(currentCombatCost), CombatsAmount: totalCombatsAmount };
}
function addElement(type, parent, data, style) {
    let el = createElement(type, data, style);
    if(parent) {
        parent.appendChild(el);
    }
    return el;
}
function createElement(type, data, style) {
    let el = document.createElement(type);
    if(data) {
        for(let key in data) {
            if(key == "innerText") {
                el.innerText = data[key];
            } else {
                el.setAttribute(key, data[key]);
            }
        }
    }
    if(style && el.id) {
        let styleStr = "";
        if(typeof(style) == "string") {
            styleStr = style;
        } else {
            for (let key in style) {
                styleStr += key + ": " + style[key] + "; ";
            }
        }
        GM_addStyle("#" + el.id + "{" + styleStr + "}");
    }
    return el;
}
function createPupupPanel(panelName) {
    let bg = document.getElementById(panelName + "1");
    let bgc = document.getElementById(panelName + "2");
    bg = addElement("div", document.body, {id: panelName + "1"}, "position: absolute; left: 0pt; width: 100%; background: none repeat scroll 0% 0% gray; opacity: 0.5; top: 0px; height: 100%; display: block; z-index: 200;");
    bg.addEventListener("click", function() { hidePupupPanel(panelName); }, false);
 
    bgc = addElement("div", document.body, {id: panelName + "2"}, "position: absolute; width: 650px; background: none repeat scroll 0% 0% rgb(246, 243, 234); left: " +
    ((document.body.offsetWidth - 650) / 2) + "px; top: 150px; display: block; z-index: 200;");
    let contentDiv = addElement("div", bgc, {id: panelName + "3"}, "border: 1px solid #abc; padding: 5px; margin: 2px;");
    
    let divClose = addElement("div", contentDiv, {id: panelName + "close", title: "Close", innerText: "x"}, "float:right;border:1px solid #abc;width:15px;height:15px;text-align:center;cursor:pointer;");
    divClose.addEventListener("click", function() { hidePupupPanel(panelName); }, false);
    return contentDiv;
}
function showPupupPanel(panelName) {
    let bg = document.getElementById(panelName + "1");
    let bgc = document.getElementById(panelName + "2");
    if(bg) {
        bg.style.display = bgc.style.display = 'block';
        return true;
    }
    return false;
}
function hidePupupPanel(panelName) {
    let bg = document.getElementById(panelName + "1");
    let bgc = document.getElementById(panelName + "2");
    bg.style.display = bgc.style.display = 'none';
}
function showScriptOptions() {
    if(showPupupPanel(ScriptName)) {
        return;
    }
    let contentDiv = createPupupPanel(ScriptName);
    
    // Script specific part
    addElement("b", contentDiv, { innerText: LocalizedString.Options, style: "text-align: center;" });
    addElement("br", contentDiv);

    addElement("label", contentDiv, { for: "combatCostBestDeviationInput", innerText: LocalizedString.BestApproach + "\t", style: "background-color: #becb10;" });
    let combatCostBestDeviationInput = addElement("input", contentDiv, { id: "combatCostBestDeviationInput", type: "number", value: CombatCostBestDeviation });
    combatCostBestDeviationInput.addEventListener("change", function() { GM_setValue("CombatCostBestDeviation", parseInt(this.value)); CombatCostBestDeviation = parseInt(this.value); }, false);
    
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "combatCostGoodDeviationInput", innerText: LocalizedString.GoodApproach + "\t", style: "background-color: #90EE90;" });
    let combatCostGoodDeviationInput = addElement("input", contentDiv, { id: "combatCostGoodDeviationInput", type: "number", value: CombatCostGoodDeviation });
    combatCostGoodDeviationInput.addEventListener("change", function() { GM_setValue("CombatCostGoodDeviation", parseInt(this.value)); CombatCostGoodDeviation = parseInt(this.value); }, false);

    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "showAfterRepairBattleCostInInventoryInput", innerText: LocalizedString.ShowAfterRepairBattleCostInInventory + "\t" });
    let showAfterRepairBattleCostInInventoryInput = addElement("input", contentDiv, { id: "showAfterRepairBattleCostInInventoryInput", type: "checkbox" });
    showAfterRepairBattleCostInInventoryInput.checked = ShowAfterRepairBattleCostInInventory;
    showAfterRepairBattleCostInInventoryInput.addEventListener("change", function() { GM_setValue("ShowAfterRepairBattleCostInInventory", this.checked); ShowAfterRepairBattleCostInInventory = this.checked; }, false);

    addElement("br", contentDiv);

    addElement("label", contentDiv, { for: "OptimalRepairAtMarketSmithLevelInput", innerText: LocalizedString.SmithLevel + "\t" });
    let optimalRepairAtMarketSmithLevelInput = addElement("input", contentDiv, { id: "OptimalRepairAtMarketSmithLevelInput", type: "number", value: SmithLevel });
    optimalRepairAtMarketSmithLevelInput.addEventListener("change", function() { GM_setValue(OptimalRepairAtMarketSmithLevelName, parseInt(this.value)); SmithLevel = parseInt(this.value); }, false);

    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "OptimalRepairAtMarketSmithRewardPercentInput", innerText: LocalizedString.SmithRewardPercent + "\t" });
    let optimalRepairAtMarketSmithRewardPercentInput = addElement("input", contentDiv, { id: "OptimalRepairAtMarketSmithRewardPercentInput", type: "number", value: SmithRewardPercent });
    optimalRepairAtMarketSmithRewardPercentInput.addEventListener("change", function() { GM_setValue(OptimalRepairAtMarketSmithRewardPercentName, parseInt(this.value)); SmithRewardPercent = parseInt(this.value); }, false);

    addElement("br", contentDiv);
}
function sortTable(tableElement, columnIndex, sortType) {
    sortType = sortType || SortType.Text;
  let rows, switching, i, x, y, shouldSwitch;
  switching = true;
  while (switching) { /* Make a loop that will continue until no switching has been done: */
    switching = false; // Start by saying: no switching is done:
    rows = tableElement.rows;
    for (i = 1; i < (rows.length - 1); i++) { /* Loop through all table rows (except the first, which contains table headers): */
      shouldSwitch = false; // Start by saying there should be no switching:
      x = rows[i].cells[columnIndex]; /* Get the two elements you want to compare, one from current row and one from the next: */
      y = rows[i + 1].cells[columnIndex];
      if (sortType == SortType.Text && x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { // Check if the two rows should switch place:
        shouldSwitch = true; // If so, mark as a switch and break the loop:
        break;
      }
      if (sortType == SortType.Number && parseFloat(x.innerHTML) > parseFloat(y.innerHTML)) { // Check if the two rows should switch place:
        shouldSwitch = true; // If so, mark as a switch and break the loop:
        break;
      }
    }
    if (shouldSwitch) {
      rows[i].parentNode.insertBefore(rows[i + 1], rows[i]); /* If a switch has been marked, make the switch and mark that a switch has been done: */
      switching = true;
    }
  }
}
function extendLotsTable() {
    let tableHeaderRow;
    for(const tr of document.querySelectorAll("tr")) {
      if(tr.nextElementSibling && tr.textContent.includes(LocalizedString.Lot) && tr.textContent.includes(LocalizedString.Cost) && tr.textContent.includes(LocalizedString.TimeLeft)) {
          tableHeaderRow = tr;
          break;
      }
    }
    if(tableHeaderRow) {
        let td = addElement("td", tableHeaderRow, { style: "text-align: center;", innerText: LocalizedString.BattlePrice });
        td.addEventListener("click", showScriptOptions, false);
        
        let sortDiv = addElement("div", td, { style: "float: right; border: 1px solid; cursor: pointer;", innerText: "v", title: "Sort" });
        sortDiv.addEventListener("click", function(e) { sortTable(tableHeaderRow.parentNode, 5, SortType.Number); e.stopPropagation(); }, false);
        
        td = addElement("td", tableHeaderRow, { style: "text-align: center;", innerText: LocalizedString.OptimalStrength });
        td.addEventListener("click", showScriptOptions, false);
        
        td = addElement("td", tableHeaderRow, { style: "text-align: center;", innerText: LocalizedString.Combats });
        td.addEventListener("click", showScriptOptions, false);
        
        logNewArtifactsIds(tableHeaderRow.previousElementSibling);
        
        let currentRow = tableHeaderRow;
        let arts = [];
        while(currentRow = currentRow.nextElementSibling) {
            let art = addOptimalRepairDataToLotRow(currentRow);
            if(art) {
                arts.push(art);
            }
        }
        if(arts.length > 0) {
            let firstArt = arts[0];
            let artId = firstArt.Id;
            let minCombatCost = arts.reduce((c, e) => Math.min(c, e.OptimalRepairCombatCost), firstArt.OptimalRepairCombatCost);
            for(const art of arts) {
                if(art.OptimalRepairCombatCost <= minCombatCost * (100 + CombatCostBestDeviation) / 100) {
                    art.RowElement.cells[5].style.backgroundColor = "#becb10";
                } else if(art.OptimalRepairCombatCost <= minCombatCost * (100 + CombatCostGoodDeviation) / 100) {
                    art.RowElement.cells[5].style.backgroundColor = "#90EE90";
                }
            }
            // Запомним последнюю рыночную минимальную цену
            let strength = ArtifactInfo[artId].Strength;
            let fullArs = [];
            for(const art of arts) {
                if(art.Id == artId && (art.LotStrength == strength && art.RestLotStrength == strength || !(artId in StockArtifactIds))) {
                    fullArs.push(art);
                }
            }
            if(fullArs.length > 0) {
                let minOptimalRepairCombatCost = fullArs.reduce((c, e) => Math.min(c, e.OptimalRepairCombatCost), fullArs[0].OptimalRepairCombatCost);
                let minPriceArt;
                for(const art of fullArs) {
                    if(art.OptimalRepairCombatCost == minOptimalRepairCombatCost) {
                        minPriceArt = art;
                        break;
                    }
                }
                GM_setValue(LastBestLotDataName + artId, JSON.stringify(minPriceArt));
            }
        }
    }
}
function addOptimalRepairDataToLotRow(rowElement) {
    if(!rowElement || rowElement.nodeName != "TR") {
        return;
    }
    let goldImageElement = rowElement.querySelector("img[src*='gold.png']");
    if(!goldImageElement) {
        return;
    }
    let lotPrice = parseFloat(goldImageElement.parentNode.nextElementSibling.innerText.replace(/,/g, ""));
    
    let artImageRefElement = rowElement.querySelector("a[href*='art_info.php']");
    let hrefParametersData = artImageRefElement.href.split("?")[1];
    let hrefParameters = hrefParametersData.split("&");
    let artId = hrefParameters[0].split("=")[1];
    let artUid;
    if(hrefParameters.length > 1) {
        artUid = hrefParameters[1].split("=")[1];
    }
    let artRepairCost = ArtifactInfo[artId].RepairCost;
    
    let strengthData = rowElement.innerText.match(/\d+\/\d+/);
    let restStrength = parseInt(strengthData[0].split("/")[0]);
    let strength = parseInt(strengthData[0].split("/")[1]);
    
    let optimalRepairData = optimalRepair(lotPrice, artRepairCost, strength, restStrength);
    let td = addElement("td", rowElement, { style: "text-align: center;" });
    td.innerText = `${optimalRepairData.CombatCost}`;
    td = addElement("td", rowElement, { style: "text-align: center;" });
    td.innerText = `${optimalRepairData.Strength}`;
    td = addElement("td", rowElement, { style: "text-align: center;" });
    td.innerText = `${optimalRepairData.CombatsAmount}`;
    
    let artefact = new ArtefactLot(artUid, artId, strength, restStrength, lotPrice, optimalRepairData.CombatCost, optimalRepairData.Strength, optimalRepairData.CombatsAmount, rowElement);
    if(artefact.Uid) {
        let buyHrefElement = rowElement.querySelector("a[onclick*='show_js_button']");
        buyHrefElement.addEventListener("click", function() { GM_setValue(artefact.Uid, JSON.stringify(artefact)); }, false);
    }
    return artefact;
}
function ArtefactLot(uid, id, strength, restStrength, lotPrice, optimalRepairCombatCost, optimalRepairStrength, optimalRepairCombatsAmount, rowElement) {
  this.Uid = uid;
  this.Id = id;
  this.LotStrength = strength;
  this.RestLotStrength = restStrength;
  this.LotPrice = lotPrice;
  this.OptimalRepairCombatCost = optimalRepairCombatCost;
  this.OptimalRepairStrength = optimalRepairStrength;
  this.OptimalRepairCombatsAmount = optimalRepairCombatsAmount;
  this.RowElement = rowElement;
  this.GetLotInfo = function() {
    return `${LocalizedString.BuyInfo}: ${LocalizedString.Cost}: ${this.LotPrice}, ${LocalizedString.Strength}: ${this.RestLotStrength}/${this.LotStrength}, ${LocalizedString.BattlePrice}: ${this.OptimalRepairCombatCost}, ${LocalizedString.Strength}: ${this.OptimalRepairStrength}, ${LocalizedString.Combats}: ${this.OptimalRepairCombatsAmount}`;
  }
}
function logNewArtifactsIds(containsRow) {
    if(!containsRow) {
        return;
    }
    let newArtIds = [];
    let options = containsRow.getElementsByTagName("option");
    //alert(options.length) = 979
    for(const constoptionElement of options) {
        let valueParts = constoptionElement.value.split("#");
        if(valueParts.length >= 2) {
            let artId = valueParts[1];
            if(!(artId in ArtifactInfo)) {
                newArtIds.push(artId);
            }
        }
    }
    if(newArtIds.length > 0) {
        var el = document.createElement("TEXTAREA");
        document.body.appendChild(el);
        el.innerText = newArtIds.reduce((t, e) => t + `, "${e}": `, "");
    }
}
function AppendLotInfo(parentElement, artUid) {
    let artefact = getArtefactLot(artUid);
    if(parentElement && artefact.Id) {
        addElement("b", parentElement, { innerText: artefact.GetLotInfo() });
    }
}
function getArtefactLot(artUid, artId) {
    let artefact;
    let artefactData = GM_getValue(artUid);
    if(artefactData && artefactData != "") {
        artefact = Object.assign(new ArtefactLot, JSON.parse(artefactData));
    }
    if(!artefact) {
        artefact = new ArtefactLot(artUid, artId);
    }
    return artefact;
}
function AddAfterRepairCombatCostToInventory() {
    let artInfoDivs = document.querySelectorAll("div.inventory_item_div.inventory_item2");
    for(const artInfoDiv of artInfoDivs) {
        let artIndex = parseInt(artInfoDiv.getAttribute("art_idx"));
        let artInfo = windowObject.arts[artIndex];
        if(artInfo.art_id in ArtifactInfo) {
            let repairCost = ArtifactInfo[artInfo.art_id].RepairCost;
            let afterRepairCombatCost = round00(repairCost * ((100 + SmithRewardPercent) / 100) / getAfterRepairRestStrength(artInfo.durability2, SmithLevel));
            if(!isNaN(afterRepairCombatCost)) {
                let overlapInfoDiv = artInfoDiv.querySelector("div.art_durability_hidden");
                overlapInfoDiv.innerText = `${overlapInfoDiv.innerText}\n${afterRepairCombatCost}`;
            }
        }
    }
    // Выведем цену за бой
    let dressedArtsBattleCost = 0;
    for(let i = 0; i < windowObject.slots.length; i++) {
        let slot = windowObject.slots[i];
        if(slot) {
            let artUid = parseInt(slot);
            let artInfo;
            for(const art of windowObject.arts) {
                if(art.id == artUid) {
                    artInfo = art;
                    break;
                }
            }
            if(artInfo) {
                let artBattleCost = getArtBattleCost(artInfo.art_id, artUid);
                dressedArtsBattleCost += artBattleCost;
                if(artBattleCost > 0) {
                    let slotDiv = document.getElementById("slot" + i);
                    let durabilityDiv = slotDiv.querySelector("div.art_durability_hidden");
                    durabilityDiv.innerText += `\n${artBattleCost}`;
                }
            }
        }
    }
    let inventoryStatsDiv = document.querySelector("div.inventory_stats");
    inventoryStatsDiv.innerHTML += `
    <div class="inv_stat_data show_hint" title="${LocalizedString.BattlePrice}">
        <div class="inv_stat_img_div">
            <div class="set_wh100"></div>
            <img src="https://dcdn1.heroeswm.ru/i/r/32/gold.png?v=3.23de65" class="mwh100">
        </div>
        <div class="inv_stat_text">${dressedArtsBattleCost}</div>
    </div>`;
    
}
function getArtBattleCost(artId, artUid) {
    let artifactLot = getSavedArtifactLot(artId, artUid);
    if(artifactLot) {
        return artifactLot.OptimalRepairCombatCost;
    }
    let art = ArtifactInfo[artId];
    let savedFactoryPrice = parseInt(GM_getValue(ShopArtFactoryPriceName + artId, 0)); // Фабричная цена
    if(savedFactoryPrice > 0) {
        return round00(savedFactoryPrice / art.Strength);
    }
    return 0;
}
function getSavedArtifactLot(artId, artUid) {
    // Рыночная цена. Сначала пытаемся найти данные о лоте, если нет, то последние минимальные по данному арту
    let lastBestLotData = GM_getValue(artUid);
    if(!lastBestLotData || lastBestLotData == "") {
        lastBestLotData = GM_getValue(LastBestLotDataName + artId, "");
    }
    if(lastBestLotData && lastBestLotData != "") {
        return Object.assign(new ArtefactLot, JSON.parse(lastBestLotData));
    }
}
function addShopArtPriceAndBattleCost() {
    let artInfoDivs = document.querySelectorAll("div.s_art");
    for(const artInfoDiv of artInfoDivs) {
        let artPropDiv = artInfoDiv.querySelector("div.s_art_prop");
        let price = 0;
        let isPriceFromLot = false;
        let strength;
        let battlePrice = 0;
        let artId = getArtIdFromArtInfoRef(artInfoDiv).Id;

        let goldImage = artInfoDiv.querySelector("img[src*='gold']");
        if(goldImage) {
            price += parseInt(goldImage.nextSibling.textContent.replace(/,/g, ""));
        }
        let woodImage = artInfoDiv.querySelector("img[src*='wood']");
        if(woodImage && woodImage.nextSibling) {
            price += parseInt(woodImage.nextSibling.textContent) * 180;
        }
        let oreImage = artInfoDiv.querySelector("img[src*='ore']");
        if(oreImage) {
            price += parseInt(oreImage.nextSibling.textContent) * 180;
        }
        let mercuryImage = artInfoDiv.querySelector("img[src*='mercury']");
        if(mercuryImage) {
            price += parseInt(mercuryImage.nextSibling.textContent) * 360;
        }
        let sulfurImage = artInfoDiv.querySelector("img[src*='sulfur']");
        if(sulfurImage) {
            price += parseInt(sulfurImage.nextSibling.textContent) * 360;
        }
        let crystalsImage = artInfoDiv.querySelector("img[src*='crystals']");
        if(crystalsImage) {
            price += parseInt(crystalsImage.nextSibling.textContent) * 360;
        }
        let gemsImage = artInfoDiv.querySelector("img[src*='gems']");
        if(gemsImage) {
            price += parseInt(gemsImage.nextSibling.textContent) * 360;
        }

        let artPropDivs = artInfoDiv.querySelectorAll("div.s_art_prop_amount");
        let artStrengthDiv;
        for(artStrengthDiv of artPropDivs) {
            if(artStrengthDiv.previousSibling.textContent == "Прочность: ") {
                strength = parseInt(artStrengthDiv.innerText);
                battlePrice = round00(price / strength);
                break;
            }
        }
        if(price == 0) {
            let lastBestLotData = GM_getValue(LastBestLotDataName + artId, "");
            if(lastBestLotData && lastBestLotData != "") {
                let artefact = Object.assign(new ArtefactLot, JSON.parse(lastBestLotData));
                price = artefact.LotPrice;
                battlePrice = artefact.OptimalRepairCombatCost;
                isPriceFromLot = true;
            }
        }
        if(price > 0) {
            if(isPriceFromLot) {
                GM_deleteValue(ShopArtFactoryPriceName + artId); // Записался мусор
            }
            let factoryPriceText = "";
            let savedPrice = parseInt(GM_getValue(ShopArtFactoryPriceName + artId, 0));
            if(savedPrice > 0 &&  savedPrice != price) {
                factoryPriceText = ` / ${savedPrice}(${round00(savedPrice / strength)})`;
            } else if(!isPriceFromLot) {
                GM_setValue(ShopArtFactoryPriceName + artId, price); // Сохраним магазинную цену. Она пригодится, если не заходили в статистику и для магазинных артов, которых нет на карте
            }
            addElement("label", artPropDiv, { innerText: ` = ${price}(${battlePrice})${factoryPriceText}` });
        }
    }    
}
function getArtIdFromArtInfoRef(artInfoRefContainer) {
    let artId;
    let artUid;
    if(artInfoRefContainer) {
        let artInfoRef = artInfoRefContainer.querySelector("a[href*='art_info.php']");
        if(artInfoRef) {
            let parameters = artInfoRef.href.split("?")[1].split("&");
            artId = parameters[0].split("=")[1];
            if(parameters.length > 1) {
                artUid = parameters[1].split("=")[1];
            }
        }
    }
    return { Id: artId, Uid: artUid };
}
function getFactoryPrice() {
    let buyResForm = document.querySelector("form[name='buy_res']");
    let artId = getArtIdFromArtInfoRef(buyResForm).Id;
    let tableElement = buyResForm.querySelector("table");
    let amountCell = tableElement.rows[1].cells[2];
    let priceCell = tableElement.rows[1].cells[3];
    let amount = parseInt(amountCell.innerText.split("/")[0].replace(/,/g, ""));
    let price = parseInt(priceCell.innerText.replace(/,/g, ""));
    if(amount > 0) { // артефакт есть в наличии
        saveBestArtPrice(artId, price);
    }
}
function saveBestArtPrice(artId, newPrice, force) {
    let savedPrice = parseInt(GM_getValue(ShopArtFactoryPriceName + artId, 0));
    if(newPrice < savedPrice || savedPrice == 0 || force) {
        GM_setValue(ShopArtFactoryPriceName + artId, newPrice);
    }    
}
function openArtPriceSettings(artUid, artId) {
    if(showPupupPanel(ArtPriceSettingsName)) {
        return;
    }
    let contentDiv = createPupupPanel(ArtPriceSettingsName);
    let artefact = getArtefactLot(artUid, artId);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsLotPrice", innerText: LocalizedString.Cost + "\t" });
    let openArtPriceSettingsLotPrice = addElement("input", contentDiv, { id: "openArtPriceSettingsLotPrice", type: "number", value: artefact.LotPrice });
    openArtPriceSettingsLotPrice.addEventListener("change", function() { artefact.LotPrice = parseInt(this.value); calcArtefactLotAndSave(artefact); openArtPriceSettingsRefresh(artefact); }, false);
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsLotStrength", innerText: LocalizedString.Strength + "\t" });
    let openArtPriceSettingsLotStrength = addElement("input", contentDiv, { id: "openArtPriceSettingsLotStrength", type: "number", value: artefact.LotStrength });
    openArtPriceSettingsLotStrength.addEventListener("change", function() { artefact.LotStrength = parseInt(this.value); calcArtefactLotAndSave(artefact); openArtPriceSettingsRefresh(artefact); }, false);
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsRestLotStrength", innerText: LocalizedString.RestStrength + "\t" });
    let openArtPriceSettingsRestLotStrength = addElement("input", contentDiv, { id: "openArtPriceSettingsRestLotStrength", type: "number", value: artefact.RestLotStrength });
    openArtPriceSettingsRestLotStrength.addEventListener("change", function() { artefact.RestLotStrength = parseInt(this.value); calcArtefactLotAndSave(artefact); openArtPriceSettingsRefresh(artefact); }, false);
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsOptimalRepairCombatCost", innerText: LocalizedString.BattlePrice + "\t" });
    let openArtPriceSettingsOptimalRepairCombatCost = addElement("input", contentDiv, { id: "openArtPriceSettingsOptimalRepairCombatCost", type: "number", value: artefact.OptimalRepairCombatCost, disabled: "disabled" });
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsOptimalRepairStrength", innerText: LocalizedString.OptimalStrength + "\t" });
    let openArtPriceSettingsOptimalRepairStrength = addElement("input", contentDiv, { id: "openArtPriceSettingsOptimalRepairStrength", type: "number", value: artefact.OptimalRepairStrength, disabled: "disabled" });
    addElement("br", contentDiv);
    
    addElement("label", contentDiv, { for: "openArtPriceSettingsOptimalRepairCombatsAmount", innerText: LocalizedString.Combats + "\t" });
    let openArtPriceSettingsOptimalRepairCombatsAmount = addElement("input", contentDiv, { id: "openArtPriceSettingsOptimalRepairCombatsAmount", type: "number", value: artefact.OptimalRepairCombatsAmount, disabled: "disabled" });
    addElement("br", contentDiv);
}
function openArtPriceSettingsRefresh(artefact) {
    document.getElementById("openArtPriceSettingsOptimalRepairCombatCost").value = artefact.OptimalRepairCombatCost;
    document.getElementById("openArtPriceSettingsOptimalRepairStrength").value = artefact.OptimalRepairStrength;
    document.getElementById("openArtPriceSettingsOptimalRepairCombatsAmount").value = artefact.OptimalRepairCombatsAmount;
}
function calcArtefactLotAndSave(artefact) {
    if(artefact.LotPrice > 0 && artefact.LotStrength > 0 && artefact.RestLotStrength > 0) {
        let artRepairCost = ArtifactInfo[artefact.Id].RepairCost;
        let optimalRepairData = optimalRepair(artefact.LotPrice, artRepairCost, artefact.LotStrength, artefact.RestLotStrength);
        artefact.OptimalRepairCombatCost = optimalRepairData.CombatCost;
        artefact.OptimalRepairStrength = optimalRepairData.Strength;
        artefact.OptimalRepairCombatsAmount = optimalRepairData.CombatsAmount;
        GM_setValue(artefact.Uid, JSON.stringify(artefact));
    }
}
function main() {
    if(location.pathname=='/auction.php') {
        extendLotsTable();
    }
    if(location.pathname=='/art_info.php') {
        let hrefParametersData = location.href.split("?")[1];
        let hrefParameters = hrefParametersData.split("&");
        let artId = hrefParameters[0].split("=")[1];
        let artUid;
        if(hrefParameters.length > 1) {
            artUid = hrefParameters[1].split("=")[1];
            let s_art_insideDiv = document.querySelector("div.s_art_inside");
            AppendLotInfo(s_art_insideDiv, artUid);
            
            let home_art_infoDiv = document.querySelector("div.home_art_info");
            let buttonsDiv = home_art_infoDiv.nextElementSibling;
            if(buttonsDiv) {
                let priceButton = addElement("input", buttonsDiv, { type: "button", value: LocalizedString.EditLotInfo, class: "s_art_btn_small s_art_btn_margin" });
                priceButton.addEventListener("click", function() { openArtPriceSettings(artUid, artId); }, false);
            }
        }
    }
    if(location.pathname=='/mod_workbench.php') {
        let formElement = document.querySelector("form[name='fmain']");
        if(formElement) {
            let idInput = formElement.querySelector("input[name='art_id2']");
            if(idInput && idInput.value != "") {
                AppendLotInfo(formElement, idInput.value);
            }
        }
    }
    if(location.pathname=='/inventory.php' && ShowAfterRepairBattleCostInInventory) {
        AddAfterRepairCombatCostToInventory();
    }
    if(location.pathname=='/shop.php') {
        addShopArtPriceAndBattleCost();
    }
    if(location.pathname=='/object-info.php') {
        getFactoryPrice();
    }
    if(location.pathname=='/ecostat_details.php') {
        let tableDiv = document.getElementById("tableDiv");
        let ecostatTable = tableDiv.querySelector("table");
        let hrefParametersData = location.href.split("?")[1];
        let artId = hrefParametersData.split("=")[1];
        let minPrice = 0;
        for(const row of ecostatTable.rows) {
            let amount = parseInt(row.cells[2].innerText);
            if(amount > 0) {
                let price = parseInt(row.cells[3].innerText.replace(/,/g, ""));
                if(price < minPrice || minPrice == 0) {
                    minPrice = price;
                }
            }
        }
        if(minPrice > 0) {
            saveBestArtPrice(artId, minPrice, true);
        }
    }
    if(location.pathname=='/home.php' || location.pathname=='/pl_info.php') {
        let artDivs = document.querySelectorAll("div.arts_info.shop_art_info");
        let battleCost = 0;
        for(const artDiv of artDivs) {
            let artId = getArtIdFromArtInfoRef(artDiv).Id;
            let artUid = getArtIdFromArtInfoRef(artDiv).Uid;
            let artBattleCost = getArtBattleCost(artId, artUid);
            if(artBattleCost > 0) {
                let artDurabilityDiv = artDiv.querySelector("div.art_durability_hidden");
                artDurabilityDiv.innerText += `\n${artBattleCost}`;
            }
            battleCost += artBattleCost;
        }
        let addbonusesImage = document.querySelector("img[src*='attr_addbonuses']");
        if(addbonusesImage && battleCost > 0) {
            if(location.pathname=='/home.php') {
                let tr = addbonusesImage.parentNode.parentNode.parentNode;
                tr.innerHTML += `<td><img src="https://dcdn1.heroeswm.ru/i/r/32/gold.png?v=3.23de65" alt="" title="${LocalizedString.BattlePrice}" width="24" height="24" border="0"></td>`;
                tr.innerHTML += `<td align="center">${LocalizedString.BattlePrice}: </td>`;
                tr.innerHTML += `<td align="center"><b>${battleCost}</b></td>`;
            }
            if(location.pathname=='/pl_info.php') {
                let tableElement = addbonusesImage.parentNode.parentNode.parentNode.parentNode;
                tableElement.innerHTML += `<tr><td><img src="https://dcdn1.heroeswm.ru/i/r/32/gold.png?v=3.23de65" alt="" title="${LocalizedString.BattlePrice}" width="24" height="24" border="0"></td><td align="center"><b>${battleCost}</b></td></tr>`;
            }
        }
    }
}

// Start
if(!this.GM_getValue) {
    this.GM_getValue = function(key, def) {
        return localStorage[key] || def;
    };
    this.GM_setValue = function(key, value) {
        localStorage[key] = value;
    };
    this.GM_deleteValue = function(key) {
        return delete localStorage[key];
    };
}
if(!this.GM_addStyle) {
    this.GM_addStyle = function(key) {
        let style = document.createElement('style');
        style.textContent = key;
        document.querySelector("head").appendChild(style);
    }
}
if(!this.GM_listValues) {
    this.GM_listValues = function() {
        let values = [];
        for (let i = 0; i < localStorage.length; i++) {
            values.push(localStorage.key(i));
        }
        return values;
    }
}

// let artefactsData = artefacts.reduce((t, a) => t + `, "${a.id}": { Strength: ${a.usual_dur}, RepairCost: ${a.repair_cost} }`, "");
// var el = document.createElement("TEXTAREA");
// document.body.appendChild(el);
// el.innerText = artefactsData;

main();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址