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("Always display drop-down in answer selection ");
@@ -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("Concede game ");
$("#concedeGame").button().click(
- function() {
- that.communication.concede();
- });
+ function () {
+ that.communication.concede();
+ });
$("#gameOptionsBox").append("Request game cancel ");
$("#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 = "";
@@ -1251,12 +1252,12 @@ var GempLotrGameUI = Class.extend({
if (!this.replayMode) {
this.smallDialog.dialog("option", "buttons",
- {
- "OK": function() {
- that.smallDialog.dialog("close");
- that.decisionFunction(id, $("#multipleChoiceDecision").val());
- }
- });
+ {
+ "OK":function () {
+ that.smallDialog.dialog("close");
+ that.decisionFunction(id, $("#multipleChoiceDecision").val());
+ }
+ });
}
} else {
this.smallDialog.append(" ");
@@ -1267,12 +1268,12 @@ var GempLotrGameUI = Class.extend({
var but = $(" ").html(results[i]).button();
if (!this.replayMode) {
but.click(
- (function(ind) {
- return function() {
- that.smallDialog.dialog("close");
- that.decisionFunction(id, "" + ind);
- }
- })(i));
+ (function (ind) {
+ return function () {
+ that.smallDialog.dialog("close");
+ that.decisionFunction(id, "" + ind);
+ }
+ })(i));
}
this.smallDialog.append(but);
}
@@ -1284,7 +1285,7 @@ var GempLotrGameUI = Class.extend({
$('.ui-dialog :button').blur();
},
- ensureCardHasBoxes: function(cardDiv) {
+ ensureCardHasBoxes:function (cardDiv) {
if ($(".cardStrength", cardDiv).length == 0) {
var tokenOverlay = $(".tokenOverlay", cardDiv);
@@ -1301,24 +1302,24 @@ var GempLotrGameUI = Class.extend({
tokenOverlay.append(cardVitalityDiv);
var cardSiteNumberBgDiv = $("");
- cardSiteNumberBgDiv.css({display: "none"});
+ cardSiteNumberBgDiv.css({display:"none"});
tokenOverlay.append(cardSiteNumberBgDiv);
var cardSiteNumberDiv = $("
");
- cardSiteNumberDiv.css({display: "none"});
+ cardSiteNumberDiv.css({display:"none"});
tokenOverlay.append(cardSiteNumberDiv);
var cardResistanceBgDiv = $("");
- cardResistanceBgDiv.css({display: "none"});
+ cardResistanceBgDiv.css({display:"none"});
tokenOverlay.append(cardResistanceBgDiv);
var cardResistanceDiv = $("
");
- cardResistanceDiv.css({display: "none"});
+ cardResistanceDiv.css({display:"none"});
tokenOverlay.append(cardResistanceDiv);
var sizeListeners = new Array();
sizeListeners[0] = {
- sizeChanged: function(cardElem, width, height) {
+ sizeChanged:function (cardElem, width, height) {
var maxDimension = Math.max(width, height);
var size = 0.0865 * maxDimension;
@@ -1344,14 +1345,14 @@ var GempLotrGameUI = Class.extend({
var thirdBoxY = 0.845 * height;
var thirdBoxSize = 0.115 * height;
- $(".cardStrengthBg", cardElem).css({position: "absolute", left: strBgX + "px", top: strBgY + "px", width: strBgWidth, height: strBgHeight});
- $(".cardStrength", cardElem).css({position: "absolute", "font-size": fontPerc, left: x + "px", top: strengthY + "px", width: size, height: size});
- $(".cardVitalityBg", cardElem).css({position: "absolute", left: vitBgX + "px", top: vitBgY + "px", width: vitalityBgSize, height: vitalityBgSize});
- $(".cardVitality", cardElem).css({position: "absolute", "font-size": fontPerc, left: x + "px", top: vitalityY + "px", width: size, height: size});
- $(".cardSiteNumberBg", cardElem).css({position: "absolute", left: thirdBoxX + "px", top: thirdBoxY + "px", width: thirdBoxSize, height: thirdBoxSize});
- $(".cardSiteNumber", cardElem).css({position: "absolute", "border-radius": borderRadius, "font-size": fontPerc, left: x + "px", top: minionSiteNumberY + "px", width: size, height: size});
- $(".cardResistanceBg", cardElem).css({position: "absolute", left: thirdBoxX + "px", top: thirdBoxY + "px", width: thirdBoxSize, height: thirdBoxSize});
- $(".cardResistance", cardElem).css({position: "absolute", "border-radius": borderRadius, "font-size": fontPerc, left: x + "px", top: minionSiteNumberY + "px", width: size, height: size});
+ $(".cardStrengthBg", cardElem).css({position:"absolute", left:strBgX + "px", top:strBgY + "px", width:strBgWidth, height:strBgHeight});
+ $(".cardStrength", cardElem).css({position:"absolute", "font-size":fontPerc, left:x + "px", top:strengthY + "px", width:size, height:size});
+ $(".cardVitalityBg", cardElem).css({position:"absolute", left:vitBgX + "px", top:vitBgY + "px", width:vitalityBgSize, height:vitalityBgSize});
+ $(".cardVitality", cardElem).css({position:"absolute", "font-size":fontPerc, left:x + "px", top:vitalityY + "px", width:size, height:size});
+ $(".cardSiteNumberBg", cardElem).css({position:"absolute", left:thirdBoxX + "px", top:thirdBoxY + "px", width:thirdBoxSize, height:thirdBoxSize});
+ $(".cardSiteNumber", cardElem).css({position:"absolute", "border-radius":borderRadius, "font-size":fontPerc, left:x + "px", top:minionSiteNumberY + "px", width:size, height:size});
+ $(".cardResistanceBg", cardElem).css({position:"absolute", left:thirdBoxX + "px", top:thirdBoxY + "px", width:thirdBoxSize, height:thirdBoxSize});
+ $(".cardResistance", cardElem).css({position:"absolute", "border-radius":borderRadius, "font-size":fontPerc, left:x + "px", top:minionSiteNumberY + "px", width:size, height:size});
}
};
@@ -1360,15 +1361,15 @@ var GempLotrGameUI = Class.extend({
}
},
- createCardDiv: function(card, text) {
+ createCardDiv:function (card, text) {
var cardDiv = createCardDiv(card.imageUrl, text, card.isFoil(), true, false, card.hasErrata());
cardDiv.data("card", card);
var that = this;
var swipeOptions = {
- threshold: 20,
- swipeUp: function (event) {
+ threshold:20,
+ swipeUp:function (event) {
var tar = $(event.target);
if (tar.hasClass("actionArea")) {
tar = tar.parent();
@@ -1385,7 +1386,7 @@ var GempLotrGameUI = Class.extend({
return cardDiv;
},
- attachSelectionFunctions: function(cardIds, selection) {
+ attachSelectionFunctions:function (cardIds, selection) {
if (selection) {
if (cardIds.length > 0)
$(".card:cardId(" + cardIds + ")").addClass("selectableCard");
@@ -1396,7 +1397,7 @@ var GempLotrGameUI = Class.extend({
},
// Choosing cards from a predefined selection (for example stating fellowship)
- arbitraryCardsDecision: function(decision) {
+ arbitraryCardsDecision:function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -1413,8 +1414,8 @@ var GempLotrGameUI = Class.extend({
var selectableCardIds = new Array();
this.cardActionDialog
- .html("
")
- .dialog("option", "title", text);
+ .html("
")
+ .dialog("option", "title", text);
// Create the action cards and fill the dialog with them
for (var i = 0; i < blueprintIds.length; i++) {
@@ -1431,36 +1432,36 @@ var GempLotrGameUI = Class.extend({
$("#arbitraryChoice").append(cardDiv);
}
- var finishChoice = function() {
+ var finishChoice = function () {
that.cardActionDialog.dialog("close");
$("#arbitraryChoice").html("");
that.clearSelection();
that.decisionFunction(id, "" + selectedCardIds);
};
- var resetChoice = function() {
+ var resetChoice = function () {
selectedCardIds = new Array();
that.clearSelection();
allowSelection();
processButtons();
};
- var processButtons = function() {
+ var processButtons = function () {
var buttons = {};
if (selectedCardIds.length > 0)
- buttons["Clear selection"] = function() {
+ buttons["Clear selection"] = function () {
resetChoice();
processButtons();
};
if (selectedCardIds.length >= min)
- buttons["Done"] = function() {
+ buttons["Done"] = function () {
finishChoice();
};
that.cardActionDialog.dialog("option", "buttons", buttons);
};
- var allowSelection = function() {
- that.selectionFunction = function(cardId) {
+ var allowSelection = function () {
+ that.selectionFunction = function (cardId) {
selectedCardIds.push(cardId);
if (selectedCardIds.length == max) {
@@ -1492,7 +1493,7 @@ var GempLotrGameUI = Class.extend({
},
// Choosing one action to resolve, for example phase actions
- cardActionChoiceDecision: function (decision) {
+ cardActionChoiceDecision:function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -1512,48 +1513,48 @@ var GempLotrGameUI = Class.extend({
this.alertText.html(text);
- var processButtons = function() {
+ var processButtons = function () {
that.alertButtons.html("");
if (selectedCardIds.length == 0) {
that.alertButtons.append("Pass ");
- $("#Pass").button().click(function() {
+ $("#Pass").button().click(function () {
finishChoice();
});
}
if (selectedCardIds.length > 0) {
that.alertButtons.append("Reset choice ");
that.alertButtons.append("Done ");
- $("#Done").button().click(function() {
+ $("#Done").button().click(function () {
finishChoice();
});
- $("#ClearSelection").button().click(function() {
+ $("#ClearSelection").button().click(function () {
resetChoice();
});
}
};
- var finishChoice = function() {
+ var finishChoice = function () {
that.alertText.html("");
that.alertButtons.html("");
that.clearSelection();
$(".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();
+ });
that.extraActionsGroup.layoutCards();
that.decisionFunction(id, "" + selectedCardIds);
};
- var resetChoice = function() {
+ var resetChoice = function () {
selectedCardIds = new Array();
that.clearSelection();
allowSelection();
processButtons();
};
- var allowSelection = function() {
+ var allowSelection = function () {
var hasVirtual = false;
for (var i = 0; i < cardIds.length; i++) {
@@ -1569,14 +1570,14 @@ var GempLotrGameUI = Class.extend({
}
var actions = cardIdElem.data("action");
- actions.push({ actionId: actionId, actionText: actionText });
+ actions.push({ actionId:actionId, actionText:actionText });
} else {
hasVirtual = true;
cardIds[i] = "extra" + cardId;
var card = new Card(blueprintId, "EXTRA", "extra" + cardId, null);
var cardDiv = that.createCardDiv(card);
- $(cardDiv).css({opacity: "0.8"});
+ $(cardDiv).css({opacity:"0.8"});
$("#main").append(cardDiv);
@@ -1586,7 +1587,7 @@ var GempLotrGameUI = Class.extend({
}
var actions = cardIdElem.data("action");
- actions.push({ actionId: actionId, actionText: actionText });
+ actions.push({ actionId:actionId, actionText:actionText });
}
}
@@ -1594,11 +1595,11 @@ var GempLotrGameUI = Class.extend({
that.extraActionsGroup.layoutCards();
}
- that.selectionFunction = function(cardId, event) {
+ that.selectionFunction = function (cardId, event) {
var cardIdElem = $(".card:cardId(" + cardId + ")");
var actions = cardIdElem.data("action");
- var selectActionFunction = function(actionId) {
+ var selectActionFunction = function (actionId) {
selectedCardIds.push(actionId);
if (that.settingsAutoAccept) {
finishChoice();
@@ -1627,7 +1628,7 @@ var GempLotrGameUI = Class.extend({
$(':button').blur();
},
- createActionChoiceContextMenu: function(actions, event, selectActionFunction) {
+ createActionChoiceContextMenu:function (actions, event, selectActionFunction) {
// Remove context menus that may be showing
$(".contextMenu").remove();
@@ -1642,17 +1643,17 @@ var GempLotrGameUI = Class.extend({
var x = event.pageX;
var y = event.pageY;
- $(div).css({left: x, top: y}).fadeIn(150);
+ $(div).css({left:x, top:y}).fadeIn(150);
$(div).find('A').mouseover(
- function() {
- $(div).find('LI.hover').removeClass('hover');
- $(this).parent().addClass('hover');
- }).mouseout(function() {
- $(div).find('LI.hover').removeClass('hover');
- });
+ function () {
+ $(div).find('LI.hover').removeClass('hover');
+ $(this).parent().addClass('hover');
+ }).mouseout(function () {
+ $(div).find('LI.hover').removeClass('hover');
+ });
- var getRidOfContextMenu = function() {
+ var getRidOfContextMenu = function () {
$(div).remove();
$(document).unbind("click", getRidOfContextMenu);
return false;
@@ -1660,7 +1661,7 @@ var GempLotrGameUI = Class.extend({
// When items are selected
$(div).find('A').unbind('click');
- $(div).find('LI:not(.disabled) A').click(function() {
+ $(div).find('LI:not(.disabled) A').click(function () {
$(document).unbind('click', getRidOfContextMenu);
$(".contextMenu").remove();
@@ -1670,13 +1671,13 @@ var GempLotrGameUI = Class.extend({
});
// Hide bindings
- setTimeout(function() { // Delay for Mozilla
+ setTimeout(function () { // Delay for Mozilla
$(document).click(getRidOfContextMenu);
}, 0);
},
// Choosing one action to resolve, for example required triggered actions
- actionChoiceDecision: function (decision) {
+ actionChoiceDecision:function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -1689,8 +1690,8 @@ var GempLotrGameUI = Class.extend({
var selectedActionIds = new Array();
this.cardActionDialog
- .html("
")
- .dialog("option", "title", text);
+ .html("
")
+ .dialog("option", "title", text);
var cardIds = new Array();
@@ -1705,36 +1706,36 @@ var GempLotrGameUI = Class.extend({
$("#arbitraryChoice").append(cardDiv);
}
- var finishChoice = function() {
+ var finishChoice = function () {
that.cardActionDialog.dialog("close");
$("#arbitraryChoice").html("");
that.clearSelection();
that.decisionFunction(id, "" + selectedActionIds);
};
- var resetChoice = function() {
+ var resetChoice = function () {
selectedActionIds = new Array();
that.clearSelection();
allowSelection();
processButtons();
};
- var processButtons = function() {
+ var processButtons = function () {
var buttons = {};
if (selectedActionIds.length > 0) {
- buttons["Clear selection"] = function() {
+ buttons["Clear selection"] = function () {
resetChoice();
processButtons();
};
- buttons["Done"] = function() {
+ buttons["Done"] = function () {
finishChoice();
};
}
that.cardActionDialog.dialog("option", "buttons", buttons);
};
- var allowSelection = function() {
- that.selectionFunction = function(cardId) {
+ var allowSelection = function () {
+ that.selectionFunction = function (cardId) {
var actionId = actionIds[parseInt(cardId.substring(4))];
selectedActionIds.push(actionId);
@@ -1761,7 +1762,7 @@ var GempLotrGameUI = Class.extend({
},
// Choosing some number of cards, for example to wound
- cardSelectionDecision: function(decision) {
+ cardSelectionDecision:function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -1775,38 +1776,38 @@ var GempLotrGameUI = Class.extend({
var selectedCardIds = new Array();
- var finishChoice = function() {
+ var finishChoice = function () {
that.alertText.html("");
that.alertButtons.html("");
that.clearSelection();
that.decisionFunction(id, "" + selectedCardIds);
};
- var resetChoice = function() {
+ var resetChoice = function () {
selectedCardIds = new Array();
that.clearSelection();
allowSelection();
processButtons();
};
- var processButtons = function() {
+ var processButtons = function () {
that.alertButtons.html("");
if (selectedCardIds.length > 0) {
that.alertButtons.append("Reset choice ");
- $("#ClearSelection").button().click(function() {
+ $("#ClearSelection").button().click(function () {
resetChoice();
});
}
if (selectedCardIds.length >= min) {
that.alertButtons.append("Done ");
- $("#Done").button().click(function() {
+ $("#Done").button().click(function () {
finishChoice();
});
}
};
- var allowSelection = function() {
- that.selectionFunction = function(cardId) {
+ var allowSelection = function () {
+ that.selectionFunction = function (cardId) {
selectedCardIds.push(cardId);
if (selectedCardIds.length == max) {
if (this.settingsAutoAccept) {
@@ -1832,7 +1833,7 @@ var GempLotrGameUI = Class.extend({
processButtons();
},
- assignMinionsDecision: function(decision) {
+ assignMinionsDecision:function (decision) {
var id = decision.getAttribute("id");
var text = decision.getAttribute("text");
@@ -1841,10 +1842,15 @@ var GempLotrGameUI = Class.extend({
var that = this;
+ this.assignmentStarted = false;
+
this.alertText.html(text);
if (!this.replayMode) {
this.alertButtons.html("Done ");
- $("#Done").button().click(function() {
+ $("#Done").button().click(function () {
+ if (!that.assignmentStarted && !confirm("Do you want to skip assigning?"))
+ return;
+
that.alertText.html("");
that.alertButtons.html("");
that.clearSelection();
@@ -1854,7 +1860,7 @@ var GempLotrGameUI = Class.extend({
assignmentMap[freeCharacters[i]] = freeCharacters[i];
}
if (minions.length > 0)
- $(".card:cardId(" + minions + ")").each(function() {
+ $(".card:cardId(" + minions + ")").each(function () {
var card = $(this).data("card");
if (card.assign != null)
assignmentMap[card.assign] += " " + card.cardId;
@@ -1872,7 +1878,7 @@ var GempLotrGameUI = Class.extend({
this.doAssignments(freeCharacters, minions);
},
- unassignMinion: function(minionId) {
+ unassignMinion:function (minionId) {
var previousCharacterId = $(".card:cardId(" + minionId + ")").data("card").assign;
delete $(".card:cardId(" + minionId + ")").data("card").assign;
@@ -1890,7 +1896,7 @@ var GempLotrGameUI = Class.extend({
}
},
- assignMinion: function(minionId, characterId) {
+ assignMinion:function (minionId, characterId) {
if ($(".card:cardId(" + minionId + ")").data("card").assign != null)
this.unassignMinion(minionId);
@@ -1905,7 +1911,7 @@ var GempLotrGameUI = Class.extend({
}, false);
var newDiv = $("
");
- newDiv.css({"border-radius": "7px"});
+ newDiv.css({"border-radius":"7px"});
$("#main").append(newDiv);
this.assignGroupDivs.push(newDiv);
}
@@ -1913,12 +1919,13 @@ var GempLotrGameUI = Class.extend({
$(".card:cardId(" + minionId + ")").data("card").assign = characterId;
},
- doAssignments: function(freeCharacters, minions) {
+ doAssignments:function (freeCharacters, minions) {
var that = this;
- this.selectionFunction = function(cardId) {
+ this.selectionFunction = function (cardId) {
+ that.assignmentStarted = true;
that.clearSelection();
- that.selectionFunction = function(secondCardId) {
+ that.selectionFunction = function (secondCardId) {
that.clearSelection();
if (cardId != secondCardId) {
that.assignMinion(cardId, secondCardId);
@@ -1936,20 +1943,20 @@ var GempLotrGameUI = Class.extend({
this.attachSelectionFunctions(minions, true);
},
- clearSelection: function() {
+ clearSelection:function () {
$(".selectableCard").removeClass("selectableCard").data("action", null);
$(".actionableCard").removeClass("actionableCard").data("action", null);
$(".selectedCard").removeClass("selectedCard");
this.selectionFunction = null;
},
- dialogResize: function(dialog, group) {
+ dialogResize:function (dialog, group) {
var width = dialog.width() + 10;
var height = dialog.height() + 10;
group.setBounds(this.padding, this.padding, width - 2 * this.padding, height - 2 * this.padding);
},
- arbitraryDialogResize: function(texts) {
+ arbitraryDialogResize:function (texts) {
if (texts) {
var width = this.cardActionDialog.width() + 10;
var height = this.cardActionDialog.height() - 10;