ConquerStats - Ingame analysis

The storehouse of handy and helpful plugins/addons and webpages.

Moderators: Global Moderators, Tech Team

Forum rules
Please read the Community Guidelines before posting.

Re: ConquerStats - Ingame analysis

Postby pamoa on Fri Jan 02, 2009 11:38 am

cspare wrote:New features are:
- There now is a setting to define where ConquerStats should appear on the screen: Above to gamelog or Below the gamechat

cool, great, perfect, nice, thanks, happy new year :P
de gueules à la tour d'argent ouverte, crénelée de trois pièces et donjonnée d'un donjon ajouré, crénelé de deux pièces
Image
User avatar
Sergeant 1st Class pamoa
 
Posts: 1207
Joined: Sat Sep 01, 2007 3:18 am
Location: Confederatio Helvetica
Medals: 57
Standard Achievement (4) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (2) Manual Troops Achievement (3) Freestyle Achievement (2) Polymorphic Achievement (1) Nuclear Spoils Achievement (2)
Fog of War Achievement (4) Trench Warfare Achievement (2) Speed Achievement (4) Teammate Achievement (2) Random Map Achievement (2)
Cross-Map Achievement (4) Beta Map Achievement (1) Ratings Achievement (4) Tournament Achievement (1) Clan Achievement (8)
Map Contribution (3)

Re: ConquerStats - Ingame analysis

Postby cspare on Sun Jan 04, 2009 3:15 pm

I've just uploaded version 1.5.0 of the script.
Download it here.

New features are:
- The reinforcements table now shows the same stat types as the chart: Reinforcements, Bonus, Territory Bonus and Spoils (which was in previous version: Regular Reinforcements, Cashed Cards Armies, Cards Bonusses);
- Fixed strike through style for eliminated players;
- The version update check now only checks once per browser session, instead of every page view;
- Some minor lingo changes (e.g. change Attack to Assault).
Sergeant 1st Class cspare
 
Posts: 101
Joined: Sun Apr 08, 2007 12:56 pm
Medals: 8
Standard Achievement (1) Doubles Achievement (1) General Contribution (6)

Re: ConquerStats - Ingame analysis

Postby AceArtemis on Sun Jan 25, 2009 1:31 am

This is not a major problem, but the word "successful" is spelled wrong.

This table shows the total number of successfull assaults between players.
User avatar
Lieutenant AceArtemis
 
Posts: 55
Joined: Sat Apr 26, 2008 5:05 pm
Location: Oregon
Medals: 7
Standard Achievement (2) Terminator Achievement (1) Speed Achievement (1) Ratings Achievement (2) General Achievement (1)

Re: ConquerStats - Ingame analysis

Postby cspare on Sun Jan 25, 2009 5:12 am

AceArtemis wrote:This is not a major problem, but the word "successful" is spelled wrong.

This table shows the total number of successfull assaults between players.

Hehe I never noticed:)
I updated the script, but there is no update notification because its such tiny change:) If you like you can click the 'Latest Version Installed' button to to install it.
Sergeant 1st Class cspare
 
Posts: 101
Joined: Sun Apr 08, 2007 12:56 pm
Medals: 8
Standard Achievement (1) Doubles Achievement (1) General Contribution (6)

Re: ConquerStats - Ingame analysis

Postby Andir on Fri Feb 27, 2009 9:16 pm

How do I remove the chart?

Microsoft is retarded and couldn't program around Linux if they tried and Moonlight crashes Iceweasel. I've had to disable it for now.

Your post says there are two scripts, but I only see one. Have you changed this?

Edit: I'd be willing to attempt to code up a Flash graph if you could give me details on the interface. I've never done Silverlight and don't plan to anytime soon. Maybe there could be two versions (Flash and Silverlight) of the script...?
Sergeant 1st Class Andir
 
Posts: 19
Joined: Thu Jan 15, 2009 11:30 am
Medals: 7
Standard Achievement (1) Triples Achievement (1) Quadruples Achievement (1) Terminator Achievement (1) Fog of War Achievement (1)
Ratings Achievement (2)

Re: ConquerStats - Ingame analysis

Postby xjia on Thu May 28, 2009 2:33 pm

Hey, thanks for the nice script.

But ive encounter some problem when conquer stats is on.
1.The numbers of troops in 2 region stack.....makes it difficult for me the see how many troops there are.
2.I cannot do futher assault or movement after i take 1 move, i MUST reload my page in order to continue my assault or next move.

Example:
-i attack from A(5 troops) to B(1troops)- i won.
-I move 1 troop to B.
-A region should have 3 troops and B region 2 troops
-BUT A region showed 3 and 5 stack together, and B region 1 and 2 together.
( something like u write a number on top of another)

Sorry for all the problem, hopefully u guys can help me out.

Thank you
Jason.
User avatar
Corporal xjia
 
Posts: 6
Joined: Sun May 24, 2009 4:18 pm
Medals: 3
Standard Achievement (1) Speed Achievement (1) Ratings Achievement (1)

Re: ConquerStats - Ingame analysis

Postby xjia on Sat Jun 06, 2009 11:38 am

Ive already find out the problem. :)
User avatar
Corporal xjia
 
Posts: 6
Joined: Sun May 24, 2009 4:18 pm
Medals: 3
Standard Achievement (1) Speed Achievement (1) Ratings Achievement (1)

Re: ConquerStats - Ingame analysis

Postby pamoa on Mon Jun 08, 2009 9:06 am

I'm having big problem with your wonderful script
it seems he's gone mad since a week or two
as he's displaying data randomly
it seems urgent to have an update
de gueules à la tour d'argent ouverte, crénelée de trois pièces et donjonnée d'un donjon ajouré, crénelé de deux pièces
Image
User avatar
Sergeant 1st Class pamoa
 
Posts: 1207
Joined: Sat Sep 01, 2007 3:18 am
Location: Confederatio Helvetica
Medals: 57
Standard Achievement (4) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (2) Manual Troops Achievement (3) Freestyle Achievement (2) Polymorphic Achievement (1) Nuclear Spoils Achievement (2)
Fog of War Achievement (4) Trench Warfare Achievement (2) Speed Achievement (4) Teammate Achievement (2) Random Map Achievement (2)
Cross-Map Achievement (4) Beta Map Achievement (1) Ratings Achievement (4) Tournament Achievement (1) Clan Achievement (8)
Map Contribution (3)

Re: ConquerStats - Ingame analysis

Postby cspare on Mon Jun 08, 2009 4:24 pm

pamoa wrote:I'm having big problem with your wonderful script
it seems he's gone mad since a week or two
as he's displaying data randomly
it seems urgent to have an update

hmm I havent been playing cc lately so I hadn't noticed. I see that there is a new API available since 14-5, do you think that is about the date that conquerstats stopped working properly for you?

Edit: Hmm I've been trying to fix it but I can't find any documentation on what CC changed. One of the things I noticed is that they renamed 'receives' to 'received', which will ofcourse break the script. But even when I fix that it still does not work, so it seems like a guessing game again *sigh*. I don't have time for that.
Sergeant 1st Class cspare
 
Posts: 101
Joined: Sun Apr 08, 2007 12:56 pm
Medals: 8
Standard Achievement (1) Doubles Achievement (1) General Contribution (6)

Re: ConquerStats - Ingame analysis

Postby cspare on Tue Jun 09, 2009 6:10 am

I got a list with all changes from Chipv and used it to fix the problems in a new version of ConquerStats (1.5.1). If you download it things should work again. If not, let me know:)
Download it here.
Sergeant 1st Class cspare
 
Posts: 101
Joined: Sun Apr 08, 2007 12:56 pm
Medals: 8
Standard Achievement (1) Doubles Achievement (1) General Contribution (6)

Re: ConquerStats - Ingame analysis

Postby pamoa on Tue Jun 09, 2009 7:45 am

8-) perfect thanks for the quickness =D>
de gueules à la tour d'argent ouverte, crénelée de trois pièces et donjonnée d'un donjon ajouré, crénelé de deux pièces
Image
User avatar
Sergeant 1st Class pamoa
 
Posts: 1207
Joined: Sat Sep 01, 2007 3:18 am
Location: Confederatio Helvetica
Medals: 57
Standard Achievement (4) Doubles Achievement (2) Triples Achievement (2) Quadruples Achievement (2) Terminator Achievement (2)
Assassin Achievement (2) Manual Troops Achievement (3) Freestyle Achievement (2) Polymorphic Achievement (1) Nuclear Spoils Achievement (2)
Fog of War Achievement (4) Trench Warfare Achievement (2) Speed Achievement (4) Teammate Achievement (2) Random Map Achievement (2)
Cross-Map Achievement (4) Beta Map Achievement (1) Ratings Achievement (4) Tournament Achievement (1) Clan Achievement (8)
Map Contribution (3)

Re: ConquerStats - Ingame analysis

Postby Kiwi123 on Tue Jun 23, 2009 1:49 pm

I really like your script but on the latest version I have, the chart showing the number of forts per player has dropped out and the update available keeps flashing even after I have clicked on it, installed it and closed and opened firefox again...is it me? Thanks.
Major Kiwi123
 
Posts: 3
Joined: Fri Aug 03, 2007 3:39 pm
Location: Wellington, New Zealand
Medals: 17
Standard Achievement (2) Doubles Achievement (2) Triples Achievement (1) Quadruples Achievement (2) Terminator Achievement (1)
Freestyle Achievement (1) Fog of War Achievement (2) Ratings Achievement (1) Tournament Achievement (1) General Achievement (1)
Clan Achievement (3)

Re: ConquerStats - Ingame analysis

Postby aselwyn1 on Fri Jul 24, 2009 7:24 am

hi

i seem to not be able to download ingame ANALYSIS I GET THIS

Code: Select all
// ==UserScript==
// @name           ConquerStats
// @namespace      cspare.ConquerStats
// @description    Shows several statistics for Conquerclub games.
// @include        http://*conquerclub.com*
// ==/UserScript==

var scriptVersion = "1.5.1";

var displayPositionNames = new Array( 'Above log', 'Below chat');
var displayPosition = GM_getValue('csDisplayPosition');
if (displayPosition == null || !(displayPosition > 0 && displayPosition < displayPositionNames.length))
{
   displayPosition = 0;
   GM_setValue('csDisplayPosition', displayPosition);
}

if (location.pathname.indexOf("game.php")==-1)
{
   CheckForUpdates();
   return; // Do not process any further.
}

// CC Elements
var divGameHistory = document.getElementById('log'); // HTML div element containing the game history.
var divDashboard = document.getElementById('dashboard');
var divPlayers = document.getElementById('players');
var divArmies = document.getElementById('armies');

// Custom Elements
var divAggression;
var divContent;
var divAttackTable;
var divReinforcements;
var divSilverApp;

// Vars
var logContent = "";
var playerCount = 0;
var attackTable = new Array();
var attackTableNeutral = new Array();
var playerNames = new Array();
var playerIsEliminatedStartStr = new Array();
var playerIsEliminatedEndStr = new Array();
var playerReinforcementsRegular = new Array();
var playerReinforcementsBonus = new Array();
var playerReinforcementsSpoils = new Array();
var playerReinforcementsTerritoryBonus = new Array();
var playerArmies = new Array();
var teamCount = 0;
var playersPerTeam = 0;
var mapTerritoryCount = 0;
var startingArmies = 0;
var neutralArmiesStart = 0;
var gameHasBonusCards = 0;
var fullLogStr;
var lastLogDate;
var originalRefreshGMScript;


setLogContent(divGameHistory.innerHTML);

function CheckForUpdates()
{

   if (unsafeWindow.sessionStorage != null && unsafeWindow.sessionStorage.csLatestVersion != null)
   {
      showMenu(unsafeWindow.sessionStorage.csLatestVersion == scriptVersion);
   }
   else
   {
     GM_xmlhttpRequest({
       method: "GET",
        url: 'http://www.cspare.nl/ConquerStats/latestVersion.txt?nocache=' + Math.random(),
        onload: function(response)
       {
         unsafeWindow.sessionStorage.csLatestVersion = response.responseText;
         showMenu(response.responseText == scriptVersion);
       }
     });
  }
}


function SwitchDisplayPosition()
{
   displayPosition++;
   if (displayPosition >= displayPositionNames.length)
   {
      displayPosition = 0;
   }
   GM_setValue('csDisplayPosition',displayPosition);
   
   document.getElementById('displayPositionMenuLink').innerHTML = 'Position: <b>' + displayPositionNames[displayPosition] + '</b>';

   // Move HTML elements to new position:
   var divAggression = document.getElementById('Aggression');
   InsertMainDiv(divAggression);
   
}

function showMenu(isLatestVersion)
{
   var divLeftColumn = document.getElementById('leftColumn');
   var ul = divLeftColumn.getElementsByTagName("ul");
   var nav = ul[0].parentNode;

   var header = document.createElement('h3');
   header.innerHTML = 'ConquerStats <span style=\'font-size:7pt;\' ><a href="http://www.conquerclub.com/forum/viewtopic.php?t=63517"> ' + scriptVersion + '</a></span>';
   var menu = document.createElement('ul');

   menu.innerHTML = '<li><a href="javascript:void(0);" id="displayPositionMenuLink">Position: <b>' + displayPositionNames[displayPosition] + '</b></a></li>';

   if (!isLatestVersion)
   {
      menu.innerHTML += '<li><a href="http://userscripts.org/scripts/source/34187.user.js"><span class="countdown-alert">Update Available</span></a></li>';
   } else
   {
      menu.innerHTML += '<li><a href="http://userscripts.org/scripts/source/34187.user.js">Latest Version Installed</a></li>';
   }
   
   
   nav.appendChild(header);
   nav.appendChild(menu);
   
   document.getElementById('displayPositionMenuLink').addEventListener("click", SwitchDisplayPosition, false);   
}



function getFullLog()
{
   var thisLog = divGameHistory.innerHTML.split('<br>');
   
   //if(thisLog[0].indexOf("Game has been initialized") < 0)
   {
      try
      {
         var lastSend = new Date();
         var url = "http://www.conquerclub.com/game.php?";
         url+= "game=" + unsafeWindow.game.value + "&ajax=1&map_key=" + unsafeWindow.mapKey + "&log_number=" + unsafeWindow.logNumber + "&chat_number=" + unsafeWindow.chatNumber+"&lastSend="+lastSend.getTime()+"&full_log=Y";
         var req = new XMLHttpRequest();
         //Setting the URL with a synchronous GET
         req.open('GET',url,false);
         req.send(null);
      }
      catch (e)
      {
         alert(e);
      }
      if (req.status != 200)
      {
         alert('Error requesting full log.');
      }

      var response = req.responseText.split("&");
      setLogContent(unescape(response[15]));
      
      return getLogContent(req.responseText);
   }

}

function setLogContent(logTxt)
{
   logContent = getLogContent(logTxt);
}
function getLogContent(logTxt)
{
   logTxt = logTxt.replace(/lost/g, 'loses');
   logTxt = logTxt.replace(/gained/g, 'gains');
   logTxt = logTxt.replace(/got/g, 'gets');
   logTxt = logTxt.replace(/received/g, 'receives');

   
   return logTxt;
}

function refreshGMScript()
{
   var response = unsafeWindow.request.responseText.split("&");
   var logContent = getLogContent(response[15]);
   var isFullLog = (response[16] == 'Y');
   
   if (isFullLog == true && lastLogDate != null)
   {
      var lastItemIndex = logContent.indexOf(lastLogDate);
      var nextItemIndex = logContent.indexOf('<br />', lastItemIndex);
      
      logContent = logContent.substr(nextItemIndex);

   }
   
   ParseLog(logContent);
   ParseArmies();
   DrawAggresionTable();
   DrawReinforcementsTable();
   UpdateChart(logContent);
   
   originalRefreshGMScript();
}

function InsertMainDiv(divAggression)
{
   switch(displayPosition)
   {
      case 0:
         divDashboard.parentNode.insertBefore(divAggression, divGameHistory.previousSibling.previousSibling);
         break;
         
      case 1:
         divDashboard.parentNode.appendChild(divAggression);
         break;

   }
   
}

function CreateHtml()
{
   divAggression = document.createElement('div');
   divAggression.id = "Aggression";
   divAggression.innerHTML = ""

   divContent = document.createElement('div');
   divContent.id = 'AggressionContent';
   divContent.innerHTML = '';

   divAttackTable = document.createElement('div');
   divAttackTable.id = 'AttackTable';
   divAttackTable.innerHTML = '';   

   divReinforcements = document.createElement('div');
   divReinforcements.id = 'Reinforcements';
   divReinforcements.innerHTML = '';   

   divSilverApp = document.createElement('div');
   divSilverApp.id = 'SilverApp';
   divSilverApp.innerHTML = '';

   divAggression.appendChild(divContent);
   divAggression.appendChild(divAttackTable);
   divAggression.appendChild(divReinforcements);
   divAggression.appendChild(divSilverApp);
   
   InsertMainDiv(divAggression);
   
}


function ParsePlayerInfo()
{
   var qryPlayers = /<span class="player(\d)">([^<]*)<\/span>/gi;
   var playerItems;
   while ((playerItems = qryPlayers.exec(divPlayers.innerHTML)) != null)
   {
      if (playerItems[1] > playerCount) playerCount = playerItems[1];
      playerNames[playerItems[1] - 1] = playerItems[2];
   }


   var qryTeamPlayers = /<li><b>Team (\d):<\/b><\/li>/gi;
   var TeamPlayers;
   while ((TeamPlayers = qryTeamPlayers.exec(divPlayers.innerHTML)) != null)
   {
      if (TeamPlayers[1] > teamCount) teamCount = TeamPlayers[1];

   }

   var qryPlayerIsEliminated = /<span class="eliminated">.*<span class="player(\d)">/gi;
   var PlayerIsEliminated;
   while ((PlayerIsEliminated = qryPlayerIsEliminated.exec(divPlayers.innerHTML)) != null)
   {
      playerIsEliminatedStartStr[PlayerIsEliminated[1] - 1] = '<span class="eliminated">';
      playerIsEliminatedEndStr[PlayerIsEliminated[1] - 1] = '</span>';
      
   }
   
   
   playersPerTeam = playerCount / teamCount;
}

function InitializeVars()
{
   attackTable = new Array(playerCount);
   attackTableNeutral = new Array(playerCount);
   playerReinforcementsRegular = new Array(playerCount);
   playerReinforcementsBonus = new Array(playerCount);
   playerReinforcementsSpoils = new Array(playerCount);
   playerReinforcementsTerritoryBonus = new Array(playerCount);
   playerArmies = new Array(playerCount);

   for (var i = 0; i < playerCount; i++)
   {
      attackTable[i] = new Array(playerCount);
      attackTableNeutral[i] = 0;
      playerReinforcementsRegular[i] = 0;
      playerReinforcementsBonus[i] = 0;
      playerReinforcementsSpoils[i] = 0;
      playerReinforcementsTerritoryBonus[i] = 0;
      playerArmies[i] = 0;
      if (playerIsEliminatedStartStr[i] == null) playerIsEliminatedStartStr[i] = '';
      if (playerIsEliminatedEndStr[i] == null) playerIsEliminatedEndStr[i] = '';
      
      for (var j = 0; j < playerCount; j++)
      {
         attackTable[i][j] = 0;
      }
   }
}

function ParseLog(testStr)
{
   var regExQry = /<span class="player(\d)">[^<]*<\/span> assaulted [ \x21-\x3D\x3F-\x7E?]* from [ \x21-\x3D\x3F-\x7E?]* and conquered it from <span class="player([\d^0])"/gi;
   var myArray;
   while ((myArray = regExQry.exec(testStr)) != null)
   {
      attackTable[myArray[1] - 1][myArray[2] - 1] += 1;
   }
   
   var regExQry = /<span class="player(\d)">[^<]*<\/span> assaulted [ \x21-\x3D\x3F-\x7E?]* from [ \x21-\x3D\x3F-\x7E?]* and conquered it from <span class="player0"/gi;
   var myArray;
   while ((myArray = regExQry.exec(testStr)) != null)
   {
      attackTableNeutral[myArray[1] - 1] += 1;
   }



   var qryRegularReinforcements = /<span class="player(\d)">[^<]*<\/span> receives (\d+) troops for \d+ regions/gi;
   var reinforcements;
   while ((reinforcements = qryRegularReinforcements.exec(testStr)) != null)
   {
      playerReinforcementsRegular[reinforcements[1] - 1] += parseInt(reinforcements[2]);
   }
   
   var qryBonusReinforcements = /<span class="player(\d)">[^<]*<\/span> receives (\d+) troops for holding /gi;
   var bonusReinforcements;
   while ((bonusReinforcements = qryBonusReinforcements.exec(testStr)) != null)
   {
      playerReinforcementsBonus[bonusReinforcements[1] - 1] += parseInt(bonusReinforcements[2]);
   }

   var qryCardSetReinforcements = /<span class="player(\d)">[^<]*<\/span> cashed in a group of <span class="card.">[ \x21-\x3D\x3F-\x7E?]*<\/span>, <span class="card.">[ \x21-\x3D\x3F-\x7E?]*<\/span>, and <span class="card.">[ \x21-\x3D\x3F-\x7E?]*<\/span> worth (\d+) troops/gi;
   var cardSetReinforcements;
   while ((cardSetReinforcements = qryCardSetReinforcements.exec(testStr)) != null)
   {
      playerReinforcementsSpoils[cardSetReinforcements[1] - 1] += parseInt(cardSetReinforcements[2]);
   }

   var qryCardBonusReinforcements = /<span class="player(\d)">[^<]*<\/span> gets bonus of (\d+) troops added to/gi;
   var cardBonusReinforcements;
   while ((cardBonusReinforcements = qryCardBonusReinforcements.exec(testStr)) != null)
   {
      playerReinforcementsTerritoryBonus[cardBonusReinforcements[1] - 1] += parseInt(cardBonusReinforcements[2]);
   }
   
   
   var qryLastDate = /<br \/>(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) /gi;
   var lastDateItem;
   while ((lastDateItem = qryLastDate.exec(testStr)) != null)
   {
      lastLogDate = lastDateItem[1];
   }
}

function ParseGameInfo()
{
   var qryBonusCards = /Spoils: <b>([\s\w]*)<\/b>/gi;
   var bonusCardsType = qryBonusCards.exec(divDashboard.innerHTML);
   if (bonusCardsType[1] != "No Spoils")
   {
      gameHasBonusCards = 1;
   } else
   {
      gameHasBonusCards = 0;
   }

   
   var armyList = divArmies.innerHTML.split(',');

   mapTerritoryCount = armyList.length;
   startingArmies = Math.floor(mapTerritoryCount / playerCount) * 3;
   neutralArmiesStart = (mapTerritoryCount % playerCount) * 3;
}

function ParseArmies()
{
   for (var i = 0; i < playerCount; i++)
   {
      playerArmies[i] = 0;
   }
   var armyList = divArmies.innerHTML.split(',');
   for (var i = 0; i < armyList.length; i++)
   {
      var armyItem = armyList[i];
      var armyItemElements = armyItem.split('-');

      playerArmies[armyItemElements[0] - 1] += parseInt(armyItemElements[1]);
   }


}



// Draw aggresion table
function DrawAggresionTable()
{
   var divAttackTableStr;

   divAttackTableStr = "<h3>ConquerStats</h3><h4>Aggression</h4>This table shows the total number of successful assaults between players.<br/><table style=\"border: 1px solid rgb(255, 255, 255); background: rgb(238, 238, 238); width: 100%\" rules=\"rows\">";
   divAttackTableStr += "<tr>";
   divAttackTableStr += "<td></td>";


   for (var i = 0; i < playerCount; i++)
   {
      var playerNumber = i + 1;
      divAttackTableStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerNames[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
   }
   if (neutralArmiesStart > 0)
   {
      divAttackTableStr += "<td><span class=\"player0\">Neutral player</span></td>";
   }
   divAttackTableStr += "<td>Total assaults</td>";
   divAttackTableStr += "</tr>";


   for (var i = 0; i < playerCount; i++)
   {
      var playerNumber = i + 1;
      var sumAttacks = 0;
      divAttackTableStr += "<tr>";
      divAttackTableStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerNames[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      
      for (var j = 0; j < playerCount; j++)
      {
         var textVal = "0";
         if (j == i)
         {
            textVal = "-";
         } else
         {
            textVal = "<b>" + attackTable[i][j] + "</b>";
            sumAttacks += attackTable[i][j];
         }
         
         divAttackTableStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + textVal + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
         
      }

      if (neutralArmiesStart > 0)
      {
         divAttackTableStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + attackTableNeutral[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      }

      divAttackTableStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + sumAttacks + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      
      divAttackTableStr += "</tr>";
   }

   divAttackTableStr += "</table>";
   divAttackTable.innerHTML = divAttackTableStr;
}

// Draw Reinforcements table
function DrawReinforcementsTable()
{
   var divReinforcementsStr;

   divReinforcementsStr = "<h4>Reinforcements</h4><table style=\"border: 1px solid rgb(255, 255, 255); background: rgb(238, 238, 238); width: 100%\" rules=\"rows\">";


   divReinforcementsStr += "<thead><tr><td>Player Name</td><td title=\"The troops you get from number of territories held.\">Reinforcements</td><td title=\"The troops you get from Continents held.\">Bonus</td><td title=\"Auto deployed bonuses for holding specific territories.\">Territory Bonus</td>";
   if (gameHasBonusCards == 1)
   {
      divReinforcementsStr += "<td title=\"The troops you get for cashing in a group of cards.\">Spoils</td>";
   }
   divReinforcementsStr += "<td>Total Reinforcements</td><td>Troops Still Alive</td><td>Win-Loss Efficiency</td></tr></thead>";


   var teamReinforcementsRegular = 0, teamReinforcementsBonus = 0, teamReinforcementsSpoils = 0, teamReinforcementsTerritoryBonus = 0, teamTotalReinforcements = 0, teamArmies = 0;
   for (var i = 0; i < playerCount; i++)
   {
      var playerNumber = i + 1;
      var totalReinforcements = parseInt(playerReinforcementsRegular[i]) + parseInt(playerReinforcementsBonus[i]) + parseInt(playerReinforcementsSpoils[i]) + parseInt(playerReinforcementsTerritoryBonus[i]);
      var winLossRatio = Math.round((parseInt(playerArmies[i]) * 1000) / (totalReinforcements + startingArmies)) / 10;
      divReinforcementsStr += "<tr><td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerNames[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerReinforcementsRegular[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerReinforcementsBonus[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerReinforcementsTerritoryBonus[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      
      if (gameHasBonusCards == 1)
      {
         divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerReinforcementsSpoils[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
         
      }

      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + totalReinforcements + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + playerArmies[i] + "</span>" + playerIsEliminatedEndStr[i] + "</td>";
      divReinforcementsStr += "<td>" + playerIsEliminatedStartStr[i] + "<span class=\"player" + playerNumber + "\">" + winLossRatio + "%</span>" + playerIsEliminatedEndStr[i] + "</td>";
      
      divReinforcementsStr += "</tr>";

      if (teamCount > 0)
      {
         teamReinforcementsRegular += playerReinforcementsRegular[i];
         teamReinforcementsBonus += playerReinforcementsBonus[i];
         teamReinforcementsSpoils += playerReinforcementsSpoils[i];
         teamReinforcementsTerritoryBonus += playerReinforcementsTerritoryBonus[i];
         teamTotalReinforcements += totalReinforcements;
         teamArmies += playerArmies[i];


         if ((i + 1) % playersPerTeam == 0)
         {
            var teamNumber = (i + 1) / playersPerTeam;
            var TeamWinLossRatio = Math.round((parseInt(teamArmies) * 1000) / (teamTotalReinforcements + startingArmies * playersPerTeam)) / 10;
            divReinforcementsStr += "<tr>";
            divReinforcementsStr += "<td><b>Team " + teamNumber + "</b></td>";
            divReinforcementsStr += "<td>" + teamReinforcementsRegular + "</td>";
            divReinforcementsStr += "<td>" + teamReinforcementsBonus + "</td>";
            divReinforcementsStr += "<td>" + teamReinforcementsTerritoryBonus + "</td>";

            if (gameHasBonusCards == 1)
            {
               divReinforcementsStr += "<td>" + teamReinforcementsSpoils + "</td>";               
            }
            
            divReinforcementsStr += "<td>" + teamTotalReinforcements + "</td>";
            divReinforcementsStr += "<td>" + teamArmies + "</td>";
            divReinforcementsStr += "<td>" + TeamWinLossRatio + "%</td>";
            divReinforcementsStr += "</tr>";

            teamReinforcementsRegular = 0;
            teamReinforcementsBonus = 0;
            teamReinforcementsSpoils = 0;
            teamReinforcementsTerritoryBonus = 0;
            teamTotalReinforcements = 0;
            teamArmies = 0;
         }
      }

      
   }

   divReinforcementsStr += "</table>";
   divReinforcements.innerHTML = divReinforcementsStr;
}

function DrawChart()
{
   var initParams = ''
   +'page=default'
   +',clientVersion='+scriptVersion;


   var divConquerData = document.createElement('div');
   divConquerData.setAttribute('id', 'ConquerStatsData');
   divConquerData.setAttribute('style', 'display: none;');
   divConquerData.innerHTML = fullLogStr;
   document.body.appendChild(divConquerData);


   divSilverApp.innerHTML = ''
   +'   <div id=\'errorLocation\' style="font-size: small;color: Gray;"></div>\r\n'
   +'    <div id="silverlightControlHost">\r\n'
   +'      <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="silverChart" width="1024" height="350">\r\n'
   +'         <param name="source" value="http://www.cspare.nl/ConquerStats/App/1.3.0/ConquerStats.xap"/>\r\n'
   +'         <param name="minRuntimeVersion" value="2.0.31005.0" />\r\n'
   +'         <param name="autoUpgrade" value="true" />\r\n'
   +'         <param name="enableHtmlAccess" value="true" />\r\n'
   +'         <param name="initParams" value="'+initParams+'" />\r\n'
   +'         <param name="background" value="white" />\r\n'
   +'         \r\n'
   +'         <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">\r\n'
   +'              <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>\r\n'
   +'         </a>\r\n'
   +'      </object>\r\n'
   +'      <iframe style=\'visibility:hidden;height:0;width:0;border:0px\'></iframe>\r\n'
   +'    </div>\r\n';
}

function UpdateChart(addedLog)
{
   var chart = document.getElementById('silverChart');
   
   chart.wrappedJSObject.Content.ChartInfo.UpdateChart(addedLog);
}

function Init()
{
   originalRefreshGMScript = unsafeWindow.refreshGMScript;
   unsafeWindow.refreshGMScript = refreshGMScript;

   fullLogStr = getFullLog();

   CreateHtml();
   ParsePlayerInfo();
   InitializeVars();
   ParseLog(logContent);
   ParseGameInfo();
   ParseArmies();

   DrawAggresionTable();
   DrawReinforcementsTable();
   DrawChart();
   
   CheckForUpdates();
}

Init();


function embedFunction(s) {
var headTag = document.getElementsByTagName('head')[0];
headTag.appendChild(document.createElement('script')).innerHTML=s.toString().replace(/([\s\S]*?return;){2}([\s\S]*)}/,'$2');
}


on my whole page what do i do now
User avatar
Private aselwyn1
 
Posts: 108
Joined: Wed Feb 18, 2009 7:21 pm
Location: Ottawa
Medals: 14
Standard Achievement (2) Doubles Achievement (1) Manual Troops Achievement (1) Freestyle Achievement (1) Fog of War Achievement (1)
Speed Achievement (1) Ratings Achievement (2) Tournament Achievement (1) Tournament Contribution (4)

Re: ConquerStats - Ingame analysis

Postby cspare on Fri Jul 24, 2009 7:49 am

aselwyn1 wrote:hi

i seem to not be able to download ingame ANALYSIS I GET THIS

Code: Select all
(...)


on my whole page what do i do now


Hey,

I think you don't have Greasemonkey installed in your browser. Follow this guide to install it. Instead of step 4 you can then try to install ConquerStats again.
Sergeant 1st Class cspare
 
Posts: 101
Joined: Sun Apr 08, 2007 12:56 pm
Medals: 8
Standard Achievement (1) Doubles Achievement (1) General Contribution (6)

Re: ConquerStats - Ingame analysis

Postby e_i_pi on Thu Oct 29, 2009 1:13 am

I'm guessing you're aware that this is currently broken with the latest upgrades to the site
Image
User avatar
Captain e_i_pi
 
Posts: 1770
Joined: Tue Feb 12, 2008 2:19 pm
Location: Corruption Capital of the world
Medals: 36
Standard Achievement (2) Doubles Achievement (3) Triples Achievement (3) Quadruples Achievement (3) Terminator Achievement (2)
Assassin Achievement (1) Freestyle Achievement (2) Fog of War Achievement (3) Speed Achievement (1) Cross-Map Achievement (3)
Ratings Achievement (3) Tournament Achievement (5) Clan Achievement (3) General Contribution (2)

PreviousNext

Return to Available Tools/Enhancements

Who is online

Users browsing this forum: dustin800, hyposquasher, macbone and 1 guest

Login