Script: Assault Odds - Version 2.0.6

The home of third-party tools and utilities that can enhance your Conquer Club experience.

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.4

Post by dgz345 »

anonymus wrote:added tampermonkey and the assult-odds shows up in lefthand menu-section but no window in the actual game, am i doing something wrong here? Mainly interested in the pathfinder..

/ :?:


I assume you are using firefox. (cause its working in chrome)

ill try to fix it. asap
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.4

Post by dgz345 »

you can fix it yourself by opening the code.

Click the tampermonkey icon in the top right corner.

then right click on assault odds

then there should be a line that says

Code: Select all

// @grant         none


change that to

Code: Select all

// @grant         unsafeWindow


a problem that i have right now is that first one makes it work in chrome while the 2nd one makes it work in FF...
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.4

Post by dgz345 »

Can also be fixed by changing the line

Code: Select all

if (!is_FF) unsafeWindow=window;


to

Code: Select all

unsafeWindow=window;


this works for both so ill push an update when i can.
User avatar
anonymus
Posts: 1579
Joined: Tue Apr 28, 2009 10:09 am
Location: Former DDR

Re: Script: Assault Odds - Version 2.0.4

Post by anonymus »

dgz345 wrote:you can fix it yourself by opening the code.

Click the tampermonkey icon in the top right corner.

then right click on assault odds

then there should be a line that says

Code: Select all

// @grant         none


change that to

Code: Select all

// @grant         unsafeWindow


a problem that i have right now is that first one makes it work in chrome while the 2nd one makes it work in FF...


NEAT! cheers mate i'll try it out!
/ :?:

Edit; worked like a charm!
/ :?:
[bigimg]https://u.cubeupload.com/SoNic11111/eb7ezgifcomgifmaker2023.gif[/bigimg]
[spoiler=BoganGod speaks the truth][/spoiler]
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.5

Post by dgz345 »

Updated to 2.0.5

Changes in version 2.0.5: by [player]dgz345[/player]
- Should work in Firefox with tampermonkey. (Might not work in greasemonkey anymore in this version)
Old version available at http://tools.conquerclub.com/assaultodds/versions/
User avatar
anonymus
Posts: 1579
Joined: Tue Apr 28, 2009 10:09 am
Location: Former DDR

Re: Script: Assault Odds - Version 2.0.5

Post by anonymus »

dgz345 wrote:Updated to 2.0.5

Changes in version 2.0.5: by [player]dgz345[/player]
- Should work in Firefox with tampermonkey. (Might not work in greasemonkey anymore in this version)
Old version available at http://tools.conquerclub.com/assaultodds/versions/


hmm now it actually stopped working..
and cant find this line of code anymore

if (!is_FF) unsafeWindow=window;

i'll try with old version and do the substitution again

/ :?:

EDIT; version 2.0.4 works when I do the @ grant substitution, dont know what got lost in the fix to 2.0.5

also one nitpicky thing is that it keep resetting to decimals instead of staying at %, works great when you reset it and refresh, just 1 more step per game ;)

/ :?:
[bigimg]https://u.cubeupload.com/SoNic11111/eb7ezgifcomgifmaker2023.gif[/bigimg]
[spoiler=BoganGod speaks the truth][/spoiler]
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.5

Post by dgz345 »

Post edited cause the information was not correct :geek:
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.5

Post by dgz345 »

I just sent away a version 2.0.6 to be uploaded. (may take a day or two as i no longer have access myself to the tools site)

apparently the settings in options was never loaded at all. so not just a firefox bug.

its been tested in both Chrome and Firefox with the options.
User avatar
dgz345
Posts: 1363
Joined: Thu Oct 07, 2010 10:53 am

Re: Script: Assault Odds - Version 2.0.6

Post by dgz345 »

It's updated!
User avatar
anonymus
Posts: 1579
Joined: Tue Apr 28, 2009 10:09 am
Location: Former DDR

Re: Script: Assault Odds - Version 2.0.6

Post by anonymus »

ok I know this last response is now 4 years old, however the last year it has not been working again for fire-fox..
I tried the update, also the down-grade and adding in the code, however no result.. (and im by no means any coder).
Anyone out there that could advice?

/ :?:
[bigimg]https://u.cubeupload.com/SoNic11111/eb7ezgifcomgifmaker2023.gif[/bigimg]
[spoiler=BoganGod speaks the truth][/spoiler]
Marta6578
Posts: 3
Joined: Tue Sep 26, 2023 3:05 am

Re: Script: Assault Odds - Version 2.0.6

Post by Marta6578 »

I used Assault Odds. It's really cool, I was able to work with a lot of armies. In my opinion, I make better decisions about when and where to attack. Here I read https://zcj.ro/utile/buget-inteligent-a ... 48861.html
Last edited by Marta6578 on Fri Dec 29, 2023 6:09 am, edited 1 time in total.
User avatar
anonymus
Posts: 1579
Joined: Tue Apr 28, 2009 10:09 am
Location: Former DDR

Re: Script: Assault Odds - Version 2.0.6

Post by anonymus »

The update is still not working..
I even tried it manually copying the script of a friend, where it does work..

outcome is still like this in-game.. so basically it registers, but doesn't load the interface.. any advice?

/ :?:

Image
[bigimg]https://u.cubeupload.com/SoNic11111/eb7ezgifcomgifmaker2023.gif[/bigimg]
[spoiler=BoganGod speaks the truth][/spoiler]
User avatar
Shannon Apple
Chatter
Chatter
Posts: 2182
Joined: Wed Jan 14, 2009 8:40 pm
Gender: Female
Location: Ireland

Re: Script: Assault Odds - Version 2.0.6

Post by Shannon Apple »

It wasn't updated recently. The other reply is from a spam bot.
I fixed this for myself. Just copy/paste it in. Should work.
Spoiler
// ==UserScript== // @name Conquer Club - Assault Odds // @version 2.0.6 // @namespace http://tools.conquerclub.com/ // @description Calculates available attack routes and odds // @match http*://*.conquerclub.com*/game.php* // ==/UserScript== var version = "2.0.6"; var forumUrl = "http://www.conquerclub.com/forum/viewtopic.php?f=527&t=202003"; var scriptUrl = "http://tools.conquerclub.com/assaultodds/versions/latest/main.user.js"; var cast = GM_getValue("cast",1); var display = GM_getValue("display",7); var features=[]; var mapName = document.getElementById('outer-map').style.backgroundImage; var is_panel = document.getElementById('console_bottom')!==null?true:false; var cMode = "attached"; if(mapName.match(/conquerclub.com\/(.+?)\./)) { mapName = RegExp.$1; } var logDiv = document.getElementById('log'); var dashboard = document.getElementById('dashboard'); var armiesarray = []; var owners = []; var path = []; var conq = []; var steps = []; var bds = []; var bmb = []; var terr = []; var copy = []; var qcalcs = []; var owner; var proto; var deploy = 0; var qcalc = 1; var cols = new Array('#000','#f00','#009a04','#00f','#cc0','#f0f','#0cc','#f92','#7f7f7f'); var attacking = {'11' : 15/36,'12' : 55/216, '21' : 125/216,'22' : 295/1296,'31' : 855/1296,'32' : 2890/7776}; var defending = {'11' : 21/36,'12' : 161/216,'21' : 91/216, '22' : 581/1296,'31' : 441/1296,'32' : 2275/7776}; var splitting = {'11' : 0,'12' : 0,'21' : 0,'22' : 420/1296,'31' : 0,'32' : 2611/7776}; var displays = ["Quick Calc", "Pathfinder", "Statistics"]; var bombard = 0; var Stack = []; var Stats = []; var compiled; var qcomps = []; var sref; var map; function Survived(size,blanks,duds) { this._min = new Array(size); for(var m=0; m<(size); m++) { this._min[m] = 0; } this._odds = 0; this._blanks = blanks; this._duds = duds; } function cleanup() { Stack = null; Stats = null; } function defence(des,deduct) { var newDefs = []; if(deduct > 0) newDefs[0] = des[0] - deduct; for(var i=1; i<des.length; i++) { newDefs.push(des[i]); } return newDefs; } function formatOdds(odds) { var prob = odds; if(!cast) prob = (100 * prob).toFixed(1) + "%"; return prob; } function bubble(parent,ab,dbs,dc,rm) { var sv = checkStackStats(ab,dbs,dc,rm); parent._odds += sv._odds * dc; for(var y=0; y<sv._min.length;y++) { parent._min[y] += dc * sv._min[y]; } } function bubbled(parent,abs,dbs,dc,rm) { var sv = checkStackedStats(abs,dbs,dc,rm); parent._odds += sv._odds * dc; for(var y=0; y<sv._min.length;y++) { parent._min[y] += dc * sv._min[y]; } } function checkStack(f,c,d) { if(Stack[f] && Stack[f][c.toString()]) return (d * Stack[f][c.toString()]); else return (d * conquest(f,c)); } function checkStacked(f,c,d) { if(Stack[f.toString()] && Stack[f.toString()][c.toString()]) return (d * Stack[f.toString()][c.toString()]); else return (d * overwhelm(f,c)); } function checkStackStats(f,c,d,r) { if(Stats[f] && Stats[f][c.toString()]) return (Stats[f][c.toString()]); else return (conquestStats(f,c,r)); } function checkStackedStats(f,c,d,r) { if(Stats[f.toString()] && Stats[f.toString()][c.toString()]) return (Stats[f.toString()][c.toString()]); else return (overwhelmStats(f,c,r)); } function conquest(a,ds) { if(!Stack[a]) Stack[a] = []; var d = ds[0]; var ad = (a>4)? 3:a-1; var dd = (d>1)?2:d; var dice = ad + '' + dd; var loss = (ad<dd)? ad:dd; var a1 = 0; if(loss){ if(a - loss > ds.length) a1 += checkStack(a-loss,ds,defending[dice]); if(d == loss) { if(ds.length == 1) a1 += attacking[dice]; else a1 += checkStack(a-1,defence(ds,0),attacking[dice]); } else a1 += checkStack(a,defence(ds,loss),attacking[dice]); if(splitting[dice] && (a-1 > ds.length)) a1 += checkStack(a-1,defence(ds,1),splitting[dice]); } Stack[a][ds.toString()] = a1; return a1; } function overwhelm(as,ds) { if(!Stack[as.toString()]) Stack[as.toString()] = []; var a = as[0]; var d = ds[0]; var ad = (a>4)? 3:a-1; var dd = (d>1)?2:d; var dice = ad + '' + dd; var loss = (ad<dd)? ad:dd; var a1 = 0; if(loss) { if(a -1 == loss) { if(as.length == 2) a1 += checkStack(as[1],ds,defending[dice]); else a1 += checkStacked(defence(as,0),ds,defending[dice]); } else a1 += checkStacked(defence(as,loss),ds,defending[dice]); if(d == loss) { if(ds.length == 1) a1 += attacking[dice]; else a1 += checkStack(a - 1,defence(ds,0),attacking[dice]); } else a1 += checkStacked(as,defence(ds,loss),attacking[dice]); if(splitting[dice]) { if(a>2) a1 += checkStacked(defence(as,1),defence(ds,1),splitting[dice]); else { if(as.length == 2) a1 += checkStack(as[1],defence(ds,1),splitting[dice]); else a1 += checkStacked(defence(as,0),defence(ds,1),splitting[dice]); } } } Stack[as.toString()][ds.toString()] = a1; return a1; } function conquestStats(a,ds,rem) { if(!Stats[a]) Stats[a] = []; if(!Stats[a][ds.toString()]) Stats[a][ds.toString()] = new Survived(a+rem,ds.length,1); var d = ds[0]; var ad = (a>4)? 3:a-1; var dd = (d>1)?2:d; var dice = ad + '' + dd; var loss = (ad<dd)? ad:dd; if(loss){ if(a - loss > ds.length) bubble(Stats[a][ds.toString()],a-loss,ds,defending[dice],rem); if(d == loss) { if(ds.length == 1) { Stats[a][ds.toString()]._odds += attacking[dice]; for(var y=0;y<a+rem; y++) { Stats[a][ds.toString()]._min[y] += attacking[dice]; } } else bubble(Stats[a][ds.toString()],a-1,defence(ds,0),attacking[dice],rem+1); } else bubble(Stats[a][ds.toString()],a,defence(ds,loss),attacking[dice],rem); if(splitting[dice] && (a-1 > ds.length)) bubble(Stats[a][ds.toString()],a-1,defence(ds,1),splitting[dice],rem); } return Stats[a][ds.toString()]; } function overwhelmStats(as,ds,rem) { if(!Stats[as.toString()]) Stats[as.toString()] = []; var atot=0; for(var cb=0; cb<as.length; cb++) { atot += as[cb]; } if(!Stats[as.toString()][ds.toString()]) Stats[as.toString()][ds.toString()] = new Survived(atot + rem,ds.length,as.length); var a = as[0]; var d = ds[0]; var ad = (a>4)? 3:a-1; var dd = (d>1)?2:d; var dice = ad + '' + dd; var loss = (ad<dd)? ad:dd; if(loss) { if(a -1 == loss) { if(as.length == 2) bubble(Stats[as.toString()][ds.toString()],as[1],ds,defending[dice],rem+1); else bubbled(Stats[as.toString()][ds.toString()],defence(as,0),ds,defending[dice],rem+1); } else bubbled(Stats[as.toString()][ds.toString()],defence(as,loss),ds,defending[dice],rem); if(d == loss) { if(ds.length == 1) { Stats[as.toString()][ds.toString()]._odds += attacking[dice]; for(var y=0;y<atot+rem; y++) { Stats[as.toString()][ds.toString()]._min[y] += attacking[dice]; } } else bubble(Stats[as.toString()][ds.toString()],a-1,defence(ds,0),attacking[dice],rem +1 + atot - a); } else bubbled(Stats[as.toString()][ds.toString()],as,defence(ds,loss),attacking[dice],rem); if(splitting[dice]) { if(a>2) bubbled(Stats[as.toString()][ds.toString()],defence(as,1),defence(ds,1),splitting[dice],rem); else { if(as.length == 2) bubble(Stats[as.toString()][ds.toString()],as[1],defence(ds,1),splitting[dice],rem+1); else bubbled(Stats[as.toString()][ds.toString()],defence(as,0),defence(ds,1),splitting[dice],rem+1); } } } return Stats[as.toString()][ds.toString()]; } function addSelect(tid,eid) { if(tid) { var pid = parseInt(eid.split('i')[1]); path = path.splice(0,pid); path.push(terr[tid]); setTable(); } } function addPath(ind) { if(ind) { var opp = []; for(var s=1; s<steps.length; s++) { opp.push(armiesarray[steps[s]]); } var prob; if(display & (1 << 2)) { compiled = checkStackStats(armiesarray[path[0]] + deploy, opp,1,0); prob = formatOdds(compiled._odds); } else prob = formatOdds(checkStack(armiesarray[path[0]] + deploy, opp,1)); var html = "<td><span class=\"player" + owners[path[ind]] + "\">" + path[ind] + " (" + armiesarray[path[ind]] + ")</span></td><td>" + prob + "</td></tr>"; } else{ html = "<td><span class=\"player" + owners[path[0]] + "\">" + path[0] + " (" + (armiesarray[path[0]] + deploy) + ")</span></td><td> </td></tr>";} if(bombard) { html += "<tr><td> </td><td>No More Attacks</td>"; return html; } var uihtml = "<tr><td> </td><td><select id=\"ui" + (ind + 1) + "\"><option value=\"\">To</option>"; var valid = 0; bds[path[ind]].sort(); for(var d=0; d<bds[path[ind]].length; d++) { if(steps.indexOf(bds[path[ind]][d]) == -1 && owners[bds[path[ind]][d]] != owner) { var sel = (path.length > ind && bds[path[ind]][d] == path[ind+1]) ? ' selected' : ''; uihtml += "<option" + sel + " style=\"font-weight:bold;color:" + cols[owners[bds[path[ind]][d]]] + "\" value=\"" + terr.indexOf(bds[path[ind]][d]) + "\">" + bds[path[ind]][d] + " (" + armiesarray[bds[path[ind]][d]] + ")</option>"; valid++; } } bmb[path[ind]].sort(); for(var d1=0; d1<bmb[path[ind]].length; d1++) { if(steps.indexOf(bmb[path[ind]][d1]) == -1 && owners[bmb[path[ind]][d1]] != owner) { var sel1 = (path.length > ind && bmb[path[ind]][d1] == path[ind+1]) ? ' selected' : ''; uihtml += "<option" + sel1 + " style=\"font-weight:bold;color:" + cols[owners[bmb[path[ind]][d1]]] + "\" value=\"" + terr.indexOf(bmb[path[ind]][d1]) + "\">" + bmb[path[ind]][d1] + " (" + armiesarray[bmb[path[ind]][d1]] + ")</option>"; valid++; if(sel1 !== '') bombard = 1; } } if(valid)html += uihtml + "</select></td>"; else html += "<tr><td> </td><td>No More Attacks</td>"; return html; } function showHide() { for(var t=0; t<displays.length; t++) { document.getElementById('dispdiv' + t).style.display = ((display & (1<<t)) ? "" : "none"); } } function getArmies() { owners = []; armiesarray = []; var armies; var spread = document.getElementById('armies').innerHTML; if(spread) { armies = eval("(" + spread + ")"); for(var a=0; a<armies.length;a++) { owners[terr[a]] = parseInt(armies[a]["player"]); var q = parseInt(armies[a]["quantity"]); armiesarray[terr[a]] = (q==-1)? 0: q; } } else{ var s = document.getElementsByTagName('script'); for(var sx=0; sx<s.length; sx++) { if(s[sx].innerHTML.match(/armies = (.+?);/)) { armies = eval("(" + RegExp.$1 + ")"); for(var a1=0; a<armies.length;a1++) { owners[terr[a1]] = parseInt(armies[a1]["player"]); var q1 = parseInt(armies[a1]["quantity"]); armiesarray[terr[a1]] = (q1==-1)? 0: q1; } } } } } function setStats() { var shtml = "<table class=\"listing\" border=\"1\" rules=\"all\"><thead><tr><th colspan=\"3\">Statistics</th></tr></thead><tbody><tr><td># Surviving Attackers</td><td>Exactly This # Survive</td><td>Minimum This # Survive</td></tr>"; var exact,rc; if(compiled) { for(var s=(compiled._blanks + compiled._duds - 1); s<compiled._min.length - 1; s++) { exact = compiled._min[s] - compiled._min[s+1]; rc = (s & 1) ? "<tr class=\"odd\">" : "<tr class=\"even\">"; shtml += rc + "<td>" + (s+1) + "</td><td>" + formatOdds(exact) + "</td><td>" + formatOdds(compiled._min[s]) + "</td></tr>"; } rc = ((compiled._min.length-1) & 1) ? "<tr class=\"odd\">" : "<tr class=\"even\">"; shtml += rc + "<td>" + (compiled._min.length) + "</td><td>" + formatOdds(compiled._min[compiled._min.length-1]) + "</td><td>" + formatOdds(compiled._min[compiled._min.length-1]) + "</td></tr>"; shtml += "</tbody></table>"; } document.getElementById('dispdiv2').innerHTML = shtml; } function validateQcalc(name,id,min) { var qc = document.getElementById(id); var dstring = qc.value.split(','); var pint = []; for(var g=0; g<dstring.length;g++) { pint[g] = parseInt(dstring[g]); if(isNaN(pint[g]) || pint[g] < min) { pint = []; break; } } if(!pint.length) { qc.value = ''; alert(name + " armies must be one or more numbers > " + (min - 1) + " separated by commas"); } return pint; } function setTable() { var thtml=""; if (is_panel) { thtml = "<div id=\"panelheader_odds\" class=\"panelheader\">Assault Odds</div>"; thtml += "<div title=\"Move\" id=\"paneltogglewrapper_odds\" onclick=\"togglePanels()\" class=\"settingslinks\" style=\"position:absolute;z-index:999;right:10px;top:-8px;\"><a id=\"paneltoggle_odds\"><img width=\"18\" src=\"/static/icons/button-move2.png\"></a></div>"; } thtml += "<div id=\"dispdiv0\"><table class=\"listing\" border=\"1\" rules=\"rows\"><thead><tr><th colspan=\"4\">Quick Calc</th></tr></thead><tbody>"; var valt = ' '; if(document.getElementById('qtotal')) valt = document.getElementById('qtotal').innerHTML; for(var q=0; q<qcalc; q++) { var vala = ''; var vald = ''; var valq = ' '; if(document.getElementById('qatt' + q) && document.getElementById('qatt' + q).value) vala = " value=\"" + document.getElementById('qatt' + q).value + "\" "; if(document.getElementById('qdef' + q) && document.getElementById('qdef' + q).value) vald = " value=\"" + document.getElementById('qdef' + q).value + "\" "; if(document.getElementById('quick' + q)) valq = document.getElementById('quick' + q).innerHTML; thtml += "<tr><td>Attackers <input size=\"5\" id=\"qatt" + q + "\" width=\"100px\" type=\"text\" " + vala + "/></td><td>Defenders <input id=\"qdef" + q + "\" type=\"text\" size=10 " + vald + "/></td>"; thtml += "<td><input id=\"calc" + q + "\" type=\"button\" value=\"Odds\"/></td><td width=\"150px\" id=\"quick" + q + "\">" + valq + "</td></tr>"; } thtml += "<tr><td><input type=\"button\" value=\"Add Calc\" id=\"qadd\" /></td><td><b style=\"font-size:10px\">Separate attacker/defender numbers with commas</b></td><td>Total: </td><td id=\"qtotal\">" + valt + "</td></tr></tbody></table></div>"; thtml += "<div id=\"dispdiv1\"><table class=\"listing\" border=\"1\" rules=\"all\"><thead><tr><th colspan=\"5\">Pathfinder</th></tr></thead><tbody><tr><td>Deploy</td><td>Territory</td><td style=\"width:200px;\">Attack Path</td><td style=\"width:100px;\">Odds</td><td> </td></tr>"; thtml += "<tr><td><input size=\"5\" id=\"deploy\" type=text value=\"" + deploy + "\" /></td><td><select style=\"width:200px;\" id=\"ui0\"><option value=\"\">From</option>"; for(var d=0; d<copy.length; d++) { if(owners[copy[d]] > 0) { var sel = (path.length && copy[d] == path[0]) ? ' selected' : ''; thtml += "<option" + sel + " style=\"font-weight:bold;color:" + cols[owners[copy[d]]] + "\" value=\"" + terr.indexOf(copy[d]) + "\">" + copy[d] + " (" + armiesarray[copy[d]] + ")</option>"; } } thtml += "</select></td>"; if(path.length) owner = owners[path[0]]; steps = []; bombard = 0; for(var p=0; p<path.length; p++) { steps.push(path[p]); thtml +=addPath(p); } thtml += "<td> </td><td> </td><td><input type=\"button\" id=\"pref\" value=\"Refresh\" /></td></tr></tbody></table></div>"; thtml += "<div id=\"dispdiv2\"></div>"; if (!is_panel) { thtml = "<H3>Assault Odds</H3>" + thtml; } document.getElementById('console_odds').innerHTML = thtml; setStats(); document.getElementById('ui0').addEventListener('change', function() { addSelect(this.options[this.selectedIndex].value, this.id); }, true); document.getElementById('pref').addEventListener('click', function() { getArmies(); if(owners[path[0]] == owner) { var valid = 1; var last = 0; for(var f=1; f<path.length; f++) { if(owners[path[f]] == owner && owners[path[f-1]] != owner) { valid = 0; break; } if(owners[path[f]] == owner) last = f; } if(valid) { if(last > 0) { for(var r=0; r<last; r++) { path.shift(); } } } else path = []; } else path = []; setTable(); }, true); document.getElementById('deploy').addEventListener('change', function() { if(isNaN(this.value)) this.value = 0; deploy = parseInt(this.value); getArmies(); setTable(); }, true); document.getElementById('qadd').addEventListener('click', function() { qcalc++; setTable(); }, true); for(q=0; q<qcalc; q++) { document.getElementById('qatt' + q).addEventListener('keypress', function(event) { event.stopPropagation(); }, false); document.getElementById('qatt' + q).addEventListener('keyup', function(event) { event.stopPropagation(); }, false); document.getElementById('qdef' + q).addEventListener('keypress', function(event) { event.stopPropagation(); }, false); document.getElementById('qdef' + q).addEventListener('keyup', function(event) { event.stopPropagation(); }, false); document.getElementById('calc' + q).addEventListener('click', function() { var ind = this.id.split('alc')[1]; var aint = validateQcalc("Attacking", 'qatt' + ind,2); var dint = validateQcalc("Defending", 'qdef' + ind,1); if(aint.length && dint.length){ var total = 1; if(aint.length == 1) { if(display & (1<<2)) { compiled = checkStackStats(aint[0],dint,1,0); qcalcs[ind] = compiled._odds; } else qcalcs[ind] = (checkStack(aint[0],dint,1)); } else { if(display & (1<<2)) { compiled = checkStackedStats(aint,dint,1,0); qcalcs[ind] = compiled._odds; } else qcalcs[ind] = (checkStacked(aint,dint,1)); } for(var qr=0; qr<qcalc; qr++) { total *= qcalcs[qr]; } document.getElementById('quick' + ind).innerHTML = formatOdds(qcalcs[ind]); document.getElementById('qtotal').innerHTML = formatOdds(total); setStats(); } else document.getElementById('quick' + ind).innerHTML = ''; }, true); } for(p=1;p<path.length+1;p++) { if(document.getElementById('ui' + p)) { document.getElementById('ui' + p).addEventListener('change', function() { addSelect(this.options[this.selectedIndex].value, this.id); }, true); } } showHide(); } function showMenu() { var gmMenu = document.createElement('div'); gmMenu.id="ass"; var html = "<h3><b>Assault Odds <span style='font-size:7pt;' ><a href='" +forumUrl+"'>" + version + "</a></span></b></h3>"; gmMenu.innerHTML = html; ul[0].parentNode.appendChild(gmMenu); ul = document.createElement ('ul'); ul.style.borderWidth = "1px 1px 0px 1px"; var inner = "<li><a href=\"javascript:void(0);\" onclick=\"document.getElementById('castopt').style.display=(document.getElementById('castopt').style.display == ''? 'none':'');\"><span>Options</span></a></li>"; inner += "<div id=\"castopt\" style=\"display:none\">"; inner+= "<b>Format</b><br />"; inner += "<input id=\"casting1\" type=\"radio\" name=\"casting\"" + ((cast)? " checked":"") + ">Decimal<br />"; inner += "<input id=\"casting2\" type=\"radio\" name=\"casting\"" + ((cast)? "":" checked") + ">Percentage<br />"; inner += "<li></li><b>Display</b><br />"; for(var t=0; t<displays.length; t++) { inner += "<input id=\"disp" + t + "\" type=\"checkbox\" value=\"" + t + "\"" + ((display & (1<<t)) ? " checked":"") + " />" + displays[t] + "<br />"; } inner += "<li></li></div>"; ul.innerHTML = inner; gmMenu.appendChild(ul); document.getElementById('casting1').addEventListener("click" , function () { cast = (this.checked === true)? 1:0; GM_setValue('cast',cast); }, true); document.getElementById('casting2').addEventListener("click" , function () { cast = (this.checked === true)? 0:1; GM_setValue('cast',cast); }, true); for(var t1=0; t<displays.length; t1++) { document.getElementById('disp' + t1).addEventListener("click" , function () { for (var u=0; u< displays.length; u++){ if (document.getElementById('disp' + u).checked===true) display |= 1 << document.getElementById('disp' + u).value; else display &= ~( 1 << document.getElementById('disp' + u).value); } GM_setValue('display',display); showHide(); }, true); } checkForUpdate(); } function checkForUpdate() { var lastversion = GM_getValue('lastupdate', 0); if (lastversion < new Date().getTime() - 60*60*1000) { GM_setValue('lastupdate', new Date().getTime() + ""); GM_xmlhttpRequest({ method: 'GET', url: forumUrl, onload: updateServerNumber }); } else { updateOptionsMenu(); } } function updateServerNumber(response) { try { var serverVersion = /version\s+(\d+.\d+.\d+)/.exec(response.responseText)[1]; GM_setValue('updateavailable', serverVersion); updateOptionsMenu(); }catch(e){} } function isNewVersion() { var serverVersion = GM_getValue('updateavailable', false); if (serverVersion) { var newVersion = serverVersion.split('.').map(function(string) { return parseInt(string,10); }); var thisVersion = version.split('.').map(function(string) { return parseInt(string,10); }); return (newVersion[0]>thisVersion[0] || (newVersion[0]==thisVersion[0] && (newVersion[1]>thisVersion[1] || (newVersion[1]==thisVersion[1] && newVersion[2]>thisVersion[2])))); } return false; } function updateOptionsMenu() { var cgMenu = document.getElementById("ass"); var ul = document.createElement('ul'); ul.style.borderWidth = "0px 1px 0px 1px"; var source = scriptUrl; if(isNewVersion()) { ul.innerHTML = "<li><a id=\"assVersionInfo\" href=" + source + "><span class=\"attention\">New Update Available</span></a></li>"; cgMenu.appendChild(ul); } else { ul.innerHTML = "<li><a id=\"assVersionInfo\" href=" + source + "><span>Latest Version Installed</span></a></li>"; cgMenu.appendChild(ul); } /*var ftext = features.join("\n"); document.getElementById('cgVersionInfo').addEventListener("click" , function () { alert('New version features\n' + ftext); },true);*/ } var leftBar = document.getElementById("leftColumn"); if(leftBar) { var ul = leftBar.getElementsByTagName("ul"); if (ul[0]) { proto = window.location.protocol; showMenu(); } } GM_addStyle("#console_odds {padding: 5px;} #console_odds table {background-color:#eee} #console_odds table {font-weight:bold;text-align:center}"); window.addEventListener("unload" , cleanup, false); if(document.getElementById('action-form')) { var s = document.getElementsByTagName('script'); for(var sx=0; sx<s.length; sx++) { if(s[sx].innerHTML.match(/map = (.+?);/)) { map = eval("(" + RegExp.$1 + ")"); for(var a=0; a<map["countries"].length;a++) { terr.push(map["countries"][a]["name"]); } for(var a1=0; a1<map["countries"].length;a1++) { var name = map["countries"][a1]["name"]; bds[name] = []; bmb[name] = []; for(var j=0; j<map["countries"][a1]["borders"].length; j++) { bds[name].push(terr[map["countries"][a1]["borders"][j]]); } for(var j1=0; j1<map["countries"][a1]["bombardments"].length; j1++) { bmb[name].push(terr[map["countries"][a1]["bombardments"][j1]]); } } copy = terr.slice(); copy.sort(); getArmies(); var div = document.createElement('div'); div.id = "console_odds"; var panelLocation = document.getElementById('console_container'); if (is_panel) { div.style.position = "relative"; div.style.width = "auto"; div.style.display="none"; div.className="attachedpanel"; div.paddingBottom="10px"; var panelnav = "<li id=\"panel_nav_odds\" class=\"\"><a href=\"javascript:void 0;\" onclick=\"toggle_console('odds');\"><span id=\"panel_nav_text_odds\">Odds</span></a></li>"; document.getElementById('invertedtabs').childNodes[1].innerHTML += panelnav; GM_addStyle("#dispdiv0 table,#dispdiv1 table,#dispdiv2 table {height:50px;} #console_odds select {width:200px} #dispdiv1 input {valign:middle}"); panelLocation.insertBefore(div, panelLocation.lastChild); panels.push('odds'); panelnames.push('Assault Odds'); var loadValue = GM_getValue("oddsLoc"); if(typeof(loadValue) != "undefined") { cMode=loadValue; } myOptions.panels[panels.indexOf('odds')]=["odds",cMode]; } else { div.innerHTML = "<H3>Assault Odds</H3>"; GM_addStyle("#dispdiv0 table,#dispdiv1 table,#dispdiv2 table {height:50px;width:650px} #console_odds select {width:200px} #dispdiv1 input {valign:middle}"); dashboard.parentNode.insertBefore(div, document.getElementById('action-form').nextSibling); } setTable(); if (is_panel) { (function() { var oldVersion = this.updatePanels; this.updatePanels = function() { var result = oldVersion.apply(this, arguments); GM_setValue("oddsLoc",myOptions.panels[panels.indexOf('odds')][1]); }; })(); if (myOptions.panelSelected=="odds") toggle_console('odds'); togglePanels(); } break; } } }
00:33:53 ‹riskllama› will her and i ever hook up, LLT???
00:34:09 ‹LiveLoveTeach› You and Shannon?
00:34:20 ‹LiveLoveTeach› Bahahahahahaha
00:34:22 ‹LiveLoveTeach› I doubt it
00:34:30 ‹LiveLoveTeach› I don't think she's into farm animals
User avatar
Shannon Apple
Chatter
Chatter
Posts: 2182
Joined: Wed Jan 14, 2009 8:40 pm
Gender: Female
Location: Ireland

Re: Script: Assault Odds - Version 2.0.6

Post by Shannon Apple »

I got this working for a while by editing the script, and then it didn't work. LOL!
00:33:53 ‹riskllama› will her and i ever hook up, LLT???
00:34:09 ‹LiveLoveTeach› You and Shannon?
00:34:20 ‹LiveLoveTeach› Bahahahahahaha
00:34:22 ‹LiveLoveTeach› I doubt it
00:34:30 ‹LiveLoveTeach› I don't think she's into farm animals
lucami
Posts: 2
Joined: Thu Jan 04, 2024 2:09 pm

Re: Script: Assault Odds - Version 2.0.6

Post by lucami »

Hello. I'm new here. Now I'm trying to understand how to play successfully
Post Reply

Return to “Third-Party Tools & Enhancements”