// ==UserScript==
// @name Custom Item Namer combat mod
// @namespace http://www.wordowl.com/misc/
// @description Allows you to specify custom names for your items. Version forked from Custom Item namer 1.10.3
// @version 1.0.16
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_log
// @downloadURL http://users.netonecom.net/~azander/greasemonkey/custom_item_namer_combat_mod.user.js
// @updateURL http://users.netonecom.net/~azander/greasemonkey/meta/custom_item_namer_combat_mod.meta.js
// @include http://www.starpirates.net/*attack.php*
// @include http://www.starpirates.net/*inventory.php*
// @include http://www.starpirates.net/*itemmarket.php*
// @include http://www.starpirates.net/*itemguide.php*
// @include http://www.starpirates.net/*gangarmory.php*
// @include http://www.starpirates.net/*npcencounter*
// @include http://www.starpirates.net/*pickdebris*
// @include http://www.starpirates.net/*=searchagain*
// @include http://*starpirates.net/*equip.php*
// @include http://*starpirates.net/*sellitem.php*
// @exclude http://*starpirates.net/*forum*
// ==/UserScript==
////////////////////////////////////////////////////////////////////////////////////
// Config section
////////////////////////////////////////////////////////////////////////////////////
var Player_text = "Player weapons:";
var Opponent_text="Oppenent weapons:";
////////////////////////////////////////////////////////////////////////////////////
// End config section
////////////////////////////////////////////////////////////////////////////////////
var item = new Array();
item[0] = 'Weak Signal Laser';
item[1] = 'Laser Beam';
item[2] = 'Fusion Beam';
item[3] = 'Ion Pulse Heavy Cannon';
item[4] = 'Neutron Emitter Array';
item[5] = 'Graviton Beam';
item[6] = 'Pulsar Beam';
item[7] = 'Phaser Emitter';
item[8] = 'Plasma Cannon';
item[9] = 'Overamped Laser Battery';
item[10] = 'Fusion Blaster Array';
item[11] = 'Excalibur';
item[12] = 'Mjolnir';
item[13] = 'Smiter';
item[14] = 'AI Cycle Burst';
item[15] = 'Roll of Duct Tape';
item[16] = 'Regenabot Summoner';
item[17] = 'Signature Scrambler Circuit';
item[18] = 'Military Targeting Comp.';
item[19] = 'Phaser Emitter Array';
item[20] = 'Heavy Armor';
item[21] = 'Tritanium Armor';
item[22] = 'Xeortrium Armor';
item[23] = 'Depleted Uranium Plating';
item[24] = 'Linked Nanobot Casing';
item[25] = 'Gravitic Deflection Lens';
item[26] = 'Reflective Field Dynamo';
item[27] = 'Black Hole Generator';
item[28] = 'Inertial Neutraliser';
item[29] = 'AI-Enhanced Paradox of Galaxiana';
item[30] = 'Class I Energy Shield';
item[31] = 'Class III Energy Shield';
item[32] = 'Class V Energy Shield';
item[33] = 'Class VII Energy Shield';
item[34] = 'Class VIII Energy Shield';
item[35] = 'Class X Energy Shield';
item[36] = 'Mauler Array';
item[37] = 'Overwhelming Roguish Charm of Kane';
item[38] = 'Surgical Singularity';
item[40] = 'Class I Energy Technology';
item[41] = 'Class III Energy Technology';
item[43] = 'Class III Drive Unit';
item[44] = 'Class V Drive Unit';
item[45] = 'Class VII Drive Unit';
item[46] = 'Class X Drive Unit';
item[47] = 'Abhorrence Drive';
item[48] = 'Class VIII Drive Unit';
item[50] = 'Cyberlink AI';
item[51] = 'Efficient Cyberlink AI';
item[52] = 'Cyberpositronic AI';
item[60] = 'Diverter Mod';
item[61] = 'Alpha Centauri Rum';
item[62] = 'Finely Aged Alpha Centauri Rum';
item[63] = '1805 Walkin Whisky';
item[64] = 'Venusian Bars';
item[65] = 'C.O.A.L.';
item[66] = 'Letter of Marque';
item[67] = 'KramBuck';
item[68] = 'Eggnog';
item[69] = 'Sunburst Chardonnay';
item[70] = 'Stealth Drive Unit';
item[71] = 'Stealth Plating';
item[72] = 'Small Bomb';
item[73] = 'Pumpkin Bomb';
item[74] = 'Large Bomb';
item[75] = 'Galactic Wedding Cake';
item[76] = 'Graviton Beam Array';
item[77] = 'Class VI Stealth drive';
item[78] = 'Venusian Heart';
item[79] = 'Long-Use Computer Kludge';
item[80] = 'Crawler Cluster';
item[81] = 'AI Data Crystal';
item[82] = 'Starcrash Celebration Cake';
item[83] = 'Slip Stream Drive';
item[84] = 'Farcaster Integration Pack';
item[85] = 'Walkin Whisky Shot';
item[99] = 'AI Data Pack';
item[100] = 'Notorious for 1 week (7 days)';
item[101] = 'Notorious Day Token';
item[150] = 'Flare Spray Lance of Sunstrike';
item[210] = 'Fusion Blaster Array NOM';
item[211] = 'Depleted Uranium Plating - NOM';
item[212] = 'Plasma Cannon - NOM';
item[213] = 'Pulsar Beam - NOM';
item[214] = 'Class VII Energy Shield - NOM';
item[215] = 'Graviton Beam - NOM';
item[216] = 'Overamped Laser Battery - NOM';
item[217] = 'Class VII Drive Unit - NOM';
item[218] = 'Xeortrium Armor - NOM';
item[219] = 'Signature Scrambler Circuit - NOM';
item[220] = 'Linked Nanobot Casing - NOM';
item[221] = 'Class X Energy Shield - NOM';
item[222] = 'Class I Energy Technology - NOM';
item[223] = 'Class III Energy Technology - NOM';
item[224] = 'Cyberlink AI - NOM';
item[225] = 'Efficient Cyberlink AI - NOM';
item[226] = 'Cyberpositronic AI - NOM';
item[227] = 'Phaser Emitter - NOM';
item[228] = 'Military Targeting Comp. - NOM';
item[229] = 'Class VIII Energy Shield - NOM';
item[230] = 'Class VIII Drive Unit - NOM';
item[231] = 'Graviton Beam Array - NOM';
item[232] = 'Phaser Emitter Array NOM';
item[233] = 'Class VI Stealth Drive NOM';
item[234] = 'Class X Drive Unit - NOM';
item[235] = 'Gravitic Deflection Lens - NOM';
item[236] = 'Reflective Field Dynamo - NOM';
item[237] = 'Black Hole Generator - NOM';
item[238] = 'Inertial Neutraliser - NOM';
item[239] = 'Mauler Array - NOM';
item[450] = 'Class I Energy Technology - Mk I';
item[451] = 'Class I Energy Technology - Mk II';
item[452] = 'Class I Energy Technology - Mk III';
item[453] = 'Class I Energy Technology - Mk IV';
item[454] = 'Class I Energy Technology - Mk V';
item[455] = 'Phaser Emitter - Mk I';
item[456] = 'Phaser Emitter - Mk II';
item[457] = 'Phaser Emitter - Mk III';
item[458] = 'Phaser Emitter - Mk IV';
item[459] = 'Phaser Emitter - Mk V';
item[460] = 'Phaser Emitter Array - Mk I';
item[461] = 'Phaser Emitter Array - Mk II';
item[462] = 'Phaser Emitter Array - Mk III';
item[463] = 'Phaser Emitter Array - Mk IV';
item[464] = 'Phaser Emitter Array - Mk V';
item[465] = 'Class VIII Drive Unit - Mk I';
item[466] = 'Class VIII Drive Unit - Mk II';
item[467] = 'Class VIII Drive Unit - Mk III';
item[468] = 'Class VIII Drive Unit - Mk IV';
item[469] = 'Class VIII Drive Unit - Mk V';
item[470] = 'Cyberlink AI - Mk I';
item[471] = 'Cyberlink AI - Mk II';
item[472] = 'Cyberlink AI - Mk III';
item[473] = 'Cyberlink AI - Mk IV';
item[474] = 'Cyberlink AI - Mk V';
item[475] = 'Xeortrium Armor - Mk I';
item[476] = 'Xeortrium Armor - Mk II';
item[477] = 'Xeortrium Armor - Mk III';
item[478] = 'Xeortrium Armor - Mk IV';
item[479] = 'Xeortrium Armor - Mk V';
item[480] = 'Class VI Stealth Drive - Mk I';
item[481] = 'Class VI Stealth Drive - Mk II';
item[482] = 'Class VI Stealth Drive - Mk III';
item[483] = 'Class VI Stealth Drive - Mk IV';
item[484] = 'Class VI Stealth Drive - Mk V';
item[485] = 'Class VIII Energy Shield - Mk I';
item[486] = 'Class VIII Energy Shield - Mk II';
item[487] = 'Class VIII Energy Shield - Mk III';
item[488] = 'Class VIII Energy Shield - Mk IV';
item[489] = 'Class VIII Energy Shield - Mk V';
item[490] = 'Efficient Cyberlink AI - Mk I';
item[491] = 'Efficient Cyberlink AI - Mk II';
item[492] = 'Efficient Cyberlink AI - Mk III';
item[493] = 'Efficient Cyberlink AI - Mk IV';
item[494] = 'Efficient Cyberlink AI - Mk V';
item[495] = 'Military Targeting Comp. - Mk I';
item[496] = 'Military Targeting Comp. - Mk II';
item[497] = 'Military Targeting Comp. - Mk III';
item[498] = 'Military Targeting Comp. - Mk IV';
item[499] = 'Military Targeting Comp. - Mk V';
item[500] = 'Graviton Beam Array - Mk I';
item[501] = 'Graviton Beam Array - Mk II';
item[502] = 'Graviton Beam Array - Mk III';
item[503] = 'Graviton Beam Array - Mk IV';
item[504] = 'Graviton Beam Array - Mk V';
item[505] = 'Class X Energy Shield - Mk I';
item[506] = 'Class X Energy Shield - Mk II';
item[507] = 'Class X Energy Shield - Mk III';
item[508] = 'Class X Energy Shield - Mk IV';
item[509] = 'Class X Energy Shield - Mk V';
item[510] = 'Fusion Blaster Array - Mk I';
item[511] = 'Fusion Blaster Array - Mk II';
item[512] = 'Fusion Blaster Array - Mk III';
item[513] = 'Fusion Blaster Array - Mk IV';
item[514] = 'Fusion Blaster Array - Mk V';
item[515] = 'Depleted Uranium Plating - Mk I';
item[516] = 'Depleted Uranium Plating - Mk II';
item[517] = 'Depleted Uranium Plating - Mk III';
item[518] = 'Depleted Uranium Plating - Mk IV';
item[519] = 'Depleted Uranium Plating - Mk V';
item[520] = 'Plasma Cannon - Mk I';
item[521] = 'Plasma Cannon - Mk II';
item[522] = 'Plasma Cannon - Mk III';
item[523] = 'Plasma Cannon - Mk IV';
item[524] = 'Plasma Cannon - Mk V';
item[525] = 'Pulsar Beam - Mk I';
item[526] = 'Pulsar Beam - Mk II';
item[527] = 'Pulsar Beam - Mk III';
item[528] = 'Pulsar Beam - Mk IV';
item[529] = 'Pulsar Beam - Mk V';
item[530] = 'Class VII Energy Shield - Mk I';
item[531] = 'Class VII Energy Shield - Mk II';
item[532] = 'Class VII Energy Shield - Mk III';
item[533] = 'Class VII Energy Shield - Mk IV';
item[534] = 'Class VII Energy Shield - Mk V';
item[535] = 'Graviton Beam - Mk I';
item[536] = 'Graviton Beam - Mk II';
item[537] = 'Graviton Beam - Mk III';
item[538] = 'Graviton Beam - Mk IV';
item[539] = 'Graviton Beam - Mk V';
item[540] = 'Class VII Drive Unit - Mk I';
item[541] = 'Class VII Drive Unit - Mk II';
item[542] = 'Class VII Drive Unit - Mk III';
item[543] = 'Class VII Drive Unit - Mk IV';
item[544] = 'Class VII Drive Unit - Mk V';
item[545] = 'Overamped Laser Battery - Mk I';
item[546] = 'Overamped Laser Battery - Mk II';
item[547] = 'Overamped Laser Battery - Mk III';
item[548] = 'Overamped Laser Battery - Mk IV';
item[549] = 'Overamped Laser Battery - Mk V';
item[550] = 'Class III Energy Technology - Mk I';
item[551] = 'Class III Energy Technology - Mk II';
item[552] = 'Class III Energy Technology - Mk III';
item[553] = 'Class III Energy Technology - Mk IV';
item[554] = 'Class III Energy Technology - Mk V';
item[555] = 'Class X Drive Unit - Mk I';
item[556] = 'Class X Drive Unit - Mk II';
item[557] = 'Class X Drive Unit - Mk III';
item[558] = 'Class X Drive Unit - Mk IV';
item[559] = 'Class X Drive Unit - Mk V';
item[560] = 'Cyberpositronic AI - Mk I';
item[561] = 'Cyberpositronic AI - Mk II';
item[562] = 'Cyberpositronic AI - Mk III';
item[563] = 'Cyberpositronic AI - Mk IV';
item[564] = 'Cyberpositronic AI - Mk V';
item[565] = 'Linked Nanobot Casing - Mk I';
item[566] = 'Linked Nanobot Casing - Mk II';
item[567] = 'Linked Nanobot Casing - Mk III';
item[568] = 'Linked Nanobot Casing - Mk IV';
item[569] = 'Linked Nanobot Casing - Mk V';
item[570] = 'Reflective Field Dynamo - Mk I';
item[571] = 'Reflective Field Dynamo - Mk II';
item[572] = 'Reflective Field Dynamo - Mk III';
item[573] = 'Reflective Field Dynamo - Mk IV';
item[574] = 'Reflective Field Dynamo - Mk V';
item[575] = 'Gravitic Deflection Lens - Mk I';
item[576] = 'Gravitic Deflection Lens - Mk II';
item[577] = 'Gravitic Deflection Lens - Mk III';
item[578] = 'Gravitic Deflection Lens - Mk IV';
item[579] = 'Gravitic Deflection Lens - Mk V';
item[580] = 'Black Hole Generator - Mk I';
item[581] = 'Black Hole Generator - Mk II';
item[582] = 'Black Hole Generator - Mk III';
item[583] = 'Black Hole Generator - Mk IV';
item[584] = 'Black Hole Generator - Mk V';
item[585] = 'Inertial Neutraliser - Mk I';
item[586] = 'Inertial Neutraliser - Mk II';
item[587] = 'Inertial Neutraliser - Mk III';
item[588] = 'Inertial Neutraliser - Mk IV';
item[589] = 'Inertial Neutraliser - Mk V';
item[590] = 'Mauler Array - Mk I';
item[591] = 'Mauler Array - Mk II';
item[592] = 'Mauler Array - Mk III';
item[593] = 'Mauler Array - Mk IV';
item[594] = 'Mauler Array - Mk V';
item[605] = 'Signature Scrambler Circuit - Mk I';
item[606] = 'Signature Scrambler Circuit - Mk II';
item[607] = 'Signature Scrambler Circuit - Mk III';
item[608] = 'Signature Scrambler Circuit - Mk IV';
item[609] = 'Signature Scrambler Circuit - Mk V';
item[701] = 'Damage Control Protocol';
item[702] = 'Divert to Shields Protocol';
item[703] = 'Batten Down Protocol';
item[704] = 'Muffled Protocol';
item[705] = 'Targeting Protocol';
item[706] = 'AI Override Protocol';
item[707] = 'Quality Control Protocol';
item[708] = 'Phalanx Protocol';
item[709] = 'OverAMP Engines Protocol';
item[710] = 'OverAMP Gunnery Protocol';
item[731] = 'Anti-Espionage Protocol';
item[732] = 'False Flag Protocol';
item[733] = 'Health & Safety Protocol';
item[734] = 'Precision Firing Protocol';
item[735] = 'Efficient Engines Protocol';
item[736] = 'Advanced Phalanx Protocol';
item[741] = 'Fuel Max Protocol';
item[742] = 'Energy Max Protocol';
item[743] = 'Exact Firing Protocol';
item[744] = 'Science Fact Protocol';
item[745] = 'Hardened Phalanx Protocol';
item[746] = 'Advanced Efficient Engines Protocol';
item[800] = 'Advanced Combat Tactics';
item[801] = 'Trajectory Altering Enigma Routines';
item[900] = 'Celebratory Cigar';
item[1000] = 'Basic Control';
item[10001] = 'Eridanus';
item[10002] = 'Bootes';
item[10003] = 'Delphinus';
item[10004] = 'Draco';
item[10005] = 'Perseus';
item[10006] = 'Scutum';
item[10007] = 'Auriga';
item[10008] = 'Lyra';
item[10009] = 'Chamaeleon';
item[10010] = 'Pegasus';
item[10011] = 'Aquila';
item[10021] = 'Hydra';
item[10022] = 'Lupus';
item[10023] = 'Reticulum';
item[10024] = 'Orion';
item[10025] = 'Cygnus';
item[10031] = 'Cetus';
item[10032] = 'Cassiopeia';
item[10033] = 'Antlian';
item[10034] = 'Vulpecula';
item[10035] = 'Fornax';
item[10036] = 'Corvus';
item[10037] = 'Pavo';
item[10038] = 'Hercules';
var customitem = new Array();
for(var i in item) {
customitem[i] = GM_getValue('Name' + i, item[i]);
}
var lastitem = i;
var weapons = [594, 593, 592, 591, 590, 584, 583, 582, 581, 580, 579, 578, 577, 576, 575, 549, 548, 547, 546, 545, 539, 538, 537, 536, 535, 529, 528, 527, 526, 525, 524, 523, 522, 521, 520, 514, 513, 512, 511, 510, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 76, 29, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 18, 27, 36, 37, 38, 84, 150];
var armour = [569, 568, 567, 566, 565, 519, 518, 517, 516, 515, 479, 478, 477, 476, 475, 20, 21, 22, 23, 24, 71 ];
var shields = [574, 573, 572, 571, 570, 534, 533, 532, 531, 530, 509, 508, 507, 506, 505, 489, 488, 487, 486, 485, 30, 31, 32, 33, 34, 35, 25, 26 ];
var drives = [589, 588, 587, 586, 585, 559, 558, 557, 556, 555, 544, 543, 542, 541, 540, 484, 483, 482, 481, 480, 469, 468, 467, 466, 465, 43, 44, 45, 48, 46, 47, 70, 77, 28];
var labcoat = [564, 563, 562, 561, 560, 554, 553, 552, 551, 550, 494, 493, 492, 491, 490, 474, 473, 472, 471, 470, 454, 453, 452, 451, 450, 14, 40, 41, 50, 51, 52 ];
var misccons = [15, 16, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 75, 78, 79, 80, 82, 83, 85 ];
var otheritems = [609, 608, 607, 606, 605, 17, 72, 73, 74, 81, 99, 100, 101 ];
var noms = [210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239 ];
var protocols = [ 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 731, 732, 733, 734, 735, 736, 741, 742, 743, 744, 745, 746];
var neurals = [ 1000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009, 10010, 10011, 10021, 10022, 10023, 10024, 10025, 10031, 10032, 10033, 10034, 10035, 10036, 10037, 10038 ];
var regex1 = new RegExp("inventory|equip|sellitem");
var regex2 = new RegExp("itemmarket|gangarmory|pickdebris|searchagain");
var regex3 = new RegExp("itemguide");
var regex4 = new RegExp("attack");
var regex5 = new RegExp("npcencounter");
if (regex1.test(window.location.href)) {
// so we're in the inventory screen, let's add the button to rename items
// create a placeholder window
var div = document.createElement('div');
div.id = "spItemRenamerPopUp";
document.body.appendChild(div);
var table = xpath("//td[@class='contenthead']");
if(table.snapshotLength > 0) {
var tableitem = table.snapshotItem(0);
var a = document.createElement('a');
a.setAttribute('href', 'javascript:renameitems();');
a.innerHTML = "Rename items | ";
a.setAttribute('style', 'margin-left:2em;');
tableitem.appendChild(a);
renameInvScreen();
}
}
if (regex2.test(window.location.href)) {
renameInvScreen();
// should work fine on the Item market without changes
}
if (regex3.test(window.location.href)) {
renameItemGuide();
}
if (regex4.test(window.location.href)) {
renameAttack();
}
if (regex5.test(window.location.href)) {
renameNPC();
}
function renameInvScreen() {
var a = document.getElementsByTagName('a');
var re = /javascript:itemWindowFunction\(([0-9]+)\)/i;
for(var i = 0; i < a.length; i++) {
var hrf = a[i].getAttribute('href');
if(hrf != null) {
var result = hrf.match(re);
if(result != null) {
var itemid = parseInt(result[1]);
a[i].childNodes[0].data = customitem[itemid];
}
}
}
}
function renameItemGuide() {
var a = document.getElementsByTagName('a');
for(var i = 0; i < a.length; i++) {
var itemid = parseInt(a[i].getAttribute('name'));
if((itemid > 0) && (itemid <400)) {
a[i].childNodes[0].data = customitem[itemid];
}
}
}
function renameAttack() {
var table = xpath("//td[@class='contentcontent']");
var re = /(^You seriously damaged)|(> defeated you)/i;
var re_player = new RegExp('.?[^<]*HIT:(.[^<]+?) does','g');
var re_enemy = new RegExp('.?[^<]*HIT:(.[^<]+?) does','g');
var re_multiitem=new RegExp('([0-9]{1,2}) (.+)');
// var re_critical = new RegExp('CRITICAL \((.+?)\) HIT:(.?) does','g');
var segment = 0;
for(var i = table.snapshotLength-1; i > 0; i--) {
// first let's find it. Starting at the end, look for the one that has either "You seriously damaged" or "... defeated you"
var text = table.snapshotItem(i).innerHTML;
if(re.test(text)) {
segment = i - 1;
break;
}
}
if(segment >= 0) {
// we found it
var text = table.snapshotItem(segment).innerHTML;
var player = re_player.exec(text);
var enemy = re_enemy.exec(text);
// alert('player: '+player+'\r\n\r\nenemy: '+enemy);
if(player !=null) {
var pl_length=player.length;
for(p=1; p=0; y--) {
if( item[y] == player_weapons[x] ) {
if( nu[x] != undefined ) {
result[x]= nu[x]+' '+customitem[y];
} else {
result[x]= customitem[y];
}
break;
}
}
result_str+=need_comma+result[x];
need_comma=', ';
}
//result_str = weapons on hand after renaming (or un-renamed!)
player[p].innerHTML=player[p].replace(re_player_weapons,result_str);
}
result_str+='';
for(z=1; z < pl_length; z++) {
// table.snapshotItem(segment).innerHTML=text.replace(re_player_weapons," ");
text=text.replace(re_player_weapons," ");
}
var player_str=""+Player_text+" "+result_str+"
";
} else {
var player_str="";
}
if(enemy!=null) {
var en_length = enemy.length;
var re_enemy_weapons= new RegExp(enemy[1],"g");
for(z=1; z< en_length; z++) {
// table.snapshotItem(segment).innerHTML=text.replace(re_enemy_weapons," ");
text=text.replace(re_enemy_weapons," ");
}
var enemy_str=""+Opponent_text+""+enemy[1]+"
";
} else {
var enemy_str="";
}
table.snapshotItem(segment).innerHTML=player_str+enemy_str+text;
}
}
function renameNPC() {
var table = xpath("//td[@class='contentcontent']");
var re = /(is defeated\.)|(defeated you\.\s+Suddenly)/i;
var re_player = new RegExp('.?[^<]*HIT:(.[^<]+?) does','g');
var re_player2 = new RegExp('(.?[^<]*HIT:(.[^<]+?) does){1,}','g');
var re_enemy = new RegExp('.?[^<]*HIT:(.[^<]+?) does','g');
var re_multiitem=new RegExp('([0-9]{1,2}) (.+)');
var segment = 0;
for(var i = table.snapshotLength-1; i > 0; i--) {
// first let's find it. Starting at the end, look for the one that has either
//"You seriously damaged" or "... defeated you"
var text = table.snapshotItem(i).innerHTML;
if(re.test(text)) {
segment = i - 1;
break;
}
}
if(segment > 0) {
// we found it
var text = table.snapshotItem(segment).innerHTML;
// alert(text);
var player = re_player.exec(text);
var enemy = re_enemy.exec(text);
// alert('player: '+player+'\r\n\r\nenemy: '+enemy);
if(enemy!=null) {
var en_length=enemy.length;
// alert(enemy.length);
var enemy_str1=enemy[1];
var enemy_weapons=enemy[1];
for(z=1; z< text.length; z++) {
text=text.replace(enemy_str1,"");
}
// alert(text);
var enemy2 = re_enemy.exec(text);
// alert("enemy1:'"+enemy_str1+"'\r\n\r\nenemy2:'"+enemy2+"'");
if(enemy2!=null) {
var enemy_str2=enemy2[1];
enemy_weapons+=","+enemy2[1];
for(z=1; z< text.length; z++) {
text=text.replace(enemy_str2,"");
}
}
// alert(text);
var enemy_str=""+Opponent_text+" "+enemy_weapons+"
';
var toSort=new Array();
var j=-1;
for(var i in arr) {
j++;
toSort[j] = Array(item[arr[i]],arr[i]);
}
var new_list= bubbleSort(toSort);
for(i in new_list) {
var indx=parseInt(new_list[i][1]);
itemname = customitem[indx];
itemname = itemname.replace('"', '"');
thisoutput += '
';
div.innerHTML = finaloutput;
}, 0);
}
unsafeWindow.saveitems = function() {
window.setTimeout(function() {
var ok = 1;
for(var i in customitem) {
if(item[i] != null) {
var inp = document.getElementById('renameditem' + i);
var inptext = inp.value.replace(/^\s+|\s+$/g,"");
if(inptext == "") {
alert("You need to actually give the " + item[i] + " a name");
ok = 0;
break;
} else {
customitem[i] = inptext;
GM_setValue('Name' + i, inptext);
}
}
}
if(ok == 1) {
var e = document.getElementById('spItemRenamerPopUp').style.display = 'none';
renameInvScreen();
}
}, 0);
}
unsafeWindow.resetitems = function() {
window.setTimeout(function() {
if(confirm("Are you sure you want to reset all items back to their defaults?")) {
for(i in customitem) {
customitem[i] = item[i];
GM_setValue('Name' + i, item[i]);
}
var e = document.getElementById('spItemRenamerPopUp').style.display = 'none';
renameInvScreen();
}
}, 0);
}
function bubbleSort(array_to_sort) {
var i, hasSwapped=true;
while (hasSwapped) {
hasSwapped=false;
for(i=0; i