Author Topic: STB v2.0.8  (Read 31489 times)

0 Members and 1 Guest are viewing this topic.

Offline CrazyCracka420

  • Minute Valuable Contributor
  • Strategus Councillor
  • **
  • Renown: 1950
  • Infamy: 794
  • cRPG Player Sir White Pawn A Gentleman and a Scholar
  • Welp
    • View Profile
  • Faction: Vaegirs
  • Game nicks: Huseby
  • IRC nick: Steam name: crazycracka420
Re: STB v2.0.8
« Reply #285 on: February 16, 2016, 09:21:41 pm »
0
Good point, I just assumed it was a known issue and there was some hurdle that you guys didn't have the power to overcome (i.e. if items don't show up on the crpg shop, you can't properly categorize them), but it actually just may be that some newer items aren't properly categorized in your sorter.

I don't have the time at the moment, but I'll see if I can get a more detailed/accurate list of what seems to be broken (as far as I know, just the sorting problem on "info" tab when in a fief, not all items are sorted properly, some are just left off the list), and also a more detailed list of some of the "basics" I'd like to see :)

visitors can't see pics , please register or login
 - Stolen from Macropussy

Offline Aye_Chingao

  • Knight
  • ***
  • Renown: 28
  • Infamy: 2
  • cRPG Player
    • View Profile
  • Faction: BIRD CLAN
  • Game nicks: _Jake
Re: STB v2.0.8
« Reply #286 on: February 23, 2016, 03:25:03 am »
+10
I updated the old "Strategus Sorted Inventory" with current item lists.  This does item sorting on inventory and faction pages, item counts in the inventory, and filtering the weapon store.  It works in chrome but I haven't had much luck with greasemonkey in firefox lately. 

Feel free to copy the item arrays if they'll work with your script, and let me know if anything doesn't sort correctly (until the next patch anyway)

Code: [Select]
// ==UserScript==
// @name        Strategus Sorted Inventory
// @namespace   http://strategus.c-rpg.net/DoD_Wolper
// @description Sorts the inventory on the cRPG Strategus website, appends the cRPG-Layout to the website and improves some other stuff
// @include     http://strategus.c-rpg.net/*
// @downloadURL http://userscripts.org/scripts/source/152233.user.js
// @updateURL   http://userscripts.org/scripts/source/152233.meta.js
// @version     4.1 - Modified by Jake, Updated Items as of 2-22-2016
// ==/UserScript==

const cPageMap = "MAP";
const cPageInventory = "inv";
const cPageFaction = "faction";
const cPageShop = "buy";
const cPageShopAll = "buy=all";
const cPageTowncenter = "towncenter";

var itemOrigin = new Object();
itemOrigin["good"] = new Array("Chalk", "Slate", "Fine Tapestry", "Ornate Carpets", "Salted Clams", "Wrought Iron Bars", "Camel Milk", "Wild Horse Steak", "Oak Timber", "Bananas", "Hemp", "Birch Bark", "Sandstone", "Onions", "Diamonds", "Dyes", "Tanned Leather", "Spruce Lumber", "Giant Crabs", "Whale Oil", "Dried Horse Meat", "Radishes", "Ceramic Bowls", "Silk Hats", "Brass Bars", "Iron Tools", "Gold Bars", "Baked Bricks", "Fine Woodcuts", "Embroidered Hats", "Pearls", "Concrete", "Rubies", "Dates", "Root Carvings", "Steppe Tea", "Goat Cheese", "Preserved Goat Bladders", "Silver Chalices", "Silver Jewelry", "Dried Goat Meat", "Colored Sands", "Gold Ore", "Silk Cloth", "Beautiful Paintings", "Fresh Shrimp", "Ceder Timber", "Ash Sapling", "Mining Tools", "Linen", "Fine-bred Mountain Goats", "Yew Seedlings", "Zinc Ore", "Smoked Salmon", "Northern Perch", "Raw Ammolite", "Preserved Crayfish", "Oak Furniture", "Delicious Apples", "Jet Jewelry", "Raw Obsidian", "Musical Instruments", "Bear Hides", "Fox Furs", "Olive Oil", "Elegant Curtains", "Dried Herring", "Amber Jewelry", "Dried Beef", "Wooden Reliefs", "Cow Hides", "Sun Dried Bricks", "Eels", "Fine Eel Skin Hoses", "Glass Chalices", "Well-bred Cows", "Emeralds", "Olives", "Fine Cutlery", "Striped Bass", "Sugarcane", "Trained Donkeys", "Albino Donkeys", "Velvet", "Well-Bred Sheep", "Marble", "Clay", "Peppered Pickles", "Ceramic Sculptures", "Salted Cod", "Eelskin", "Carrots", "Copper Ore", "Red Potatoes", "Reindeer Antlers", "Onyx", "Hemp Rope", "Coconuts", "Malachite", "Tiger Fur", "Iron Bars", "Brass Sheets", "Elm Timber", "Smoked Codfish", "Granite", "Quartz", "Pumpkins", "Jasper Gems", "Dried Potatoes", "Horse Saddles", "Dried Eel", "Dried Corn", "Boar Tusks", "Bejeweled Cutlery", "White Seedy Bread", "Salted Mackerel", "Strong Barrels", "Large Eggs", "Apple Pies", "Amber Gems", "Dried Leather", "Healthy Pigs", "Iron Ore", "Fine Lamb Wool", "Exotic Flowers", "Ale", "Fox Furs", "Marble Sculptures", "Heavy Waybread", "Carved Oak Planks", "Spices", "Goat Milk", "Pure White Candles", "Camel Hooves", "Bear Meat", "Chicken Feathers", "Frog Legs", "Dried Reindeer Meat", "Silver Bars", "Gold Jewelry", "Pig Iron Ingots", "Linen", "Rock Salt", "Cured Leather", "Fine-coated Mules", "Raw Hides", "Pork Ribs", "Sapphires", "Mushrooms", "Mysterious Meat", "Wooden Sculptures", "Iron Jewelry", "Wolf Pelts", "Wheat", "Raw Wool", "Albino Chicken", "Silver Ore", "Stone Reliefs", "Strong Nord Ale", "Spiced Strongwine", "Pigeons", "Bear Skins", "Limestone", "Bee Wax", "Fine Wool", "Dried Bear Meat", "Tents", "Dried Camel Meat", "Hops", "Nickel Bars", "Barley", "Lutefisk", "Boar Ribs", "Crabs", "Snake Meat", "Yeast", "Wheat Flour", "Dog Meat", "Honey", "Kitten", "Exotic Chalk", "Exotic Ornate Carpets", "Exotic Wrought Iron Bars", "Exotic Camel Milk", "Exotic Wild Horse Steak", "Exotic Bananas", "Exotic Hemp", "Exotic Birch Bark", "Exotic Diamonds", "Exotic Tanned Leather", "Exotic Dried Horse Meat", "Exotic Silk Hats", "Exotic Brass Bars", "Exotic Concrete", "Exotic Rubies", "Exotic Root Carvings", "Exotic Steppe Tea", "Exotic Preserved Goat Bladders", "Exotic Silver Jewelry", "Exotic Colored Sands", "Exotic Beautiful Paintings", "Exotic Silk Cloth", "Exotic Ceder Timber", "Exotic Ash Sapling", "Exotic Mining Tools", "Exotic Jet Jewelry", "Exotic Musical Instruments", "Exotic Olive Oil", "Exotic Wooden Reliefs", "Exotic Eels", "Exotic Emeralds", "Exotic Trained Donkeys", "Exotic Well-Bred Sheep", "Exotic Marble", "Exotic Clay", "Exotic Ceramic Sculptures", "Exotic Eelskin", "Exotic Carrots", "Exotic Onyx", "Exotic Hemp Rope", "Exotic Malachite", "Exotic Tiger Fur", "Exotic Elm Timber", "Exotic Quartz", "Exotic Jasper Gems", "Exotic Dried Corn", "Exotic White Seedy Bread", "Exotic Fine Lamb Wool", "Exotic Ale", "Exotic Heavy Waybread", "Exotic Carved Oak Planks", "Exotic Camel Hooves", "Exotic Bear Meat", "Exotic Chicken Feathers", "Exotic Dried Reindeer Meat", "Exotic Silver Bars", "Exotic Pig Iron Ingots", "Exotic Rock Salt", "Exotic Cured Leather", "Exotic Wooden Sculptures", "Exotic Mysterious Meat", "Exotic Raw Wool", "Exotic Albino Chicken", "Exotic Silver Ore", "Exotic Spiced Strongwine", "Exotic Bear Skins", "Exotic Limestone", "Exotic Bee Wax", "Exotic Dried Camel Meat", "Exotic Boar Ribs", "Exotic Snake Meat", "Exotic Wheat Flour", "Exotic Dog Meat", "Exotic Honey", "Exotic Kitten", "Exotic Slate", "Exotic Oak Timber", "Exotic Baked Bricks", "Exotic Radishes", "Exotic Embroidered Hats", "Exotic Dates", "Exotic Gold Ore", "Exotic Smoked Salmon", "Exotic Delicious Apples", "Exotic Dried Beef", "Exotic Fine Eel Skin Hoses", "Exotic Albino Donkeys", "Exotic Red Potatoes", "Exotic Coconuts", "Exotic Dried Potatoes", "Exotic Horse Saddles", "Exotic Dried Eel", "Exotic Bejeweled Cutlery", "Exotic Exotic Flowers", "Exotic Fox Furs", "Exotic Marble Sculptures", "Exotic Spices", "Exotic Pure White Candles", "Exotic Frog Legs", "Exotic Linen", "Exotic Fine-coated Mules", "Exotic Wolf Pelts", "Exotic Wheat", "Exotic Stone Reliefs", "Exotic Pigeons", "Exotic Dried Bear Meat", "Exotic Tents", "Exotic Hops", "Exotic Barley");
itemOrigin["place"] = new Array("Ada Kulun", "Aab", "Alburq Castle", "Ahmerrad", "Aldelen", "Almerra Castle", "Amashke", "Ambean", "Amere", "Asugan Castle", "Ayn Assuadi", "Ayyike", "Azgad", "Balanli", "Bardaq Castle", "Bariyye", "Bhulaban", "Bazeck", "Buillin", "Bulugha Castle", "Bulugur", "Burglen", "Buvran", "Caraf Castle", "Chaeza", "Chalbek Castle", "Chelez", "Chide", "Culmarr Castle", "Curaw", "Curin Castle", "Dashbigha", "Derchios Castle", "Dhibbain", "Dhirim", "Dirigh Aban", "Dirigsene", "Distar Castle", "Dramug Castle", "Dugan", "Dumar", "Durquba", "Durrin Castle", "Dusturil", "Ehlerdah", "Elberl", "Emer", "Emirin", "Ergellon Castle", "Epeshe", "Etrosq Castle", "Fearichen", "Fedner", "Fenada", "Fisdnar", "Fishara", "Gisim", "Glunmar", "Grunwalder Castle", "Habba", "Haen", "Halmar", "Hanun", "Haringoth Castle", "Hawaha", "Hrus Castle", "Ibdeles", "Ibdeles Castle", "Ibiran", "Ichamur", "Ilvia", "Iqbayl", "Ismirala", "Ismirala Castle", "Istiniar", "Iyindah", "Jameyyed Castle", "Jamiche", "Jamiche Castle", "Jayek", "Jeirbe Castle", "Jelbegi", "Jelbegi Castle", "Jelkala", "Karindi", "Kedelke", "Kelredan Castle", "Khudan", "Knudarr Castle", "Kulum", "Kwynn", "Malayurg Castle", "Maras Castle", "Mawiti", "Mazen", "Mazigh", "Mechin", "Mijayet", "Mit Nun", "Narra", "Nelag Castle", "Nemeja", "Nomar", "Odasan", "Pagundur", "Peshmi", "Praven", "Qalyut", "Radoghir Castle", "Rduna", "Rebache", "Reindi Castle", "Reveran", "Reyvadin", "Rindyar Castle", "Rivacheg", "Rizi", "Ruldi", "Ruluns", "Rushdigh", "Ruvar", "Ryibelet", "Ryibelet Castle", "Samarra Castle", "Saren", "Sargoth", "Sarimish", "Sekhtem", "Senuzgda Castle", "Serindiar", "Shariz", "Shapeshte", "Sharwa Castle", "Shibal Zumr", "Shulus", "Slezkh", "Slezkh Castle", "Sumbuja", "Sungetche Castle", "Suno", "Tadsamesh", "Tahlberl", "Tamnuh", "Tash Kulun", "Tazjunat", "Tebandra", "Tehlrog Castle", "Teramma Castle", "Tevarin Castle", "Tilimsal", "Tilbaut Castle", "Tihr", "Tismirr", "Tosdhar", "Tshibtin", "Tulbuk", "Tulbuk Castle", "Tulga", "Udiniad", "Uhhun", "Uhhun Castle", "Ulburban", "Unriya", "Unuzdaq Castle", "Ushkuru", "Uslum", "Uxkhal", "Uzgha", "Vayejeg", "Veidar", "Veluca", "Vezin", "Vyincourd Castle", "Wercheg", "Weyyah Castle", "Yalen", "Yalibe", "Yaragar", "Yruma Castle", "Zagush", "New Ada Kulun", "New Ahmerrad", "New Almerra Castle", "New Amashke", "New Ambean", "New Asugan Castle", "New Ayn Assuadi", "New Ayyike", "New Bardaq Castle", "New Bhulaban", "New Bulugur", "New Caraf Castle", "New Chaeza", "New Dashbigha", "New Derchios Castle", "New Dhirim", "New Dirigh Aban", "New Distar Castle", "New Dugan", "New Durquba", "New Ehlerdah", "New Dusturil", "New Emer", "New Emirin", "New Ergellon Castle", "New Habba", "New Halmar", "New Hawaha", "New Ichamur", "New Ismirala", "New Jameyyed Castle", "New Jelbegi", "New Karindi", "New Kedelke", "New Kelredan Castle", "New Knudarr Castle", "New Kwynn", "New Malayurg Castle", "New Mazigh", "New Mechin", "New Mit Nun", "New Narra", "New Nomar", "New Peshmi", "New Qalyut", "New Reindi Castle", "New Rindyar Castle", "New Samarra Castle", "New Sargoth", "New Senuzgda Castle", "New Serindiar", "New Shibal Zumr", "New Shulus", "New Slezkh", "New Sumbuja", "New Sungetche Castle", "New Tadsamesh", "New Tamnuh", "New Tash Kulun", "New Tilbaut Castle", "New Tilimsal", "New Tshibtin", "New Tulbuk", "New Tulbuk Castle", "New Uhhun", "New Ulburban", "New Unriya", "New Unuzdaq Castle", "New Uzgha", "New Vyincourd Castle", "New Weyyah Castle", "New Yalibe", "New Yaragar", "New Yruma Castle", "New Zagush", "Nova Aab", "Nova Amere", "Nova Chide", "Nova Burglen", "Nova Curaw", "Nova Dhibbain", "Nova Durrin Castle", "Nova Fenada", "Nova Grunwalder Castle", "Nova Ibiran", "Nova Ismirala Castle", "Nova Jelbegi Castle", "Nova Mawiti", "Nova Mijayet", "Nova Radoghir Castle", "Nova Rduna", "Nova Rebache", "Nova Reyvadin", "Nova Saren", "Nova Sarimish", "Nova Sekhtem", "Nova Shariz", "Nova Sharwa Castle", "Nova Slezkh Castle", "Nova Tahlberl", "Nova Tazjunat", "Nova Tismirr", "Nova Tosdhar", "Nova Tulga", "Nova Uhhun Castle", "Nova Uslum", "Nova Uxkhal", "Nova Vayejeg", "Nova Veluca");

var allItems = new Array();
allItems[0]  = new Array("00", "Trading goods", "equip_inv.png", 0);
allItems[1]  = new Array("01", "Horses", "equip_horse.png", 6190, 7963, 1, 7962, 2, 3, 10, 4, 7114, 7, 5, 6051, 6, 6049, 6050, 6474, 8636, 8637, 8638, 8639, 8, 524, 6048, 525, 9, 526, 527);
allItems[2]  = new Array("14", "Throwing", "equip_throw.png", 23, 25, 528, 46, 28, 26, 29, 536, 47, 48, 6176, 534, 32, 34, 529, 5142, 537, 535, 36, 8492, 8493, 38, 30, 8490, 8491, 7000, 7001, 539, 6680, 40, 42, 44, 538);
allItems[3]  = new Array("02", "Body armors", "equip_body.png", 364, 369, 6479, 366, 367, 368, 370, 372, 373, 374, 375, 376, 412, 413, 6354, 371, 378, 5393, 377, 379, 431, 432, 6481, 5498, 6482, 381, 382, 384, 6802, 383, 386, 385, 390, 6213, 4722, 389, 6352, 7135, 7136, 391, 5169, 387, 388, 394, 392, 399, 6480, 393, 395, 396, 6353, 397, 398, 5500, 416, 400, 6060, 417, 7984, 7985, 419, 472, 418, 403, 6813, 434, 420, 5501, 437, 7980, 7981, 438, 3971, 6803, 404, 6059, 440, 5394, 5919, 365, 401, 402, 414, 415, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 433, 3130, 442, 443, 3137, 4952, 6805, 6806, 444, 8244, 8245, 7982, 4723, 5502, 445, 6485, 7784, 8246, 6483, 6484, 6214, 447, 6486, 7975, 7976, 5738, 5741, 405, 454, 5507, 6807, 8241, 8242, 8243, 8247, 8248, 8249, 5506, 407, 408, 409, 410, 411, 459, 7143, 441, 448, 7978, 7979, 6478, 458, 461, 7146, 5916, 7782, 446, 6218, 460, 7137, 7138, 7139, 7140, 4947, 4948, 4949, 4950, 4951, 450, 451, 7153, 8250, 4957, 8238, 8239, 8240, 8251, 8515, 6801, 439, 5505, 5918, 4958, 7144, 8235, 8236, 8237, 8514, 6219, 449, 455, 7983, 6217, 5739, 5740, 5742, 457, 7147, 7148, 7149, 7150, 7151, 7152, 8252, 456, 8253, 7145, 6062, 452, 6058, 435, 6814, 6815, 8232, 8233, 8234, 8254, 4955, 406, 4720, 453, 8586, 6061, 6063, 7977, 7783, 4956, 5504, 5509, 6804, 5499, 6808, 4953, 4954, 462, 463, 436, 5917, 7781, 3972, 6215, 5496, 469, 464, 465, 466, 6216, 5508, 467, 6812, 473, 474, 475, 4721, 6811, 476, 477, 478, 480, 8255, 8256, 5503, 5497, 468, 547, 541, 545, 6809, 471, 6810, 7142, 380, 7141, 470, 479);
allItems[4]  = new Array("03", "Head armors", "equip_head.png", 273, 283, 256, 257, 258, 259, 260, 261, 262, 279, 280, 255, 284, 5915, 263, 295, 268, 264, 265, 266, 267, 7971, 7972, 294, 298, 299, 7973, 7974, 5162, 270, 272, 274, 275, 276, 277, 278, 309, 6057, 6350, 8154, 495, 6800, 271, 286, 281, 285, 5484, 5168, 287, 288, 289, 290, 7132, 291, 292, 312, 348, 282, 269, 300, 293, 296, 5914, 7133, 302, 297, 7130, 301, 307, 5159, 303, 5160, 5161, 5155, 5156, 5157, 5163, 304, 353, 6351, 5164, 5165, 305, 317, 319, 321, 306, 7129, 308, 311, 8516, 5733, 3968, 6796, 5158, 310, 326, 347, 349, 350, 5730, 5737, 6795, 6797, 314, 323, 7772, 7773, 7774, 7775, 7776, 7777, 313, 320, 322, 549, 8517, 330, 4938, 7779, 5385, 5386, 6210, 6476, 5913, 315, 324, 325, 5486, 5487, 6477, 5494, 6056, 318, 327, 329, 328, 5736, 5492, 5910, 8518, 338, 5734, 5483, 5488, 5489, 5731, 5493, 494, 546, 331, 5490, 7134, 504, 332, 335, 4944, 5491, 5166, 8519, 4939, 333, 4942, 7780, 363, 5912, 7970, 5167, 4941, 334, 336, 337, 4945, 5735, 361, 5482, 3969, 316, 6206, 4943, 339, 359, 5485, 8155, 5384, 6209, 362, 6207, 6208, 340, 7778, 360, 6055, 507, 5911, 8520, 8521, 4940, 341, 5732, 5495, 6054, 540, 342, 503, 5885, 7117, 7118, 7119, 7120, 7121, 7122, 5388, 5389, 6204, 6205, 4946, 343, 6348, 5390, 5391, 5392, 506, 5154, 6212, 344, 345, 346, 351, 352, 356, 6349, 6211, 354, 355, 7131, 5387, 357, 358, 6798, 6799, 509, 8230, 8231, 7756, 492, 5383);
allItems[5]  = new Array("04", "Leg armors", "equip_leg.png", 218, 219, 5727, 5479, 5480, 6792, 6052, 220, 5906, 7966, 7967, 222, 223, 221, 224, 4936, 225, 226, 228, 5153, 227, 5907, 229, 3966, 230, 7968, 7969, 4937, 5728, 5729, 5908, 234, 6984, 235, 238, 6053, 5909, 3967, 233, 7964, 7965, 236, 4935, 232, 244, 6793, 237, 231, 239, 243, 6985, 240, 242, 241, 7115);
allItems[6]  = new Array("05", "Hand armors", "equip_hand.png", 245, 6475, 246, 5884, 6343, 7770, 7771, 253, 6341, 6342, 251, 252, 6338, 6339, 247, 248, 6345, 6346, 550, 249, 543, 542, 6344, 254, 6347, 7116, 5481, 6794, 6340, 533);
allItems[7]  = new Array("06", "Polearms", "equip_polearm.png", 552, 89, 90, 91, 491, 132, 92, 111, 5371, 93, 94, 99, 95, 109, 107, 116, 103, 7897, 100, 104, 108, 4754, 7898, 96, 4753, 106, 6682, 112, 98, 120, 122, 110, 133, 5856, 5855, 6684, 113, 5857, 119, 105, 114, 6683, 5858, 7004, 118, 4692, 124, 101, 123, 6584, 6585, 6586, 6587, 6588, 6589, 6590, 115, 97, 126, 7896, 7003, 8683, 531, 532, 530, 6681, 102, 128, 117);
allItems[8]  = new Array("07", "Two handed", "equip_twohand.png", 129, 502, 7017, 130, 137, 7018, 131, 136, 139, 138, 519, 134, 189, 8454, 142, 135, 140, 148, 147, 145, 146, 152, 7014, 143, 151, 150, 7015, 158, 149, 154, 518, 6690, 517, 6697, 6198, 8682, 7016, 153, 6691, 8177, 6332, 144, 6696, 155, 6692, 6695, 7764, 156, 6694, 3320, 6693, 522, 521, 157, 159, 141, 160, 8178);
allItems[9]  = new Array("08", "One handed", "equip_onehand.png", 489, 161, 162, 164, 165, 166, 168, 551, 500, 3322, 167, 172, 554, 7010, 169, 163, 173, 5900, 171, 174, 184, 5372, 178, 170, 7900, 175, 187, 183, 177, 188, 185, 181, 190, 186, 499, 180, 200, 192, 197, 196, 7011, 182, 6687, 176, 205, 179, 3195, 191, 194, 198, 201, 3194, 193, 217, 207, 6686, 7006, 516, 203, 209, 8175, 202, 206, 208, 204, 211, 520, 195, 215, 6591, 7012, 3192, 7007, 3196, 3298, 6688, 3190, 7009, 7013, 216, 8176, 7005, 3193, 6022, 8174, 213, 3323, 210, 199, 510, 212, 6685, 214, 6689, 7008, 8173, 523, 6021, 3191, 4755);
allItems[10] = new Array("09", "Shields", "equip_shield.png", 490, 497, 488, 508, 52, 49, 53, 58, 8171, 51, 50, 54, 60, 59, 55, 74, 75, 79, 56, 57, 62, 80, 505, 496, 498, 61, 7890, 7891, 7892, 493, 72, 64, 66, 70, 73, 548, 501, 77, 85, 7893, 7894, 7895, 76, 7002, 71, 8172, 86, 81, 82, 78, 63, 65, 67, 68, 69, 84, 83, 6019, 6018, 544, 87, 6020, 8687, 88);
allItems[11] = new Array("10", "Bows", "equip_bow.png", 17, 16, 8720, 18, 8721, 19, 22, 20, 21, 5141, 8719, 8722, 8612);
allItems[12] = new Array("11", "Arrows", "equip_arrow.png", 481, 482, 484, 483);
allItems[13] = new Array("12", "Crossbows", "equip_crossbow.png", 11, 12, 13, 14, 15);
allItems[14] = new Array("13", "Bolts", "equip_bolt.png", 485, 486);

var items = document.getElementsByClassName("item");
var itemsSorted = [];
var itemCount = [];
var categoryCount = new Array();

function getCategoryById(id)
{
for(var i = 0; i < allItems.length; i++)
{
if(allItems[i].indexOf(parseInt(id), 3) >= 0)
return i;
}
return 0;
}

function getSortingById(id)
{
for(var i = 0; i < allItems.length; i++)
{
var x = allItems[i].indexOf(parseInt(id), 3);
if(x >= 0)
{
if(x < 10)
x = "000" + x;
else if(x < 100)
x = "00" + x;
else if(x < 100)
x = "0" + x;
return allItems[i][0] + "_" + x;
}
}
return "0";
}

function sortItems()
{
var funcSort = function(a, b)
{
akey = a.getAttribute("sort");
bkey = b.getAttribute("sort");
asubkey = parseInt(a.getAttribute("itemcondition"));
bsubkey = parseInt(b.getAttribute("itemcondition"));
if (akey == bkey)
{
if(asubkey < bsubkey) return 1;
if(asubkey > bsubkey) return -1;
return 0;
}
if (akey < bkey) return -1;
if (akey > bkey) return 1;
}

itemsSorted.sort(funcSort);

for(var i = 0; i < itemsSorted.length; i++)
{
itemsSorted[i].parentNode.appendChild(itemsSorted[i]);
}
}

function addItemEvents()
{
for(var i = 0; i < itemsSorted.length; i++)
{
    (function (i) {
        itemsSorted[i].getElementsByTagName("img")[0].onclick = function () {
        var id = itemsSorted[i].getAttribute("itemid");
        if(id != "0")
popupShow("http://c-rpg.net/index.php?page=itemdetail&id=" + id)
        };
    }) (i);
}
}

function showAllItems()
{
var shoppages = document.getElementById("shoppages").childNodes;
for(var i = 0; i < shoppages.length; i++)
{
shoppages[i].setAttribute("style", "");
}
}

function addShopTabAll()
{
var tab = document.getElementById("all_tab");
if("" + tab == "null")
{
tab = document.createElement("a");
tab.setAttribute("id", "all_tab");
tab.setAttribute("class", "shop_type");
tab.setAttribute("href", "?buy=all");
var img = document.createElement("img");
img.setAttribute("src", "img/equip_inv.png");
tab.appendChild(img);
document.getElementById("shoptabs").appendChild(tab);
}
tab.setAttribute("onclick", "setTab('#all_tab', '#itp_type_all');");
}

function addShopItemConditionSelect()
{
var select = document.createElement("select");
select.setAttribute("id", "showShopItemsByCondition");
select.setAttribute("style", "text-align: center;");
var opt;
for(var i = 3; i >= -2; i--)
{
opt = document.createElement("option");
if(GM_getValue("showShopItemsByCondition", -2) == i)
opt.setAttribute("selected", "selected");
opt.innerHTML = (i > 0 ? "+" : "") + i;
select.appendChild(opt);
}
select.addEventListener("change", updateShopView, false);
var tab = document.getElementById("buy_page");
tab.insertBefore(select, tab.firstChild);
tab.insertBefore(document.createTextNode("Hide items lower than level "), select)
}

function updateShopView()
{
var select = document.getElementById("showShopItemsByCondition");
var showCondition = select.options[select.options.selectedIndex].value;
GM_setValue("showShopItemsByCondition", showCondition);

for(var i = 0; i < itemsSorted.length; i++)
{
var condition = parseInt(itemsSorted[i].getAttribute("itemcondition"));
itemsSorted[i].setAttribute("style", (condition < showCondition ? "display: none;" : ""));
}
}

function addInventoryOverView()
{
var div = document.createElement("div");
var str = "";

str += "<table width='100%' border='0'>";
str += "<tr><td valign='top'><table border='0'>";
for(var i = 0; i < categoryCount.length; i++)
{
str += "<tr><td><img src='/img/" + allItems[i][2] + "' width='15px'></td>";
str += "<td>" + allItems[i][1] + ": <td align='right'><strong>" + categoryCount[i] + "</strong></td></tr>";
if((i == 2) || (i == 6) || (i == 10))
str += "</table></td><td valign='top'><table border='0'>";
}
str += "</table></td></tr>";
str += "</table>";

div.innerHTML = str;
itemsSorted[0].parentNode.insertBefore(div, itemsSorted[0].parentNode.firstChild);
}

function pageIs(page)
{
if((page == cPageMap) && (document.location.href.indexOf("http://strategus.c-rpg.net/index.php") >= 0))
return true;
if(document.location.href.indexOf("http://strategus.c-rpg.net/news.php?" + page) >= 0)
return true;
return false;
}

function popupShow(url)
{
var popup = document.createElement("div");
popup.setAttribute("id", "popupframe");
var frm = document.createElement("iframe");
frm.setAttribute("allowtransparency", "true");
frm.setAttribute("src", url);
var btn = document.createElement("img");
btn.setAttribute("src", "http://c-rpg.net/img/border_close_button.png");
btn.setAttribute("title", "Close");
btn.addEventListener("click", popupClose, false);
popup.addEventListener("click", popupClose, false);
popup.appendChild(frm);
popup.appendChild(btn);
document.body.appendChild(popup);
}

function popupClose()
{
var popup = document.getElementById("popupframe");
if(popup != null)
popup.parentNode.removeChild(popup);
}

function setStylesheets()
{
var css = "";

// Inventory/Towncenter
if(pageIs(cPageShop))
{
css += ".conditionbad { background-color: rgba(200, 0, 0, 0.1); }";
css += ".conditiongood { background-color: rgba(0, 200, 0, 0.1); }";
}
else
{
css += ".conditionbad { background-color: rgba(100, 0, 0, 0.1); } ";
css += ".conditiongood { background-color: rgba(0, 100, 0, 0.1); } ";
}
css += ".myown { background-color: rgba(0, 0, 255, 0.1) !important; } ";
css += ".cheap { background-color: rgba(0, 100, 0, 0.1); } ";
css += ".cheaper { background-color: rgba(0, 200, 0, 0.1); } ";

// Popup
css += "#popupframe { background: url('http://c-rpg.net/img/bgoverlay75.png') repeat scroll 0 0 transparent; width: 100%; height: 100%; top: 0; left: 0; position: fixed; z-index: 99; }";
css += "#popupframe iframe { position: absolute; top: 120px; left: 250px; width: 676px; height: 600px; z-index: 100; border: none; }";
css += "#popupframe img { z-index: 101; position: absolute; top: 120px; left: 864px; padding: 10px; cursor: pointer; }";


// Cursors
/*
css += "#player_info li.sendaction:nth-of-type(9) { cursor: url(http://img855.imageshack.us/img855/7936/followmousepointer.png), pointer; }";
css += "#player_info li.sendaction:nth-of-type(8) { cursor: url(http://img846.imageshack.us/img846/3710/attackmousepointer.png), pointer; }";
css += "#player_info li.sendaction:nth-of-type(9):not(:last-child) { cursor: url(http://img826.imageshack.us/img826/4296/trademousepointer.png), pointer; }";
css += "#player_info li.sendaction:nth-of-type(10) { cursor: url(http://img855.imageshack.us/img855/7936/followmousepointer.png), pointer; }";
*/

// Buttons Player-Menu
//css += "#player_menu { overflow: hidden; }";
/*css += "#player_menu li:first-of-type, #player_menu li#move_player, #player_menu li#stop_player { float: right; font-size: 0px; overflow: hidden; vertical-align: middle; text-align: center; color: black; opacity: 0.7; margin-top: 5px; margin-bottom: 5px; }";
css += "#player_menu li:first-of-type:after, #player_menu li#move_player:after, #player_menu li#stop_player:after { font-size: 12px; font-weight: bold; line-height: 22px; }";
css += "#player_menu li#move_player:active { color: red; opacity: 1.0; }";
css += "#player_menu li:first-of-type:hover, #player_menu li#move_player:hover, #player_menu li#stop_player:hover { color: white; opacity: 1.0; }";

css += "#player_menu li#stop_player { width: 92px; background: url(http://img13.imageshack.us/img13/430/attackplayerbutton.png) transparent no-repeat; }";
css += "#player_menu li#stop_player:after { content: 'Stop'; }";

css += "#player_menu li#move_player { width: 90px; margin-left: -9px; background: url(http://img542.imageshack.us/img542/9219/tradeplayerbutton.png) transparent no-repeat; }";
css += "#player_menu li#move_player:after { content: 'Move'; }";

css += "#player_menu li:first-of-type { width: 97px; margin-right: 20px; margin-left: -5px; background: url(http://img547.imageshack.us/img547/6402/followplayerbutton.png) transparent no-repeat; }";
css += "#player_menu li:first-of-type:after { content: 'My Stats'; }";

css += "#player_menu li:nth-of-type(3):not(#stop_player) { clear: both; }";
css += "#player_menu li:nth-of-type(4) { clear: both; }";

css += "#player_menu li[id^='location'] { color: darkred; }";
css += "#player_menu li[id^='hero']:not(:first-of-type) { color: darkgreen; }";

css += "#player_menu { min-height: 50px; }";
    */
// Mainheader from cRPG
css += "#chatlink { display: none; }";
//css += "#settings { display: none; }";
css += "#settings #showpartynames, #settings #showtownnames, #settings #showpartiesarmysizethreshold, #settings label[for=showpartynames], #settings label[for=showtownnames], #settings label[for=showpartiesarmysizethreshold] { display: none; }";
css += "#settings label a { color: red; position: relative; top: -35px; left: 180px; }";
css += "#settings {"
+ " background: url(http://c-rpg.net/img/bg_info.png) no-repeat scroll 0 0 transparent;"
+ " color: #DDBE8F;"
+ " height: 49px;"
+ " padding: 11px 0 0 5px;"
+ " position: absolute;"
+ " top: 10px;"
+ " width: 262px;"
+ "}";

// cRPG-Layout
css += "#headerCRPG {"
+ " height: 110px;"
+ " left: 0;"
+ " position: absolute;"
+ " right: 0;"
+ " top: 0;"
+ " z-index: 2;"
+ "}"
+ "#headerCRPG h1 {"
+ " background: url(http://c-rpg.net/img/bg_logo_strategus.png) no-repeat scroll 0 0 transparent;"
+ " height: 96px;"
+ " left: 275px;"
+ " position: absolute;"
+ " top: 16px;"
+ " width: 77px;"
+ " z-index: 3;"
+ "}"
+ "#headerCRPG h1 span {"
+ " display: none;"
+ "}"
+ "#headerCRPG h2 {"
+ " font-size: 15px;"
+ " margin: 0px;"
+ "}"
+ "#headerCRPG .info {"
+ " background: url(http://c-rpg.net/img/bg_info.png) no-repeat scroll 0 0 transparent;"
+ " color: #DDBE8F;"
+ " height: 49px;"
+ " left: 10px;"
+ " padding: 11px 0 0 15px;"
+ " position: absolute;"
+ " top: 10px;"
+ " width: 252px;"
+ "}"
+ "#headerCRPG .info .char {"
+ " display: block;"
+ " font-size: 15px;"
+ " font-weight: bold;"
+ " height: 21px;"
+ " line-height: 19px;"
+ "}"
+ "#headerCRPG .info .itemCRPG {"
+ " background-position: left center;"
+ " background-repeat: no-repeat;"
+ " display: inline-block;"
+ " font-size: 12px;"
+ " font-weight: bold;"
+ " line-height: 16px;"
+ " padding-left: 18px;"
+ "}"
+ "#headerCRPG .info .itemCRPG + .itemCRPG {"
+ " margin-left: 10px;"
+ "}"
+ "#headerCRPG .info a.itemCRPG {"
+ " color: #DDBE8F;"
+ " text-decoration: none;"
+ "}"
+ "#headerCRPG .info a.itemCRPG:hover {"
+ " color: white;"
+ "}"
+ "#headerCRPG .info .itemCRPG.gold {"
+ " background-image: url(http://c-rpg.net/img/hi_gold.png);"
+ "}"
+ "#headerCRPG .info .itemCRPG.message {"
+ " background-image: url(http://c-rpg.net/img/hi_message.png);"
+ "}"
+ "#headerCRPG .info .itemCRPG.battle {"
+ " background-image: url(http://c-rpg.net/img/hi_battle.png);"
+ "}"
+ "#headerCRPG .info .itemCRPG.generation {"
+ " background-image: url(http://c-rpg.net/img/hi_emblem.png);"
+ "}"
+ "#headerCRPG .info .itemCRPG.level {"
+ " background-image: url(http://c-rpg.net/img/hi_sword.png);"
+ "}"
+ "#headerCRPG .nav {"
+ " background: url(http://c-rpg.net/img/bg_pole.png) no-repeat scroll right 18px transparent;"
+ " left: 349px;"
+ " position: absolute;"
+ " top: 0;"
+ " white-space: nowrap;"
+ " z-index: 4;"
+ "}"
+ "#headerCRPG .nav .dynamic, #headerCRPG .nav .static {"
+ " display: inline-block;"
+ " vertical-align: top;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary {"
+ " margin: 4px 0 0 2px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a {"
+ " background: url(http://c-rpg.net/img/button_gray_center.png) no-repeat scroll left center transparent;"
+ " display: inline-block;"
+ " height: 26px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a span {"
+ " border-left: 1px solid rgba(255, 255, 255, 0.5);"
+ " border-right: 1px solid rgba(0, 0, 0, 0.25);"
+ " color: rgba(0, 0, 0, 0.75);"
+ " display: inline-block;"
+ " font-size: 12px;"
+ " font-weight: bold;"
+ " height: 20px;"
+ " line-height: 18px;"
+ " margin: 3px 0;"
+ " padding: 2px 10px 0;"
+ " text-decoration: none;"
+ " text-shadow: 0 1px 0 white;"
+ " text-transform: uppercase;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a span {"
+ " line-height: 20px;"
+ " padding: 0 10px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:hover span {"
+ " color: black;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:first-child {"
+ " background-clip: content-box, padding-box;"
+ " background-image: url(http://c-rpg.net/img/button_gray_center.png), url(http://c-rpg.net/img/button_gray_start.png);"
+ " background-origin: content-box, padding-box;"
+ " background-position: left center, left center;"
+ " padding-left: 15px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:last-child {"
+ " background-clip: content-box, padding-box;"
+ " background-image: url(http://c-rpg.net/img/button_gray_center.png), url(http://c-rpg.net/img/button_gray_end.png);"
+ " background-origin: content-box, padding-box;"
+ " background-position: right center, right center;"
+ " padding-right: 15px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:only-child {"
+ " background-clip: content-box, padding-box, padding-box;"
+ " background-image: url(http://c-rpg.net/img/button_gray_center.png), url(http://c-rpg.net/img/button_gray_start.png), url(http://c-rpg.net/img/button_gray_end.png);"
+ " background-origin: content-box, padding-box, padding-box;"
+ " background-position: right center, left center, right center;"
+ " padding-left: 15px;"
+ " padding-right: 15px;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:first-child span {"
+ " border-left: 0 none;"
+ " padding-left: 0;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:last-child span {"
+ " border-right: 0 none;"
+ " padding-right: 0;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:only-child span {"
+ " border-left: 0 none;"
+ " border-right: 0 none;"
+ " padding-left: 0;"
+ " padding-right: 0;"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:hover {"
+ " background-image: url(http://c-rpg.net/img/button_gold_center.png);"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:first-child:hover {"
+ " background-image: url(http://c-rpg.net/img/button_gold_center.png), url(http://c-rpg.net/img/button_gold_start.png);"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:last-child:hover {"
+ " background-image: url(http://c-rpg.net/img/button_gold_center.png), url(http://c-rpg.net/img/button_gold_end.png);"
+ "}"
+ "#headerCRPG .nav .dynamic .primary a:only-child:hover {"
+ " background-image: url(http://c-rpg.net/img/button_gold_center.png), url(http://c-rpg.net/img/button_gold_start.png), url(http://c-rpg.net/img/button_gold_end.png);"
+ "}"
+ "#headerCRPG .nav .dynamic .secondary {"
+ " height: 20px;"
+ " margin: 4px 0 0 3px;"
+ " text-align: right;"
+ "}"
+ "#headerCRPG .nav .dynamic .secondary a {"
+ " background-attachment: scroll, scroll;"
+ " background-clip: border-box, padding-box;"
+ " background-color: transparent;"
+ " background-image: url(http://c-rpg.net/img/bg_tab_small_start.png), url(http://c-rpg.net/img/bg_tab_small_end.png);"
+ " background-origin: border-box, border-box;"
+ " background-position: left center, right center;"
+ " background-repeat: no-repeat, no-repeat;"
+ " background-size: auto auto, auto auto;"
+ " border-left: 8px solid transparent;"
+ " color: rgba(222, 200, 166, 0.5);"
+ " display: inline-block;"
+ " font-size: 12px;"
+ " font-weight: bold;"
+ " line-height: 17px;"
+ " margin-right: 2px;"
+ " padding-right: 8px;"
+ " text-decoration: none;"
+ "}"
+ "#headerCRPG .nav .dynamic .secondary a:hover {"
+ " color: #DEC8A6;"
+ "}"
+ "#headerCRPG .nav .dynamic .secondary a.current {"
+ " color: #DEC8A6;"
+ " font-weight: bold;"
+ "}"
+ "#headerCRPG .nav .static {"
+ " padding-right: 10px;"
+ "}"
+ "#headerCRPG .nav .static a {"
+ " background-position: left top;"
+ " background-repeat: no-repeat;"
+ " display: inline-block;"
+ " margin-top: 16px;"
+ " vertical-align: top;"
+ "}"
+ "#headerCRPG .nav .static a span {"
+ " display: none;"
+ "}"
+ "#headerCRPG .nav .static a.donate {"
+ " background-image: url(http://c-rpg.net/img/bg_flag_donate.png);"
+ " height: 39px;"
+ " width: 24px;"
+ "}"
+ "#headerCRPG .nav .static a.forum {"
+ " background-image: url(http://c-rpg.net/img/bg_flag_forum.png);"
+ " height: 37px;"
+ " width: 26px;"
+ "}"
+ "#headerCRPG .nav .static a.download {"
+ " background-image: url(http://c-rpg.net/img/bg_flag_download.png);"
+ " height: 47px;"
+ " width: 24px;"
+ "}"
+ "#headerCRPG .nav .static a.help {"
+ " background-image: url(http://c-rpg.net/img/bg_flag_help.png);"
+ " height: 44px;"
+ " width: 18px;"
+ "}";

// Viewer
css += "#sv-overlay { background: url(../img/sub_t.png) no-repeat scroll center top border-box, url(../img/sub_b.png) no-repeat scroll center bottom border-box, url(../img/sub_c.png) repeat-y scroll center top padding-box transparent; }";
css += "#sv-overlay { border-bottom: 22px solid transparent; border-top: 22px solid transparent; width: 300px; left: 10px; }";
css += "#sv-overlay { position: fixed !important; bottom: 10px; top: auto !important; left: 10px !important; }";
css += "#sv-overlay span { color: black; padding-left: 20px; font-size: 12px; }";
css += "#sv-overlay span[id^='sv'] { color: darkblue; padding-left: 0px; }";

var styleElement = document.createElement("style");
styleElement.type = "text/css";
if (styleElement.styleSheet){
styleElement.styleSheet.cssText = css;
} else {
styleElement.appendChild(document.createTextNode(css));
}
document.getElementsByTagName("head")[0].appendChild(styleElement);
}

function addSomeNiceStuff(strategusUsername)
{
var e1, e2, e3, e4;
var hd = document.createElement("div");
hd.setAttribute("id", "headerCRPG");
e1 = document.createElement("h1");
e1.innerHTML = "<span>cRPG beta</span>";
hd.appendChild(e1);

// Info
e1 = document.createElement("div");
e1.setAttribute("class", "info");
// Username
e2 = document.createElement("div");
e2.setAttribute("class", "char");
e2.innerHTML = strategusUsername;
e1.appendChild(e2);
// Gold
e2 = document.createElement("div");
e2.setAttribute("class", "itemCRPG gold");
e2.innerHTML = "0"; // TODO: Gold
e1.appendChild(e2);
// Messages
e2 = document.createElement("a");
e2.setAttribute("class", "itemCRPG message");
e2.setAttribute("title", "Show messages");
e2.setAttribute("href", "#");
e2.innerHTML = "Messages";
e2.addEventListener("click", function() { popupShow("http://c-rpg.net/index.php?page=messenger"); }, false);
e1.appendChild(e2);
hd.appendChild(e1);

// Nav
e1 = document.createElement("div");
e1.setAttribute("class", "nav");
// Dynamic
e2 = document.createElement("div");
e2.setAttribute("class", "dynamic");
// secondary
e3 = document.createElement("div");
e3.setAttribute("class", "secondary");
// Chat
e4 = document.createElement("a");
e4.setAttribute("title", "Join our chat channel #mount&amp;blade-crpg @ qnet.org");
e4.setAttribute("target", "_blank");
e4.setAttribute("href", "http://webchat.quakenet.org/?channels=mount%26blade-crpg");
e4.innerHTML = "Join chat";
e3.appendChild(e4);
// Map settings
/* e4 = document.createElement("a");
e4.setAttribute("title", "Show map settings");
e4.setAttribute("href", "#");
e4.setAttribute("onmouseover", "Javascript:document.getElementById('settings').setAttribute('style', 'display: block;');");
e4.setAttribute("onmouseout", "Javascript:document.getElementById('settings').setAttribute('style', 'display: hidden;');");
e4.innerHTML = "Map settings";
e3.appendChild(e4);*/
e2.appendChild(e3);

// primary
e3 = document.createElement("div");
e3.setAttribute("class", "primary");
// cRPG
e4 = document.createElement("a");
e4.setAttribute("title", "Visit cRPG-website");
e4.setAttribute("href", "http://c-rpg.net/");
e4.setAttribute("target", "_blank");
e4.innerHTML = "<span>cRPG</span>";
e3.appendChild(e4);
// Factions
e4 = document.createElement("a");
e4.setAttribute("title", "Show Strategus factions");
e4.setAttribute("href", "#");
e4.addEventListener("click", function() { popupShow("http://c-rpg.net/index.php?page=strategusinfofaction"); }, false);
e4.innerHTML = "<span>Factions</span>";
e3.appendChild(e4);
// Locations
e4 = document.createElement("a");
e4.setAttribute("title", "Show Strategus locations");
e4.setAttribute("href", "#");
e4.addEventListener("click", function() { popupShow("http://c-rpg.net/index.php?page=strategusinfolocation"); }, false);
e4.innerHTML = "<span>Locations</span>";
e3.appendChild(e4);
// Heroes
e4 = document.createElement("a");
e4.setAttribute("title", "Search for Strategus heroes");
e4.setAttribute("href", "#");
e4.addEventListener("click", function() { popupShow("http://c-rpg.net/index.php?page=strategusinfohero"); }, false);
e4.innerHTML = "<span>Heroes</span>";
e3.appendChild(e4);
// cRPG Battles
e4 = document.createElement("a");
e4.setAttribute("title", "Visit cRPG battle page");
e4.setAttribute("href", "http://c-rpg.net/index.php?page=battlesupcoming");
e4.setAttribute("target", "_blank");
e4.innerHTML = "<span>Battles</span>";
e3.appendChild(e4);
e2.appendChild(e3);
e1.appendChild(e2);
// Static
e2 = document.createElement("div");
e2.setAttribute("class", "static");
e2.innerHTML = '<a class="forum" target="_blank" href="http://c-rpg.net/?page=forumlogin" title="Visit forums"><span>Forum</span></a>'
+ '<a class="download" target="_blank" href="http://c-rpg.net/cRPGLauncher.exe" title="Download latest version"><span>Download</span></a>'
+ '<a class="donate" target="_blank" href="http://c-rpg.net/?page=donate" title="Help with a donation"><span>Donate</span></a>'
+ '<a class="help" target="_blank" href="http://wiki.c-rpg.net/index.php?title=Skills" title="Find more information in the wiki"><span>Help</span></a>';
e1.appendChild(e2);
hd.appendChild(e1);
document.getElementById("header").appendChild(hd);
}

function echo(str)
{
console.log(str);
}

function sortedInventoryMain()
{
var strategusUsername = "None";
if(!pageIs(cPageMap))
{
strategusUsername = document.getElementsByTagName("h2")[0].innerHTML;
GM_setValue("strategusUsername", strategusUsername);
}
else
{
strategusUsername = GM_getValue("strategusUsername", "None");
}

setStylesheets();
addSomeNiceStuff(strategusUsername);

for(var i = 0; i < allItems.length; i++)
{
categoryCount[i] = 0;
for(var j = 3; j < allItems[i].length; j++)
itemCount[j] = 0;
}

for(var i in items)
{
if (items[i].nodeType == 1) { // get rid of the whitespace text nodes
itemsSorted.push(items[i]);
}
}

for(var i = 0; i < items.length; i++)
{
var img = items[i].getElementsByClassName("header")[0].getElementsByTagName("img")[0];
var itemId = "0";
var itemCondition = "0";
if(img.hasAttribute("rel"))
{
var rel = img.getAttribute("rel");
itemId = rel.substring(16, rel.indexOf("&m="));
itemCondition = rel.substring(rel.indexOf("&m=") + 3);
}
itemsSorted[i].setAttribute("itemid", itemId);
itemsSorted[i].setAttribute("sort", getSortingById(itemId));
itemsSorted[i].setAttribute("itemcondition", itemCondition);
if(parseInt(itemCondition) < 0)
itemsSorted[i].setAttribute("class", itemsSorted[i].getAttribute("class") + " conditionbad");
else if(parseInt(itemCondition) > 0)
itemsSorted[i].setAttribute("class", itemsSorted[i].getAttribute("class") + " conditiongood");
itemsSorted[i].parentNode = items[i].parentNode;

var desc = itemsSorted[i].getElementsByClassName("desc")[0].innerHTML;
var a = desc.indexOf("Number: ");
var count = desc.slice(desc.indexOf("<strong>", a) + 8, desc.indexOf("</strong>", a)).replace(",", "").replace(".", "");
itemCount[itemId] += parseInt(count);
categoryCount[getCategoryById(itemId)] += parseInt(count);

if(itemId == "0")
{
var name = items[i].getElementsByClassName("header")[0].getElementsByClassName("name")[0].innerHTML;
var origin = "<i>" + itemOrigin["place"][itemOrigin["good"].indexOf(name)] + "</i>";
if(pageIs(cPageFaction))
origin = "<br/>" + origin;
itemsSorted[i].getElementsByClassName("desc")[0].innerHTML += origin;
}
}

if(pageIs(cPageTowncenter))
{
var table = document.getElementsByClassName("towncenter")[0];
var trs = table.getElementsByTagName("tr");
for(var i = 0; i < trs.length; i++)
{
var tds = trs[i].getElementsByTagName("td");
if(tds.length > 9)
{
var or = itemOrigin["place"][itemOrigin["good"].indexOf(tds[4].innerHTML.trim())];
if("" + or != "undefined")
tds[4].innerHTML += "<br><i>(" + or + ")</i>"
if(tds[9].innerHTML == strategusUsername)
trs[i].setAttribute("class", trs[i].getAttribute("class") + " myown");
if(parseFloat(tds[6].innerHTML.replace(",", "")) < parseFloat(tds[5].innerHTML))
trs[i].setAttribute("class", trs[i].getAttribute("class") + " cheap");
if(parseFloat(tds[8].innerHTML.replace(",", "")) < parseFloat(tds[5].innerHTML))
trs[i].setAttribute("class", trs[i].getAttribute("class") + " cheaper");
}
}
}

if(pageIs(cPageInventory) || pageIs(cPageFaction))
{
sortItems();
}

if(pageIs(cPageShop))
{
addShopTabAll();
addShopItemConditionSelect();
updateShopView();
}

if(pageIs(cPageShop) || pageIs(cPageInventory) || pageIs(cPageFaction))
{
addItemEvents();
}

if(pageIs(cPageShopAll))
showAllItems();

if(pageIs(cPageInventory))
addInventoryOverView();
}

sortedInventoryMain();

Offline Sparvico

  • Marshall
  • ********
  • Renown: 976
  • Infamy: 174
  • cRPG Player Sir Black Bishop A Gentleman and a Scholar
  • Steam ID: Sparvico
    • View Profile
  • Faction: Mossbacks
  • Game nicks: Sparvico et al.
Re: STB v2.0.8
« Reply #287 on: February 23, 2016, 09:47:03 am »
+1
Quote
Mossback_Westwood: "I swear 2 my semitic God if you give me this bundle of sticks's address I'll cut off his ear and eat it"

visitors can't see pics , please register or login

Offline Latvian

  • King
  • **********
  • Renown: 1494
  • Infamy: 379
  • cRPG Player Sir Black Bishop A Gentleman and a Scholar
  • с̴͎͖͈͟͠ͅу̷̸̻̣͇͚̫͎͇̩̟̖̪͇̯к̀́͠͞҉͎͚͎а̰̤͕̱͔̬͖̟̺͍͎́͞ ̸͝
    • View Profile
  • Faction: one and only DESERTERS
  • Game nicks: u know its me when you see me
Re: STB v2.0.8
« Reply #288 on: February 23, 2016, 06:32:30 pm »
0
stuff
  how does one use it or we have to wait untill it gets included in STB thingy?
people are like potatoes, they come in different shapes and sizes and they all are beautifull
masturbating while looking in a mirror isnt wrong unless its the rear view mirror and you are driving a school buss.

it doesnt matter if you are happiest person or an unfortunate weeper, a powerfull beast or a terrifying creature. we are all equal, in the eyes of the reaper.

Offline Turkhammer

  • Earl
  • ******
  • Renown: 376
  • Infamy: 194
  • cRPG Player
    • View Profile
Re: STB v2.0.8
« Reply #289 on: February 23, 2016, 08:03:57 pm »
+1
  how does one use it or we have to wait untill it gets included in STB thingy?

DL Tampermonkey for chrome.
copy script from post above to clipboard.
Open tampermonkey.
select install new script.
paste script that you copied into the window.
save.
open tampermonkey and activate Strat Sorted inventory.

Offline Lt_Anders

  • King
  • **********
  • Renown: 1049
  • Infamy: 651
  • cRPG Player Sir Black Pawn A Gentleman and a Scholar
  • Man, I still play this shit?
    • View Profile
    • Drowtales
  • Faction: Astralis
  • Game nicks: Anders_Astralis
Re: STB v2.0.8
« Reply #290 on: February 24, 2016, 12:13:25 am »
0
I updated the old "Strategus Sorted Inventory" with current item lists.  This does item sorting on inventory and faction pages, item counts in the inventory, and filtering the weapon store.  It works in chrome but I haven't had much luck with greasemonkey in firefox lately. 

Feel free to copy the item arrays if they'll work with your script, and let me know if anything doesn't sort correctly (until the next patch anyway)


So, it's not the script, but greasemonkey not getting it to work correctly in firefox?
Also, it's missing an @grant allowable(according to both tampermonkey and greasemonkey)
visitors can't see pics , please register or login

Offline Butan

  • King
  • **********
  • Renown: 1713
  • Infamy: 214
  • cRPG Player A Gentleman and a Scholar
  • Best tincan EU
    • View Profile
Re: STB v2.0.8
« Reply #291 on: February 26, 2016, 01:42:24 am »
+1
Feel free to copy the item arrays if they'll work with your script, and let me know if anything doesn't sort correctly (until the next patch anyway)


We are pretty far in the refactorisation but if there is some missteps we will gladly look at what you have done and at least compare and fill in.
Cool to see some guys with code skills still interested in strategus.

Offline Butan

  • King
  • **********
  • Renown: 1713
  • Infamy: 214
  • cRPG Player A Gentleman and a Scholar
  • Best tincan EU
    • View Profile
Re: STB v2.0.8
« Reply #292 on: March 04, 2016, 02:14:50 pm »
+2
Quick update: STB v3.0.0 soon ready  :mrgreen:

v3.0.0 = v2.0.8 features 100% working/compatible, no new ones AFAIA, code-ready for new features in further updates.
When v3.0.0 is ready and uploaded I will create a new thread, this should be the last post I do here.

v3.x.x will be when we start adding more goodies and pimp the shit out of the UI.

Offline njames89

  • the Old Leaf
  • Supreme Overlord
  • *******
  • Renown: 1488
  • Infamy: 457
  • cRPG Player
  • Deus vult, Dieu le veut, God wills it!
    • View Profile
  • Faction: Kingdom of Acre, The Holy Chadzian Empire
  • Game nicks: King James IV, John IV, Temujin of the Wolves, William III
Re: STB v2.0.8
« Reply #293 on: March 04, 2016, 02:20:34 pm »
0
Nice work! Looking forward to it!

Offline Butan

  • King
  • **********
  • Renown: 1713
  • Infamy: 214
  • cRPG Player A Gentleman and a Scholar
  • Best tincan EU
    • View Profile
Re: STB v2.0.8
« Reply #294 on: March 12, 2016, 03:36:52 pm »
+1
I've got those extensions but was just curious if I have to copy/paste the script that you linked to somewhere.  I just can't figure out how to install it.

I have ver 1.1 installed.  Is there a way to just update that to 2.2?

 I've got the older version (1.1) of STB working but it's not showing an "enter fief" button when the STB is active.


Since I recently had to install STB 3.0, I remember how you install the scripts  :D

For both Greasemonkey and Tampermonkey, you need to drag & drop the script file in the script list panel. It will ask you to install/activate the script, you say yes, and you can then unable/activate the script within the script list aswell (having strategus open helps). Delete all the other older scripts.

Should be last-last post here, doing some last minute job because 3.0 was not really finished when we looked at it hard  :mrgreen:
« Last Edit: March 12, 2016, 03:40:26 pm by Butan »

Offline Vovka

  • King
  • **********
  • Renown: 1174
  • Infamy: 240
  • cRPG Player Sir White Bishop A Gentleman and a Scholar
    • View Profile
  • Faction: Druzhina
  • Game nicks: Druzhina_Vovka
  • IRC nick: Vovka
Re: STB v2.0.8
« Reply #295 on: March 13, 2016, 06:53:28 pm »
0
wanna be allfatester!
visitors can't see pics , please register or login

Offline Sir_Frank

  • Knight
  • ***
  • Renown: 38
  • Infamy: 5
  • cRPG Player
    • View Profile
Re: STB v2.0.8
« Reply #296 on: March 13, 2016, 07:15:16 pm »
0
vovka what is the gif it makes me dizzy ........

Offline Vovka

  • King
  • **********
  • Renown: 1174
  • Infamy: 240
  • cRPG Player Sir White Bishop A Gentleman and a Scholar
    • View Profile
  • Faction: Druzhina
  • Game nicks: Druzhina_Vovka
  • IRC nick: Vovka
Re: STB v2.0.8
« Reply #297 on: March 13, 2016, 08:42:51 pm »
+1

his work on engl   :P
visitors can't see pics , please register or login

Offline Butan

  • King
  • **********
  • Renown: 1713
  • Infamy: 214
  • cRPG Player A Gentleman and a Scholar
  • Best tincan EU
    • View Profile
Re: STB v2.0.8
« Reply #298 on: March 13, 2016, 09:20:21 pm »
0
last-last-last post!

At the moment if I gave you alpha version, it would look more like a downgrade than an upgrade  :mrgreen:  some stuff very basic is not working  100% :P but we are very near!

Offline fosr

  • Knight
  • ***
  • Renown: 52
  • Infamy: 9
  • cRPG Player
  • Eucliwood Hellscythe
    • View Profile
Re: STB v2.0.8
« Reply #299 on: April 10, 2016, 12:02:49 pm »
0
I updated the old "Strategus Sorted Inventory" with current item lists.  This does item sorting on inventory and faction pages, item counts in the inventory, and filtering the weapon store.  It works in chrome but I haven't had much luck with greasemonkey in firefox lately. 

Feel free to copy the item arrays if they'll work with your script, and let me know if anything doesn't sort correctly (until the next patch anyway)

Thank you, but now it‘s not working with Tampermonkey v4.0.10, this is the latest version on Apr. 07.