Frame 1
function checkGameLoad() {
chatMovie._visible = false;
gameMovie._visible = false;
var _local3 = Math.round(getBytesLoaded() * 1024);
var _local2 = Math.round(getBytesTotal() * 1024);
var _local1 = Math.round((_local3 / _local2) * 100);
barFill._xscale = _local1;
graphicBG.loadPercent.text = _local1 + "%";
if (_local1 >= 100) {
clearInterval(gameLoadInterval);
play();
chat._visible = true;
game._visible = true;
}
}
stop();
var gameLoadInterval;
gameLoadInterval = setInterval(checkGameLoad, 100);
Frame 2
function gotoFrame(frame) {
doDebug("gotoFrame: " + frame);
if (frame == "landing") {
resetGame();
} else if (frame == "game") {
doDebug("MY muID: " + fmsApp.muID);
gameStarting(fmsApp.currentGameSO);
} else if (frame == "cta") {
resetGame();
}
}
function init() {
clearInterval(blobInterval);
doDebug("signedIn: " + userInfo.signedIn);
if (userInfo.signedIn) {
doDebug("checking for game blob");
gameBlob = lotroRoot.getGameBlob(2);
blobInterval = setInterval(checkBlob, 100);
}
updateGameStatus("init");
initButtons();
betInput.bankAmount.text = bank;
betInput.betAmount.text = currentBet;
target._visible = false;
targetLeftPlate._visible = false;
targetRightPlate._visible = false;
targetMug._visible = false;
targetMugLeft._visible = false;
targetVase._visible = false;
targetLeftTorch._visible = false;
targetRightTorch._visible = false;
quitWindow._visible = false;
gameOverConfirm._visible = false;
rulesWindow._visible = false;
}
function initButtons() {
lotroLogo.onRelease = mx.utils.Delegate.create(this, doLotroURL);
swigLogo.lotroLogo.onRelease = mx.utils.Delegate.create(this, doLotroURL);
returnToMain.onRelease = mx.utils.Delegate.create(this, doReturnToMain);
windowStartGame.singlePlayer.onRelease = mx.utils.Delegate.create(this, startSinglePlayer);
windowStartGame.howToPlay.onRelease = mx.utils.Delegate.create(this, toggleRules);
rulesWindow.close.onRelease = mx.utils.Delegate.create(this, toggleRules);
rulesWindow.next.onRelease = mx.utils.Delegate.create(this, rulesIncrease);
rulesWindow.background.useHandCursor = false;
drinkInput.arrowUp.onRelease = mx.utils.Delegate.create(this, increaseDrink);
drinkInput.arrowDown.onRelease = null;
drinkInput.swig.onRelease = mx.utils.Delegate.create(this, doDrink);
drinkInput.arrowDown._alpha = 50;
drinkInput.drinkAmount.text = roundDrinks;
betInput.arrowUp.onRelease = mx.utils.Delegate.create(this, increaseBet);
betInput.arrowDown.onRelease = mx.utils.Delegate.create(this, decreaseBet);
betInput.bet.onRelease = mx.utils.Delegate.create(this, doBet);
betInput.maxBet.onRelease = mx.utils.Delegate.create(this, doMaxBet);
}
function toggleRules() {
if (rulesWindow._visible == false) {
rulesWindow.gotoAndStop(1);
rulesWindow._visible = true;
} else {
rulesWindow._visible = false;
}
}
function rulesIncrease() {
rulesWindow.play();
}
function checkBlob() {
if (gameBlob) {
doDebug("gameBlob: " + gameBlob);
if (gameBlob == "NO_BLOB") {
prevMediatorValue = 0;
prevDeadEyeValue = 0;
prevLastManValue = 0;
} else {
var _local1 = gameBlob.split("|");
prevMediatorValue = Number(_local1[0]);
prevDeadEyeValue = Number(_local1[1]);
prevLastManValue = Number(_local1[2]);
}
clearInterval(blobInterval);
}
}
function resetInit() {
bank = 250;
totalDrinks = 0;
roundDrinks = 0;
currentBet = 0;
isMultiplayer = false;
isWaiting = false;
initDrunk();
}
function updateGameStatus(status) {
gameStatus = status;
if (status == "waiting") {
isWaiting = true;
} else {
isWaiting = false;
}
doDebug("gameStatus: " + gameStatus);
}
function doReturnToMain() {
lotroRoot.backToMain();
}
function startSinglePlayer() {
doDebug("SINGLE PLAYER");
doPing("start");
lotroRoot.callGoogle("/swigAndToss/startSingleplayer");
startedMultiplayer = false;
singlePlayerClicked = true;
moriaChat.goto_game2();
playDrinkSound();
if (fmsApp.screenName) {
userScore.user.text = fmsApp.screenName;
} else {
userScore.user.text = "Your Score";
}
mpScore._visible = false;
gotoAndPlay ("start");
updateGameStatus("drink");
startTimer("drink");
}
function startMultiplayer() {
if (!singlePlayerClicked) {
doDebug("MULTIPLAYER");
startedMultiplayer = true;
singlePlayerClicked = false;
mpScore._visible = true;
playDrinkSound();
var _local3 = fmsApp.getUserObject(fmsApp.muID);
userScore.user.text = _local3.screenName;
doDebug(_local3.screenName);
var _local1 = 0;
while (_local1 < fmsApp.currentGameUserList.length) {
if (fmsApp.currentGameUserList[_local1] != fmsApp.muID) {
var _local2 = fmsApp.getUserObject(fmsApp.currentGameUserList[_local1]);
mpScore.user.text = _local2.screenName;
doDebug(_local2.screenName);
}
_local1++;
}
isMultiplayer = true;
doPing("start");
lotroRoot.callGoogle("/swigAndToss/startMultiplayer");
gotoAndPlay ("start");
updateGameStatus("drink");
startTimer("drink");
}
}
function increaseDrink() {
roundDrinks++;
drinkInput.drinkAmount.text = roundDrinks;
if ((totalDrinks + roundDrinks) == 0) {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
} else {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "0-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
}
updateDrinkArrows();
}
function decreaseDrink() {
roundDrinks--;
drinkInput.drinkAmount.text = roundDrinks;
if ((totalDrinks + roundDrinks) == 0) {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
} else {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "0-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
}
updateDrinkArrows();
}
function updateDrinkArrows() {
if (roundDrinks == 0) {
drinkInput.arrowDown.onRelease = null;
drinkInput.arrowDown._alpha = 50;
} else if (roundDrinks == 3) {
drinkInput.arrowUp.onRelease = null;
drinkInput.arrowUp._alpha = 50;
} else {
drinkInput.arrowDown.onRelease = mx.utils.Delegate.create(this, decreaseDrink);
drinkInput.arrowDown._alpha = 100;
drinkInput.arrowUp.onRelease = mx.utils.Delegate.create(this, increaseDrink);
drinkInput.arrowUp._alpha = 100;
}
}
function doDrink() {
clearInterval(timerInterval);
playBetSound();
currentGameSO.data.turnNumber = 0;
drinkIsDone = false;
totalDrinks = totalDrinks + roundDrinks;
betInput.betAmount.text = Math.ceil(bank * (totalDrinks * 0.1));
currentBet = Math.ceil(bank * (totalDrinks * 0.1));
drunkBackground();
updateBetArrows();
if (totalDrinks >= 10) {
windowRound.timerText._visible = false;
gotoAndPlay ("passOut");
passOutVideo.gotoAndPlay(2);
hideMeter();
response._visible = false;
} else {
if (roundDrinks > 0) {
drinkMovie.play();
} else {
drinkIsDone = true;
}
gotoAndPlay ("bet");
updateGameStatus("bet");
startTimer("bet");
}
drinkInput.arrowUp.onRelease = null;
drinkInput.arrowDown.onRelease = null;
drinkInput.swig.onRelease = null;
roundDrinks = 0;
}
function increaseBet() {
currentBet = currentBet + 5;
if (currentBet > bank) {
betInput.betAmount.text = bank;
currentBet = bank;
} else {
betInput.betAmount.text = currentBet;
}
updateBetArrows();
}
function decreaseBet() {
currentBet = currentBet - 5;
if (currentBet < 0) {
betInput.betAmount.text = 0;
currentBet = 0;
} else {
betInput.betAmount.text = currentBet;
}
updateBetArrows();
}
function updateBetArrows() {
if (currentBet <= Math.ceil(bank * (totalDrinks * 0.1))) {
betInput.arrowDown.onRelease = null;
betInput.arrowDown._alpha = 50;
} else if (currentBet >= (bank * ((totalDrinks * 0.1) + 0.1))) {
betInput.arrowDown.onRelease = mx.utils.Delegate.create(this, decreaseBet);
betInput.arrowDown._alpha = 100;
betInput.arrowUp.onRelease = null;
betInput.arrowUp._alpha = 50;
} else {
betInput.arrowDown.onRelease = mx.utils.Delegate.create(this, decreaseBet);
betInput.arrowDown._alpha = 100;
betInput.arrowUp.onRelease = mx.utils.Delegate.create(this, increaseBet);
betInput.arrowUp._alpha = 100;
}
}
function doBet() {
if (isMultiplayer) {
currentGameSO.data[fmsApp.muID + "Bet"] = currentBet;
currentGameSO.data[fmsApp.muID + "Ready"] = true;
updateGameStatus("waitingForReady");
gotoAndPlay ("waiting");
preparingText._visible = false;
waitingBetDrink._visible = true;
waitingThrow._visible = false;
clearTimer();
} else {
currentBetWindow.bet.text = currentBet;
updateGameStatus("shot");
gotoAndPlay ("shot");
clearTimer();
if (drinkIsDone) {
clearInterval(drinkDoneInterval);
startThrow();
startTimer("throw");
} else {
drinkDoneInterval = setInterval(checkDrinkDone, 100);
}
}
betInput.arrowUp.onRelease = null;
betInput.arrowDown.onRelease = null;
betInput.bet.onRelease = null;
betInput.maxBet.onRelease = null;
}
function checkDrinkDone() {
if (drinkIsDone) {
clearInterval(drinkDoneInterval);
startThrow();
startTimer("throw");
}
}
function doMultiplayerShot() {
doDebug("isMyTurn: " + isMyTurn());
doDebug("who's turn: " + currentGameSO.data.currentTurn);
if (isMyTurn()) {
doDebug("allowing you to shoot");
updateGameStatus("shot");
gotoAndPlay ("shot");
if (drinkIsDone) {
clearInterval(drinkDoneInterval);
startThrow();
startTimer("throw");
} else {
drinkDoneInterval = setInterval(checkDrinkDone, 100);
}
windowSmall._visible = false;
betInput._visible = false;
} else {
waitingBetDrink._visible = false;
if (currentGameSO.data.turnNumber == 2) {
preparingText._visible = true;
waitingThrow._visible = false;
} else {
preparingText._visible = false;
waitingThrow._visible = true;
}
updateGameStatus("waitingForReady");
}
}
function doMaxBet() {
currentBet = Math.ceil(bank * ((totalDrinks * 0.1) + 0.1));
betInput.betAmount.text = currentBet;
updateBetArrows();
}
function startTimer(type) {
clearTimer();
currentTimerType = type;
windowRound.timerText._visible = true;
windowRound.timerText.text = "Time Left: " + currentTimer;
timerInterval = setInterval(updateTimer, 1000, type);
}
function pauseTimer() {
clearInterval(timerInterval);
}
function resumeTimer() {
clearInterval(timerInterval);
timerInterval = setInterval(updateTimer, 1000, currentTimerType);
}
function updateTimer(type) {
currentTimer--;
if (currentTimer == 0) {
clearInterval(timerInterval);
windowRound.timerText._visible = false;
if (type == "drink") {
doDrink();
} else if (type == "bet") {
doBet();
} else if (type == "throw") {
stopMeter(true);
}
}
windowRound.timerText.text = "Time Left: " + currentTimer;
}
function clearTimer() {
clearInterval(timerInterval);
currentTimer = 10;
windowRound.timerText._visible = false;
}
function doDebug(message) {
if (isDebug) {
debug.text = debug.text + (message + newline);
debug.scroll = debug.maxscroll;
}
}
function doLotroURL() {
getURL ("http://www.lotro.com", "_blank");
}
function doGameStart() {
trace("doGameStart");
gameStarting(fmsApp.currentGameSO);
}
function userDrop(eventObject) {
if (isMultiplayer) {
if (roundNumber < 3) {
startedMultiplayer = false;
} else {
startedMultiplayer = true;
}
doDebug("user drop: " + eventObject.muID);
doDebug("startedMultiplayer: " + startedMultiplayer);
isMultiplayer = false;
notifyReady();
currentGameSO.data[eventObject.muID + "Ready"] = true;
currentBetWindow.bet.text = currentBet;
}
}
function gameStarting(gameSO) {
trace("GAME STARTING!");
doDebug("gameStarting: " + gameSO);
currentGameSO = gameSO;
trace("GAME SESSION STARTING");
startMultiplayer();
currentGameSO.onSync = gameSOsync;
currentGameSO.switchPlayers = function () {
trace("so switch players");
switchPlayers();
};
currentGameSO.playerGameOver = function (muID) {
doDebug("player game over: " + muID);
if (muID != fmsApp.muID) {
pauseTimer();
gameOverConfirm.yes.onRelease = mx.utils.Delegate.create(this, continuePlaying);
gameOverConfirm.no.onRelease = mx.utils.Delegate.create(this, quitPlaying);
gameOverConfirm._visible = true;
doDebug(muID + "'s game is over");
} else {
isMultiplayer = false;
}
};
currentGameSO.data[fmsApp.muID + "Score"] = 250;
currentGameSO.data[fmsApp.muID + "Ready"] = false;
currentGameSO.data.currentTurn = fmsApp.currentGameHost;
currentGameSO.data.turnNumber = 0;
}
function gameSOsync(objArray) {
if (isMultiplayer) {
if (gameStatus == "waitingForReady") {
var _local3 = 0;
var _local1 = 0;
while (_local1 < fmsApp.currentGameUserList.length) {
if (currentGameSO.data[fmsApp.currentGameUserList[_local1] + "Ready"] == true) {
_local3++;
}
_local1++;
}
doDebug("usersReady: " + _local3);
if (_local3 == fmsApp.currentGameUserList.length) {
doDebug("notifyReady");
notifyReady();
}
}
userScore.score.text = currentGameSO.data[fmsApp.muID + "Score"];
cta.scoreWindow.scoreboard.text = "";
if (isMyTurn()) {
currentBetWindow.bet.text = currentBet;
}
var _local1 = 0;
while (_local1 < fmsApp.currentGameUserList.length) {
var _local2 = fmsApp.getUserObject(fmsApp.currentGameUserList[_local1]);
cta.scoreWindow.scoreboard.text = cta.scoreWindow.scoreboard.text + (((_local2.screenName + " ") + currentGameSO.data[fmsApp.currentGameUserList[_local1] + "Score"]) + newline);
if (fmsApp.currentGameUserList[_local1] != fmsApp.muID) {
if (!isMyTurn()) {
currentBetWindow.bet.text = currentGameSO.data[fmsApp.currentGameUserList[_local1] + "Bet"];
}
mpScore.score.text = currentGameSO.data[fmsApp.currentGameUserList[_local1] + "Score"];
}
_local1++;
}
}
}
function notifyReady() {
if (gameStatus == "waitingForReady") {
doDebug("notifyReady");
doMultiplayerShot();
} else if (gameStatus == "shot") {
nextRound();
}
}
function resetReady() {
var _local1 = 0;
while (_local1 < fmsApp.currentGameUserList.length) {
currentGameSO.data[fmsApp.currentGameUserList[_local1] + "Ready"] = false;
_local1++;
}
}
function isMyTurn() {
if (isMultiplayer) {
if (currentGameSO.data.currentTurn == fmsApp.muID) {
return(true);
}
return(false);
}
return(true);
}
function continuePlaying() {
isMultiplayer = false;
notifyReady();
currentGameSO.data[eventObject.muID + "Ready"] = true;
resumeTimer();
gameOverConfirm._visible = false;
}
function quitPlaying() {
isMultiplayer = false;
moriaChat.leaveGame();
gameOverConfirm._visible = false;
meter._visible = false;
response._visible = false;
doGameOver();
}
function startThrow() {
Mouse.hide();
crosshair._alpha = 100;
meter._visible = true;
initMeter();
showMeter();
crosshairInterval = setInterval(doCrosshairMove, 100);
this.onMouseMove = mx.utils.Delegate.create(this, calculateCrosshair);
enableThrow();
}
function enableThrow() {
shotButton.enabled = true;
shotButton.onPress = mx.utils.Delegate.create(this, startMeter);
shotButton.onRelease = (shotButton.onReleaseOutside = mx.utils.Delegate.create(this, stopMeter));
}
function disableThrow() {
this.onMouseMove = null;
clearInterval(crosshairInterval);
shotButton.enabled = false;
shotButton.onPress = null;
shotButton.onRelease = null;
}
function calculateCrosshair() {
idleAmountX = 0;
idleAmountY = 0;
var _local4 = Math.round((middle._xmouse / Stage.width) * 100);
var _local2 = Math.round((middle._ymouse / Stage.height) * 100);
var _local5 = _local4 * (totalDrinks / 2);
var _local3 = _local2 * (totalDrinks / 2);
drunk._visible = false;
drunk._x = this._xmouse + _local5;
drunk._y = this._ymouse + _local3;
localPoint.x = drunk._x;
localPoint.y = drunk._y;
var _local7 = new mx.transitions.Tween(crosshair, "_x", mx.transitions.easing.Elastic.easeOut, crosshair._x, drunk._x, (totalDrinks / 3) + 0.1, true);
var _local6 = new mx.transitions.Tween(crosshair, "_y", mx.transitions.easing.Elastic.easeOut, crosshair._y, drunk._y, (totalDrinks / 3) + 0.1, true);
}
function fadeCrosshair() {
clearInterval(fadeInterval);
var _local1 = new mx.transitions.Tween(crosshair, "_alpha", mx.transitions.easing.Strong.easeOut, 100, 0, 1, true);
}
function doCrosshairMove() {
if ((crosshair._x - middle._x) < 0) {
idleAmountX = idleAmountX - totalDrinks;
} else {
idleAmountX = idleAmountX + totalDrinks;
}
if ((crosshair._y - middle._y) < 0) {
idleAmountY = idleAmountY - totalDrinks;
} else {
idleAmountY = idleAmountY + totalDrinks;
}
var _local1 = ((Math.round((Math.random() * (totalDrinks * 2)) - totalDrinks) * (totalDrinks / 2)) - 25) + idleAmountX;
var _local2 = ((Math.round((Math.random() * (totalDrinks * 2)) - totalDrinks) * (totalDrinks / 2)) - 25) + idleAmountY;
var _local4 = new mx.transitions.Tween(crosshair.innerCrosshair, "_x", mx.transitions.easing.Elastic.easeOut, crosshair.innerCrosshair._x, _local1, (totalDrinks / 3) + 0.1, true);
var _local3 = new mx.transitions.Tween(crosshair.innerCrosshair, "_y", mx.transitions.easing.Elastic.easeOut, crosshair.innerCrosshair._y, _local2, (totalDrinks / 3) + 0.1, true);
}
function initMeter() {
var _local1 = totalDrinks * 10;
meter.sweetspot._xscale = (100 - _local1) + 20;
meter.icon._visible = false;
hasYoyoed = false;
}
function showMeter() {
var _local1 = new mx.transitions.Tween(meter, "_alpha", mx.transitions.easing.Strong.easeOut, meter._alpha, 100, 0.5, true);
}
function hideMeter() {
var _local1 = new mx.transitions.Tween(meter, "_alpha", mx.transitions.easing.Strong.easeOut, meter._alpha, 0, 0.5, true);
}
function startMeter() {
clearInterval(timerInterval);
meter.icon._visible = true;
meterTween = new mx.transitions.Tween(meter.icon, "_x", mx.transitions.easing.None.easeOut, 30, (meter._width - meter.icon._width) - 30, meterTime, true);
meterTween.onMotionFinished = function () {
if (!hasYoyoed) {
hasYoyoed = true;
meterTween.yoyo();
}
};
}
function stopMeter(defaultThrow) {
clearInterval(timerInterval);
meterTime = 1;
Mouse.show();
hideMeter();
fadeCrosshair();
disableThrow();
meterTween.stop();
hasYoyoed = false;
if (defaultThrow) {
throwAxe(true);
} else {
throwAxe();
}
}
function throwAxe(defaultThrow) {
clearInterval(sfxInterval);
isShot = false;
axeThrowInterval = setInterval(playSfx, 500, "axeThrow");
if (meter.icon.hitTest(meter.sweetspot)) {
isShot = true;
var _local1 = shots.attachMovie("shot", "shot" + shotNumber, shots.getNextHighestDepth());
} else {
var _local1 = shots.attachMovie("miss", "miss" + shotNumber, shots.getNextHighestDepth());
}
if (defaultThrow) {
crosshair._x = Stage.width / 2;
crosshair._y = Stage.width / 2;
}
_local1._visible = false;
_local1._x = (crosshair._x + crosshair.innerCrosshair._x) + 25;
_local1._y = (crosshair._y + crosshair.innerCrosshair._y) + 25;
axeEndX = (crosshair._x + crosshair.innerCrosshair._x) + 25;
axeEndY = (crosshair._y + crosshair.innerCrosshair._y) + 25;
var _local4 = target._width / 2;
var _local2 = _local1._width / 2;
var _local27 = _local2 + _local4;
var _local21 = Math.sqrt(Math.pow(target._x - _local1._x, 2) + Math.pow(target._y - _local1._y, 2));
var _local16 = targetLeftPlate._width / 2;
var _local8 = _local2 + _local16;
var _local19 = Math.sqrt(Math.pow(targetLeftPlate._x - _local1._x, 2) + Math.pow(targetLeftPlate._y - _local1._y, 2));
var _local10 = targetRightPlate._width / 2;
var _local17 = _local2 + _local10;
var _local11 = Math.sqrt(Math.pow(targetRightPlate._x - _local1._x, 2) + Math.pow(targetRightPlate._y - _local1._y, 2));
var _local26 = targetMug._width / 2;
var _local20 = _local2 + _local26;
var _local9 = Math.sqrt(Math.pow(targetMug._x - _local1._x, 2) + Math.pow(targetMug._y - _local1._y, 2));
var _local18 = targetMugLeft._width / 2;
var _local13 = _local2 + _local18;
var _local7 = Math.sqrt(Math.pow(targetMugLeft._x - _local1._x, 2) + Math.pow(targetMugLeft._y - _local1._y, 2));
var _local14 = targetVase._width / 2;
var _local5 = _local2 + _local14;
var _local15 = Math.sqrt(Math.pow(targetVase._x - _local1._x, 2) + Math.pow(targetVase._y - _local1._y, 2));
var _local6 = targetLeftTorch._width / 2;
var _local22 = _local2 + _local6;
var _local12 = Math.sqrt(Math.pow(targetLeftTorch._x - _local1._x, 2) + Math.pow(targetLeftTorch._y - _local1._y, 2));
var _local24 = targetRightTorch._width / 2;
var _local23 = _local2 + _local24;
var _local25 = Math.sqrt(Math.pow(targetRightTorch._x - _local1._x, 2) + Math.pow(targetRightTorch._y - _local1._y, 2));
gotoAndPlay ("response");
var _local3 = Math.ceil(Math.random() * 8);
var _local29 = new mx.transitions.Tween(response, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 1, true);
response._visible = false;
throwMovie.axeThrow._visible = false;
throwMovie.axeMiss._visible = false;
if (isShot) {
throwMovie.axeThrow._visible = true;
} else {
throwMovie.axeMiss._visible = true;
}
if (nextRoundReward == 1) {
currentBet = currentBet * 2;
} else if (nextRoundReward == 2) {
currentBet = Math.round(currentBet / 2);
}
nextRoundReward = 0;
trace("BANK: " + bank);
trace("CURRENT BET: " + currentBet);
if ((_local21 <= _local27) && (isShot)) {
bank = bank + Math.ceil(currentBet);
response.gotoAndPlay("good" + _local3);
currentGameSO.data.currentThrow = {x:axeEndX, y:axeEndY, hit:true};
soundInterval = setInterval(playGoodSound, 2000);
} else {
bank = bank - Math.ceil(currentBet);
if (bank <= 0) {
bank = 0;
}
response.gotoAndPlay("bad" + _local3);
currentGameSO.data.currentThrow = {x:axeEndX, y:axeEndY, hit:false};
soundInterval = setInterval(playBadSound, 2000);
}
if (!isMultiplayer) {
if (fmsApp.screenName) {
cta.scoreWindow.scoreboard.text = (fmsApp.screenName + " ") + bank;
} else {
cta.scoreWindow.scoreboard.text = "Your Score " + bank;
}
}
if (_local19 <= _local8) {
hitLeftPlate = true;
} else if (_local11 <= _local17) {
hitRightPlate = true;
} else if (_local9 <= _local20) {
hitMug = true;
} else if (_local7 <= _local13) {
hitMugLeft = true;
} else if (_local15 <= _local5) {
hitVase = true;
} else if (_local12 <= _local22) {
hitLeftTorch = true;
} else if (_local25 <= _local23) {
hitRightTorch = true;
}
if ((((((hitLeftPlate || (hitRightPlate)) || (hitMug)) || (hitMugLeft)) || (hitVase)) || (hitLeftTorch)) || (hitRightTorch)) {
clearInterval(sfxInterval);
throwMovie.axeThrow._visible = false;
throwMovie.axeMiss._visible = true;
}
throwMovie.play();
responseInterval = setInterval(showResponse, 3000);
shotNumber++;
}
function multiplayerThrow() {
gotoAndPlay ("response");
response._visible = false;
meter._visible = false;
axeEndX = currentGameSO.data.currentThrow.x;
axeEndY = currentGameSO.data.currentThrow.y;
if (currentGameSO.data.currentThrow.hit) {
throwMovie.axeThrow._visible = true;
throwMovie.axeMiss._visible = false;
} else {
throwMovie.axeThrow._visible = false;
throwMovie.axeMiss._visible = true;
}
throwMovie.play();
}
function doAxeTween() {
var _local1 = new mx.transitions.Tween(throwMovie.axeThrow, "_x", mx.transitions.easing.None.easeOut, 0, axeEndX - 300, 0.5, true);
var _local4 = new mx.transitions.Tween(throwMovie.axeThrow, "_y", mx.transitions.easing.None.easeOut, 0, axeEndY - 220, 0.5, true);
var _local2 = new mx.transitions.Tween(throwMovie.axeMiss, "_x", mx.transitions.easing.None.easeOut, 0, axeEndX - 280, 0.5, true);
var _local3 = new mx.transitions.Tween(throwMovie.axeMiss, "_y", mx.transitions.easing.None.easeOut, 0, axeEndY - 210, 0.5, true);
_local1.onMotionFinished = function () {
doBreakables();
};
}
function doBreakables() {
hideRewards(gameBackground.wall.leftPlate.rewards);
hideRewards(gameBackground.wall.rightPlate.rewards);
hideRewards(gameBackground.rightTable.mug.rewards);
hideRewards(gameBackground.leftTable.mug.rewards);
hideRewards(gameBackground.wallDup.leftPlate.rewards);
hideRewards(gameBackground.wallDup.rightPlate.rewards);
hideRewards(gameBackground.rightTableDup.mug.rewards);
hideRewards(gameBackground.leftTableDup.mug.rewards);
hideRewards(gameBackground.wall.vase.rewards);
if (hitLeftPlate && (!hasHitLeftPlate)) {
playSfx("leftPlate");
hasHitLeftPlate = true;
gameBackground.wall.leftPlate.rewards.plateReward1._visible = true;
nextRoundReward = 1;
gameBackground.wall.leftPlate.play();
gameBackground.wallDup.leftPlate.play();
} else if (hitRightPlate && (!hasHitRightPlate)) {
playSfx("rightPlate");
gameBackground.wall.rightPlate.rewards.plateReward2._visible = true;
nextRoundReward = 2;
hasHitRightPlate = true;
gameBackground.wall.rightPlate.play();
gameBackground.wallDup.rightPlate.play();
} else if (hitMug && (!hasHitMug)) {
playSfx("rightMug");
var _local1 = Math.ceil(Math.random() * 2);
gameBackground.rightTable.mug.rewards["drinkReward" + _local1]._visible = true;
if (_local1 == 1) {
if (totalDrinks > 0) {
totalDrinks--;
}
} else if (_local1 == 2) {
totalDrinks++;
}
hasHitMug = true;
gameBackground.rightTable.mug.play();
gameBackground.rightTableDup.mug.play();
} else if (hitMugLeft && (!hasHitMugLeft)) {
playSfx("leftMug");
var _local1 = Math.ceil(Math.random() * 2);
gameBackground.leftTable.mug.rewards["drinkReward" + _local1]._visible = true;
if (_local1 == 1) {
if (totalDrinks > 0) {
totalDrinks--;
}
} else if (_local1 == 2) {
totalDrinks++;
}
hasHitMugLeft = true;
gameBackground.leftTable.mug.play();
gameBackground.leftTableDup.mug.play();
} else if (hitVase && (!hasHitVase)) {
playSfx("vase");
var _local2 = Math.ceil(Math.random() * 2);
gameBackground.wall.vase.rewards["vaseReward" + _local2]._visible = true;
if (_local2 == 1) {
meterTime = 2;
} else if (_local2 == 2) {
meterTime = 0.5;
}
hasHitVase = true;
gameBackground.wall.vase.play();
gameBackground.wallDup.vase.play();
} else if (hitLeftTorch) {
torchHitLeft.play();
} else if (hitRightTorch) {
torchHitRight.play();
} else if (isShot) {
playSfx("woodThunk");
} else {
playSfx("tink");
}
hitLeftPlate = false;
hitRightPlate = false;
hitMug = false;
hitMugLeft = false;
hitVase = false;
hitLeftTorch = false;
hitRightTorch = false;
}
function hideRewards(rewardsMovie) {
rewardsMovie.vaseReward1._visible = false;
rewardsMovie.vaseReward2._visible = false;
rewardsMovie.plateReward1._visible = false;
rewardsMovie.plateReward2._visible = false;
rewardsMovie.drinkReward1._visible = false;
rewardsMovie.drinkReward2._visible = false;
}
function showResponse() {
clearInterval(responseInterval);
response._visible = true;
if (isMultiplayer) {
currentGameSO.data[fmsApp.muID + "Score"] = bank;
playerInterval = setInterval(doSwitchPlayersSend, 2500);
} else {
userScore.score.text = bank;
roundInterval = setInterval(nextRound, 2500);
}
if (bank <= 0) {
clearInterval(roundInterval);
clearInterval(playerInterval);
bankZeroInterval = setInterval(doGameOver, 500);
}
}
function doSwitchPlayersSend() {
currentGameSO.send("switchPlayers");
}
function switchPlayers() {
clearInterval(playerInterval);
if (isMyTurn()) {
gotoAndPlay ("waiting");
waitingBetDrink._visible = false;
if (currentGameSO.data.turnNumber == 1) {
preparingText._visible = true;
waitingThrow._visible = false;
} else {
preparingText._visible = false;
waitingThrow._visible = true;
}
currentGameSO.data.turnNumber++;
} else {
multiplayerThrow();
}
turnInterval = setInterval(switchTurns, 6000);
}
function switchTurns() {
doDebug("switching turns");
clearInterval(turnInterval);
if (currentGameSO.data.turnNumber == 2) {
currentGameSO.data.currentTurn = fmsApp.currentGameHost;
nextRound();
} else {
throwMovie.gotoAndPlay("reset");
meter._visible = true;
doDebug((("able to switch: " + currentGameSO.data.currentTurn) + " vs. ") + fmsApp.muID);
if (currentGameSO.data.currentTurn == fmsApp.muID) {
var _local1 = 0;
while (_local1 < fmsApp.currentGameUserList.length) {
doDebug((fmsApp.currentGameUserList[_local1] + " vs. ") + currentGameSO.data.currentTurn);
if (fmsApp.currentGameUserList[_local1] != currentGameSO.data.currentTurn) {
currentGameSO.data.currentTurn = fmsApp.currentGameUserList[_local1];
break;
}
_local1++;
}
}
}
doDebug("turn: " + currentGameSO.data.currentTurn);
}
function nextRound() {
if (isMultiplayer) {
resetReady();
}
clearInterval(roundInterval);
roundNumber++;
throwMovie.gotoAndPlay("reset");
windowRound["round" + roundNumber].gotoAndPlay(2);
if (roundNumber == 10) {
if (startedMultiplayer) {
if (Number(userScore.score.text) > Number(mpScore.score.text)) {
doDebug((("YOU WIN! - you: " + userScore.score.text) + " vs. them: ") + mpScore.score.text);
isWinner = true;
} else if (Number(userScore.score.text) == Number(mpScore.score.text)) {
doDebug("YOU TIE!");
isWinner = false;
} else {
doDebug("YOU LOSE!");
isWinner = false;
}
} else {
doDebug("YOU ARE IN SP MODE! YOU CANT WIN!");
isWinner = false;
}
doGameOver();
resetInit();
} else if (roundNumber == 5) {
interstitialAd._visible = true;
newRoundInterval = setInterval(doNewRound, 5000);
} else {
doNewRound();
}
init();
}
function doNewRound() {
clearInterval(newRoundInterval);
interstitialAd._visible = false;
gotoAndPlay ("drink");
windowSmall._visible = true;
betInput._visible = true;
if ((totalDrinks + roundDrinks) == 0) {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
} else {
drinkInput.maxBetAmount.text = (((totalDrinks + roundDrinks) + "0-") + ((totalDrinks + roundDrinks) + 1)) + "0%";
}
updateGameStatus("drink");
startTimer("drink");
init();
}
function doGameOver() {
clearInterval(bankZeroInterval);
doPing("end");
windowRound.timerText._visible = false;
if (roundNumber < 10) {
isWinner = false;
if (startedMultiplayer) {
doDebug("doing playerGameOver");
currentGameSO.send("playerGameOver", fmsApp.muID);
}
}
moriaChat.goto_game2_cta();
if (userInfo.signedIn) {
doDebug("saving rank: " + bank);
lotroRoot.saveMyRank(2, bank);
}
updateDeeds();
throwMovie._visible = false;
response._visible = false;
cta.play();
gotoAndPlay ("gameOver");
updateGameStatus("gameOver");
lotroRoot.callGoogle("/swigAndToss/displayCTA");
hideMeter();
response._visible = false;
}
function resetMeter() {
meter.icon._x = 0;
meter.icon._visible = false;
hasYoyoed = false;
}
function drunkBackground() {
removeMovieClip(gameBackground.wallDup);
removeMovieClip(gameBackground.leftTableDup);
removeMovieClip(gameBackground.rightTableDup);
if (totalDrinks > 2) {
duplicateMovieClip (gameBackground.wall, "wallDup", gameBackground.getNextHighestDepth());
duplicateMovieClip (gameBackground.leftTable, "leftTableDup", gameBackground.getNextHighestDepth());
duplicateMovieClip (gameBackground.rightTable, "rightTableDup", gameBackground.getNextHighestDepth());
if (hasHitLeftPlate) {
gameBackground.wallDup.leftPlate._visible = false;
}
if (hasHitRightPlate) {
gameBackground.wallDup.rightPlate._visible = false;
}
if (hasHitMug) {
gameBackground.rightTableDup.mug._visible = false;
}
if (hasHitMugLeft) {
gameBackground.leftTableDup.mug._visible = false;
}
if (hasHitVase) {
gameBackground.wallDup.vase._visible = false;
}
var _local2 = new flash.filters.BlurFilter(10 - totalDrinks, 10 - totalDrinks, 1);
var _local1 = new Array();
_local1.push(_local2);
gameBackground.wallDup.filters = _local1;
gameBackground.leftTableDup.filters = _local1;
gameBackground.rightTableDup.filters = _local1;
gameBackground.wallDup._alpha = 50;
gameBackground.leftTableDup._alpha = 50;
gameBackground.rightTableDup._alpha = 50;
doDrunkTween();
}
}
function doDrunkTween() {
trace("totalDrinks: " + totalDrinks);
}
function confirmQuit() {
Mouse.show();
if (isMultiplayer) {
quitWindow.countAsBail._visible = true;
} else {
quitWindow.countAsBail._visible = false;
}
quitWindow._visible = true;
quitWindow.yes.onRelease = function () {
if (isMultiplayer) {
moriaChat.bailFromGame();
}
moriaChat.goto_game2_landing();
resetGame(true);
};
quitWindow.no.onRelease = function () {
quitWindow._visible = false;
};
}
function resetGame(doCta) {
deleteIntervals();
var _local1 = 0;
while (_local1 < 11) {
windowRound["round" + _local1].gotoAndStop(1);
_local1++;
}
loadAds();
fadeCrosshair();
resetInit();
init();
throwMovie.gotoAndPlay("reset");
if (doCta) {
gotoAndPlay ("gameOver");
updateDeeds();
response._visible = false;
} else {
currentBetWindow.bet.text = 0;
userScore.score.text = 250;
mpScore.score.text = 250;
drinkInput.maxBetAmount.text = "0-10%";
gotoAndPlay ("title");
}
}
function deleteIntervals() {
clearInterval(blobInterval);
clearInterval(timerInterval);
clearInterval(timerUpdateInterval);
clearInterval(crosshairInterval);
clearInterval(fadeInterval);
clearInterval(roundInterval);
clearInterval(playerInterval);
clearInterval(responseInterval);
clearInterval(turnInterval);
clearInterval(soundInterval);
clearInterval(sfxInterval);
clearInterval(axeThrowInterval);
clearInterval(drinkDoneInterval);
clearInterval(bankZeroInterval);
clearInterval(newRoundInterval);
}
function updateDeeds() {
var _local5 = Math.floor(Math.random() * 2);
trace("kewlboxRandomAd: " + _local5);
cta.adWindow.adOne._visible = false;
cta.adWindow.adTwo._visible = false;
if (_local5 == 0) {
cta.adWindow.adOne._visible = true;
cta.adWindow.adTwo._visible = false;
} else {
cta.adWindow.adOne._visible = false;
cta.adWindow.adTwo._visible = true;
}
if (userInfo.signedIn) {
doDebug("----------------------");
var _local2 = prevMediatorValue + totalDrinks;
var _local1 = 0;
cta.deedWindow.deed.text = "Play again and try to Unlock the Mines of Moria\u2122 by completing another deed! ";
if (roundNumber < 10) {
if (totalDrinks >= 10) {
cta.deedWindow.deed.text = "You had too many swigs \u2013 even for a dwarf! Better luck next time.";
} else if (bank <= 0) {
cta.deedWindow.deed.text = "Keep an eye on that coin pouch! When you\u2019re out of money, you\u2019re out of the game.";
}
}
if (bank > prevDeadEyeValue) {
var _local3 = bank;
} else {
var _local3 = prevDeadEyeValue;
}
if (isWinner) {
var _local4 = prevLastManValue + 1;
} else {
var _local4 = prevLastManValue;
}
if (_local2 >= mediatorAccompValue) {
if (prevMediatorValue < mediatorAccompValue) {
_local1++;
doDebug("MEDIATOR EARNED!");
cta.deedWindow.deed.text = ("Congratulations! You completed the Mead-iator deed by taking " + mediatorAccompValue) + " swigs!";
}
numberOfAchievements++;
}
if (_local3 >= deadEyeAccompValue) {
if (prevDeadEyeValue < deadEyeAccompValue) {
_local1++;
doDebug("DEAD EYE EARNED!");
cta.deedWindow.deed.text = ("Congratulations! You completed the Dead Eye deed for scoring " + deadEyeAccompValue) + " or higher!";
}
numberOfAchievements++;
}
if (_local4 >= lastManAccompValue) {
if (prevLastManValue < lastManAccompValue) {
_local1++;
doDebug("LAST MAN STANDING EARNED!");
cta.deedWindow.deed.text = ("Congratulations! You completed the Last Man Standing deed for " + lastManAccompValue) + " multiplayer victories!";
}
numberOfAchievements++;
}
if (_local1 > 1) {
cta.deedWindow.deed.text = (("Congratulations! You completed " + _local1) + " deeds!") + newline;
if (_local2 >= mediatorAccompValue) {
if (prevMediatorValue < mediatorAccompValue) {
cta.deedWindow.deed.text = cta.deedWindow.deed.text + "Mead-iator\r";
}
}
if (_local3 >= deadEyeAccompValue) {
if (prevDeadEyeValue < deadEyeAccompValue) {
cta.deedWindow.deed.text = cta.deedWindow.deed.text + "Dead Eye\r";
}
}
if (_local4 >= lastManAccompValue) {
if (prevLastManValue < lastManAccompValue) {
cta.deedWindow.deed.text = cta.deedWindow.deed.text + "Last Man Standing\r";
}
}
}
if (((prevMediatorValue >= mediatorAccompValue) && (prevDeadEyeValue >= deadEyeAccompValue)) && (prevLastManValue >= lastManAccompValue)) {
cta.deedWindow.deed.text = "Visit the gate for a peek inside the Mines of Moria\u2122!";
}
doDebug((("mediator: " + prevMediatorValue) + " -> ") + _local2);
doDebug((("dead eye: " + prevDeadEyeValue) + " -> ") + _local3);
doDebug((("last man: " + prevLastManValue) + " -> ") + _local4);
doDebug("achievements: " + numberOfAchievements);
doDebug("----------------------");
lotroRoot.saveAchievement(3, numberOfAchievements);
lotroRoot.saveGameBlob(2, (((_local2 + "|") + _local3) + "|") + _local4);
} else {
cta.deedWindow.deed.text = "Log in before your next game so that you can complete deeds and Unlock the Mines of Moria\u2122!";
if (roundNumber < 10) {
if (totalDrinks >= 10) {
cta.deedWindow.deed.text = "You had too many swigs \u2013 even for a dwarf! Better luck next time.";
} else if (bank <= 0) {
cta.deedWindow.deed.text = "Keep an eye on that coin pouch! When you\u2019re out of money, you\u2019re out of the game.";
}
}
}
}
function loadAds() {
adXml = new XML();
adXml.ignoreWhite = true;
adXml.onLoad = mx.utils.Delegate.create(this, parseAds);
adXml.load(lotroRoot.mediaUrl + "/media/ads/ads.xml");
}
function parseAds(success) {
var _local9 = lotroRoot.isCodemasters;
if (_local9) {
var _local2 = adXml.firstChild.childNodes[1];
} else {
var _local2 = adXml.firstChild.childNodes[0];
}
var _local3 = new Array();
var _local4 = new Array();
var _local1 = 0;
while (_local1 < _local2.childNodes.length) {
if (_local2.childNodes[_local1].attributes.adType == "CTA") {
_local4.push(_local2.childNodes[_local1]);
} else if (_local2.childNodes[_local1].attributes.adType == "inGame") {
_local3.push(_local2.childNodes[_local1]);
}
_local1++;
}
var _local5 = Math.floor(Math.random() * _local3.length);
var _local6 = Math.floor(Math.random() * _local4.length);
var _local10 = _local4[_local6].attributes.adType;
var _local7 = _local4[_local6].attributes.imageURL;
var ctaAdURL = _local4[_local6].attributes.linkURL;
var _local11 = _local3[_local5].attributes.adType;
var _local8 = _local3[_local5].attributes.imageURL;
var gameAdURL = _local3[_local5].attributes.linkURL;
interstitialAd.createEmptyMovieClip("ad", interstitialAd.getNextHighestDepth());
interstitialAd.ad.loadMovie(_local8);
interstitialAd.ad.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/clickAd");
getURL (gameAdURL, "_blank");
};
cta.adWindow.adSpace.loadMovie(_local7);
cta.adWindow.adButton.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/clickAd");
getURL (ctaAdURL, "_blank");
};
}
function doPing(type) {
var _local7 = new LoadVars();
if (isMultiplayer) {
var _local1 = 294;
} else {
var _local1 = 289;
}
var _local2 = 132;
var _local3 = 52080;
var _local4 = 3;
if (type == "start") {
startGameTime = getTimer();
var _local6 = ((((((("gameId=" + _local1) + "&clientId=") + _local2) + "&version=") + _local3) + "&partner=") + _local4) + "&var1=0&type=3";
var _local8 = (("http://updates.kewlbox.com/update/gameRequests.aspx?process=ping3&" + _local6) + "&rnd=") + startGameTime;
} else if (type == "end") {
var _local9 = Math.round((getTimer() - startGameTime) / 1000);
var _local5 = lotroRoot.ruId;
var _local10 = lotroRoot.rsId;
playNum++;
var _local6 = (((((((((((((("time=" + _local9) + "&gameId=") + _local1) + "&clientId=") + _local2) + "&ruId=") + _local5) + "&rsId=") + _local10) + "&version=") + _local3) + "&partner=") + _local4) + "&var1=0&agev=0&type=3&pp=10&playNum=") + playNum;
var _local8 = (("http://updates.kewlbox.com/update/gameRequests.aspx?process=endSession&" + _local6) + "&rnd=") + getTimer();
}
_local7.load(_local8);
}
function playMusic() {
clearInterval(soundInterval);
clearInterval(sfxInterval);
backgroundSound.stop();
fireSound.stop();
sfxSound.stop();
backgroundSound.start(0, 9999);
fireSound.start(0, 9999);
}
function initSoundArrays(arrayTarget) {
if (arrayTarget == "good") {
goodResponseArray = new Array();
goodResponseArray.push("vox-nothingButWood");
goodResponseArray.push("vox-luckyThrow");
goodResponseArray.push("vox-youHitIt");
goodResponseArray.push("vox-roundOnMe");
goodResponseArray.push("vox-dwarfLaugh02");
goodResponseArray.push("vox-dwarfLaugh03");
goodResponseArray.push("vox-dwarLaugh01");
} else if (arrayTarget == "bad") {
badResponseArray = new Array();
badResponseArray.push("vox-throwForkInstead");
badResponseArray.push("vox-eyesLikeHawk");
badResponseArray.push("vox-openYourEyesNextTime");
badResponseArray.push("vox-tryUsingSharpEnd");
badResponseArray.push("vox-notTooHeavy");
badResponseArray.push("vox-needHelpWithThat");
badResponseArray.push("vox-couldntHitBackside");
badResponseArray.push("vox-bullocks");
badResponseArray.push("vox-corBlimy");
badResponseArray.push("vox-bloodyEll");
badResponseArray.push("vox-dontTossDwarf");
badResponseArray.push("vox-grannyThrowsBetter");
badResponseArray.push("vox-throwLikeElf");
badResponseArray.push("vox-illCleanThatUp");
badResponseArray.push("vox-walkItOff");
badResponseArray.push("vox-leavePrettyScar");
badResponseArray.push("vox-lookLikeTarget");
} else if (arrayTarget == "bet") {
betArray = new Array();
betArray.push("vox-higher");
betArray.push("vox-higherHigher");
betArray.push("vox-more");
betArray.push("vox-more2");
betArray.push("vox-moreMore");
betArray.push("vox-whatAreOdds");
betArray.push("vox-whatAreOdds2");
betArray.push("vox-illCoverThat");
betArray.push("vox-buyThatGold");
betArray.push("vox-wagerDrawf");
}
}
function playGoodSound() {
clearInterval(soundInterval);
if (isSoundOn) {
if (goodResponseArray.length == 0) {
initSoundArrays("good");
}
var _local1 = Math.floor(Math.random() * goodResponseArray.length);
voiceSound.attachSound(goodResponseArray[_local1]);
voiceSound.start();
goodResponseArray.splice(_local1, 1);
}
}
function playBadSound() {
clearInterval(soundInterval);
if (isSoundOn) {
if (badResponseArray.length == 0) {
initSoundArrays("bad");
}
var _local1 = Math.floor(Math.random() * badResponseArray.length);
voiceSound.attachSound(badResponseArray[_local1]);
voiceSound.start();
badResponseArray.splice(_local1, 1);
}
}
function playBetSound() {
if (isSoundOn) {
if (betArray.length == 0) {
initSoundArrays("bet");
}
var _local1 = Math.floor(Math.random() * betArray.length);
voiceSound.attachSound(betArray[_local1]);
voiceSound.start();
betArray.splice(_local1, 1);
}
}
function playDrinkSound() {
if (isSoundOn) {
voiceSound.attachSound("vox-drinkDrink");
voiceSound.start();
}
}
function playSfx(type) {
clearInterval(sfxInterval);
if (isSoundOn) {
if (type == "leftPlate") {
sfxSound.attachSound("sfx-plateBreak");
sfxSound.start(0, 0);
} else if (type == "rightPlate") {
sfxSound.attachSound("sfx-plateBreak2");
sfxSound.start(0, 0);
} else if (type == "vase") {
sfxSound.attachSound("sfx-plateBreak3");
sfxSound.start(0, 0);
} else if (type == "leftMug") {
sfxSound.attachSound("sfx-mugHit");
sfxSound.start(0, 0);
} else if (type == "rightMug") {
sfxSound.attachSound("sfx-mugHit2");
sfxSound.start(0, 0);
} else if (type == "woodThunk") {
sfxSound.attachSound("sfx-woodThunk");
sfxSound.start(0, 0);
} else if (type == "tink") {
sfxSound.attachSound("sfx-axeTink2");
sfxSound.start(0, 0);
} else if (type == "axeThrow") {
clearInterval(axeThrowInterval);
sfxSound.attachSound("sfx-dwarfThrowAxe");
sfxSound.start(0, 0);
}
}
}
if (!_root.gameType) {
_root.gameType = "kewlbox";
}
if (_root.gameType == "facebook") {
windowStartGame.multiplayer._visible = true;
} else {
windowStartGame.multiplayer._visible = false;
}
windowStartGame.multiplayer.onRelease = function () {
var _local1 = new Object();
_local1.gameType = "game2";
_local1.minUsers = 2;
_local1.maxUsers = 2;
gmaeObj.numberOfTeams = 1;
_local1.inGameJoins = false;
fmsApp.gameSO_joinQuickMatch(_local1);
};
var totalDrinks = 0;
var roundDrinks = 0;
var currentBet = 0;
var bank = 250;
var isMultiplayer = false;
var startedMultiplayer = false;
var isWaiting = false;
var isWinner = false;
var gameStatus;
var blobInterval;
var timerInterval;
var timerUpdateInterval;
var drinkDoneInterval;
var isDebug = false;
var singlePlayerClicked = false;
var gameBlob;
var currentTimer = 10;
var prevMediatorValue;
var prevDeadEyeValue;
var prevLastManValue;
var currentTimerType;
var drinkIsDone = false;
init();
initDrunk();
interstitialAd._visible = false;
doDebug("lotroRoot.gameLaunchType: " + lotroRoot.gameLaunchType);
if (lotroRoot.gameLaunchType == "pregame") {
gameStarting(fmsApp.currentGameSO);
}
lotroRoot.gameLoadComplete();
var currentGameSO;
fmsApp.addEventListener("gameSO_userDrop", userDrop);
if (_root.gameType) {
trace("FMS APP: " + fmsApp);
fmsApp.addEventListener("gameSO_startGame", doGameStart);
}
var crosshairInterval;
var fadeInterval;
var roundInterval;
var playerInterval;
var responseInterval;
var turnInterval;
var soundInterval;
var sfxInterval;
var axeThrowInterval;
var drunkAnimInterval;
var bankZeroInterval;
var newRoundInterval;
var idleAmountX = 0;
var idleAmountY = 0;
var meterTime = 1;
var shotNumber = 0;
var roundNumber = 0;
var meterTween;
var hasYoyoed;
var isShot = false;
var hitLeftPlate = false;
var hitRightPlate = false;
var hitMug = false;
var hitMugLeft = false;
var hitVase = false;
var hitLeftTorch = false;
var hitRightTorch = false;
var hasHitLeftPlate = false;
var hasHitRightPlate = false;
var hasHitMug = false;
var hasHitMugLeft = false;
var hasHitVase = false;
var nextRoundReward = 0;
var axeEndX;
var axeEndY;
var localPoint = new Object();
initMeter();
hideMeter();
var angleX = 0;
var angleY = 0;
var tableAngleX = 0;
var wallX = -20;
var wallY = 0;
var leftTableX = -20;
var leftTableY = 130;
var rightTableX = 432;
var rightTableY = 130;
var wallXspeed = 0.07;
var wallYspeed = 0.11;
var tableXspeed = 0.04;
this.onEnterFrame = function () {
gameBackground.wallDup._x = wallX + (Math.sin(angleX) * ((totalDrinks * 4) - (totalDrinks * 2)));
gameBackground.wallDup._y = wallY + (Math.sin(angleY) * ((totalDrinks * 4) - (totalDrinks * 2)));
gameBackground.leftTableDup._x = leftTableX + (Math.sin(tableAngleX) * ((totalDrinks * 4) - (totalDrinks * 2)));
gameBackground.rightTableDup._x = rightTableX + (Math.sin(tableAngleX) * ((totalDrinks * 4) - (totalDrinks * 2)));
angleX = angleX + wallXspeed;
angleY = angleY + wallYspeed;
tableAngleX = tableAngleX + tableXspeed;
};
var numberOfAchievements = 0;
var mediatorAccompValue = 99;
var deadEyeAccompValue = 35000;
var lastManAccompValue = 10;
var adXml;
var startGameTime;
var playNum = 0;
loadAds();
doStartPing();
quit.onRelease = function () {
confirmQuit();
};
cta.deedWindow.playAgain.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/playAgain");
resetGame();
moriaChat.goto_game2_landing();
};
cta.scoreWindow.inviteFriend.onRelease = function () {
lotroRoot.dropWin(tellFriendWin, -430, 115, false);
};
cta.adWindow.adButtonKewlbox.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/bannerAd");
getURL ("http://trial.lotro.com/?utm_source=Moria_Unlock&utm_medium=ad01&utm_campaign=moria_unlock", "_blank");
};
cta.ctaKewlbox.visitText.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/visitSite");
getURL ("http://www.unlocktheminesofmoria.com/?utm_source=Kewlbox&utm_medium=Swig&utm_campaign=moria_unlock", "_blank");
};
cta.ctaKewlbox.visitButton.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/visitSite");
getURL ("http://www.unlocktheminesofmoria.com/?utm_source=Kewlbox&utm_medium=Swig&utm_campaign=moria_unlock", "_blank");
};
cta.ctaKewlbox.playAgain.onRelease = function () {
lotroRoot.callGoogle("/swigAndToss/playAgain");
resetGame();
};
cta.kewlboxSiteLogo.onRelease = function () {
getURL ("http://www.kewlbox.com", "_blank");
};
var goodResponseArray;
var badResponseArray;
this.createEmptyMovieClip("sounds", this.getNextHighestDepth());
sounds.createEmptyMovieClip("background", sounds.getNextHighestDepth());
sounds.createEmptyMovieClip("fire", sounds.getNextHighestDepth());
sounds.createEmptyMovieClip("sfx", sounds.getNextHighestDepth());
sounds.createEmptyMovieClip("voice", sounds.getNextHighestDepth());
var backgroundSound = new Sound(sounds.background);
var fireSound = new Sound(sounds.fire);
var sfxSound = new Sound(sounds.sfx);
var voiceSound = new Sound(sounds.voice);
if ((_root.gameType == "kewlbox") || (_root.gameType == "facebook")) {
isSoundOn = true;
}
backgroundSound.setVolume(20);
backgroundSound.attachSound("mzk-background");
if (isSoundOn) {
backgroundSound.start(0, 9999);
}
fireSound.attachSound("sfx-fireCrackle");
if (isSoundOn) {
fireSound.start(0, 9999);
}
voiceSound.setVolume(100);
initSoundArrays("good");
initSoundArrays("bad");
initSoundArrays("bet");
var lotroPing;
lotroRoot = this;
lotroPing = new com.blockdot.utils.Ping();
callGoogle = function (ping) {
lotroPing.sendPing(("/" + _root.gameType) + ping, "google2");
};
Frame 11
stop();
Frame 51
stop();
Frame 66
stop();
Frame 81
stop();
Frame 96
stop();
Frame 111
stop();
Frame 127
stop();
Frame 147
stop();
Symbol 50 MovieClip Frame 2
stop();
Symbol 50 MovieClip Frame 7
stop();
Symbol 386 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 387 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 388 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 389 MovieClip [__Packages.com.blockdot.utils.Ping] Frame 0
class com.blockdot.utils.Ping
{
var pingCount, pings, pingType, pingInterval;
function Ping () {
pingCount = 0;
pings = new Array();
}
function sendPing(id, type) {
pings.push(id);
pingType = type;
if (pings.length == 1) {
pingInterval = setInterval(this, "parsePings", 500);
}
}
function parsePings() {
if (pings[pingCount] != pings[pingCount - 1]) {
choosePing(pings[pingCount]);
}
if (pingCount == (pings.length - 1)) {
pings = new Array();
pingCount = 0;
clearInterval(pingInterval);
} else {
pingCount++;
}
}
function choosePing(id) {
trace(("Ping.as - Sent ping: " + id) + ".");
switch (pingType) {
case "google" :
flash.external.ExternalInterface.call("urchinTracker", id);
break;
case "google2" :
flash.external.ExternalInterface.call("pageTracker._trackPageview", id);
break;
default :
flash.external.ExternalInterface.call("urchinTracker", id);
}
}
}
Symbol 390 MovieClip [__Packages.mx.transitions.easing.Elastic] Frame 0
class mx.transitions.easing.Elastic
{
function Elastic () {
}
static function easeIn(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
t = t - 1;
return((-((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
static function easeOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / d;
if (t == 1) {
return(b + c);
}
if (!p) {
p = d * 0.3;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
return((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) + c) + b);
}
static function easeInOut(t, b, c, d, a, p) {
if (t == 0) {
return(b);
}
t = t / (d / 2);
if (t == 2) {
return(b + c);
}
if (!p) {
p = d * 0.45;
}
if ((!a) || (a < Math.abs(c))) {
a = c;
var _local7 = p / 4;
} else {
var _local7 = (p / (Math.PI*2)) * Math.asin(c / a);
}
if (t < 1) {
t = t - 1;
return((-0.5 * ((a * Math.pow(2, 10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p))) + b);
}
t = t - 1;
return(((((a * Math.pow(2, -10 * t)) * Math.sin((((t * d) - _local7) * (Math.PI*2)) / p)) * 0.5) + c) + b);
}
static var version = "1.1.0.52";
}
Symbol 391 MovieClip [__Packages.mx.transitions.easing.Strong] Frame 0
class mx.transitions.easing.Strong
{
function Strong () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return((((((c * t) * t) * t) * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = (t / d) - 1;
return((c * (((((t * t) * t) * t) * t) + 1)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return(((((((c / 2) * t) * t) * t) * t) * t) + b);
}
t = t - 2;
return(((c / 2) * (((((t * t) * t) * t) * t) + 2)) + b);
}
static var version = "1.1.0.52";
}
Symbol 392 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 393 MovieClip [__Packages.mx.transitions.easing.None] Frame 0
class mx.transitions.easing.None
{
function None () {
}
static function easeNone(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeIn(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static function easeInOut(t, b, c, d) {
return(((c * t) / d) + b);
}
static var version = "1.1.0.52";
}
Symbol 132 MovieClip Frame 1
stop();
Symbol 134 MovieClip Frame 1
stop();
Symbol 136 MovieClip Frame 1
stop();
Symbol 136 MovieClip Frame 97
_parent.doGameOver();
stop();
Symbol 174 MovieClip Frame 1
stop();
Symbol 178 MovieClip Frame 1
stop();
Symbol 213 MovieClip Frame 1
stop();
Symbol 213 MovieClip Frame 2
stop();
Symbol 213 MovieClip Frame 3
stop();
Symbol 258 MovieClip Frame 1
stop();
Symbol 258 MovieClip Frame 7
stop();
Symbol 315 MovieClip Frame 1
stop();
Symbol 315 MovieClip Frame 79
stop();
Symbol 317 MovieClip Frame 1
stop();
Symbol 317 MovieClip Frame 79
stop();
Symbol 319 MovieClip Frame 1
stop();
Symbol 319 MovieClip Frame 114
stop();
Symbol 324 MovieClip Frame 1
this._alpha = random(25);
Symbol 326 MovieClip Frame 1
stop();
Symbol 326 MovieClip Frame 42
stop();
Symbol 327 MovieClip Frame 1
stop();
Symbol 331 MovieClip Frame 1
stop();
Symbol 331 MovieClip Frame 2
mugMovie.play();
Symbol 331 MovieClip Frame 42
stop();
Symbol 332 MovieClip Frame 1
stop();
Symbol 335 MovieClip Frame 1
stop();
Symbol 335 MovieClip Frame 67
stop();
Symbol 337 MovieClip Frame 1
stop();
Symbol 337 MovieClip Frame 13
stop();
Symbol 339 MovieClip Frame 1
stop();
Symbol 339 MovieClip Frame 22
stop();
Symbol 340 MovieClip Frame 1
stop();
Symbol 340 MovieClip Frame 2
armThrow.play();
Symbol 340 MovieClip Frame 23
_parent.doAxeTween();
axeThrow.play();
axeMiss.play();
Symbol 340 MovieClip Frame 104
stop();
Symbol 342 MovieClip Frame 1
stop();
Symbol 342 MovieClip Frame 85
_parent.drinkIsDone = true;
Symbol 379 MovieClip Frame 4
stop();
Symbol 379 MovieClip Frame 9
stop();
Symbol 379 MovieClip Frame 14
stop();
Symbol 379 MovieClip Frame 19
stop();
Symbol 379 MovieClip Frame 24
stop();
Symbol 379 MovieClip Frame 29
stop();
Symbol 379 MovieClip Frame 34
stop();
Symbol 379 MovieClip Frame 39
stop();
Symbol 379 MovieClip Frame 44
stop();
Symbol 379 MovieClip Frame 49
stop();
Symbol 379 MovieClip Frame 54
stop();
Symbol 379 MovieClip Frame 59
stop();
Symbol 379 MovieClip Frame 64
stop();
Symbol 379 MovieClip Frame 69
stop();
Symbol 379 MovieClip Frame 74
stop();
Symbol 379 MovieClip Frame 79
stop();
Symbol 379 MovieClip Frame 84
stop();
Symbol 379 MovieClip Frame 90
stop();