diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html index a237e7471..d504ec383 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html @@ -1,6 +1,8 @@
 5 Jun. 2012
 - "Host of Udun" now correctly reduces the cost if threats are removed, when card could be played for full cost.
+- If player is given an option of assigning, if no assignments is made, a popup confirmation window will show to ask if
+that was the intended operation.
 
 4 Jun. 2012
 - Reworked "Orkish Sneak".
diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-006/gameUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-006/gameUi.js
index f13d35201..476c83f57 100644
--- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-006/gameUi.js
+++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/gemp-006/gameUi.js
@@ -1,73 +1,75 @@
 var GempLotrGameUI = Class.extend({
-    padding: 5,
+    padding:5,
 
-    bottomPlayerId: null,
-    replayMode: null,
-    spectatorMode: null,
+    bottomPlayerId:null,
+    replayMode:null,
+    spectatorMode:null,
 
-    currentPlayerId: null,
-    allPlayerIds: null,
+    currentPlayerId:null,
+    allPlayerIds:null,
 
-    playerPositions: null,
-    cardActionDialog: null,
-    smallDialog: null,
-    gameStateElem: null,
-    alertBox: null,
-    alertText: null,
-    alertButtons: null,
-    infoDialog: null,
+    playerPositions:null,
+    cardActionDialog:null,
+    smallDialog:null,
+    gameStateElem:null,
+    alertBox:null,
+    alertText:null,
+    alertButtons:null,
+    infoDialog:null,
 
-    advPathGroup: null,
-    supportOpponent: null,
-    charactersOpponent: null,
-    shadow: null,
-    charactersPlayer: null,
-    supportPlayer: null,
-    hand: null,
-    specialGroup: null,
+    advPathGroup:null,
+    supportOpponent:null,
+    charactersOpponent:null,
+    shadow:null,
+    charactersPlayer:null,
+    supportPlayer:null,
+    hand:null,
+    specialGroup:null,
 
-    discardPileDialogs: null,
-    discardPileGroups: null,
-    adventureDeckDialogs: null,
-    adventureDeckGroups: null,
-    deadPileDialogs: null,
-    deadPileGroups: null,
+    discardPileDialogs:null,
+    discardPileGroups:null,
+    adventureDeckDialogs:null,
+    adventureDeckGroups:null,
+    deadPileDialogs:null,
+    deadPileGroups:null,
 
-    statsDiv: null,
+    statsDiv:null,
 
-    skirmishGroupDiv: null,
-    fpStrengthDiv: null,
-    fpDamageBonusDiv: null,
-    shadowStrengthDiv: null,
-    shadowDamageBonusDiv: null,
-    skirmishShadowGroup: null,
-    skirmishFellowshipGroup: null,
+    skirmishGroupDiv:null,
+    fpStrengthDiv:null,
+    fpDamageBonusDiv:null,
+    shadowStrengthDiv:null,
+    shadowDamageBonusDiv:null,
+    skirmishShadowGroup:null,
+    skirmishFellowshipGroup:null,
 
-    extraActionsGroup: null,
+    extraActionsGroup:null,
 
-    assignGroupDivs: null,
-    shadowAssignGroups: null,
-    freePeopleAssignGroups: null,
+    assignGroupDivs:null,
+    shadowAssignGroups:null,
+    freePeopleAssignGroups:null,
 
-    selectionFunction: null,
+    assignmentStarted:null,
 
-    chatBoxDiv: null,
-    chatBox: null,
-    communication: null,
-    channelNumber: null,
+    selectionFunction:null,
 
-    settingsAutoPass: false,
-    settingsAutoAccept: false,
-    settingsAlwaysDropDown: false,
+    chatBoxDiv:null,
+    chatBox:null,
+    communication:null,
+    channelNumber:null,
 
-    windowWidth: null,
-    windowHeight: null,
+    settingsAutoPass:false,
+    settingsAutoAccept:false,
+    settingsAlwaysDropDown:false,
 
-    tabPane: null,
+    windowWidth:null,
+    windowHeight:null,
 
-    animations: null,
+    tabPane:null,
 
-    init: function(url, replayMode) {
+    animations:null,
+
+    init:function (url, replayMode) {
         this.replayMode = replayMode;
 
         log("ui initialized");
@@ -76,24 +78,24 @@ var GempLotrGameUI = Class.extend({
         this.animations = new GameAnimations(this);
 
         this.communication = new GempLotrCommunication(url,
-                function(xhr, ajaxOptions, thrownError) {
-                    if (thrownError != "abort") {
-                        if (xhr != null) {
-                            if (xhr.status == 401) {
-                                that.chatBox.appendMessage("Game problem - You're not logged in, go to the main page to log in", "warningMessage");
-                                return;
-                            } else {
-                                that.chatBox.appendMessage("There was a problem communicating with the server (" + xhr.status + "), if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
-                                that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
-                                return;
-                            }
+            function (xhr, ajaxOptions, thrownError) {
+                if (thrownError != "abort") {
+                    if (xhr != null) {
+                        if (xhr.status == 401) {
+                            that.chatBox.appendMessage("Game problem - You're not logged in, go to the main page to log in", "warningMessage");
+                            return;
+                        } else {
+                            that.chatBox.appendMessage("There was a problem communicating with the server (" + xhr.status + "), if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
+                            that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
+                            return;
                         }
-                        that.chatBox.appendMessage("There was a problem communicating with the server, if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
-                        that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
                     }
-                });
+                    that.chatBox.appendMessage("There was a problem communicating with the server, if the game is finished, it has been removed, otherwise you have lost connection to the server.", "warningMessage");
+                    that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage");
+                }
+            });
 
-        $.expr[':'].cardId = function(obj, index, meta, stack) {
+        $.expr[':'].cardId = function (obj, index, meta, stack) {
             var cardIds = meta[3].split(",");
             var cardData = $(obj).data("card");
             return (cardData != null && ($.inArray(cardData.cardId, cardIds) > -1));
@@ -103,7 +105,7 @@ var GempLotrGameUI = Class.extend({
             var replayDiv = $("
"); replayDiv.append(""); $("#main").append(replayDiv); - replayDiv.css({"z-index": 1000}); + replayDiv.css({"z-index":1000}); $("#replayButton").button(); } @@ -130,7 +132,7 @@ var GempLotrGameUI = Class.extend({ this.addBottomLeftTabPane(); }, - getReorganizableCardGroupForCardData: function(cardData) { + getReorganizableCardGroupForCardData:function (cardData) { if (this.charactersPlayer.cardBelongs(cardData)) { return this.charactersPlayer; } @@ -172,7 +174,7 @@ var GempLotrGameUI = Class.extend({ return null; }, - layoutGroupWithCard: function(cardId) { + layoutGroupWithCard:function (cardId) { var cardData = $(".card:cardId(" + cardId + ")").data("card"); if (this.advPathGroup.cardBelongs(cardData)) { this.advPathGroup.layoutCards(); @@ -229,46 +231,46 @@ var GempLotrGameUI = Class.extend({ this.layoutUI(false); }, - initializeGameUI: function() { + initializeGameUI:function () { this.advPathGroup = new AdvPathCardGroup($("#main")); var that = this; - this.supportOpponent = new NormalCardGroup($("#main"), function(card) { + this.supportOpponent = new NormalCardGroup($("#main"), function (card) { return (card.zone == "SUPPORT" && card.owner != that.bottomPlayerId && that.shadowAssignGroups[card.cardId] == null && card.skirmish == null); }); - this.charactersOpponent = new NormalCardGroup($("#main"), function(card) { + this.charactersOpponent = new NormalCardGroup($("#main"), function (card) { return (card.zone == "FREE_CHARACTERS" && card.owner != that.bottomPlayerId && that.shadowAssignGroups[card.cardId] == null && card.skirmish == null); }); - this.shadow = new NormalCardGroup($("#main"), function(card) { + this.shadow = new NormalCardGroup($("#main"), function (card) { return (card.zone == "SHADOW_CHARACTERS" && card.assign == null && card.skirmish == null); }); - this.charactersPlayer = new NormalCardGroup($("#main"), function(card) { + this.charactersPlayer = new NormalCardGroup($("#main"), function (card) { return (card.zone == "FREE_CHARACTERS" && card.owner == that.bottomPlayerId && that.shadowAssignGroups[card.cardId] == null && card.skirmish == null); }); - this.supportPlayer = new NormalCardGroup($("#main"), function(card) { + this.supportPlayer = new NormalCardGroup($("#main"), function (card) { return (card.zone == "SUPPORT" && card.owner == that.bottomPlayerId && that.shadowAssignGroups[card.cardId] == null && card.skirmish == null); }); - this.extraActionsGroup = new NormalCardGroup($("#main"), function(card) { + this.extraActionsGroup = new NormalCardGroup($("#main"), function (card) { return (card.zone == "EXTRA"); }, false); if (!this.spectatorMode) { - this.hand = new NormalCardGroup($("#main"), function(card) { + this.hand = new NormalCardGroup($("#main"), function (card) { return (card.zone == "HAND"); }); } - this.specialGroup = new NormalCardGroup(this.cardActionDialog, function(card) { + this.specialGroup = new NormalCardGroup(this.cardActionDialog, function (card) { return (card.zone == "SPECIAL"); }, false); this.specialGroup.setBounds(this.padding, this.padding, 580 - 2 * (this.padding), 250 - 2 * (this.padding)); this.gameStateElem = $("
"); - this.gameStateElem.css({"border-radius": "7px"}); + this.gameStateElem.css({"border-radius":"7px"}); for (var i = 0; i < this.allPlayerIds.length; i++) { this.gameStateElem.append("
" + (i + 1) + ". " + this.allPlayerIds[i] + "
" - + "
"); + + "
"); } this.gameStateElem.append("
0
"); @@ -278,63 +280,62 @@ var GempLotrGameUI = Class.extend({ for (var i = 0; i < this.allPlayerIds.length; i++) { var showBut = $("
+
").button().click( - ( - function(playerIndex) { - return function() { - $(".player").each( - function(index) { - if (index == playerIndex) { - if ($(this).hasClass("opened")) { - $(this).removeClass("opened").css({width: 150 - that.padding}); - $("#discard" + playerIndex).css({display: "none"}); - $("#deadPile" + playerIndex).css({display: "none"}); - $("#adventureDeck" + playerIndex).css({display: "none"}); - } else { - $(this).addClass("opened").css({width: 150 - that.padding + 126}); - $("#discard" + playerIndex).css({display: "table-cell"}); - $("#deadPile" + playerIndex).css({display: "table-cell"}); - $("#adventureDeck" + playerIndex).css({display: "table-cell"}); - } - } - }); - }; - })(i)); + (function (playerIndex) { + return function () { + $(".player").each( + function (index) { + if (index == playerIndex) { + if ($(this).hasClass("opened")) { + $(this).removeClass("opened").css({width:150 - that.padding}); + $("#discard" + playerIndex).css({display:"none"}); + $("#deadPile" + playerIndex).css({display:"none"}); + $("#adventureDeck" + playerIndex).css({display:"none"}); + } else { + $(this).addClass("opened").css({width:150 - that.padding + 126}); + $("#discard" + playerIndex).css({display:"table-cell"}); + $("#deadPile" + playerIndex).css({display:"table-cell"}); + $("#adventureDeck" + playerIndex).css({display:"table-cell"}); + } + } + }); + }; + })(i)); $("#showStats" + i).append(showBut); } if (!this.spectatorMode) { $("#discard" + this.getPlayerIndex(this.bottomPlayerId)).addClass("clickable").click( - (function(index) { - return function() { - openSizeDialog(that.discardPileDialogs[that.bottomPlayerId]); - }; - })(i)); + (function (index) { + return function () { + openSizeDialog(that.discardPileDialogs[that.bottomPlayerId]); + }; + })(i)); $("#adventureDeck" + this.getPlayerIndex(this.bottomPlayerId)).addClass("clickable").click( - (function(index) { - return function() { - openSizeDialog(that.adventureDeckDialogs[that.bottomPlayerId]); - }; - })(i)); + (function (index) { + return function () { + openSizeDialog(that.adventureDeckDialogs[that.bottomPlayerId]); + }; + })(i)); } for (var i = 0; i < this.allPlayerIds.length; i++) { $("#deadPile" + i).addClass("clickable").click( - (function(index) { - return function() { - openSizeDialog(that.deadPileDialogs[that.allPlayerIds[index]]); - }; - })(i)); + (function (index) { + return function () { + openSizeDialog(that.deadPileDialogs[that.allPlayerIds[index]]); + }; + })(i)); } this.alertBox = $("
"); - this.alertBox.css({"border-radius": "7px"}); + this.alertBox.css({"border-radius":"7px"}); this.alertText = $("
"); - this.alertText.css({position: "absolute", left: "0px", top: "0px", width: "100%", height: "50px", scroll: "auto"}); + this.alertText.css({position:"absolute", left:"0px", top:"0px", width:"100%", height:"50px", scroll:"auto"}); this.alertButtons = $("
"); - this.alertButtons.css({position: "absolute", left: "0px", top: "50px", width: "100%", height: "30px", scroll: "auto"}); + this.alertButtons.css({position:"absolute", left:"0px", top:"50px", width:"100%", height:"30px", scroll:"auto"}); this.alertBox.append(this.alertText); this.alertBox.append(this.alertButtons); @@ -342,31 +343,31 @@ var GempLotrGameUI = Class.extend({ $("#main").append(this.alertBox); this.statsDiv = $("
"); - this.statsDiv.css({"border-radius": "7px"}); + this.statsDiv.css({"border-radius":"7px"}); this.statsDiv.append("
"); $("#main").append(this.statsDiv); - var dragFunc = function(event) { + var dragFunc = function (event) { return that.dragContinuesCardFunction(event); }; $("body").click( - function (event) { - return that.clickCardFunction(event); - }); + function (event) { + return that.clickCardFunction(event); + }); $("body").mousedown( - function (event) { - $("body").bind("mousemove", dragFunc); - return that.dragStartCardFunction(event); - }); + function (event) { + $("body").bind("mousemove", dragFunc); + return that.dragStartCardFunction(event); + }); $("body").mouseup( - function (event) { - $("body").unbind("mousemove", dragFunc); - return that.dragStopCardFunction(event); - }); + function (event) { + $("body").unbind("mousemove", dragFunc); + return that.dragStopCardFunction(event); + }); }, - addBottomLeftTabPane: function() { + addBottomLeftTabPane:function () { var that = this; var tabsLabels = "
  • Chat
  • "; var tabsBodies = "
    "; @@ -390,10 +391,10 @@ var GempLotrGameUI = Class.extend({ this.settingsAutoAccept = true; } - $("#autoAccept").bind("change", function() { + $("#autoAccept").bind("change", function () { var selected = $("#autoAccept").prop("checked"); that.settingsAutoAccept = selected; - $.cookie("autoAccept", "" + selected, { expires: 365 }); + $.cookie("autoAccept", "" + selected, { expires:365 }); }); $("#settingsBox").append("
    "); @@ -404,10 +405,10 @@ var GempLotrGameUI = Class.extend({ this.settingsAlwaysDropDown = true; } - $("#alwaysDropDown").bind("change", function() { + $("#alwaysDropDown").bind("change", function () { var selected = $("#alwaysDropDown").prop("checked"); that.settingsAlwaysDropDown = selected; - $.cookie("alwaysDropDown", "" + selected, { expires: 365 }); + $.cookie("alwaysDropDown", "" + selected, { expires:365 }); }); $("#settingsBox").append("Phases when game auto-passes for you, if you have no phase actions to play
    "); @@ -428,7 +429,7 @@ var GempLotrGameUI = Class.extend({ $("#autoPass" + passPhasesArr[i]).prop("checked", true); } - $("#autoPassFELLOWSHIP,#autoPassSHADOW,#autoPassMANEUVER,#autoPassARCHERY,#autoPassASSIGNMENT,#autoPassSKIRMISH,#autoPassREGROUP").bind("change", function() { + $("#autoPassFELLOWSHIP,#autoPassSHADOW,#autoPassMANEUVER,#autoPassARCHERY,#autoPassASSIGNMENT,#autoPassSKIRMISH,#autoPassREGROUP").bind("change", function () { var newAutoPassPhases = ""; if ($("#autoPassFELLOWSHIP").prop("checked")) newAutoPassPhases += "0FELLOWSHIP"; @@ -447,10 +448,10 @@ var GempLotrGameUI = Class.extend({ if (newAutoPassPhases.length > 0) newAutoPassPhases = newAutoPassPhases.substr(1); - $.cookie("autoPassPhases", newAutoPassPhases, { expires: 365 }); + $.cookie("autoPassPhases", newAutoPassPhases, { expires:365 }); }); - var playerListener = function(players) { + var playerListener = function (players) { var val = ""; for (var i = 0; i < players.length; i++) val += players[i] + "
    "; @@ -465,18 +466,18 @@ var GempLotrGameUI = Class.extend({ if (!this.spectatorMode && !this.replayMode) { $("#gameOptionsBox").append("
    "); $("#concedeGame").button().click( - function() { - that.communication.concede(); - }); + function () { + that.communication.concede(); + }); $("#gameOptionsBox").append(""); $("#cancelGame").button().click( - function() { - that.communication.cancel(); - }); + function () { + that.communication.cancel(); + }); } }, - clickCardFunction: function(event) { + clickCardFunction:function (event) { var tar = $(event.target); if (tar.hasClass("cardHint")) { @@ -513,15 +514,15 @@ var GempLotrGameUI = Class.extend({ return true; }, - dragCardId: null, - dragCardIndex: null, - draggedCardIndex: null, - dragStartX: null, - dragStartY: null, - successfulDrag: null, - draggingHorizontaly: false, + dragCardId:null, + dragCardIndex:null, + draggedCardIndex:null, + dragStartX:null, + dragStartY:null, + successfulDrag:null, + draggingHorizontaly:false, - dragStartCardFunction: function(event) { + dragStartCardFunction:function (event) { this.successfulDrag = false; var tar = $(event.target); if (tar.hasClass("actionArea")) { @@ -542,7 +543,7 @@ var GempLotrGameUI = Class.extend({ return true; }, - dragContinuesCardFunction: function(event) { + dragContinuesCardFunction:function (event) { if (this.dragCardId != null) { if (!this.draggingHorizontaly && Math.abs(this.dragStartX - event.clientX) >= 20) { var cardElems = $(".card:cardId(" + this.dragCardId + ")"); @@ -600,7 +601,7 @@ var GempLotrGameUI = Class.extend({ } }, - dragStopCardFunction: function(event) { + dragStopCardFunction:function (event) { if (this.dragCardId != null) { if (this.dragStartY - event.clientY >= 20 && !this.draggingHorizontaly) { var cardElems = $(".card:cardId(" + this.dragCardId + ")"); @@ -620,7 +621,7 @@ var GempLotrGameUI = Class.extend({ return true; }, - displayCard: function(card, extraSpace) { + displayCard:function (card, extraSpace) { this.infoDialog.html(""); this.infoDialog.html("
    "); var floatCardDiv = $("
    "); @@ -637,15 +638,15 @@ var GempLotrGameUI = Class.extend({ if (card.horizontal) { // 500x360 - this.infoDialog.dialog({width: Math.min(500 + horSpace, windowWidth), height: Math.min(360 + vertSpace, windowHeight)}); + this.infoDialog.dialog({width:Math.min(500 + horSpace, windowWidth), height:Math.min(360 + vertSpace, windowHeight)}); } else { // 360x500 - this.infoDialog.dialog({width: Math.min(360 + horSpace, windowWidth), height: Math.min(500 + vertSpace, windowHeight)}); + this.infoDialog.dialog({width:Math.min(360 + horSpace, windowWidth), height:Math.min(500 + vertSpace, windowHeight)}); } this.infoDialog.dialog("open"); }, - displayCardInfo: function(card) { + displayCardInfo:function (card) { var showModifiers = false; var cardId = card.cardId; if (!this.replayMode && (cardId.length < 4 || cardId.substring(0, 4) != "temp")) @@ -657,32 +658,32 @@ var GempLotrGameUI = Class.extend({ this.getCardModifiersFunction(cardId, this.setCardModifiers); }, - setCardModifiers: function(html) { + setCardModifiers:function (html) { $("#cardEffects").replaceWith(html); }, - initializeDialogs: function() { + initializeDialogs:function () { this.smallDialog = $("
    ") - .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: false, - width: 400, - height: 200 - }); + .dialog({ + autoOpen:false, + closeOnEscape:false, + resizable:false, + width:400, + height:200 + }); this.cardActionDialog = $("
    ") - .dialog({ - autoOpen: false, - closeOnEscape: false, - resizable: true, - width: 600, - height: 300 - }); + .dialog({ + autoOpen:false, + closeOnEscape:false, + resizable:true, + width:600, + height:300 + }); var that = this; - this.cardActionDialog.bind("dialogresize", function() { + this.cardActionDialog.bind("dialogresize", function () { that.arbitraryDialogResize(); }); @@ -692,32 +693,32 @@ var GempLotrGameUI = Class.extend({ var height = $(window).height(); this.infoDialog = $("
    ") - .dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: false, - title: "Card information" - }); + .dialog({ + autoOpen:false, + closeOnEscape:true, + resizable:false, + title:"Card information" + }); var swipeOptions = { - threshold: 20, - swipeUp: function (event) { - that.infoDialog.prop({ scrollTop: that.infoDialog.prop("scrollHeight") }); + threshold:20, + swipeUp:function (event) { + that.infoDialog.prop({ scrollTop:that.infoDialog.prop("scrollHeight") }); return false; }, - swipeDown: function (event) { - that.infoDialog.prop({ scrollTop: 0 }); + swipeDown:function (event) { + that.infoDialog.prop({ scrollTop:0 }); return false; } }; this.infoDialog.swipe(swipeOptions); }, - windowResized: function() { + windowResized:function () { this.animations.windowResized(); }, - layoutUI: function(sizeChanged) { + layoutUI:function (sizeChanged) { var padding = this.padding; var width = $(window).width(); var height = $(window).height(); @@ -758,7 +759,7 @@ var GempLotrGameUI = Class.extend({ var currentPlayerTurn = (this.currentPlayerId == this.bottomPlayerId); if (this.advPathGroup != null) { - this.statsDiv.css({position: "absolute", left: padding + "px", top: height - (padding * 2) - chatHeight - 34 + "px", width: advPathWidth - 4 , height: 30}); + this.statsDiv.css({position:"absolute", left:padding + "px", top:height - (padding * 2) - chatHeight - 34 + "px", width:advPathWidth - 4, height:30}); this.advPathGroup.setBounds(padding, padding, advPathWidth, height - (padding * 3) - chatHeight - 34 - padding); this.supportOpponent.setBounds(advPathWidth + specialUiWidth + (padding * 2), padding + yScales[0] * heightPerScale, width - (advPathWidth + specialUiWidth + padding * 3), heightScales[0] * heightPerScale); @@ -774,23 +775,23 @@ var GempLotrGameUI = Class.extend({ var groupHeight = currentPlayerTurn ? (heightScales[2] * heightPerScale + heightScales[3] * heightPerScale + padding) : (heightScales[1] * heightPerScale + heightScales[2] * heightPerScale + padding); var x = advPathWidth + specialUiWidth + (padding * 2) + charsWidthWithAssignments + padding + i * (groupWidth + padding); var y = currentPlayerTurn ? (padding * 3 + yScales[2] * heightPerScale) : (padding * 2 + yScales[1] * heightPerScale); - this.skirmishGroupDiv.css({left:x + "px", top:y + "px", width: groupWidth, height: groupHeight, position: "absolute"}); + this.skirmishGroupDiv.css({left:x + "px", top:y + "px", width:groupWidth, height:groupHeight, position:"absolute"}); var strengthBoxSize = 40; var dmgBoxSize = 30; if (currentPlayerTurn) { this.skirmishShadowGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6); this.skirmishFellowshipGroup.setBounds(x + 3, y + heightScales[2] * heightPerScale + padding + 3, groupWidth - 6, heightScales[3] * heightPerScale - 6); - this.fpStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50}); - this.fpDamageBonusDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top: groupHeight - dmgBoxSize - 2 + "px", width: dmgBoxSize, height: dmgBoxSize, "z-index": 50}); - this.shadowStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50}); - this.shadowDamageBonusDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top: 2 + "px", width: dmgBoxSize, height: dmgBoxSize, "z-index": 50}); + this.fpStrengthDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - 2 + "px", top:groupHeight - strengthBoxSize - 2 + "px", width:strengthBoxSize, height:strengthBoxSize, "z-index":50}); + this.fpDamageBonusDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top:groupHeight - dmgBoxSize - 2 + "px", width:dmgBoxSize, height:dmgBoxSize, "z-index":50}); + this.shadowStrengthDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - 2 + "px", top:2 + "px", width:strengthBoxSize, height:strengthBoxSize, "z-index":50}); + this.shadowDamageBonusDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top:2 + "px", width:dmgBoxSize, height:dmgBoxSize, "z-index":50}); } else { this.skirmishFellowshipGroup.setBounds(x + 3, y + 3, groupWidth - 6, heightScales[1] * heightPerScale - 6); this.skirmishShadowGroup.setBounds(x + 3, y + heightScales[1] * heightPerScale + padding + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6); - this.shadowStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: groupHeight - strengthBoxSize - 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50}); - this.shadowDamageBonusDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top: groupHeight - dmgBoxSize - 2 + "px", width: dmgBoxSize, height: dmgBoxSize, "z-index": 50}); - this.fpStrengthDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - 2 + "px", top: 2 + "px", width: strengthBoxSize, height: strengthBoxSize, "z-index": 50}); - this.fpDamageBonusDiv.css({position: "absolute", left: groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top: 2 + "px", width: dmgBoxSize, height: dmgBoxSize, "z-index": 50}); + this.shadowStrengthDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - 2 + "px", top:groupHeight - strengthBoxSize - 2 + "px", width:strengthBoxSize, height:strengthBoxSize, "z-index":50}); + this.shadowDamageBonusDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top:groupHeight - dmgBoxSize - 2 + "px", width:dmgBoxSize, height:dmgBoxSize, "z-index":50}); + this.fpStrengthDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - 2 + "px", top:2 + "px", width:strengthBoxSize, height:strengthBoxSize, "z-index":50}); + this.fpDamageBonusDiv.css({position:"absolute", left:groupWidth - strengthBoxSize - dmgBoxSize - 2 + "px", top:2 + "px", width:dmgBoxSize, height:dmgBoxSize, "z-index":50}); } i++; } @@ -802,7 +803,7 @@ var GempLotrGameUI = Class.extend({ var groupHeight = currentPlayerTurn ? (heightScales[2] * heightPerScale + heightScales[3] * heightPerScale + padding) : (heightScales[1] * heightPerScale + heightScales[2] * heightPerScale + padding); var x = advPathWidth + specialUiWidth + (padding * 2) + charsWidthWithAssignments + padding + i * (groupWidth + padding); var y = currentPlayerTurn ? (padding * 3 + yScales[2] * heightPerScale) : (padding * 2 + yScales[1] * heightPerScale); - this.assignGroupDivs[assignIndex].css({left:x + "px", top:y + "px", width: groupWidth, height: groupHeight, position: "absolute"}); + this.assignGroupDivs[assignIndex].css({left:x + "px", top:y + "px", width:groupWidth, height:groupHeight, position:"absolute"}); if (currentPlayerTurn) { this.shadowAssignGroups[characterId].setBounds(x + 3, y + 3, groupWidth - 6, heightScales[2] * heightPerScale - 6); this.freePeopleAssignGroups[characterId].setBounds(x + 3, y + heightScales[2] * heightPerScale + padding + 3, groupWidth - 6, heightScales[3] * heightPerScale - 6); @@ -819,9 +820,9 @@ var GempLotrGameUI = Class.extend({ if (!this.spectatorMode) this.hand.setBounds(advPathWidth + specialUiWidth + (padding * 2), padding * 6 + yScales[5] * heightPerScale, width - (advPathWidth + specialUiWidth + padding * 3), heightScales[5] * heightPerScale); - this.gameStateElem.css({ position: "absolute", left: padding * 2 + advPathWidth, top: padding, width: specialUiWidth - padding, height: height - padding * 4 - alertHeight - chatHeight}); + this.gameStateElem.css({ position:"absolute", left:padding * 2 + advPathWidth, top:padding, width:specialUiWidth - padding, height:height - padding * 4 - alertHeight - chatHeight}); this.extraActionsGroup.setBounds(padding * 2 + advPathWidth, padding + 160, specialUiWidth - padding, height - padding * 4 - alertHeight - chatHeight - 160); - this.alertBox.css({ position: "absolute", left: padding * 2 + advPathWidth, top: height - (padding * 2) - alertHeight - chatHeight, width: specialUiWidth - padding, height: alertHeight }); + this.alertBox.css({ position:"absolute", left:padding * 2 + advPathWidth, top:height - (padding * 2) - alertHeight - chatHeight, width:specialUiWidth - padding, height:alertHeight }); for (var playerId in this.discardPileGroups) @@ -836,67 +837,67 @@ var GempLotrGameUI = Class.extend({ if (this.deadPileGroups.hasOwnProperty(playerId)) this.deadPileGroups[playerId].layoutCards(); } - this.tabPane.css({ position: "absolute", left: padding, top: height - padding - chatHeight, width: specialUiWidth + advPathWidth - padding, height: chatHeight - padding}); + this.tabPane.css({ position:"absolute", left:padding, top:height - padding - chatHeight, width:specialUiWidth + advPathWidth - padding, height:chatHeight - padding}); this.chatBox.setBounds(4, 4 + 25, specialUiWidth + advPathWidth - 8, chatHeight - 8 - 25); if (this.replayMode) { - $(".replay").css({position: "absolute", left: width - 50 - 4 - padding, top: height - 50 - 2 - padding, width: 50, height: 50, "z-index": 1000}); + $(".replay").css({position:"absolute", left:width - 50 - 4 - padding, top:height - 50 - 2 - padding, width:50, height:50, "z-index":1000}); } }, - startGameSession: function() { + startGameSession:function () { var that = this; this.communication.startGameSession( - function(xml) { - that.processXml(xml, false); - }); + function (xml) { + that.processXml(xml, false); + }); }, - startReplaySession: function(replayId) { + startReplaySession:function (replayId) { var that = this; this.communication.getReplay(replayId, - function(xml) { - that.processXmlReplay(xml, true); - }); + function (xml) { + that.processXmlReplay(xml, true); + }); }, - updateGameState: function() { + updateGameState:function () { var that = this; this.communication.updateGameState( - this.channelNumber, - function(xml) { - that.processXml(xml, true); - }); + this.channelNumber, + function (xml) { + that.processXml(xml, true); + }); }, - decisionFunction: function(decisionId, result) { + decisionFunction:function (decisionId, result) { var that = this; this.communication.gameDecisionMade(decisionId, result, - this.channelNumber, - function(xml) { - that.processXml(xml, true); - }); + this.channelNumber, + function (xml) { + that.processXml(xml, true); + }); }, - getCardModifiersFunction: function(cardId, func) { + getCardModifiersFunction:function (cardId, func) { var that = this; this.communication.getGameCardModifiers(cardId, - function(html) { - that.setCardModifiers(html); - }); + function (html) { + that.setCardModifiers(html); + }); }, - processXml: function(xml, animate) { + processXml:function (xml, animate) { log(xml); var root = xml.documentElement; if (root.tagName == 'gameState' || root.tagName == 'update') this.processGameEventsXml(root, animate); }, - replayGameEventNextIndex: 0, - replayGameEvents: null, + replayGameEventNextIndex:0, + replayGameEvents:null, - processXmlReplay: function(xml, animate) { + processXmlReplay:function (xml, animate) { var that = this; log(xml); var root = xml.documentElement; @@ -905,42 +906,42 @@ var GempLotrGameUI = Class.extend({ this.replayGameEventNextIndex = 0; $("label", $(".replay")).click( - function() { - that.playNextReplayEvent(); - }); + function () { + that.playNextReplayEvent(); + }); this.playNextReplayEvent(); } }, - shouldPlay: function() { + shouldPlay:function () { return $("label", $(".replay")).hasClass("ui-state-active"); }, - playNextReplayEvent: function() { + playNextReplayEvent:function () { if (this.shouldPlay()) { var that = this; if (this.replayGameEventNextIndex < this.replayGameEvents.length) { $("#main").queue( - function(next) { - that.cleanupDecision(); - next(); - }); + function (next) { + that.cleanupDecision(); + next(); + }); var gameEvent = this.replayGameEvents[this.replayGameEventNextIndex]; this.processGameEvent(gameEvent, true); this.replayGameEventNextIndex++; $("#main").queue( - function(next) { - that.playNextReplayEvent(); - next(); - }); + function (next) { + that.playNextReplayEvent(); + next(); + }); } } }, - processGameEvent: function(gameEvent, animate) { + processGameEvent:function (gameEvent, animate) { var eventType = gameEvent.getAttribute("type"); if (eventType == "PCIP") { this.animations.putCardInPlay(gameEvent, animate); @@ -991,7 +992,7 @@ var GempLotrGameUI = Class.extend({ } }, - processGameEventsXml: function(element, animate) { + processGameEventsXml:function (element, animate) { this.channelNumber = element.getAttribute("cn"); var gameEvents = element.getElementsByTagName("ge"); @@ -1032,14 +1033,14 @@ var GempLotrGameUI = Class.extend({ this.animations.updateGameState(animate); }, - getPlayerIndex: function(playerId) { + getPlayerIndex:function (playerId) { for (var plId = 0; plId < this.allPlayerIds.length; plId++) if (this.allPlayerIds[plId] == playerId) return plId; return -1; }, - layoutZones: function() { + layoutZones:function () { this.advPathGroup.layoutCards(); this.charactersPlayer.layoutCards(); this.charactersOpponent.layoutCards(); @@ -1060,7 +1061,7 @@ var GempLotrGameUI = Class.extend({ } }, - participant: function(element) { + participant:function (element) { var participantId = element.getAttribute("participantId"); this.allPlayerIds = element.getAttribute("allParticipantIds").split(","); @@ -1076,70 +1077,70 @@ var GempLotrGameUI = Class.extend({ this.spectatorMode = false; var discardPileDialog = $("
    ").dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: true, - title: "Discard - " + participantId, - minHeight: 80, - minWidth: 200, - width: 600, - height: 300 + autoOpen:false, + closeOnEscape:true, + resizable:true, + title:"Discard - " + participantId, + minHeight:80, + minWidth:200, + width:600, + height:300 }); this.discardPileDialogs[participantId] = discardPileDialog; - this.discardPileGroups[participantId] = new NormalCardGroup(discardPileDialog, function(card) { + this.discardPileGroups[participantId] = new NormalCardGroup(discardPileDialog, function (card) { return true; }, false); this.discardPileGroups[participantId].setBounds(this.padding, this.padding, 580 - 2 * (this.padding), 250 - 2 * (this.padding)); - discardPileDialog.bind("dialogresize", function() { + discardPileDialog.bind("dialogresize", function () { that.dialogResize(discardPileDialog, that.discardPileGroups[participantId]); }); var adventureDeckDialog = $("
    ").dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: true, - title: "Adventure deck - " + participantId, - minHeight: 80, - minWidth: 200, - width: 600, - height: 300 + autoOpen:false, + closeOnEscape:true, + resizable:true, + title:"Adventure deck - " + participantId, + minHeight:80, + minWidth:200, + width:600, + height:300 }); this.adventureDeckDialogs[participantId] = adventureDeckDialog; - this.adventureDeckGroups[participantId] = new NormalCardGroup(adventureDeckDialog, function(card) { + this.adventureDeckGroups[participantId] = new NormalCardGroup(adventureDeckDialog, function (card) { return true; }, false); this.adventureDeckGroups[participantId].setBounds(this.padding, this.padding, 580 - 2 * (this.padding), 250 - 2 * (this.padding)); - adventureDeckDialog.bind("dialogresize", function() { + adventureDeckDialog.bind("dialogresize", function () { that.dialogResize(adventureDeckDialog, that.adventureDeckGroups[participantId]); }); } for (var i = 0; i < this.allPlayerIds.length; i++) { var deadPileDialog = $("
    ").dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: true, - title: "Dead pile - " + this.allPlayerIds[i], - minHeight: 80, - minWidth: 200, - width: 600, - height: 300 + autoOpen:false, + closeOnEscape:true, + resizable:true, + title:"Dead pile - " + this.allPlayerIds[i], + minHeight:80, + minWidth:200, + width:600, + height:300 }); this.deadPileDialogs[this.allPlayerIds[i]] = deadPileDialog; - this.deadPileGroups[this.allPlayerIds[i]] = new NormalCardGroup(deadPileDialog, function(card) { + this.deadPileGroups[this.allPlayerIds[i]] = new NormalCardGroup(deadPileDialog, function (card) { return true; }, false); this.deadPileGroups[this.allPlayerIds[i]].setBounds(this.padding, this.padding, 580 - 2 * (this.padding), 250 - 2 * (this.padding)); - deadPileDialog.bind("dialogresize", (function(dialog, index) { - return function() { + deadPileDialog.bind("dialogresize", (function (dialog, index) { + return function () { that.dialogResize(dialog, that.deadPileGroups[that.allPlayerIds[index]]); } })(deadPileDialog, i)); @@ -1149,7 +1150,7 @@ var GempLotrGameUI = Class.extend({ this.layoutUI(true); }, - getDecisionParameter: function(decision, name) { + getDecisionParameter:function (decision, name) { var parameters = decision.getElementsByTagName("parameter"); for (var i = 0; i < parameters.length; i++) if (parameters[i].getAttribute("name") == name) @@ -1158,7 +1159,7 @@ var GempLotrGameUI = Class.extend({ return null; }, - getDecisionParameters: function(decision, name) { + getDecisionParameters:function (decision, name) { var result = new Array(); var parameters = decision.getElementsByTagName("parameter"); for (var i = 0; i < parameters.length; i++) @@ -1168,7 +1169,7 @@ var GempLotrGameUI = Class.extend({ return result; }, - cleanupDecision: function() { + cleanupDecision:function () { this.smallDialog.dialog("close"); this.cardActionDialog.dialog("close"); this.clearSelection(); @@ -1177,16 +1178,16 @@ var GempLotrGameUI = Class.extend({ if (this.alertButtons != null) this.alertButtons.html(""); $(".card").each( - function() { - var card = $(this).data("card"); - if (card.zone == "EXTRA") - $(this).remove(); - }); + function () { + var card = $(this).data("card"); + if (card.zone == "EXTRA") + $(this).remove(); + }); if (this.extraActionsGroup != null) this.extraActionsGroup.layoutCards(); }, - integerDecision: function(decision) { + integerDecision:function (decision) { var id = decision.getAttribute("id"); var text = decision.getAttribute("text"); var val = 0; @@ -1204,35 +1205,35 @@ var GempLotrGameUI = Class.extend({ var that = this; this.smallDialog - .html(text + "
    "); + .html(text + "
    "); if (!this.replayMode) { this.smallDialog.dialog("option", "buttons", - { - "OK": function() { - $(this).dialog("close"); - that.decisionFunction(id, $("#integerDecision").val()); - } - }); + { + "OK":function () { + $(this).dialog("close"); + that.decisionFunction(id, $("#integerDecision").val()); + } + }); } - $("#integerDecision").SpinnerControl({ type: 'range', - typedata: { - min: parseInt(min), - max: parseInt(max), - interval: 1, - decimalplaces: 0 + $("#integerDecision").SpinnerControl({ type:'range', + typedata:{ + min:parseInt(min), + max:parseInt(max), + interval:1, + decimalplaces:0 }, - defaultVal: val, - width: '50px', - backColor: "#000000" + defaultVal:val, + width:'50px', + backColor:"#000000" }); this.smallDialog.dialog("open"); $('.ui-dialog :button').blur(); }, - multipleChoiceDecision: function(decision) { + multipleChoiceDecision:function (decision) { var id = decision.getAttribute("id"); var text = decision.getAttribute("text"); @@ -1240,7 +1241,7 @@ var GempLotrGameUI = Class.extend({ var that = this; this.smallDialog - .html(text); + .html(text); if (results.length > 2 || this.settingsAlwaysDropDown) { var html = "