diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/GameHistoryDAO.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/GameHistoryDAO.java index 43be11425..6be053b18 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/GameHistoryDAO.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/db/GameHistoryDAO.java @@ -268,7 +268,7 @@ public class GameHistoryDAO { } } - public List getCompetetivePlayerStatistics(Player player) { + public List getCompetitivePlayerStatistics(Player player) { try { Connection connection = _dbAccess.getDataSource().getConnection(); try { diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameHistoryService.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameHistoryService.java index f4377314b..eba730782 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameHistoryService.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/GameHistoryService.java @@ -62,7 +62,7 @@ public class GameHistoryService { return _gameHistoryDAO.getCasualPlayerStatistics(player); } - public List getCompetetivePlayerStatistics(Player player) { - return _gameHistoryDAO.getCompetetivePlayerStatistics(player); + public List getCompetitivePlayerStatistics(Player player) { + return _gameHistoryDAO.getCompetitivePlayerStatistics(player); } } diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java index 47af09e8e..30ead7d30 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java @@ -122,7 +122,7 @@ public class LotroServer extends AbstractServer { return "Game" + gameId; } - public synchronized String createNewGame(LotroFormat lotroFormat, String tournamentName, final LotroGameParticipant[] participants, boolean competetive, boolean tournament) { + public synchronized String createNewGame(LotroFormat lotroFormat, String tournamentName, final LotroGameParticipant[] participants, boolean competitive, boolean tournament) { if (participants.length < 2) throw new IllegalArgumentException("There has to be at least two players"); final String gameId = String.valueOf(_nextGameId); @@ -139,7 +139,7 @@ public class LotroServer extends AbstractServer { _chatServer.createChatRoom(getChatRoomName(gameId), 30); LotroGameMediator lotroGameMediator = new LotroGameMediator(lotroFormat, participants, _lotroCardBlueprintLibrary, - competetive ? 60 * 40 : 60 * 80, noSpectators, cancellable); + competitive ? 60 * 40 : 60 * 80, noSpectators, cancellable); lotroGameMediator.addGameResultListener( new GameResultListener() { @Override diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java index ed0497365..b7dab4836 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/hall/HallServer.java @@ -394,8 +394,8 @@ public class HallServer extends AbstractServer { _awaitingTables.remove(tableId); } - private void createGame(String tableId, LotroGameParticipant[] participants, GameResultListener listener, LotroFormat lotroFormat, String tournamentName, boolean competetive, boolean tournament) { - String gameId = _lotroServer.createNewGame(lotroFormat, tournamentName, participants, competetive, tournament); + private void createGame(String tableId, LotroGameParticipant[] participants, GameResultListener listener, LotroFormat lotroFormat, String tournamentName, boolean competitive, boolean tournament) { + String gameId = _lotroServer.createNewGame(lotroFormat, tournamentName, participants, competitive, tournament); LotroGameMediator lotroGameMediator = _lotroServer.getGameById(gameId); if (listener != null) lotroGameMediator.addGameResultListener(listener); diff --git a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java index 8cb983708..9596a5523 100644 --- a/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java +++ b/gemp-lotr/gemp-lotr-web-server/src/main/java/com/gempukku/lotro/server/ServerResource.java @@ -283,7 +283,7 @@ public class ServerResource extends AbstractResource { Player resourceOwner = getResourceOwnerSafely(request, participantId); List casualStatistics = _gameHistoryService.getCasualPlayerStatistics(resourceOwner); - List competetiveStatistics = _gameHistoryService.getCompetetivePlayerStatistics(resourceOwner); + List competitiveStatistics = _gameHistoryService.getCompetitivePlayerStatistics(resourceOwner); DecimalFormat percFormat = new DecimalFormat("#0.0%"); @@ -296,9 +296,9 @@ public class ServerResource extends AbstractResource { appendStatistics(casualStatistics, percFormat, doc, casual); stats.appendChild(casual); - Element competetive = doc.createElement("competetive"); - appendStatistics(competetiveStatistics, percFormat, doc, competetive); - stats.appendChild(competetive); + Element competitive = doc.createElement("competitive"); + appendStatistics(competitiveStatistics, percFormat, doc, competitive); + stats.appendChild(competitive); doc.appendChild(stats); return doc; diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html index 90ae2a385..d58d400bb 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/hall.html @@ -190,6 +190,7 @@ + @@ -237,11 +238,11 @@ var infoDialog = $("
") .dialog({ - autoOpen:false, - closeOnEscape:true, - resizable:false, - title:"Card information" - }); + autoOpen:false, + closeOnEscape:true, + resizable:false, + title:"Card information" + }); $("body").click( function (event) { @@ -318,7 +319,8 @@
  • Manual
  • Format Rules
  • Contribute
  • -
  • Stats
  • +
  • Your stats
  • +
  • Server stats
  • diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/yourStats.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/yourStats.html new file mode 100644 index 000000000..dc374719f --- /dev/null +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/yourStats.html @@ -0,0 +1,9 @@ + +All times are GMT based. +
    \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/communication.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/communication.js index cbe39de58..452525dfe 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/communication.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/communication.js @@ -83,6 +83,19 @@ var GempLotrCommunication = Class.extend({ }); }, + getPlayerStats:function (callback, errorMap) { + $.ajax({ + type:"GET", + url:this.url + "/playerStats", + cache:false, + data:{ + participantId:getUrlParam("participantId") }, + success:this.deliveryCheck(callback), + error:this.errorCheck(errorMap), + dataType:"xml" + }); + }, + getLiveTournaments:function (callback, errorMap) { $.ajax({ type:"GET", diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/playerStatsUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/playerStatsUi.js new file mode 100644 index 000000000..ad3a6a869 --- /dev/null +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/playerStatsUi.js @@ -0,0 +1,51 @@ +var PlayerStatsUI = Class.extend({ + communication:null, + + init:function (url) { + this.communication = new GempLotrCommunication(url, + function (xhr, ajaxOptions, thrownError) { + }); + + this.loadPlayerStats(); + }, + + loadPlayerStats:function () { + this.communication.getPlayerStats(this.loadedPlayerStats); + }, + + loadedPlayerStats:function (xml) { + var that = this; + log(xml); + var root = xml.documentElement; + if (root.tagName == 'playerStats') { + $("#playerStats").html(""); + + var stats = root; + + var casual = stats.getElementsByTagName("casual")[0]; + var competitive = stats.getElementsByTagName("competitive")[0]; + + $("#playerStats").append("
    Casual statistics
    "); + this.appendStats(casual); + $("#playerStats").append("
    Competitive statistics
    "); + this.appendStats(competitive); + } + }, + + appendStats:function (stats) { + var entries = stats.getElementsByTagName("entry"); + if (entries.length == 0) { + $("#playerStats").append("You have not played any games counting for this statistics"); + } else { + var table = $("
    "); + table.append("Format nameDeck name# of wins# of losses% of wins"); + for (var i = 0; i < entries.length; i++) { + var entry = entries[i]; + + table.append("" + entry.getAttribute("format") + "" + entry.getAttribute("deckName") + "" + entry.getAttribute("wins") + "" + entry.getAttribute("losses") + "" + entry.getAttribute("perc") + ""); + } + + $("#playerStats").append(table); + } + } +}); \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/statsUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/statsUi.js index 95dedb9ce..b8d4c003e 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/statsUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-010/statsUi.js @@ -1,11 +1,10 @@ var StatsUI = Class.extend({ communication:null, - formatDialog:null, init:function (url) { this.communication = new GempLotrCommunication(url, - function (xhr, ajaxOptions, thrownError) { - }); + function (xhr, ajaxOptions, thrownError) { + }); var now = new Date(); @@ -18,16 +17,16 @@ var StatsUI = Class.extend({ var that = this; $(".getStats", $("#statsParameters")).click( - function () { - var startDay = $(".startDay", $("#statsParameters")).prop("value"); - var period = $("option:selected", $(".period", $("#statsParameters"))).prop("value"); + function () { + var startDay = $(".startDay", $("#statsParameters")).prop("value"); + var period = $("option:selected", $(".period", $("#statsParameters"))).prop("value"); - that.communication.getStats(startDay, period, that.loadedStats, { - "400":function () { - alert("Invalid parameter entered"); - } - }) - }); + that.communication.getStats(startDay, period, that.loadedStats, { + "400":function () { + alert("Invalid parameter entered"); + } + }) + }); }, loadedStats:function (xml) {