Frame 1
function checkServer() {
return(true);
}
function bitOR(a, b) {
var _local1 = (a & 1) | (b & 1);
var _local2 = (a >>> 1) | (b >>> 1);
return((_local2 << 1) | _local1);
}
function bitXOR(a, b) {
var _local1 = (a & 1) ^ (b & 1);
var _local2 = (a >>> 1) ^ (b >>> 1);
return((_local2 << 1) | _local1);
}
function bitAND(a, b) {
var _local1 = (a & 1) & (b & 1);
var _local2 = (a >>> 1) & (b >>> 1);
return((_local2 << 1) | _local1);
}
function addme(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
function rhex(num) {
str = "";
j = 0;
while (j <= 3) {
str = str + (hex_chr.charAt((num >> ((j * 8) + 4)) & 15) + hex_chr.charAt((num >> (j * 8)) & 15));
j++;
}
return(str);
}
function str2blks_MD5(str) {
nblk = ((str.length + 8) >> 6) + 1;
blks = new Array(nblk * 16);
i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
}
i = 0;
while (i < str.length) {
blks[i >> 2] = blks[i >> 2] | (str.charCodeAt(i) << ((((str.length * 8) + i) % 4) * 8));
i++;
}
blks[i >> 2] = blks[i >> 2] | (128 << ((((str.length * 8) + i) % 4) * 8));
var _local2 = str.length * 8;
blks[(nblk * 16) - 2] = _local2 & 255;
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 8) & 255) << 8);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 16) & 255) << 16);
blks[(nblk * 16) - 2] = blks[(nblk * 16) - 2] | (((_local2 >>> 24) & 255) << 24);
return(blks);
}
function rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
function cmn(q, a, b, x, s, t) {
return(addme(rol(addme(addme(a, q), addme(x, t)), s), b));
}
function ff(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, c), bitAND(~b, d)), a, b, x, s, t));
}
function gg(a, b, c, d, x, s, t) {
return(cmn(bitOR(bitAND(b, d), bitAND(c, ~d)), a, b, x, s, t));
}
function hh(a, b, c, d, x, s, t) {
return(cmn(bitXOR(bitXOR(b, c), d), a, b, x, s, t));
}
function ii(a, b, c, d, x, s, t) {
return(cmn(bitXOR(c, bitOR(b, ~d)), a, b, x, s, t));
}
function calcMD5(str) {
x = str2blks_MD5(str);
a = 1732584193 /* 0x67452301 */;
b = -271733879;
c = -1732584194;
d = 271733878 /* 0x10325476 */;
var _local1;
i = 0;
while (i < x.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
_local1 = 0;
a = ff(a, b, c, d, x[i + 0], 7, -680876936);
d = ff(d, a, b, c, x[i + 1], 12, -389564586);
c = ff(c, d, a, b, x[i + 2], 17, 606105819);
b = ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = ff(a, b, c, d, x[i + 4], 7, -176418897);
d = ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = ff(b, c, d, a, x[i + 7], 22, -45705983);
a = ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = ff(c, d, a, b, x[i + 10], 17, -42063);
b = ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = ff(d, a, b, c, x[i + 13], 12, -40341101);
c = ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = gg(a, b, c, d, x[i + 1], 5, -165796510);
d = gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = gg(c, d, a, b, x[i + 11], 14, 643717713);
b = gg(b, c, d, a, x[i + 0], 20, -373897302);
a = gg(a, b, c, d, x[i + 5], 5, -701558691);
d = gg(d, a, b, c, x[i + 10], 9, 38016083);
c = gg(c, d, a, b, x[i + 15], 14, -660478335);
b = gg(b, c, d, a, x[i + 4], 20, -405537848);
a = gg(a, b, c, d, x[i + 9], 5, 568446438);
d = gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = gg(c, d, a, b, x[i + 3], 14, -187363961);
b = gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = gg(d, a, b, c, x[i + 2], 9, -51403784);
c = gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = hh(a, b, c, d, x[i + 5], 4, -378558);
d = hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = hh(b, c, d, a, x[i + 14], 23, -35309556);
a = hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = hh(c, d, a, b, x[i + 7], 16, -155497632);
b = hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = hh(a, b, c, d, x[i + 13], 4, 681279174);
d = hh(d, a, b, c, x[i + 0], 11, -358537222);
c = hh(c, d, a, b, x[i + 3], 16, -722521979);
b = hh(b, c, d, a, x[i + 6], 23, 76029189);
a = hh(a, b, c, d, x[i + 9], 4, -640364487);
d = hh(d, a, b, c, x[i + 12], 11, -421815835);
c = hh(c, d, a, b, x[i + 15], 16, 530742520);
b = hh(b, c, d, a, x[i + 2], 23, -995338651);
a = ii(a, b, c, d, x[i + 0], 6, -198630844);
d = ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = ii(b, c, d, a, x[i + 5], 21, -57434055);
a = ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = ii(c, d, a, b, x[i + 10], 15, -1051523);
b = ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = ii(d, a, b, c, x[i + 15], 10, -30611744);
c = ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = ii(a, b, c, d, x[i + 4], 6, -145523070);
d = ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = ii(c, d, a, b, x[i + 2], 15, 718787259);
b = ii(b, c, d, a, x[i + 9], 21, -343485551);
a = addme(a, olda);
b = addme(b, oldb);
c = addme(c, oldc);
d = addme(d, oldd);
i = i + 16;
}
return(((rhex(a) + rhex(b)) + rhex(c)) + rhex(d));
}
System.useCodepage = true;
stop();
var hex_chr = "0123456789abcdef";
isSound = true;
soundsName = new Array("haha", "roll", "safe", "tick", "walk", "won", "yourturn");
sounds = new Array();
var i = 0;
while (i < soundsName.length) {
sounds[soundsName[i]] = new Sound(this);
sounds[soundsName[i]].attachSound(soundsName[i] + ".wav");
sounds[soundsName[i]].isReady = true;
i++;
}
stop();
myScore = new CScore();
orderColors = ["blue", "yellow", "green", "red"];
indexPlayer = -1;
this.createEmptyMovieClip("controlScore", this.getNextHighestDepth());
Frame 11
score = 0;
if (!lvBanners) {
lvBanners = new LoadVars();
lvBanners.onLoad = function () {
trace("lvBanners -> " + this.toString());
_root.mcBanner1.area.loadMovie(this.Banner1);
_root.mcBanner1.url = this.Url1;
if (_root.mcBanner1.url) {
_root.mcBanner1.onRelease = function () {
getURL (this.url, "_blank");
};
}
_root.mcBanner2.area.loadMovie(this.Banner2);
_root.mcBanner2.url = this.Url2;
if (_root.mcBanner1.url) {
_root.mcBanner2.onRelease = function () {
getURL (this.url, "_blank");
};
}
};
lvBanners.sendAndLoad("http://www.playbandit.com/sp/ludo/banners.asp", lvBanners, "POST");
}
oldScore = 0;
score = 0;
controlScore.onEnterFrame = function () {
var _local4 = true;
if (oldScore < score) {
oldScore++;
} else if (oldScore > score) {
oldScore--;
} else {
_local4 = false;
}
if (_root.isSound && (_local4)) {
_root.sounds.tick.start();
}
TxtScore.text = oldScore;
if (((getTimer() - this.timeToView) >= 500) && (this.lstScores.length > 0)) {
var _local5 = this.lstScores.shift();
var _local3 = 0;
while (_local3 < this.lstMcScores.length) {
if (this.lstMcScores[_local3]._x == undefined) {
this.lstMcScores.shift();
} else {
break;
}
_local3++;
}
_local3 = 0;
while (_local3 < this.lstMcScores.length) {
this.lstMcScores[_local3]._y = this.lstMcScores[_local3]._y - 35;
_local3++;
}
this.lstMcScores.push(_root.attachMovie("MvcInfo", "mcInfo" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), _local5));
this.timeToView = getTimer();
}
};
controlScore.show = function (newScore) {
this.lstScores.push(newScore);
};
Frame 21
function endMove() {
hasMove--;
trace("endMove and move -> " + hasMove);
if (hasMove <= 0) {
mcDice.gotoAndStop(1);
isReady = true;
if ((mcDice.idPlayer != indexPlayer) && (mcDice.rollPlayer == indexPlayer)) {
mcCurrPlayer.gotoAndStop("_" + indexPlayer);
if (isSound) {
sounds.yourturn.start();
}
}
}
}
function putInSquare(id, mPeon) {
var _local2 = squares[id];
if (id > 500) {
_local2 = squares[players[mPeon.ownerId].finalStar].finalRoute[id - 501];
}
var _local5 = true;
if (((_local2.type != CPeon.GLOBE) && (_local2.peons.length == 1)) || (_local2.player == mPeon.ownerId)) {
var _local4 = _local2.peons.length - 1;
while (_local4 > -1) {
var _local3 = _local2.peons[_local4];
if (_local3.ownerId != mPeon.ownerId) {
if (mPeon.ownerId == indexPlayer) {
changeScore(mPeon, 30, SCORE_HIT);
}
trace("Expulsei algu\u00E9m!");
hasMove++;
_local3.escape();
_local2.peons = _local2.peons.slice(0, _local4).concat(_local2.peons.slice(_local4 + 1));
}
_local4--;
}
} else {
var _local4 = 0;
while (_local4 < _local2.peons.length) {
var _local3 = _local2.peons[_local4];
if (_local3.ownerId != mPeon.ownerId) {
if (_local3.ownerId == indexPlayer) {
changeScore(_local3, 30, SCORE_HIT);
}
trace("Eu fui expulso!");
mPeon.oldSquare = mPeon.targetSquare;
mPeon.escape();
_local5 = false;
break;
}
_local4++;
}
}
if (_local5) {
_local2.peons.push(mPeon);
mPeon.status = _local2.type;
if (_local2.type == CPeon.GLOBE) {
if (mPeon.ownerId == indexPlayer) {
if (mPeon.oldSquare == -1) {
changeScore(mPeon, 25, SCORE_OUT);
} else {
changeScore(mPeon, 15, SCORE_HOME);
}
}
if (isSound) {
sounds.safe.start();
}
}
if ((_local2.type == CPeon.STAR) && (mPeon.ownerId == indexPlayer)) {
changeScore(mPeon, 10, SCORE_STAR);
}
if ((id == 506) && (mPeon.ownerId == indexPlayer)) {
changeScore(mPeon, 100, SCORE_FIESTA);
}
if ((id == 506) && (_local2.peons.length == 4)) {
isReady = false;
mPeon.status = CPeon.ESCAPE;
delete mPeon.onEnterFrame;
if (isSound) {
sounds.won.start();
}
speedBonus = 0;
wonBonus = 0;
if (mPeon.ownerId == indexPlayer) {
wonBonus = 250;
if (rounds < 100) {
speedBonus = (60 - rounds) * 20;
}
}
congratulations();
}
}
positionPeonsInSquare(_local2);
}
function positionPeonsInSquare(currentSquare) {
switch (currentSquare.peons.length) {
case 1 :
currentSquare.peons[0]._x = currentSquare._x;
currentSquare.peons[0]._y = currentSquare._y;
break;
case 2 :
currentSquare.peons[0]._x = currentSquare._x - 8;
currentSquare.peons[0]._y = currentSquare._y;
currentSquare.peons[1]._x = currentSquare._x + 8;
currentSquare.peons[1]._y = currentSquare._y;
break;
case 3 :
currentSquare.peons[0]._x = currentSquare._x - 8;
currentSquare.peons[0]._y = currentSquare._y - 4;
currentSquare.peons[1]._x = currentSquare._x + 8;
currentSquare.peons[1]._y = currentSquare._y - 4;
currentSquare.peons[2]._x = currentSquare._x;
currentSquare.peons[2]._y = currentSquare._y + 4;
break;
case 4 :
currentSquare.peons[0]._x = currentSquare._x - 8;
currentSquare.peons[0]._y = currentSquare._y - 4;
currentSquare.peons[1]._x = currentSquare._x + 8;
currentSquare.peons[1]._y = currentSquare._y - 4;
currentSquare.peons[2]._x = currentSquare._x - 8;
currentSquare.peons[2]._y = currentSquare._y + 4;
currentSquare.peons[3]._x = currentSquare._x + 8;
currentSquare.peons[3]._y = currentSquare._y + 4;
}
}
function putOutSquare(id, mPeon) {
var _local2 = squares[id];
if (id > 500) {
_local2 = squares[players[mPeon.ownerId].finalStar].finalRoute[id - 501];
}
var _local1 = 0;
while (_local1 < _local2.peons.length) {
if (_local2.peons[_local1] == mPeon) {
trace("Inicio " + _local2.peons.slice(0, _local1));
trace("Inicio " + _local2.peons.slice(_local1 + 1));
_local2.peons = _local2.peons.slice(0, _local1).concat(_local2.peons.slice(_local1 + 1));
}
_local1++;
}
positionPeonsInSquare(_local2);
}
function changeScore(mPeon, value, logo) {
trace("function caller -> " + String(arguments.caller));
score = score + value;
mPeon.gainBonus = true;
controlScore.show({mPeon:mPeon, value:value, logo:logo});
}
function congratulations() {
if (onEnterFrame != congratulations) {
markTime = getTimer();
onEnterFrame = congratulations;
} else if ((getTimer() - markTime) >= 3000) {
var _local3 = 0;
while (_local3 < 4) {
var _local2 = 0;
while (_local2 < 4) {
this[(("peon" + _local3) + "_") + _local2].removeMovieClip();
_local2++;
}
_local3++;
}
mcMarker.removeMovieClip();
delete onEnterFrame;
gotoAndStop ("congratulations");
}
}
myScore.startGame();
SCORE_GLOBE = 1;
SCORE_HIT = 2;
SCORE_HOME = 3;
SCORE_OUT = 4;
SCORE_SIX = 5;
SCORE_STAR = 6;
SCORE_FIESTA = 7;
SCORE_NULL = 8;
TIMETOROLL = 500;
btnRoll._visible = false;
btnAuto._visible = true;
btnAutoOn._visible = false;
players = new Array();
mcMarker._visible = false;
isReady = true;
hasMove = 0;
firstPlayer = Math.floor(Math.random() * 4);
rounds = 0;
score = 0;
oldScore = 0;
var i = 0;
while (i < 4) {
_root["maskColor" + i]._visible = false;
i++;
}
_root["maskColor" + indexPlayer]._visible = true;
squares = [{_x:21, _y:288, peons:[], type:CPeon.NORMAL}, {_x:53, _y:288, peons:[], type:CPeon.GLOBE, player:0}, {_x:83, _y:288, peons:[], type:CPeon.NORMAL}, {_x:118, _y:288, peons:[], type:CPeon.NORMAL}, {_x:147, _y:288, peons:[], type:CPeon.NORMAL}, {_x:180, _y:288, peons:[], type:CPeon.NORMAL}, {_x:208, _y:262, peons:[], type:CPeon.STAR}, {_x:208, _y:229, peons:[], type:CPeon.NORMAL}, {_x:208, _y:196, peons:[], type:CPeon.NORMAL}, {_x:208, _y:165, peons:[], type:CPeon.GLOBE}, {_x:208, _y:135, peons:[], type:CPeon.NORMAL}, {_x:208, _y:101, peons:[], type:CPeon.NORMAL}, {_x:238, _y:101, peons:[], type:CPeon.STAR, player:1, finalRoute:[{_x:238, _y:135, peons:[]}, {_x:238, _y:165, peons:[]}, {_x:238, _y:196, peons:[]}, {_x:238, _y:229, peons:[]}, {_x:238, _y:262, peons:[]}, {_x:238, _y:288, peons:[]}]}, {_x:271, _y:101, peons:[], type:CPeon.NORMAL}, {_x:271, _y:135, peons:[], type:CPeon.GLOBE, player:1}, {_x:271, _y:165, peons:[], type:CPeon.NORMAL}, {_x:271, _y:196, peons:[], type:CPeon.NORMAL}, {_x:271, _y:229, peons:[], type:CPeon.NORMAL}, {_x:271, _y:262, peons:[], type:CPeon.NORMAL}, {_x:294, _y:288, peons:[], type:CPeon.STAR}, {_x:330, _y:288, peons:[], type:CPeon.NORMAL}, {_x:363, _y:288, peons:[], type:CPeon.NORMAL}, {_x:394, _y:288, peons:[], type:CPeon.GLOBE}, {_x:426, _y:288, peons:[], type:CPeon.NORMAL}, {_x:457, _y:288, peons:[], type:CPeon.NORMAL}, {_x:457, _y:320, peons:[], type:CPeon.STAR, player:2, finalRoute:[{_x:425, _y:320, peons:[]}, {_x:394, _y:320, peons:[]}, {_x:363, _y:320, peons:[]}, {_x:330, _y:320, peons:[]}, {_x:294, _y:320, peons:[]}, {_x:271, _y:320, peons:[]}]}, {_x:457, _y:353, peons:[], type:CPeon.NORMAL}, {_x:426, _y:353, peons:[], type:CPeon.GLOBE, player:2}, {_x:394, _y:353, peons:[], type:CPeon.NORMAL}, {_x:363, _y:353, peons:[], type:CPeon.NORMAL}, {_x:330, _y:353, peons:[], type:CPeon.NORMAL}, {_x:294, _y:353, peons:[], type:CPeon.NORMAL}, {_x:271, _y:379, peons:[], type:CPeon.STAR}, {_x:271, _y:413, peons:[], type:CPeon.NORMAL}, {_x:271, _y:444, peons:[], type:CPeon.NORMAL}, {_x:271, _y:476, peons:[], type:CPeon.GLOBE}, {_x:271, _y:507, peons:[], type:CPeon.NORMAL}, {_x:271, _y:540, peons:[], type:CPeon.NORMAL}, {_x:238, _y:540, peons:[], type:CPeon.STAR, player:3, finalRoute:[{_x:238, _y:507, peons:[]}, {_x:238, _y:476, peons:[]}, {_x:238, _y:444, peons:[]}, {_x:238, _y:413, peons:[]}, {_x:238, _y:379, peons:[]}, {_x:238, _y:353, peons:[]}]}, {_x:208, _y:540, peons:[], type:CPeon.NORMAL}, {_x:208, _y:507, peons:[], type:CPeon.GLOBE, player:3}, {_x:208, _y:476, peons:[], type:CPeon.NORMAL}, {_x:208, _y:444, peons:[], type:CPeon.NORMAL}, {_x:208, _y:413, peons:[], type:CPeon.NORMAL}, {_x:208, _y:379, peons:[], type:CPeon.NORMAL}, {_x:180, _y:353, peons:[], type:CPeon.STAR}, {_x:147, _y:353, peons:[], type:CPeon.NORMAL}, {_x:118, _y:353, peons:[], type:CPeon.NORMAL}, {_x:83, _y:353, peons:[], type:CPeon.GLOBE}, {_x:53, _y:353, peons:[], type:CPeon.NORMAL}, {_x:21, _y:353, peons:[], type:CPeon.NORMAL}, {_x:21, _y:320, peons:[], type:CPeon.STAR, player:0, finalRoute:[{_x:53, _y:320, peons:[]}, {_x:83, _y:320, peons:[]}, {_x:118, _y:320, peons:[]}, {_x:147, _y:320, peons:[]}, {_x:180, _y:320, peons:[]}, {_x:208, _y:320, peons:[]}]}];
players[0] = new CPlayer(((indexPlayer == 0) ? (CPlayer.HUMAN) : (CPlayer.CPU)), 0, {_x:46, _y:181}, [{_x:106, _y:226}, {_x:146, _y:226}, {_x:106, _y:186}, {_x:146, _y:186}]);
players[1] = new CPlayer(((indexPlayer == 1) ? (CPlayer.HUMAN) : (CPlayer.CPU)), 1, {_x:396, _y:161}, [{_x:336, _y:186}, {_x:336, _y:226}, {_x:376, _y:186}, {_x:376, _y:226}]);
players[2] = new CPlayer(((indexPlayer == 2) ? (CPlayer.HUMAN) : (CPlayer.CPU)), 2, {_x:416, _y:501}, [{_x:374, _y:408}, {_x:334, _y:408}, {_x:374, _y:448}, {_x:334, _y:448}]);
players[3] = new CPlayer(((indexPlayer == 3) ? (CPlayer.HUMAN) : (CPlayer.CPU)), 3, {_x:66, _y:496}, [{_x:148, _y:446}, {_x:148, _y:406}, {_x:108, _y:446}, {_x:108, _y:406}]);
controlScore.lstScores = new Array();
controlScore.lstMcScores = new Array();
controlScore.timeToView = getTimer();
Frame 31
function fillRanking(lvObject) {
trace(lvObject);
var _local1 = 0;
while (lvObject["name" + _local1]) {
scoreList.addItem("SmbScoreListItem", {name:lvObject["name" + _local1], score:lvObject["score" + _local1], color:lvObject["color" + _local1].toLowerCase(), seconds:lvObject["secsplayed" + _local1]});
_local1++;
}
}
trace(myScore.getRanking);
myScore.getRanking();
Frame 51
mcHidden0._visible = false;
totalScore = 0;
nScore = 0;
nWonBonus = 0;
nSpeedBonus = 0;
Selection.setFocus("TxtUsername");
controlScore.onEnterFrame = function () {
var _local2 = true;
if (score > 0) {
if (score > 100) {
score = score - 11;
nScore = nScore + 11;
totalScore = totalScore + 11;
} else {
score--;
nScore++;
totalScore++;
}
} else if (wonBonus > 0) {
if (wonBonus > 100) {
wonBonus = wonBonus - 11;
nWonBonus = nWonBonus + 11;
totalScore = totalScore + 11;
} else {
wonBonus--;
nWonBonus++;
totalScore++;
}
} else if (speedBonus > 0) {
if (speedBonus > 100) {
speedBonus = speedBonus - 11;
nSpeedBonus = nSpeedBonus + 11;
totalScore = totalScore + 11;
} else {
speedBonus--;
nSpeedBonus++;
totalScore++;
}
} else {
_local2 = false;
}
if (_root.isSound && (_local2)) {
_root.sounds.tick.start();
}
};
Symbol 24 MovieClip Frame 1
stop();
Symbol 25 MovieClip [MvcInfo] Frame 1
countShowInfo = 0;
_x = Math.max(40, mPeon._x);
_y = Math.max(30, mPeon._y - 40);
mcLogo.gotoAndStop(logo);
if (this.value >= 0) {
txtInfo.text = "+" + String(this.value);
} else {
txtInfo.text = String(this.value);
}
countShowInfo = 100;
onEnterFrame = function () {
if (countShowInfo > 0) {
countShowInfo--;
_alpha = (countShowInfo * 2.2);
} else {
value = 0;
_visible = false;
txtInfo.text = "";
}
};
Symbol 33 MovieClip Frame 1
stop();
Symbol 35 MovieClip [SmbScoreListItem] Frame 1
#initclip 6
Object.registerClass("SmbScoreListItem", SmbScoreListItem);
#endinitclip
Symbol 40 MovieClip Frame 1
_root.stop();
initialTime = getTimer();
mcBarra.onEnterFrame = function () {
var _local4 = _root.getBytesLoaded();
var _local3 = _root.getBytesTotal();
this._xscale = 100 * Math.min(_local4 / _local3, (getTimer() - initialTime) / 5000);
if ((Math.round(this._xscale) >= 100) && (_root.checkServer())) {
_root.gotoAndStop("mainMenu");
delete this.onEnterFrame;
}
};
Symbol 357 MovieClip [__Packages.CScore] Frame 0
class CScore extends LoadVars
{
var rounds, Points, username, Rand, ip, v, sendAndLoad, Webpage, Language, Color, onLoad;
function CScore () {
super();
}
function sendScorePlayer(rounds, score, username) {
var _local5 = "casablanca";
result = _root.calcMD5((((((rounds + "_") + score) + "_") + username) + "_") + _local5);
this.rounds = rounds;
Points = score;
this.username = username;
Rand = 0;
var _local3 = 0;
while (_local3 < 4) {
Rand = Rand + (v[_local3] * Number(ip[_local3]));
_local3++;
}
var _local4 = new LoadVars();
_local4.result = result;
_local4.Rounds = this.rounds;
_local4.Username = this.username;
_local4.Rand = Rand;
_local4.Points = Points;
_local4.onLoad = function (success) {
trace(this.toString());
if (isNaN(this.place)) {
_root.TxtLastPlace.text = "";
} else {
_root.TxtLastPlace.text = this.place;
}
};
_local4.sendAndLoad(submitLink, _local4, "POST");
}
function getRanking() {
var _local3 = new LoadVars();
_local3.onLoad = function (success) {
trace("calling fillRanking");
_root.fillRanking(this);
};
trace("getRanking -> " + rankingLink);
sendAndLoad(rankingLink, _local3, "POST");
}
function startGame() {
Webpage = String(flash.external.ExternalInterface.call("window.location.href.toString"));
Language = System.capabilities.language;
Color = _root.color;
v = new Array(4);
Rand = 0;
var _local3 = 0;
while (_local3 < 4) {
v[_local3] = Math.floor((Math.random() * 255) + 1);
Rand = (Rand * 256) + v[_local3];
_local3++;
}
onLoad = function (success) {
this.ip = this.IP.split(".");
};
var _local4 = new LoadVars();
_local4.Rand = Rand;
_local4.Webpage = Webpage;
_local4.Language = Language;
_local4.Color = Color;
trace("COLOR -> " + Color);
_local4.sendAndLoad(startLink, this, "POST");
}
var submitLink = "http://www.playbandit.com/sp/ludo/submithiscore.asp";
var rankingLink = "http://www.playbandit.com/sp/ludo/hiscore.asp";
var startLink = "http://www.playbandit.com/sp/ludo/startgame.asp";
var error = 0;
var result = "";
}
Symbol 358 MovieClip [__Packages.SmbScoreListItem] Frame 0
class SmbScoreListItem extends MovieClip
{
var name, score, seconds, TxtName, TxtScore, TxtTime, mcPeon;
function SmbScoreListItem () {
super();
trace("initializing SmbScoreListItem");
}
function setData(data) {
name = data.name;
score = data.score;
seconds = Number(data.seconds);
TxtName.text = name;
TxtScore.text = score;
if (isNaN(seconds)) {
TxtTime.text = "";
} else {
var _local5 = Math.floor(seconds / 3600);
var _local3 = Math.floor((seconds - (_local5 * 3600)) / 60);
var _local2 = seconds % 60;
if (_local3 < 10) {
_local3 = "0" + _local3;
}
if (_local2 < 10) {
_local2 = "0" + _local2;
}
TxtTime.text = (((_local5 + ":") + _local3) + ":") + _local2;
}
mcPeon.gotoAndStop("_" + data.color);
}
function getData() {
return({name:name, score:score});
}
}
Symbol 359 MovieClip [__Packages.CPeon] Frame 0
class CPeon extends MovieClip
{
var onEnterFrame, _x, _y, _name, _xscale, _yscale, gainBonus, swapDepths, onRollOver, onReleaseOutside, onRollOut, onRelease;
function CPeon () {
super();
status = STARTAREA;
}
function escape() {
if (onEnterFrame != escape) {
if (_root.isSound) {
_root.sounds.haha.start();
}
oldSquare = ((oldSquare + _root.squares.length) - 1) % _root.squares.length;
status = ESCAPE;
onEnterFrame = escape;
} else if (status == ESCAPE) {
var _local5 = _root.squares[oldSquare]._x - _x;
var _local4 = _root.squares[oldSquare]._y - _y;
var _local7 = ((((_root.mcSpeedButton.status == "on") ? (rateEscape) : 1) * distEscape) * _local5) / Math.sqrt((_local5 * _local5) + (_local4 * _local4));
var _local6 = ((((_root.mcSpeedButton.status == "on") ? (rateEscape) : 1) * distEscape) * _local4) / Math.sqrt((_local5 * _local5) + (_local4 * _local4));
_x = _x + _local7;
_y = _y + _local6;
_local7 = _root.squares[oldSquare]._x - _x;
_local6 = _root.squares[oldSquare]._y - _y;
if ((((_local5 * _local7) < 0) || ((_local4 * _local6) < 0)) || ((Math.abs(_local7) + Math.abs(_local6)) == 0)) {
if (_root.players[ownerId].initialGlobe == oldSquare) {
status = STARTAREA;
oldSquare = -1;
nextSquare = -1;
} else {
oldSquare = ((oldSquare + _root.squares.length) - 1) % _root.squares.length;
}
}
} else {
var _local3 = _root.players[ownerId].home[_name.split("_")[1]];
var _local5 = _local3._x - _x;
var _local4 = _local3._y - _y;
var _local7 = ((((_root.mcSpeedButton.status == "on") ? (rateEscape) : 1) * distEscape) * _local5) / Math.sqrt((_local5 * _local5) + (_local4 * _local4));
var _local6 = ((((_root.mcSpeedButton.status == "on") ? (rateEscape) : 1) * distEscape) * _local4) / Math.sqrt((_local5 * _local5) + (_local4 * _local4));
_x = _x + _local7;
_y = _y + _local6;
_local7 = _local3._x - _x;
_local6 = _local3._y - _y;
if ((((_local5 * _local7) < 0) || ((_local4 * _local6) < 0)) || ((Math.abs(_local7) + Math.abs(_local6)) == 0)) {
_x = _local3._x;
_y = _local3._y;
_root.endMove();
delete onEnterFrame;
}
}
}
function moveTo(square) {
if (onEnterFrame != moveTo) {
if (_root.isSound) {
_root.sounds.walk.start();
}
_xscale = 100;
_yscale = 100;
gainBonus = false;
targetSquare = square;
trace("targetSquare -> " + targetSquare);
_root.isReady = false;
_root.putOutSquare(oldSquare, this);
swapDepths(_root.getNextHighestDepth());
if (oldSquare == _root.players[ownerId].finalStar) {
nextSquare = 501;
trace("Case 1! nextSquare = " + nextSquare);
} else if (status == FINALROUTE) {
nextSquare = oldSquare + 1;
trace("Case 2! nextSquare = " + nextSquare);
} else {
nextSquare = (oldSquare + 1) % _root.squares.length;
trace("Case 3! nextSquare = " + nextSquare);
}
onEnterFrame = moveTo;
} else if (oldSquare == -1) {
var _local7 = _root.squares[targetSquare]._x - _x;
var _local6 = _root.squares[targetSquare]._y - _y;
var _local9 = ((((_root.mcSpeedButton.status == "on") ? (rateSpeed) : 1) * distance) * _local7) / Math.sqrt((_local7 * _local7) + (_local6 * _local6));
var _local8 = ((((_root.mcSpeedButton.status == "on") ? (rateSpeed) : 1) * distance) * _local6) / Math.sqrt((_local7 * _local7) + (_local6 * _local6));
_x = _x + _local9;
_y = _y + _local8;
_local9 = _root.squares[targetSquare]._x - _x;
_local8 = _root.squares[targetSquare]._y - _y;
if ((((_local7 * _local9) < 0) || ((_local6 * _local8) < 0)) || ((Math.abs(_local9) + Math.abs(_local8)) == 0)) {
_root.putInSquare(targetSquare, this);
if (status != ESCAPE) {
if (targetSquare == _root.players[ownerId].finalStar) {
status = FINALROUTE;
} else if (targetSquare == 506) {
status = VICTORY;
}
oldSquare = targetSquare;
targetSquare = -1;
if ((ownerId == _root.indexPlayer) && (!gainBonus)) {
_root.score = _root.score + _root.mcDice.value;
}
_root.endMove();
delete onEnterFrame;
} else if ((ownerId == _root.indexPlayer) && (!gainBonus)) {
_root.score = _root.score + _root.mcDice.value;
}
}
} else {
var _local3 = _root.squares[nextSquare];
if (nextSquare > 506) {
_local3 = _root.squares[_root.players[ownerId].finalStar].finalRoute[(1012 - nextSquare) - 501];
} else if (nextSquare >= 500) {
_local3 = _root.squares[_root.players[ownerId].finalStar].finalRoute[nextSquare - 501];
}
var _local7 = _local3._x - _x;
var _local6 = _local3._y - _y;
var _local9 = ((((_root.mcSpeedButton.status == "on") ? (rateSpeed) : 1) * distance) * _local7) / Math.sqrt((_local7 * _local7) + (_local6 * _local6));
var _local8 = ((((_root.mcSpeedButton.status == "on") ? (rateSpeed) : 1) * distance) * _local6) / Math.sqrt((_local7 * _local7) + (_local6 * _local6));
_x = _x + _local9;
_y = _y + _local8;
_local9 = _local3._x - _x;
_local8 = _local3._y - _y;
if ((((_local7 * _local9) < 0) || ((_local6 * _local8) < 0)) || ((Math.abs(_local9) + Math.abs(_local8)) == 0)) {
if (nextSquare == targetSquare) {
if (targetSquare > 506) {
targetSquare = 1012 - targetSquare;
}
_root.putInSquare(targetSquare, this);
if (status != ESCAPE) {
if (targetSquare == 506) {
status = VICTORY;
} else if ((targetSquare == _root.players[ownerId].finalStar) || (targetSquare >= 500)) {
status = FINALROUTE;
}
oldSquare = targetSquare;
targetSquare = -1;
if ((ownerId == _root.indexPlayer) && (!gainBonus)) {
_root.score = _root.score + _root.mcDice.value;
}
_root.endMove();
delete onEnterFrame;
} else if ((ownerId == _root.indexPlayer) && (!gainBonus)) {
_root.score = _root.score + _root.mcDice.value;
}
} else {
if (nextSquare == middleSquare) {
if (_local3.peons.length <= 1) {
var _local5 = _local3.peons.length - 1;
while (_local5 > -1) {
var _local4 = _local3.peons[_local5];
if (_local4.ownerId != ownerId) {
trace("Expulsei algu\u00E9m! in CPeon");
if (ownerId == _root.indexPlayer) {
_root.changeScore(this, 30, _root.SCORE_HIT);
}
_root.hasMove++;
_local4.escape();
_local3.peons = _local3.peons.slice(0, _local5).concat(_local3.peons.slice(_local5 + 1));
}
_local5--;
}
_root.positionPeonsInSquare(_local3);
} else {
var _local5 = 0;
while (_local5 < _local3.peons.length) {
var _local4 = _local3.peons[_local5];
if (_local4.ownerId != ownerId) {
trace("Eu fui expulso!");
if (_local4.ownerId == _root.indexPlayer) {
_root.changeScore(_local4, 30, _root.SCORE_HIT);
}
oldSquare = targetSquare;
escape();
break;
}
_local5++;
}
}
}
if (status != ESCAPE) {
if (nextSquare == _root.players[ownerId].finalStar) {
nextSquare = 501;
status = FINALROUTE;
} else if (status == FINALROUTE) {
nextSquare = nextSquare + 1;
} else {
nextSquare = (nextSquare + 1) % _root.squares.length;
}
} else if ((ownerId == _root.indexPlayer) && (!gainBonus)) {
_root.score = _root.score + _root.mcDice.value;
}
}
}
}
}
function setResize() {
onRollOver = function () {
this._xscale = 150;
this._yscale = 150;
if (_root.isReady) {
trace("My TargetSquare -> " + this.targetSquare);
if ((this.targetSquare > -1) && (_root.players[this.ownerId].diceValue > 0)) {
_root.mcMarker._visible = true;
_root.mcMarker.swapDepths(_root.getNextHighestDepth());
if (this.targetSquare < 500) {
var _local4 = true;
if (_root.squares[this.targetSquare].type == CPeon.STAR) {
var _local3 = 0;
while (_local3 < _root.squares[this.targetSquare].peons) {
if (_root.squares[this.targetSquare].peons[_local3].ownerId != this.ownerId) {
_local4 = false;
}
_local3++;
}
}
if (_local4) {
_root.mcMarker._x = _root.squares[this.targetSquare]._x;
_root.mcMarker._y = _root.squares[this.targetSquare]._y;
} else {
var _local5 = _root.players[this.ownerId].home[this._name.split("_")[1]];
_root.mcMarker._x = _local5._x;
_root.mcMarker._y = _local5._y;
}
} else if (this.targetSquare > 506) {
_root.mcMarker._x = _root.squares[_root.players[this.ownerId].finalStar].finalRoute[(1012 - this.targetSquare) - 501]._x;
_root.mcMarker._y = _root.squares[_root.players[this.ownerId].finalStar].finalRoute[(1012 - this.targetSquare) - 501]._y;
} else {
_root.mcMarker._x = _root.squares[_root.players[this.ownerId].finalStar].finalRoute[this.targetSquare - 501]._x;
_root.mcMarker._y = _root.squares[_root.players[this.ownerId].finalStar].finalRoute[this.targetSquare - 501]._y;
}
}
}
};
onReleaseOutside = (onRollOut = function () {
this._xscale = 100;
this._yscale = 100;
if (_root.isReady) {
_root.mcMarker._visible = false;
}
});
onRelease = function () {
if ((this.targetSquare > -1) && (_root.players[this.ownerId].diceValue > 0)) {
this.moveTo(this.targetSquare);
_root.players[this.ownerId].diceValue = -1;
_root.mcMarker._visible = false;
}
};
}
static var NORMAL = 0;
static var STARTAREA = 1;
static var GLOBE = 2;
static var STAR = 3;
static var FINALROUTE = 4;
static var VICTORY = 5;
static var ESCAPE = 6;
var status = -1;
var targetSquare = -1;
var oldSquare = -1;
var nextSquare = -1;
var middleSquare = -1;
var ownerId = -1;
var distance = 5;
var distEscape = 15;
var rateSpeed = 1.7;
var rateEscape = 1.7;
}
Symbol 360 MovieClip [__Packages.CPlayer] Frame 0
class CPlayer extends MovieClip
{
var initialPos, home, inHome, globes, sixes;
function CPlayer (type, id, initialPos, home) {
super();
this.type = type;
this.id = id;
this.initialPos = initialPos;
this.home = home;
var _local5 = 0;
while (_local5 < 4) {
var _local4 = _root[(("peon" + id) + "_") + _local5];
_local4._x = initialPos._x;
_local4._y = initialPos._y;
_local4._xscale = 60;
_local4._yscale = 60;
_local4.counter = (-_local5) * 7;
_local4.ownerId = id;
if (type == HUMAN) {
_local4.setResize();
}
_local5++;
}
peonsMoving = 4;
inHome = true;
_local5 = 0;
while (_local5 < _root.squares.length) {
if (_root.squares[_local5].player == id) {
if (_root.squares[_local5].type == CPeon.GLOBE) {
initialGlobe = _local5;
}
if (_root.squares[_local5].type == CPeon.STAR) {
finalStar = _local5;
}
}
_local5++;
}
iGoInitialToHome = setInterval(this, "goInitialToHome", 50);
}
function myTime() {
if (id == _root.firstPlayer) {
_root.rounds++;
}
launches = 0;
globes = 0;
sixes = 0;
if (((id == _root.indexPlayer) && (_root.hasmove <= 0)) && (_root.isReady)) {
_root.mcDice.gotoAndStop(1);
_root.mcCurrPlayer.gotoAndStop("_" + id);
if (_root.isSound) {
_root.sounds.yourturn.start;
}
}
askRollDice();
}
function askRollDice() {
trace("askRollDice " + type);
launches++;
_root.mcDice.rollPlayer = id;
if ((type == CPU) || (_root.btnAutoOn._visible)) {
_root.mcDice.iRollDice = setInterval(_root.mcDice, "rollDice", _root.TIMETOROLL);
} else if (type == HUMAN) {
_root.btnRoll._visible = true;
}
}
function receivesDiceValue(diceValue) {
trace("receivesDiceValue -> " + diceValue);
this.diceValue = diceValue;
if (inHome) {
if (diceValue == 5) {
if (type == CPU) {
var _local11 = 0;
while (_local11 < 4) {
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_root.hasMove = 1;
_local6.moveTo(initialGlobe);
break;
}
_local11++;
}
} else if (type == HUMAN) {
_root.hasMove = 1;
var _local11 = 0;
while (_local11 < 4) {
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_local6.targetSquare = initialGlobe;
} else {
_local6.targetSquare = -1;
}
_local11++;
}
}
inHome = false;
askRollDice();
} else if (launches < 3) {
askRollDice();
} else {
_root.players[(id + 1) % 4].myTime();
}
} else if (diceValue == 5) {
if (type == CPU) {
var _local7 = new Array(4);
var _local5 = new Array(4);
var _local11 = 0;
while (_local11 < 4) {
_local7[_local11] = 0;
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_local7[_local11] = DECISION_START;
_local5[_local11] = initialGlobe;
} else if (_local6.oldSquare == finalStar) {
_local5[_local11] = 501;
_local7[_local11] = DECISION_SECURE;
} else if ((_local6.status == CPeon.FINALROUTE) || (_local6.status == CPeon.VICTORY)) {
trace(_local6 + " is walking to victory");
_local7[_local11] = DECISION_NULL;
_local5[_local11] = -1;
} else {
_local5[_local11] = (_local6.oldSquare + 1) % _root.squares.length;
var _local9 = 1;
while (_root.squares[_local5[_local11]].type != CPeon.GLOBE) {
if ((_root.squares[_local5[_local11]].type == CPeon.STAR) && (_root.squares[_local5[_local11]].player == id)) {
_local5[_local11] = -1;
break;
}
_local5[_local11] = (_local5[_local11] + 1) % _root.squares.length;
_local9++;
}
if (_local5[_local11] > -1) {
_local7[_local11] = DECISION_SECURE;
if ((_root.squares[_local5[_local11]].peons.length > 0) && (_root.squares[_local5[_local11]].peons[0].ownerId != _local6.ownerId)) {
if (_root.squares[_local5[_local11]].player == _local6.ownerId) {
_local7[_local11] = _local7[_local11] + DECISION_EXPULSE;
} else {
_local7[_local11] = DECISION_SACRIFICE;
}
}
} else {
_local7[_local11] = DECISION_NULL;
_local5[_local11] = -1;
}
}
_local11++;
}
var _local13 = 0;
var _local12 = -1;
_local11 = 0;
while (_local11 < 4) {
if (_local7[_local11] > _local13) {
_local13 = _local7[_local11];
_local12 = _local11;
}
_local11++;
}
if (_local12 > -1) {
_root.hasMove = 1;
_root[(("peon" + id) + "_") + _local12].moveTo(_local5[_local12]);
}
} else if (type == HUMAN) {
_root.hasMove = 0;
var _local11 = 0;
while (_local11 < 4) {
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_root.hasMove = 1;
_local6.targetSquare = initialGlobe;
} else if (_local6.oldSquare == finalStar) {
_local6.targetSquare = 501;
} else if ((_local6.status == CPeon.VICTORY) || (_local6.status == CPeon.FINALROUTE)) {
_local6.targetSquare = -1;
} else {
var _local5 = (_local6.oldSquare + 1) % _root.squares.length;
while (_root.squares[_local5].type != CPeon.GLOBE) {
if ((_root.squares[_local5].type == CPeon.STAR) && (_root.squares[_local5].player == id)) {
_local5 = -1;
break;
}
_local5 = (_local5 + 1) % _root.squares.length;
}
_local6.targetSquare = _local5;
if (_local6.targetSquare > -1) {
_root.hasMove = 1;
}
}
_local11++;
}
}
askRollDice();
} else if (diceValue == 3) {
if (type == CPU) {
var _local7 = new Array(4);
var _local3 = new Array(4);
var _local4 = new Array(4);
var _local11 = 0;
while (_local11 < 4) {
_local7[_local11] = 0;
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_local7[_local11] = DECISION_NULL;
_local3[_local11] = -1;
} else if ((_local6.status == CPeon.FINALROUTE) || (_local6.status == CPeon.VICTORY)) {
_local7[_local11] = DECISION_NULL;
_local3[_local11] = -1;
} else {
_local3[_local11] = (_local6.oldSquare + 1) % _root.squares.length;
var _local9 = 1;
while (_root.squares[_local3[_local11]].type != CPeon.STAR) {
_local3[_local11] = (_local3[_local11] + 1) % _root.squares.length;
_local9++;
}
if (_root.squares[_local3[_local11]].player == id) {
_local7[_local11] = DECISION_WIN;
_local4[_local11] = 506;
} else {
_local4[_local11] = (_local3[_local11] + 1) % _root.squares.length;
while (_root.squares[_local4[_local11]].type != CPeon.STAR) {
_local4[_local11] = (_local4[_local11] + 1) % _root.squares.length;
_local9++;
}
_local7[_local11] = _local9;
}
if ((((_local3[_local11] > -1) && (_local3[_local11] < 501)) && (_root.squares[_local3[_local11]].peons.length > 0)) && (_root.squares[_local3[_local11]].peons[0].ownerId != _local6.ownerId)) {
if (_root.squares[_local3[_local11]].peons.length > 1) {
_local7[_local11] = DECISION_SACRIFICE;
} else {
_local7[_local11] = DECISION_EXPULSE;
}
}
if (((((_local7[_local11] != DECISION_SACRIFICE) && (_local4[_local11] > -1)) && (_local4[_local11] < 501)) && (_root.squares[_local4[_local11]].peons.length > 0)) && (_root.squares[_local4[_local11]].peons[0].ownerId != _local6.ownerId)) {
if (_root.squares[_local4[_local11]].peons.length > 1) {
_local7[_local11] = DECISION_SACRIFICE;
} else {
_local7[_local11] = DECISION_EXPULSE;
}
}
}
_local11++;
}
var _local13 = 0;
var _local12 = -1;
_local11 = 0;
while (_local11 < 4) {
if (_local7[_local11] > _local13) {
_local13 = _local7[_local11];
_local12 = _local11;
}
_local11++;
}
if (_local12 > -1) {
_root[(("peon" + id) + "_") + _local12].middleSquare = _local3[_local12];
_root[(("peon" + id) + "_") + _local12].targetSquare = _local4[_local12];
_root.hasMove = 1;
_root[(("peon" + id) + "_") + _local12].moveTo(_local4[_local12]);
}
} else if (type == HUMAN) {
_root.hasMove = 0;
var _local11 = 0;
while (_local11 < 4) {
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if (_local6.status == CPeon.STARTAREA) {
_local6.targetSquare = -1;
} else if (_local6.status == CPeon.FINALROUTE) {
_local6.targetSquare = -1;
} else if ((_local6.status != CPeon.VICTORY) && (_local6.oldSquare < 500)) {
_root.hasMove = 1;
var _local5 = (_local6.oldSquare + 1) % _root.squares.length;
while (_root.squares[_local5].type != CPeon.STAR) {
_local5 = (_local5 + 1) % _root.squares.length;
}
_local6.middleSquare = _local5;
if (_root.squares[_local5].player == id) {
_local6.targetSquare = 506;
} else {
_local5 = (_local5 + 1) % _root.squares.length;
while (_root.squares[_local5].type != CPeon.STAR) {
_local5 = (_local5 + 1) % _root.squares.length;
}
_local6.targetSquare = _local5;
}
}
_local11++;
}
}
_root.players[(id + 1) % 4].myTime();
} else {
if (type == CPU) {
var _local7 = new Array(4);
var _local3 = new Array(4);
var _local4 = new Array(4);
var _local11 = 0;
while (_local11 < 4) {
_local7[_local11] = 0;
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if ((_local6.status == CPeon.STARTAREA) || (_local6.status == CPeon.VICTORY)) {
_local7[_local11] = DECISION_NULL;
_local3[_local11] = -1;
_local4[_local11] = -1;
} else if (_local6.status == CPeon.FINALROUTE) {
_local3[_local11] = -1;
_local4[_local11] = Math.max(_local6.oldSquare, 500) + diceValue;
_local7[_local11] = ((_local4[_local11] == 506) ? DECISION_WIN : ((DECISION_MOVE + _local4[_local11]) - _local6.oldSquare));
} else {
var _local8 = diceValue;
var _local9 = 0;
_local3[_local11] = _local6.oldSquare;
while (_local8 > 0) {
if ((_root.squares[_local3[_local11]].type == CPeon.STAR) && (_root.squares[_local3[_local11]].player == id)) {
_local7[_local11] = DECISION_SECURE;
_local3[_local11] = -1;
_local4[_local11] = 500 + _local8;
break;
}
_local3[_local11] = (_local3[_local11] + 1) % _root.squares.length;
_local9++;
_local8--;
}
if (_local7[_local11] == 0) {
if (_root.squares[_local3[_local11]].type == CPeon.STAR) {
if (_root.squares[_local3[_local11]].player == id) {
_local7[_local11] = DECISION_WIN;
_local4[_local11] = 506;
} else {
_local4[_local11] = (_local3[_local11] + 1) % _root.squares.length;
while (_root.squares[_local4[_local11]].type != CPeon.STAR) {
_local4[_local11] = (_local4[_local11] + 1) % _root.squares.length;
_local9++;
}
_local7[_local11] = DECISION_MOVE + _local9;
}
} else {
_local7[_local11] = DECISION_MOVE + _local9;
_local4[_local11] = _local3[_local11];
_local3[_local11] = -1;
}
}
if ((((_local3[_local11] > -1) && (_local3[_local11] < 501)) && (_root.squares[_local3[_local11]].peons.length > 0)) && (_root.squares[_local3[_local11]].peons[0].ownerId != _local6.ownerId)) {
if (((_root.squares[_local3[_local11]].type == CPeon.GLOBE) && (_root.squares[_local3[_local11]].player != _local6.ownerId)) || ((_root.squares[_local3[_local11]].type != CPeon.GLOBE) && (_root.squares[_local3[_local11]].peons.length > 1))) {
_local7[_local11] = DECISION_SACRIFICE;
} else {
_local7[_local11] = DECISION_EXPULSE;
}
}
if (((((_local7[_local11] != DECISION_SACRIFICE) && (_local4[_local11] > -1)) && (_local4[_local11] < 501)) && (_root.squares[_local4[_local11]].peons.length > 0)) && (_root.squares[_local4[_local11]].peons[0].ownerId != _local6.ownerId)) {
if (((_root.squares[_local4[_local11]].type == CPeon.GLOBE) && (_root.squares[_local4[_local11]].player != _local6.ownerId)) || ((_root.squares[_local4[_local11]].type != CPeon.GLOBE) && (_root.squares[_local4[_local11]].peons.length > 1))) {
_local7[_local11] = DECISION_SACRIFICE;
} else {
_local7[_local11] = DECISION_EXPULSE;
}
}
}
_local11++;
}
var _local13 = 0;
var _local12 = -1;
_local11 = 0;
while (_local11 < 4) {
if (_local7[_local11] > _local13) {
_local13 = _local7[_local11];
_local12 = _local11;
}
_local11++;
}
if (_local12 > -1) {
_root[(("peon" + id) + "_") + _local12].middleSquare = _local3[_local12];
_root[(("peon" + id) + "_") + _local12].targetSquare = _local4[_local12];
_root.hasMove = 1;
_root[(("peon" + id) + "_") + _local12].moveTo(_local4[_local12]);
}
} else if (type == HUMAN) {
_root.hasMove = 0;
var _local11 = 0;
while (_local11 < 4) {
var _local6 = _root[(("peon" + id) + "_") + _local11];
_local6.middleSquare = -1;
if ((_local6.status == CPeon.STARTAREA) || (_local6.status == CPeon.VICTORY)) {
_local6.targetSquare = -1;
} else if (_local6.status == CPeon.FINALROUTE) {
_root.hasMove = 1;
_local6.targetSquare = Math.max(_local6.oldSquare, 500) + diceValue;
} else {
_root.hasMove = 1;
var _local8 = diceValue;
var _local5 = _local6.oldSquare;
_local6.targetSquare = -1;
while (_local8 > 0) {
if ((_root.squares[_local5].type == CPeon.STAR) && (_root.squares[_local5].player == id)) {
_local6.targetSquare = 500 + _local8;
break;
}
_local5 = (_local5 + 1) % _root.squares.length;
_local8--;
}
if (_local6.targetSquare == -1) {
if (_root.squares[_local5].type == CPeon.STAR) {
_local6.middleSquare = _local5;
if (_root.squares[_local5].player == id) {
_local6.targetSquare = 506;
} else {
_local5 = (_local5 + 1) % _root.squares.length;
while (_root.squares[_local5].type != CPeon.STAR) {
_local5 = (_local5 + 1) % _root.squares.length;
}
_local6.targetSquare = _local5;
}
} else {
_local6.targetSquare = _local5;
}
}
}
_local11++;
}
}
if (diceValue == 6) {
askRollDice();
} else {
_root.players[(id + 1) % 4].myTime();
}
}
}
function goInitialToHome() {
var _local4 = 0;
while (_local4 < 4) {
var _local3 = _root[(("peon" + id) + "_") + _local4];
_local3.counter++;
if (_local3.counter >= 0) {
_local3._xscale = _local3._xscale + 2;
_local3._yscale = _local3._yscale + 2;
var _local6 = home[_local4]._x - _local3._x;
var _local5 = home[_local4]._y - _local3._y;
var _local9 = 5;
var _local8 = (_local9 * _local6) / Math.sqrt((_local6 * _local6) + (_local5 * _local5));
var _local7 = (_local9 * _local5) / Math.sqrt((_local6 * _local6) + (_local5 * _local5));
_local3._x = _local3._x + _local8;
_local3._y = _local3._y + _local7;
_local8 = home[_local4]._x - _local3._x;
_local7 = home[_local4]._y - _local3._y;
if (((_local6 * _local6) + (_local5 * _local5)) <= ((_local8 * _local8) + (_local7 * _local7))) {
_local3._xscale = 100;
_local3._yscale = 100;
_local3._x = home[_local4]._x;
_local3._y = home[_local4]._y;
_local3.counter = Number.NEGATIVE_INFINITY;
peonsMoving--;
if (peonsMoving <= 0) {
clearInterval(iGoInitialToHome);
iGoInitialToHome = -1;
if (id == _root.firstPlayer) {
if ((id == _root.indexPlayer) && (_root.isSound)) {
_root.sounds.yourturn.start();
}
myTime();
}
}
}
}
_local4++;
}
}
static var HUMAN = 1;
static var CPU = 2;
var type = 0;
var id = -1;
var launches = 0;
var diceValue = 0;
var iGoInitialToHome = -1;
var peonsMoving = -1;
var initialGlobe = -1;
var finalStar = -1;
var DECISION_WIN = 5000;
var DECISION_FINAL = 4000;
var DECISION_START = 3000;
var DECISION_SECURE = 2000;
var DECISION_EXPULSE = 1000;
var DECISION_MOVE = 100;
var DECISION_SACRIFICE = 1;
var DECISION_NULL = -1;
}
Symbol 361 MovieClip [__Packages.SmbAreaRolagem] Frame 0
class SmbAreaRolagem extends MovieClip
{
var items, _yscale, mcRolagem, _xscale, area, mascara, onEnterFrame;
function SmbAreaRolagem () {
super();
items = new Array();
mcRolagem._yscale = (100 * mcRolagem._yscale) / _yscale;
mcRolagem._xscale = (100 * mcRolagem._xscale) / _xscale;
area._yscale = (100 * area._yscale) / _yscale;
area._xscale = (100 * area._xscale) / _xscale;
mcRolagem.btnBaixo._y = (mascara._height * _yscale) / 100;
onEnterFrame = function () {
if (this.area._height > this.mascara._height) {
this.mcRolagem._visible = true;
}
};
}
function removeAll() {
trace("\n\n\n\nremoveAll in SmbAreaRolagem");
for (var _local2 in items) {
items[_local2].removeMovieClip();
}
items = new Array();
trace("N\u00FAmero de elementos " + items.length);
}
function getLength() {
return(items.length);
}
function getItemAt(index) {
return(items[index]);
}
function sortItemsBy(dado, tipo) {
}
function removeItemAt(index) {
items[index].removeMovieClip();
items[index] = undefined;
}
function replaceItemAt(index, dados) {
items[index].setData(dados);
}
function addItem(simbolo, dados) {
var _local3 = 0;
if (items.length) {
_local3 = items.length * items[0]._height;
}
var _local2 = area.attachMovie(simbolo, "item" + items.length, items.length);
trace("Item \u00E9 -> " + _local2);
items.push(_local2);
_local2._y = _local3;
_local2.setData(dados);
}
function clearSelection() {
}
}
Symbol 46 MovieClip Frame 1
onRelease = function () {
getURL (this.url, "_blank");
};
Symbol 51 Button
on (release) {
gotoAndStop ("ranking");
}
Symbol 56 Button
on (release) {
indexPlayer = 3;
color = "r";
gotoAndStop ("inGame");
}
Symbol 61 Button
on (release) {
indexPlayer = 0;
color = "b";
gotoAndStop ("inGame");
}
Symbol 66 Button
on (release) {
indexPlayer = 1;
color = "y";
gotoAndStop ("inGame");
}
Symbol 71 Button
on (release) {
indexPlayer = 2;
color = "g";
gotoAndStop ("inGame");
}
Symbol 253 MovieClip Frame 1
function rollDice() {
trace("_root.hasMove -> " + _root.hasMove);
if (((!_root.isReady) || (_root.hasMove > 0)) || (_root.onEnterFrame != undefined)) {
return(undefined);
}
_root.hasMove = 0;
if (_root.isSound) {
_root.sounds.roll.start();
}
clearInterval(iRollDice);
iRollDice = -1;
_root.mcCurrPlayer.gotoAndStop("_" + rollPlayer);
_root.btnRoll._visible = false;
if (idPlayer != rollPlayer) {
_root.players[rollPlayer].inHome = true;
var _local2 = 0;
while (_local2 < 4) {
var _local3 = _root[(("peon" + rollPlayer) + "_") + _local2];
if ((_local3.status != CPeon.STARTAREA) && (_local3.status != CPeon.VICTORY)) {
_root.players[rollPlayer].inHome = false;
}
_local2++;
}
}
idPlayer = rollPlayer;
value = Math.floor((Math.random() * 6) + 1);
if (value == 5) {
_root.players[idPlayer].globes++;
}
if (value == 6) {
_root.players[idPlayer].sixes++;
}
if (idPlayer == _root.indexPlayer) {
if ((_root.players[idPlayer].globes >= 3) && (value == 5)) {
_root.changeScore(_root.mcCurrPlayer, 20, _root.SCORE_GLOBE);
} else if ((_root.players[idPlayer].sixes >= 3) && (value == 6)) {
_root.changeScore(_root.mcCurrPlayer, 20, _root.SCORE_SIX);
}
}
gotoAndPlay("value" + value);
}
function checkDiceValue() {
_root.players[idPlayer].receivesDiceValue(value);
stop();
}
function advanceFrame() {
if (_root.mcSpeedButton.status == "on") {
gotoAndPlay(_currentframe + 1);
}
}
stop();
if (!loaded) {
value = -1;
idPlayer = -1;
iRollDice = -1;
rollPlayer = -1;
loaded = true;
}
Symbol 253 MovieClip Frame 16
advanceFrame();
Symbol 253 MovieClip Frame 18
advanceFrame();
Symbol 253 MovieClip Frame 20
advanceFrame();
Symbol 253 MovieClip Frame 22
advanceFrame();
Symbol 253 MovieClip Frame 24
advanceFrame();
Symbol 253 MovieClip Frame 26
advanceFrame();
Symbol 253 MovieClip Frame 28
advanceFrame();
Symbol 253 MovieClip Frame 30
advanceFrame();
Symbol 253 MovieClip Frame 32
advanceFrame();
Symbol 253 MovieClip Frame 34
advanceFrame();
Symbol 253 MovieClip Frame 36
advanceFrame();
Symbol 253 MovieClip Frame 38
advanceFrame();
Symbol 253 MovieClip Frame 40
advanceFrame();
Symbol 253 MovieClip Frame 42
advanceFrame();
Symbol 253 MovieClip Frame 46
checkDiceValue();
Symbol 253 MovieClip Frame 48
advanceFrame();
Symbol 253 MovieClip Frame 50
advanceFrame();
Symbol 253 MovieClip Frame 52
advanceFrame();
Symbol 253 MovieClip Frame 54
advanceFrame();
Symbol 253 MovieClip Frame 56
advanceFrame();
Symbol 253 MovieClip Frame 58
advanceFrame();
Symbol 253 MovieClip Frame 60
advanceFrame();
Symbol 253 MovieClip Frame 62
advanceFrame();
Symbol 253 MovieClip Frame 64
advanceFrame();
Symbol 253 MovieClip Frame 66
advanceFrame();
Symbol 253 MovieClip Frame 68
advanceFrame();
Symbol 253 MovieClip Frame 70
advanceFrame();
Symbol 253 MovieClip Frame 72
advanceFrame();
Symbol 253 MovieClip Frame 74
advanceFrame();
Symbol 253 MovieClip Frame 78
checkDiceValue();
Symbol 253 MovieClip Frame 80
advanceFrame();
Symbol 253 MovieClip Frame 82
advanceFrame();
Symbol 253 MovieClip Frame 84
advanceFrame();
Symbol 253 MovieClip Frame 86
advanceFrame();
Symbol 253 MovieClip Frame 88
advanceFrame();
Symbol 253 MovieClip Frame 90
advanceFrame();
Symbol 253 MovieClip Frame 92
advanceFrame();
Symbol 253 MovieClip Frame 94
advanceFrame();
Symbol 253 MovieClip Frame 96
advanceFrame();
Symbol 253 MovieClip Frame 98
advanceFrame();
Symbol 253 MovieClip Frame 100
advanceFrame();
Symbol 253 MovieClip Frame 102
advanceFrame();
Symbol 253 MovieClip Frame 104
advanceFrame();
Symbol 253 MovieClip Frame 106
advanceFrame();
Symbol 253 MovieClip Frame 110
checkDiceValue();
Symbol 253 MovieClip Frame 112
advanceFrame();
Symbol 253 MovieClip Frame 114
advanceFrame();
Symbol 253 MovieClip Frame 116
advanceFrame();
Symbol 253 MovieClip Frame 118
advanceFrame();
Symbol 253 MovieClip Frame 120
advanceFrame();
Symbol 253 MovieClip Frame 122
advanceFrame();
Symbol 253 MovieClip Frame 124
advanceFrame();
Symbol 253 MovieClip Frame 126
advanceFrame();
Symbol 253 MovieClip Frame 128
advanceFrame();
Symbol 253 MovieClip Frame 130
advanceFrame();
Symbol 253 MovieClip Frame 132
advanceFrame();
Symbol 253 MovieClip Frame 134
advanceFrame();
Symbol 253 MovieClip Frame 136
advanceFrame();
Symbol 253 MovieClip Frame 138
advanceFrame();
Symbol 253 MovieClip Frame 142
checkDiceValue();
Symbol 253 MovieClip Frame 144
advanceFrame();
Symbol 253 MovieClip Frame 146
advanceFrame();
Symbol 253 MovieClip Frame 148
advanceFrame();
Symbol 253 MovieClip Frame 150
advanceFrame();
Symbol 253 MovieClip Frame 152
advanceFrame();
Symbol 253 MovieClip Frame 154
advanceFrame();
Symbol 253 MovieClip Frame 156
advanceFrame();
Symbol 253 MovieClip Frame 158
advanceFrame();
Symbol 253 MovieClip Frame 160
advanceFrame();
Symbol 253 MovieClip Frame 162
advanceFrame();
Symbol 253 MovieClip Frame 164
advanceFrame();
Symbol 253 MovieClip Frame 166
advanceFrame();
Symbol 253 MovieClip Frame 168
advanceFrame();
Symbol 253 MovieClip Frame 170
advanceFrame();
Symbol 253 MovieClip Frame 174
checkDiceValue();
Symbol 253 MovieClip Frame 176
advanceFrame();
Symbol 253 MovieClip Frame 178
advanceFrame();
Symbol 253 MovieClip Frame 180
advanceFrame();
Symbol 253 MovieClip Frame 182
advanceFrame();
Symbol 253 MovieClip Frame 184
advanceFrame();
Symbol 253 MovieClip Frame 186
advanceFrame();
Symbol 253 MovieClip Frame 188
advanceFrame();
Symbol 253 MovieClip Frame 190
advanceFrame();
Symbol 253 MovieClip Frame 192
advanceFrame();
Symbol 253 MovieClip Frame 194
advanceFrame();
Symbol 253 MovieClip Frame 196
advanceFrame();
Symbol 253 MovieClip Frame 198
advanceFrame();
Symbol 253 MovieClip Frame 200
advanceFrame();
Symbol 253 MovieClip Frame 202
advanceFrame();
Symbol 253 MovieClip Frame 206
checkDiceValue();
Symbol 258 MovieClip Frame 1
stop();
Symbol 261 Button
on (release) {
mcDice.rollDice(indexPlayer);
}
Symbol 264 Button
on (release) {
if (_root.isReady) {
_root.btnAutoOn._visible = true;
_root.btnAutoOff._visible = false;
if (_root.btnRoll._visible && (_root.mcDice.iRollDice == -1)) {
_root.mcDice.iRollDice = setInterval(_root.mcDice, "rollDice", _root.TIMETOROLL, _root.indexPlayer);
_root.mcDice.rollDice(_root.indexPlayer);
}
}
}
Symbol 266 MovieClip [MvcPeonBlue] Frame 1
#initclip 10
Object.registerClass("MvcPeonBlue", CPeon);
#endinitclip
Symbol 268 MovieClip [MvcPeonYellow] Frame 1
#initclip 7
Object.registerClass("MvcPeonYellow", CPeon);
#endinitclip
Symbol 270 MovieClip [MvcPeonGreen] Frame 1
#initclip 8
Object.registerClass("MvcPeonGreen", CPeon);
#endinitclip
Symbol 272 MovieClip [MvcPeonRed] Frame 1
#initclip 9
Object.registerClass("MvcPeonRed", CPeon);
#endinitclip
Symbol 281 MovieClip Frame 1
stop();
status = "off";
onRollOver = function () {
gotoAndStop("rollOver_" + status);
};
onRollOut = (onReleaseOutside = function () {
gotoAndStop(status);
});
onRelease = function () {
if (status == "on") {
status = "off";
} else {
status = "on";
}
gotoAndStop(status);
};
Symbol 298 MovieClip Frame 1
stop();
if (_root.isSound) {
status = "on";
} else {
status = "off";
}
gotoAndStop(status);
onRollOver = function () {
gotoAndStop("rollOver_" + status);
};
onRollOut = (onReleaseOutside = function () {
gotoAndStop(status);
});
onRelease = function () {
_root.isSound = !_root.isSound;
if (_root.isSound) {
status = "on";
} else {
status = "off";
}
gotoAndStop(status);
};
Symbol 304 Button
on (release) {
_root.btnAutoOn._visible = false;
_root.btnAutoOff._visible = true;
if (_root.mcDice.rollPlayer == _root.indexPlayer) {
_root.btnRoll._visible = true;
clearInterval(_root.mcDice.iRollDice);
_root.mcDice.iRollDice = -1;
}
}
Symbol 320 Button
on (release) {
gotoAndStop ("mainMenu");
}
Symbol 331 Button
on (press) {
direcao = 1;
}
on (release) {
direcao = 0;
}
Symbol 334 MovieClip Frame 1
dragged = false;
onPress = function () {
fixY = _parent._ymouse - _y;
dragged = true;
};
onRelease = function () {
dragged = false;
};
onReleaseOutside = function () {
dragged = false;
};
onMouseMove = function () {
if (dragged) {
_y = Math.min(Math.max(_parent._ymouse - fixY, _parent.btnCima._y + _parent.btnCima._height), (_parent.btnBaixo._y - this._height) - _parent.btnBaixo._height);
hMenor = _y - _parent.limTopo;
_parent._parent.area._y = _parent._parent.mascara._y - ((hMenor * _parent.aMenor) / _parent.hMaior);
}
};
Symbol 339 Button
on (press) {
direcao = -1;
}
on (release) {
direcao = 0;
}
Symbol 340 MovieClip Frame 1
btnBarra._y = btnCima._y + btnCima._height;
_visible = false;
fundoBarra._height = btnBaixo._y;
direcao = 0;
velRolagem = 15;
onEnterFrame = function () {
limiteTop = _parent.mascara._y;
limiteBottom = _parent.mascara._y - (_parent.area._height - _parent.mascara._height);
limTopo = btnCima._y + btnCima._height;
limFundo = btnBaixo._y - btnBaixo._height;
hMaior = (limFundo - btnBarra._height) - (btnCima._y + btnCima._height);
aMenor = _parent.area._height - _parent.mascara._height;
if ((_parent.area._y < limiteTop) && (direcao == -1)) {
_parent.area._y = _parent.area._y + velRolagem;
if (_parent.area._y > limiteTop) {
_parent.area._y = limiteTop;
}
}
if ((_parent.area._y > limiteBottom) && (direcao == 1)) {
_parent.area._y = _parent.area._y - velRolagem;
if (_parent.area._y < limiteBottom) {
_parent.area._y = limiteBottom;
}
}
btnBarra._y = (_parent.mascara._y + limTopo) - ((_parent.area._y * hMaior) / aMenor);
};
Symbol 341 MovieClip [SmbAreaRolagem] Frame 1
#initclip 11
Object.registerClass("SmbAreaRolagem", SmbAreaRolagem);
#endinitclip
Instance of Symbol 322 MovieClip "area" in Symbol 341 MovieClip [SmbAreaRolagem] Frame 1
onClipEvent (load) {
this.setMask(_parent.mascara);
}
Symbol 345 Button
on (release) {
totalScore = totalScore + ((score + wonBonus) + speedBonus);
score = 0;
wonBonus = 0;
speedBonus = 0;
myScore.sendScorePlayer(rounds, totalScore, TxtUsername.text);
if (TxtUsername.text.length > 0) {
gotoAndStop ("place");
} else {
gotoAndStop ("mainMenu");
}
}
Symbol 355 Button
on (release) {
gotoAndStop ("mainMenu");
}