Frame 1
function CleanName(nm) {
nm = com.gamebrew.Common.StringTrim(nm);
nm = com.gamebrew.Common.StringTrimChar(nm, "_");
nm = com.gamebrew.Common.StringReplace(nm, "__", "_");
var _local3 = "";
var _local4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
var _local1 = 0;
while (_local1 < nm.length) {
if (com.gamebrew.Common.StringContains(_local4, nm.charAt(_local1))) {
_local3 = _local3 + nm.charAt(_local1);
}
_local1++;
}
_local3 = com.gamebrew.Common.StringTrim(_local3);
if (_local3.length == 0) {
_local3 = "Guest";
}
return(_local3);
}
function AttachFooter(game_title, game_version, url, email_url, d) {
if (_root.mc_footer != null) {
return(undefined);
}
_root.attachMovie("mc_footer", "mc_footer", com.gamebrew.Common.MovieGetNextDepthAt(_root, d));
_root.mc_footer._x = 0;
_root.mc_footer._y = Stage.height - 16;
_root.mc_footer.msg = ((((game_title + " v") + game_version) + " (c) ") + new Date().getFullYear()) + " <FONT COLOR='#FFFF00'>gamebrew.com</FONT> - created by t.suriyathep";
_root.mc_footer.url = url;
_root.mc_footer.email_url = email_url;
}
function MovieRemoveAllExceptFooter() {
com.gamebrew.Common.MovieRemoveAllExcept(_root, new Array("mc_fader", "mc_footer"));
}
function ShowTooltip(txt, mcp, px, py) {
if ((txt == "") || (txt == null)) {
return(undefined);
}
if (_root.mc_tooltip != undefined) {
_root.mc_tooltip.removeMovieClip();
}
var _local2 = {x:0, y:0};
mcp.localToGlobal(_local2);
mc = _root.attachMovie("mc_tooltip", "mc_tooltip", _root.getNextHighestDepth());
mc._x = (_root._xmouse + 2) + px;
mc._y = (_root._ymouse - 16) + py;
mc.new_text = txt;
mc.frames = 0;
mc.owner = mcp;
return(mc);
}
function ClearTooltip(mcp) {
if (mcp == null) {
_root.mc_tooltip.removeMovieClip();
return(undefined);
}
if (_root.mc_tooltip != undefined) {
if (_root.mc_tooltip.owner == mcp) {
_root.mc_tooltip.removeMovieClip();
}
}
}
function ButtonOver() {
this.is_over = true;
}
function ButtonOut() {
this.is_over = false;
}
function ButtonPress() {
this.is_pressed = true;
}
function ButtonRelease() {
this.is_pressed = false;
}
function ButtonReleaseOutside() {
this.is_pressed = false;
this.is_over = false;
}
function ButtonDisable(mc) {
delete mc.onRollOver;
delete mc.onRollOut;
delete mc.onPress;
delete mc.onRelease;
delete mc.onReleaseOutside;
delete mc.onEnterFrame;
mc.is_over = false;
mc.is_pressed = false;
}
function ButtonRollOver(mc, tooltip) {
if ((tooltip != null) || (tooltip != undefined)) {
mc.txt_tooltip = tooltip;
_root.ShowTooltip(mc.txt_tooltip, mc, 0, 0);
}
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 64, 64, 64, 0);
}
function ButtonRollOut(mc) {
_root.ClearTooltip(mc);
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
}
function EnterFrameRoll(mc, txt) {
if (mc.is_over == true) {
var _local2 = mc.transform.colorTransform.redOffset;
if (_local2 < 64) {
_local2 = _local2 + 32;
if (_local2 >= 64) {
_local2 = 64;
_root.ShowTooltip(txt, mc, 0, 0);
}
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local2, _local2, _local2, 0);
}
} else {
var _local2 = mc.transform.colorTransform.redOffset;
if (_local2 > 0) {
_local2 = _local2 - 16;
if (_local2 <= 0) {
_local2 = 0;
_root.ClearTooltip(mc);
}
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local2, _local2, _local2, 0);
}
}
}
function FadeOutIn(colin, colout, callfunc) {
var _local5 = com.gamebrew.Common.MovieGetNextDepthAt(_root, 40000);
var _local3 = _root.createEmptyMovieClip("mc_fader", _local5);
_local3.callfunc = callfunc;
_local3.colout = colout;
_local3._x = 0;
_local3._y = 0;
_local3.clear();
_local3.beginFill(colin);
_local3.moveTo(0, 0);
_local3.lineTo(_root.GB_GAME_WIDTH, 0);
_local3.lineTo(_root.GB_GAME_WIDTH, _root.GB_GAME_HEIGHT);
_local3.lineTo(0, _root.GB_GAME_HEIGHT);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._alpha = 0;
delete _root.onMouseUp;
delete _root.onMouseDown;
delete _root.onMouseMove;
_local3.onEnterFrame = function () {
var _local3 = this._alpha + 20;
if (_local3 > 100) {
com.gamebrew.Common.MovieRemoveAllExcept(_root, new Array("mc_fader", "mc_footer"));
this.callfunc();
this._alpha = 100;
delete this.onEnterFrame;
this.clear();
this.beginFill(this.colout);
this.moveTo(0, 0);
this.lineTo(_root.GB_GAME_WIDTH, 0);
this.lineTo(_root.GB_GAME_WIDTH, _root.GB_GAME_HEIGHT);
this.lineTo(0, _root.GB_GAME_HEIGHT);
this.lineTo(0, 0);
this.endFill();
this.onEnterFrame = function () {
var _local2 = this._alpha - 20;
if (_local2 < 0) {
this._alpha = 0;
delete this.onEnterFrame;
this.removeMovieClip();
} else {
this._alpha = _local2;
}
};
} else {
this._alpha = _local3;
}
};
}
function OpenWindow(win) {
if (_root.mc_win_fader == null) {
mc = _root.attachMovie("mc_fader", "mc_win_fader", com.gamebrew.Common.MovieGetNextDepthAt(_root, GB_POPUP_DEPTH));
mc._x = 0;
mc._y = 0;
mc._alpha = 50;
}
_root.mc_win.removeMovieClip();
mc = _root.attachMovie(win, "mc_win", com.gamebrew.Common.MovieGetNextDepthAt(_root, GB_POPUP_DEPTH));
mc._x = (GB_GAME_WIDTH / 2) - (mc._width / 2);
mc._y = (GB_GAME_HEIGHT / 2) - (mc._height / 2);
return(mc);
}
function CloseWindow() {
_root.mc_win_fader.removeMovieClip();
_root.mc_win.removeMovieClip();
}
_root.GB_URL = "http://www.gamebrew.com/";
cmif = function () {
getURL (_root.GB_URL, "_blank");
};
cm = new ContextMenu();
cm.hideBuiltInItems();
cmi = new ContextMenuItem("Visit Gamebrew.com", cmif);
cm.customItems.push(cmi);
_root.menu = cm;
function ErrorLog(str) {
_root.txt_error.text = _root.txt_error.text + (str + newline);
}
function GotoMenu() {
MovieRemoveAllExceptFooter();
gotoAndPlay (114);
return(undefined);
}
function GotoAfterInit() {
if (GB_DEBUG == false) {
gotoAndPlay (27);
} else {
gotoAndPlay (114);
}
}
function LoadCookie() {
var _local2 = new LoadVars();
_local2.decode(com.gamebrew.Common.GetCookie(_root.GB_GAME_SHORT, "player", "&nm=Guest&col=0&tm="));
_root.gb_name = _local2.nm;
_root.color_id = _local2.col;
_root.gb_team = _local2.tm;
}
function SaveCookie() {
com.gamebrew.Common.SetCookie(_root.GB_GAME_SHORT, "player", (((("&nm=" + _root.gb_name) + "&col=") + _root.color_id) + "&tm=") + _root.gb_team);
}
_root.GB_DEBUG = false;
_root.kongregateServices.connect();
var host = com.gamebrew.Common.GetHost();
var _mochiads_game_id = "852201f3d3288f97";
stop();
var SERVER_IP = "live.gamebrew.com";
var SERVER_PORT = 9339;
var SERVER_VERSION = 2;
var SERVER_ZONE = "Artillery";
var SERVER_EXT = "artillery";
var sfs = (new it.gotoandplay.smartfoxserver.SmartFoxClient());
sfs.debug = GB_DEBUG;
_root.KONG_GAME_ID = 2390;
_root.KONG_SCORE_URL_1P = "http://kongregate.com/high_scores?game_id=" + _root.KONG_GAME_ID;
_root.KONG_SCORE_URL_LIVE = ("http://kongregate.com/high_scores?game_id=" + _root.KONG_GAME_ID) + "&statistic_id=1913&commit=Submit";
_root.GB_GAME_TITLE = "Artillery Live";
_root.GB_GAME_ID = 3503;
_root.GB_GAME_SHORT = "artillery-live";
_root.GB_GAME_WIDTH = 720;
_root.GB_GAME_HEIGHT = 560;
_root.GB_BLOG_URL = _root.GB_URL + "games/blogs/artillery/";
_root.GB_CONTACT_URL = _root.GB_URL + "games/blogs/artillery/contact.php";
_root.GB_SCORE_CGI = _root.GB_URL + "process/score.php";
_root.GB_SCORE_URL = ((_root.GB_URL + "game/") + _root.GB_GAME_SHORT) + "/scores";
_root.GB_PLAY_URL = ((_root.GB_URL + "game/") + _root.GB_GAME_SHORT) + "/play";
_root.GB_GAME_VERSION = "3.38";
_root.GB_GAME_DEPTH = 100;
_root.GB_POPUP_DEPTH = 300;
LoadCookie();
qs = com.gamebrew.Common.GetQueryString();
_root.gb_pw = null;
_root.gb_name_locked = false;
if (_root.kongregate_username != null) {
_root.gb_name = com.gamebrew.Common.StringTrim(_root.kongregate_username);
} else if (qs.nm != null) {
_root.gb_name = com.gamebrew.Common.StringTrim(qs.nm);
_root.gb_pw = com.gamebrew.Common.StringTrim(qs.pw);
_root.gb_name_locked = true;
SaveCookie();
}
if ((_root.gb_name == null) || (_root.gb_name == "")) {
_root.gb_name = "Guest";
}
ErrorLog((((_root.GB_GAME_TITLE + " v") + _root.GB_GAME_VERSION) + " z") + _root.GB_ZONE_VERSION);
ErrorLog("Copyright 2008 Gamebrew Inc.");
ErrorLog(("SWF hosted at [" + com.gamebrew.Common.GetHost()) + "]");
AttachFooter(_root.GB_GAME_TITLE, _root.GB_GAME_VERSION, _root.GB_URL, _root.GB_CONTACT_URL, _root.GB_POPUP_DEPTH);
var show_ads = true;
var host = com.gamebrew.Common.GetHost();
if (((((host == "armorgames.com") || (host == "kongregate.com")) || (host == "chat.kongregate.com")) || (host == "andkon.com")) || (host == "addictinggames.com")) {
show_ads = false;
}
if (show_ads == true) {
MochiAd.showPreGameAd({id:"852201f3d3288f97", res:"720x560"});
} else {
_root.attachMovie("mc_preloader", "mc_preloader", _root.getNextHighestDepth());
_root.mc_preloader._x = _root.GB_GAME_WIDTH / 2;
_root.mc_preloader._y = ((_root.GB_GAME_HEIGHT / 2) - (_root.mc_preloader._height / 2)) - 16;
}
Frame 3
var total_bytes = _root.getBytesTotal();
var bytes_loaded = _root.getBytesLoaded();
var pct = int((bytes_loaded / total_bytes) * 100);
if (pct < 100) {
gotoAndPlay (2);
} else {
gotoAndPlay ("pause?");
}
Frame 9
ErrorLog("END");
Frame 11
if (Key.isDown(16)) {
txt_error.textColor = 16777215 /* 0xFFFFFF */;
gotoAndPlay(_currentframe - 1);
}
Frame 16
_root.gotoAndPlay("done");
_root.game_type = 0;
_root.COLOR_NAME = ["Green", "Forest", "Blue", "Red", "Desert"];
_root.COLOR_FILTER = [null, [new flash.filters.ColorMatrixFilter([0.33, 0.33, 0.33, 0, 32, 0.33, 0.33, 0.33, 0, 64, 0.33, 0.33, 0.33, 0, -16, 0, 0, 0, 1, 0])], [new flash.filters.ColorMatrixFilter([0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 128, 0, 0, 0, 1, 0])], [new flash.filters.ColorMatrixFilter([0.33, 0.33, 0.33, 0, 128, 0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0, 0, 0, 1, 0])], [new flash.filters.ColorMatrixFilter([0.33, 0.33, 0.33, 0, 96, 0.33, 0.33, 0.33, 0, 64, 0.33, 0.33, 0.33, 0, 32, 0, 0, 0, 1, 0])]];
_root.GLOW_FILTER = new Array(new flash.filters.GlowFilter(16776960, 0.9, 3, 3, 3, 3, false, false));
Frame 21
stop();
FadeOutIn(0, 0, _root.GotoAfterInit);
Frame 27
var mouse_listener = new Object();
mouse_listener.onMouseUp = function () {
delete this.onMouseUp;
if (_root._ymouse >= 560) {
return(undefined);
}
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(_root.GB_URL, "_blank");
};
Mouse.addListener(mouse_listener);
Frame 113
stop();
Mouse.removeListener(mouse_listener);
delete mouse_listener;
FadeOutIn(0, 0, _root.GotoMenu);
Frame 114
com.gamebrew.Common.MusicStop();
_root.onMouseUp = function () {
if (_root._ymouse >= GB_GAME_HEIGHT) {
return(undefined);
}
_root.gotoAndStop("menu");
};
var key_listener = new Object();
key_listener.onKeyUp = function () {
_root.gotoAndStop("menu");
};
Key.addListener(key_listener);
Frame 131
com.gamebrew.Common.SoundPlay("zap.wav");
Frame 137
function EnableColors() {
i = 0;
while (i <= 4) {
var _local3 = _root["mc_color_" + i];
_local3.gotoAndStop(i + 1);
_local3.color_id = i;
if (_root.color_id == i) {
_local3.filters = _root.GLOW_FILTER;
} else {
_local3.filters = null;
}
_local3.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
_local3.onRollOver = function () {
_root.ButtonRollOver(this, _root.COLOR_NAME[this.color_id]);
};
_local3.onRollOut = function () {
_root.ButtonRollOut(this);
};
_local3.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.color_id = this.color_id;
_root.EnableColors();
_root.ClearTooltip();
};
i++;
}
}
function DisableColors() {
i = 0;
while (i <= 4) {
var _local2 = _root["mc_color_" + i];
_root.ButtonDisable(_local2);
i++;
}
}
function UpdateServerStatus() {
clearInterval(server_timer);
sfs.onConnection = function (success) {
if (!success) {
_root.txt_server.text = "server unavailable";
clearInterval(_root.server_timer);
server_timer = setInterval(_root, "UpdateServerStatus", 60000);
} else {
_root.txt_server.text = "connected to server";
this.login(_root.SERVER_ZONE, "@public.info", null);
}
};
sfs.onExtensionResponse = function (obj, type) {
if (obj._cmd == "@public.info") {
_root.txt_server.text = ((obj.users + " players ") + obj.rooms) + " games";
this.disconnect();
clearInterval(_root.server_timer);
_root.server_timer = setInterval(_root, "UpdateServerStatus", 30000);
}
};
sfs.connect(SERVER_IP, SERVER_PORT);
_root.txt_server.text = "connecting to server";
}
function StopServerStatus() {
delete sfs.onConnection;
delete sfs.onExtensionResponse;
clearInterval(server_timer);
server_timer = null;
sfs.disconnect();
}
function EnableMainMenu() {
txt_name_listener = new Object();
txt_name_listener.field_path = _root.txt_name;
txt_name_listener.onKeyDown = function () {
if (Key.getAscii() == 13) {
if (Selection.getFocus() == String(this.field_path)) {
_root.mc_but_play.onRelease();
}
}
};
Key.addListener(txt_name_listener);
if (_root.gb_name_locked == true) {
com.gamebrew.Common.EnableTextField(txt_name, false);
} else {
com.gamebrew.Common.EnableTextField(txt_name, true);
}
mc_but_1p.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_1p.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_1p.onRelease = function () {
_root.DisableMainMenu();
com.gamebrew.Common.SoundPlay("click.wav");
com.gamebrew.Common.MusicStop();
delete this.onRelease;
if (_root.gb_name_locked == false) {
_root.gb_name = _root.CleanName(_root.txt_name.text);
_root.txt_name.text = _root.gb_name;
}
_root.SaveCookie();
_root.FadeOutIn(0, 0, _root.Goto1P);
delete this.onRelease;
};
mc_but_play.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_play.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_play.onRelease = function () {
_root.DisableMainMenu();
com.gamebrew.Common.SoundPlay("click.wav");
delete this.onRelease;
if (_root.gb_name_locked == false) {
_root.gb_name = _root.CleanName(_root.txt_name.text);
_root.txt_name.text = _root.gb_name;
}
_root.SaveCookie();
_root.mu_type = 0;
_root.OpenWindow("mc_win_connect");
};
mc_but_team.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_team.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_team.onRelease = function () {
_root.DisableMainMenu();
com.gamebrew.Common.SoundPlay("click.wav");
delete this.onRelease;
if (_root.gb_name_locked == false) {
_root.gb_name = _root.CleanName(_root.txt_name.text);
_root.txt_name.text = _root.gb_name;
}
_root.SaveCookie();
_root.mu_type = 1;
_root.OpenWindow("mc_win_connect");
};
mc_but_more.onRollOver = function () {
_root.ButtonRollOver(this, "");
};
mc_but_more.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_more.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(_root.GB_URL, "_blank");
};
mc_gb.onRollOver = function () {
_root.ButtonRollOver(this, "Click here for more games!");
};
mc_gb.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_gb.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL("http://www.gamebrew.com", "_blank");
};
mc_but_credits.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.DisableMainMenu();
_root.OpenWindow("mc_win_credits");
delete this.onRelease;
};
mc_but_webmasters.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.DisableMainMenu();
_root.OpenWindow("mc_win_webmasters");
delete this.onRelease;
};
mc_but_help.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.DisableMainMenu();
_root.OpenWindow("mc_win_help");
delete this.onRelease;
};
mc_but_blog.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(_root.GB_BLOG_URL, "_blank");
};
UpdateServerStatus();
EnableColors();
}
function DisableMainMenu() {
_root.ButtonDisable(mc_but_blog);
_root.ButtonDisable(mc_but_help);
_root.ButtonDisable(mc_but_credits);
_root.ButtonDisable(mc_but_webmasters);
_root.ButtonDisable(mc_gb);
_root.ButtonDisable(mc_but_more);
_root.ButtonDisable(mc_but_scores);
_root.ButtonDisable(mc_but_1p);
_root.ButtonDisable(mc_but_play);
_root.ButtonDisable(mc_but_team);
StopServerStatus();
DisableColors();
Key.removeListener(txt_name_listener);
_root.txt_name.selectable = false;
}
function Goto1P() {
game_type = 0;
com.gamebrew.Common.MusicStop();
delete _root.mc_fader.onEnterFrame;
MovieRemoveAllExceptFooter();
gotoAndPlay (143);
}
function GotoMu() {
game_type = 1;
com.gamebrew.Common.MusicStop();
delete _root.mc_fader.onEnterFrame;
MovieRemoveAllExceptFooter();
gotoAndPlay (143);
}
stop();
txt_name.text = _root.gb_name;
var mu_type = 0;
com.gamebrew.Common.MusicSet("music.wav");
com.gamebrew.Common.MusicPlay();
delete _root.onMouseUp;
Key.removeListener(key_listener);
server_timer = null;
txt_version.text = "v" + _root.GB_GAME_VERSION;
txt_name.restrict = "A-za-z0-9_";
EnableMainMenu();
Frame 143
function ResetChat() {
if (_root.chat_interval != null) {
clearInterval(_root.chat_interval);
}
mc_chat.Enable();
}
function ClickChat(txt) {
mc_chat.txt_input.text = "";
var _local2 = new Object();
_local2.msg = com.gamebrew.Common.StringTrim(txt);
_root.sfs.sendXtMessage(_root.SERVER_EXT, "chat", _local2, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
}
function AddChat(nm, team_id, txt) {
txt = ((((("<font color='" + _root.CHAT_COLORS[team_id]) + "'><b>") + nm) + "></b> ") + txt) + "</font>";
var _local2 = _root.txt_chat.htmlText;
var _local3 = _local2.split("</P>");
if (_local3.length > _root.CHAT_MAX_LINES) {
_local3 = _local3.splice(1);
_local2 = (_local3.join("</P>") + txt) + newline;
} else {
_local2 = _local2 + (txt + newline);
}
_root.txt_chat.htmlText = _local2;
_root.txt_chat.scroll = _root.txt_chat.maxscroll;
}
gotoAndPlay ("play");
_root.CHAT_COLORS = ["#666666", "#FF0000", "#0000FF", "#444444"];
_root.CHAT_DEFAULT = "type chat here then press enter ...";
_root.CHAT_MAX_LINES = 9;
_root.txt_chat.html = true;
_root.txt_chat.text = (_root.txt_chat.htmlText = "");
_root.chat_interval = null;
if (game_type == 0) {
_root.mc_chat.Disable();
}
Frame 149
function cleanSmartfox() {
if (_root.game_type != 1) {
return(undefined);
}
delete _root.sfs.onConnection;
delete _root.sfs.onConnectionLost;
delete _root.sfs.onAdminMessage;
delete _root.sfs.onModeratorMessage;
delete _root.sfs.onJoinRoom;
delete _root.sfs.onUserEnterRoom;
delete _root.sfs.onUserLeaveRoom;
delete _root.sfs.onExtensionResponse;
_root.sfs.disconnect();
}
function ShowHiscoreBug() {
if (_root.kongregateServices != null) {
return(undefined);
}
var _local2 = _root.attachMovie("mc_hiscore", "mc_hiscore", _root.getNextHighestDepth());
_local2._x = 567;
_local2._y = 4;
_local2.game_id = _root.GB_GAME_ID;
_local2.mode_id = _root.game_type;
_local2.score_cgi = _root.GB_SCORE_CGI;
_local2.score_url = _root.GB_SCORE_URL + ((_root.game_type == 1) ? "/live" : "");
}
function CreateTankAI(i) {
var _local2 = new ArtilleryUser();
_local2.user_name = ((i == 0) ? (_root.gb_name) : ("Computer-" + (++ai_cpu_count)));
_local2.slot = i;
_local2.pos = ((com.gamebrew.Common.RandomBit() == 0) ? 1 : -1);
if ((i == 0) || (i == 2)) {
_local2.color = _root.color_id;
} else {
_local2.color = (_root.color_id + 1) % COLOR_NAME.length;
}
_local2.angle = com.gamebrew.Common.RandomInteger(20, 80);
_local2.power = com.gamebrew.Common.RandomInteger(11, 89);
_local2.score = 0;
_local2.kills = 0;
_local2.armor = 3;
_local2.combo = 0;
CreateTankUser(_local2, i == 0);
}
function sendResults() {
if ((_root.AllTanksDone() == false) || (sent_result == true)) {
return(undefined);
}
_root.sent_result = true;
_root.mc_menu.ClearTimer("getting battle results");
if (_root.game_type == 1) {
var _local4 = new Object();
_local4.kills = _root.player.user.kills;
_local4.sc = _root.player.user.score;
_local4.hp = _root.player.user.armor;
_local4.ff = _root.player.user.ally_hits;
_root.sfs.sendXtMessage(_root.SERVER_EXT, "result", _local4, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
if (_root.player.is_dead == true) {
_root.mc_menu.StartTimer();
}
var _local3 = 0;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if (_local2.is_dead || (_local2.is_disconnected)) {
_local2.command_on = false;
} else {
_local2.command_on = true;
}
_local3++;
}
} else {
_root.GameReady();
}
}
function GameReady() {
if (game_type == 0) {
var _local3 = 1;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if (_local2.is_disconnected == true) {
CreateTankAI(_local3);
_root.ai_change_wind = true;
}
_local3++;
}
if (_root.ai_change_wind == true) {
_root.ai_change_wind = false;
RandomizeWind();
_local3 = 1;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (((_local2 == null) || (_local2.is_dead)) || (_local2.is_disconnected)) {
} else {
_local2.ai_pos = ((com.gamebrew.Common.RandomInteger(0, 2) == 0) ? ((com.gamebrew.Common.RandomBit() ? 1 : -1)) : 0);
_local2.ai_angle = com.gamebrew.Common.RandomInteger(30, 65);
_local2.ai_power = com.gamebrew.Common.RandomInteger(11, 89);
}
_local3++;
}
}
}
com.gamebrew.Common.SoundPlay("shortbloop.wav");
if (_root.player.is_dead == false) {
_root.sent_result = false;
_root.mc_controls.EnableAll();
}
var _local3 = 0;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if ((_local2.is_dead == false) && (_local2.is_disconnected == true)) {
_root.RemoveTank(_local3);
} else {
_local2.user.ally_hits = 0;
}
_local3++;
}
_root.mc_menu.StartTimer();
_root.rounds++;
}
function AiRun(did_submit) {
_root.mc_menu.ClearTimer("battle in progress");
_root.mc_controls.DisableGrayAll();
var _local2 = 0;
while (_local2 <= 3) {
mc = _root["mc_tank_" + _local2];
if (mc == null) {
} else if (mc.is_dead || (mc.is_disconnected)) {
mc.command_on = false;
} else {
mc.command_on = true;
}
_local2++;
}
if (did_submit == true) {
var _local4 = ((mc_controls.val_pos == _root.player.user.pos) ? 0 : (mc_controls.val_pos));
var _local5 = mc_controls.val_angle;
var _local3 = mc_controls.val_power;
_root.player.ProcessCommand(_local4, _local5, _local3);
} else {
_root.player.command_on = false;
}
_local2 = 1;
while (_local2 <= 3) {
mc = _root["mc_tank_" + _local2];
if ((mc == null) || (mc.is_dead == true)) {
} else {
mc.ProcessCommand(((mc.ai_pos == mc.user.pos) ? 0 : (mc.ai_pos)), mc.ai_angle, mc.ai_power);
}
_local2++;
}
}
function DisableGame() {
Key.removeListener(key_listener);
com.gamebrew.Common.MusicStop();
_root.mc_hiscore.Stop();
_root.CloseCaption();
_root.CloseMarker();
_root.SetWind(0);
_root.mc_menu.Disable();
clearInterval(_root.chat_interval);
_root.mc_chat.Disable();
_root.mc_controls.DisableGrayAll();
var _local2 = 0;
while (_local2 <= 3) {
_root.DisableTank(_local2);
_local2++;
}
for (var _local3 in _root) {
if (com.gamebrew.Common.StringContains(_local3, "mc_ammo")) {
com.gamebrew.Common.MovieFilterGrayScale(_root[_local3]);
_root[_local3].stop();
delete _root[_local3].onEnterFrame;
}
}
}
function SetWind(w) {
if (w == 0) {
_root.wind_x = 0;
} else {
var _local2 = w / 3000;
if (_root.wind_x == _local2) {
return(undefined);
}
_root.wind_x = _local2;
}
_root.mc_wind.ChangeWind(_root.wind_x);
}
function RandomizeWind() {
if (_root.wind_x >= 0) {
SetWind((-com.gamebrew.Common.RandomInteger(0, 96)) - 3);
} else {
SetWind(com.gamebrew.Common.RandomInteger(0, 96) + 3);
}
}
function AnimateClouds() {
if (_root.wind_x == 0) {
return(undefined);
}
this._x = this._x + (_root.wind_x * 20);
if ((_root.wind_x > 0) && ((this._x - (this._width / 2)) > Stage.width)) {
this._x = this._x - (Stage.width + this._width);
} else if ((_root.wind_x < 0) && ((this._x + (this._width / 2)) < 0)) {
this._x = this._x + (Stage.width + this._width);
}
}
function OpenCaption(txt) {
_root.CloseCaption();
var _local2 = _root.attachMovie("mc_caption", "mc_caption", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = 360;
_local2._y = 111;
_local2.arg_txt = txt;
return(_local2);
}
function CloseCaption() {
_root.mc_caption.removeMovieClip();
}
function OpenStatus(mcp, txt) {
_root.CloseStatus();
var _local2 = _root.attachMovie("mc_status", "mc_status", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = mcp._x;
_local2._y = mcp._y - 60;
_local2.arg_txt = txt;
return(_local2);
}
function CloseStatus() {
_root.mc_status.removeMovieClip();
}
function OpenMarker() {
_root.CloseMarker();
var _local2 = _root.attachMovie("mc_marker", "mc_marker", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = _root.player._x;
_local2._y = _root.player._y - 51;
return(_local2);
}
function CloseMarker() {
_root.mc_marker.removeMovieClip();
}
function OpenControls() {
_root.CloseControls();
if ((_root.PLAYER_DATA[_root.self.getVariable("slot")].face == 1) || (_root.game_type == 0)) {
var _local2 = _root.attachMovie("mc_controls_right", "mc_controls", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = 50;
_local2._y = 504;
_local2 = _root.attachMovie("mc_menu", "mc_menu", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = 711;
_local2._y = 553;
} else {
var _local2 = _root.attachMovie("mc_controls_left", "mc_controls", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2._x = 670;
_local2._y = 504;
_local2 = _root.attachMovie("mc_menu", "mc_menu", com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
_local2.gotoAndStop("left");
_local2._x = 9;
_local2._y = 553;
}
return(_local2);
}
function CloseControls() {
_root.mc_controls.removeMovieClip();
_root.mc_menu.removeMovieClip();
}
function CreateTank(slot, nm, pos, col, is_plr) {
mc = _root["mc_tank_" + slot];
if (mc != undefined) {
mc.removeMovieClip();
}
var _local6 = _root.PLAYER_DATA[slot].face * -1;
var mc = _root.attachMovie("mc_tank", "mc_tank_" + slot, com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH));
mc._x = _root.PLAYER_DATA[slot].x + ((_local6 == pos) ? 0 : (pos * _root.TANK_MOVE));
mc._y = _root.PLAYER_DATA[slot].y;
mc.face = _root.PLAYER_DATA[slot].face;
mc.team_id = _root.PLAYER_DATA[slot].team_id;
mc.color_id = col;
mc.is_dead = false;
mc.is_disconnected = false;
if (_root.game_type == 0) {
mc.ai_pos = 0;
mc.ai_angle = 0;
mc.ai_power = 0;
}
_root.players[slot] = mc;
if (col != 0) {
mc.body.filters = COLOR_FILTER[col];
mc.turret.filters = COLOR_FILTER[col];
}
com.gamebrew.Common.SoundPlay("zap.wav");
mc._xscale = 0;
mc._yscale = 300;
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 255, 0);
mc.onEnterFrame = function () {
this._xscale = this._xscale + (10 * this.face);
if ((this.face == 1) && (this._xscale >= 100)) {
this._xscale = 100;
} else if ((this.face == -1) && (this._xscale <= -100)) {
this._xscale = -100;
}
this._yscale = this._yscale - 30;
if (this._yscale < 100) {
this._yscale = 100;
}
var _local2 = this.transform.colorTransform.redOffset - 16;
if (_local2 < 0) {
_local2 = 0;
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local2, _local2, _local2, 0);
if (((this._xscale == (100 * this.face)) && (this._yscale == 100)) && (_local2 == 0)) {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
delete this.onEnterFrame;
}
};
if (is_plr == true) {
_root.player = mc;
_root.txt_pc.htmlText = ((("<FONT COLOR='" + _root.CHAT_COLORS[mc.team_id]) + "'><B>") + nm) + "</B></FONT>";
}
return(mc);
}
function CreateTankUser(user, is_plr) {
var _local2 = CreateTank(user.slot, user.user_name, user.pos, user.color, is_plr);
_local2.user = user;
_local2.ai_power = user.power;
_local2.ai_angle = user.angle;
_local2.ai_pos = user.pos;
return(_local2);
}
function RemoveTank(slot) {
mc = _root["mc_tank_" + slot];
if (mc == undefined) {
return(undefined);
}
if (mc.is_dead == true) {
return(undefined);
}
if (mc.ammo != null) {
mc.ammo.removeAmmo();
}
com.gamebrew.Common.SoundPlay("zap.wav");
mc._xscale = 100 * this.face;
mc._yscale = 100;
mc.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc.onEnterFrame = function () {
this._xscale = this._xscale - (10 * this.face);
if ((this.face == 1) && (this._xscale <= 0)) {
this._xscale = 0;
} else if ((this.face == -1) && (this._xscale >= 0)) {
this._xscale = 0;
}
this._yscale = this._yscale + 50;
if (this._yscale > 300) {
this._yscale = 300;
}
var _local3 = this.transform.colorTransform.redOffset + 16;
if (_local3 > 255) {
_local3 = 255;
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local3, _local3, _local3, 0);
if (((this._xscale == 0) && (this._yscale == 300)) && (_local3 == 255)) {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
_root[("txt_p" + slot) + "k"].text = this.user.reason_dc;
_root[this._name].removeMovieClip();
delete this.onEnterFrame;
}
};
}
function DisableTank(slot) {
var _local2 = _root["mc_tank_" + slot];
if (_local2 == null) {
return(undefined);
}
if (_local2.is_dead == false) {
com.gamebrew.Common.MovieFilterGrayScale(_local2);
}
}
function AllTanksDone() {
var _local3 = 0;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if ((_local2.is_disconnected == null) || (_local2.is_disconnected == true)) {
} else if (_local2.command_on == true) {
return(false);
}
_local3++;
}
return(true);
}
function CountTanks() {
var _local4 = 0;
var _local3 = 0;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if ((_local2.is_disconnected == null) || (_local2.is_disconnected == true)) {
} else {
_local4++;
}
_local3++;
}
return(_local4);
}
function CountEnemies() {
var _local4 = 0;
var _local3 = 0;
while (_local3 <= 3) {
var _local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if ((_local2.is_disconnected == null) || (_local2.is_disconnected == true)) {
} else if (_local2.team_id != _root.player.team_id) {
_local4++;
}
_local3++;
}
return(_local4);
}
function GotoEnding(tt) {
cleanSmartfox();
DisableGame();
_root.OpenWindow("mc_win_end");
_root.mc_win.arg_title = tt;
}
function ReturnMenu() {
cleanSmartfox();
com.gamebrew.Common.MovieRemoveAll(this);
gotoAndPlay (114);
}
stop();
_root.GRAVITY = 0.1;
_root.TANK_MOVE = 50;
_root.TURN_SECS = 10;
_root.MAX_WIND = 3;
_root.PLAYER_DATA = [{player_id:1, team_id:1, face:1, x:32, y:295}, {player_id:2, team_id:2, face:-1, x:688, y:295}, {player_id:3, team_id:1, face:1, x:165, y:360}, {player_id:4, team_id:2, face:-1, x:555, y:360}];
_root.player = null;
_root.players = new Array(4);
_root.turn_secs = _root.TURN_SECS;
_root.rounds = 0;
_root.ai_change_wind = false;
_root.ai_cpu_count = 0;
_root.sent_result = false;
var key_up = 0;
var key_listener = new Object();
key_listener.onKeyUp = function () {
key_up = Key.getCode();
};
Key.addListener(key_listener);
SetWind(0);
mc_cloud.onEnterFrame = AnimateClouds;
mc_cloud_1.onEnterFrame = AnimateClouds;
_root.txt_pc.htmlText = "";
var i = 0;
while (i <= 3) {
_root["txt_p" + i].text = "";
_root[("txt_p" + i) + "k"].text = "";
_root[("mc_p" + i) + "a"]._visible = false;
i++;
}
if (game_type == 1) {
mc_menu.ClearTimer("starting game");
sfs.onConnectionLost = function () {
if (_root.player == null) {
_root.AddChat("System", 0, "You have been disconnected");
_root.OpenStatus(_root.player, "disconnected!");
_root.mc_menu.ClearTimer("you are disconnected");
_root.GotoEnding("Disconnected");
} else if (_root.player.is_dead == false) {
_root.AddChat("System", 0, "You have been disconnected");
_root.mc_menu.ClearTimer("you are disconnected");
_root.GotoEnding("Disconnected");
} else {
_root.AddChat("System", 0, "Game over disconnected");
_root.mc_menu.ClearTimer("you are disconnected");
_root.GotoEnding("Game Over");
}
};
sfs.onAdminMessage = (sfs.onModeratorMessage = function (msg) {
_root.AddChat("System", 0, msg);
});
sfs.onExtensionResponse = function (obj) {
if (obj._cmd == "moves") {
if (_root.player.is_dead == true) {
return(undefined);
}
_root.mc_menu.ClearTimer("battle in progress");
var _local5 = 0;
while (_local5 <= 3) {
var _local3 = _root["mc_tank_" + _local5];
if (_local3 == null) {
} else {
var _local4 = obj["slot_" + _local5];
if (_local4 == null) {
_local3.arg_pos = 0;
_local3.arg_angle = -1;
_local3.arg_power = -1;
_local3.ProcessResult(0, 0, 0);
} else {
_local3.ProcessCommand(_local4.pos, _local4.ang, _local4.pow);
}
}
_local5++;
}
_root.mc_controls.DisableGrayAll();
} else if (obj._cmd == "ready") {
if (_root.player.is_dead == true) {
return(undefined);
}
_root.GameReady();
} else if (obj._cmd == "info") {
_root.AddChat("System", 0, obj.msg);
} else if (obj._cmd == "chat") {
if (this.myUserId == obj.id) {
_root.AddChat(this.myUserName, _root.PLAYER_DATA[_root.self.getVariable("slot")].team_id, obj.msg);
_root.chat_interval = setInterval(_root.ResetChat, 2000);
} else {
var _local7 = _root.sfs.getActiveRoom().getUser(obj.id);
var _local8 = 0;
if (_local7 != null) {
_local8 = _root.PLAYER_DATA[_local7.getVariable("slot")].team_id;
}
_root.AddChat(obj.nm, _local8, obj.msg);
}
} else if (obj._cmd == "disconnect") {
delete this.onConnectionLost;
_root.AddChat("System", 0, obj.msg);
_root.OpenStatus(_root.player, "kicked!");
_root.mc_menu.ClearTimer("you are kicked");
_root.GotoEnding("Disconnected");
sfs.disconnect();
} else if (obj._cmd == "userKicked") {
this.onUserLeaveRoom(obj.roomId, obj.userId, obj.userName, obj.msg, obj.cd);
} else if (obj._cmd == "start") {
OpenCaption("Gun Battle!");
OpenMarker();
mc_menu.timer_start = true;
mc_chat.Enable();
com.gamebrew.Common.SoundPlay("windy.wav");
SetWind(_root.sfs.getActiveRoom().getVariable("wind"));
com.gamebrew.Common.MusicPlay();
GameReady();
}
};
sfs.onRoomVariablesUpdate = function (room, changedVars) {
for (var _local3 in changedVars) {
if (_local3 == "wind") {
com.gamebrew.Common.SoundPlay("windy.wav");
_root.SetWind(room.getVariable(_local3));
}
}
};
sfs.onUserEnterRoom = function (roomId, u) {
if (_root.player.is_dead == true) {
return(undefined);
}
_root.AddChat("System", 0, u.getName() + " has joined the game");
var _local2 = new ArtilleryUser();
_local2.user_name = u.getName();
_local2.user_id = u.getId();
_local2.slot = u.getVariable("slot");
_local2.color = u.getVariable("col");
_local2.pos = u.getVariable("pos");
_local2.power = u.getVariable("pow");
_local2.angle = u.getVariable("ang");
_local2.score = u.getVariable("sc");
_local2.kills = u.getVariable("kills");
_local2.armor = u.getVariable("hp");
_root.CreateTankUser(_local2, false);
};
sfs.onUserLeaveRoom = function (roomId, userId, userName, msg, cd) {
var _local2 = null;
var _local5 = false;
var _local3 = 0;
while (_local3 <= 3) {
_local2 = _root["mc_tank_" + _local3];
if (_local2 == null) {
} else if (_local2.user.user_name == userName) {
_local5 = true;
break;
}
_local3++;
}
if (_local5 == false) {
_root.AddChat("System", 0, userName + " has disconnected");
} else if (_local2.is_disconnected == false) {
if (_local2.is_dead == true) {
_root.AddChat("System", 0, userName + " has been destroyed");
_local2.user.reason_dc = "destroyed";
} else {
if (msg == null) {
_root.AddChat("System", 0, userName + " has left the game");
_local2.user.reason_dc = "disconnected";
} else {
_root.AddChat("System", 0, msg);
if (cd == 1) {
_local2.user.reason_dc = "lagged";
} else if (cd == 2) {
_local2.user.reason_dc = "idled";
} else if (cd == 3) {
_local2.user.reason_dc = "cheated";
} else if (cd == 4) {
_local2.user.reason_dc = "traitorous";
} else {
_local2.user.reason_dc = "disconnected";
}
}
_local2.is_disconnected = true;
}
}
};
var r = _root.sfs.getActiveRoom();
_root.self = r.getUser(_root.sfs.myUserId);
_root.sfs.myUserName = _root.self.getName();
var str = (("You are playing \"" + r.getName()) + "\"");
var rounds = r.getVariable("round");
if (rounds > 1) {
str = str + ((" running " + rounds) + " rounds");
}
_root.AddChat("System", 0, str);
var userList = r.getUserList();
var users = new Array();
for (var n in userList) {
users.push(userList[n]);
}
var i = 0;
while (i < users.length) {
var u = users[i];
var au = new ArtilleryUser();
if (u.getVariable("hp") <= 0) {
} else {
au.user_name = u.getName();
au.user_id = u.getId();
au.slot = u.getVariable("slot");
au.color = u.getVariable("col");
au.pos = u.getVariable("pos");
au.power = u.getVariable("pow");
au.angle = u.getVariable("ang");
au.score = u.getVariable("sc");
au.kills = u.getVariable("kills");
au.armor = u.getVariable("hp");
CreateTankUser(au, u.getId() == _root.sfs.myUserId);
}
i++;
}
ShowHiscoreBug();
OpenControls();
sfs.sendXtMessage(_root.SERVER_EXT, "@user.info", {url:_root._url}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
sfs.sendXtMessage(_root.SERVER_EXT, "start", {}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else {
AddChat("System", 0, "Single player mode");
OpenControls();
OpenCaption("Gun Battle!");
RandomizeWind();
mc_menu.timer_start = true;
ShowHiscoreBug();
var i = 0;
while (i <= 3) {
CreateTankAI(i);
i++;
}
OpenMarker();
com.gamebrew.Common.MusicPlay();
}
Symbol 227 MovieClip [mc_preloader] Frame 1
this.onEnterFrame = function () {
var _local4 = _root.getBytesTotal();
var _local5 = _root.getBytesLoaded();
var _local3 = int((_local5 / _local4) * 100);
txt_pct.text = ("Loading Artillery Live : " + (((_local3 + 1) > 100) ? 100 : (_local3 + 1))) + " %";
if (_local3 == 100) {
_root.play();
delete this.onEnterFrame;
this.removeMovieClip();
}
};
Symbol 227 MovieClip [mc_preloader] Frame 30
gotoAndPlay (2);
Symbol 238 MovieClip Frame 1
stop();
onPress = function () {
if (com.gamebrew.Common.MuteGet() == false) {
com.gamebrew.Common.MuteSet(true);
com.gamebrew.Common.MovieFilterGrayScale(this);
com.gamebrew.Common.MovieFilterGrayScale(this._parent.mc_but_music);
gotoAndStop (2);
} else {
com.gamebrew.Common.MuteSet(false);
com.gamebrew.Common.SoundPlay("click.wav");
com.gamebrew.Common.MovieFilterClear(this);
com.gamebrew.Common.MovieFilterClear(this._parent.mc_but_music);
gotoAndStop (1);
}
onRollOver();
};
onRollOver = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 0, 0);
this._parent.opt = "volume = " + (com.gamebrew.Common.MuteGet() ? "off" : "on");
};
onRollOut = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
this._parent.opt = "";
};
Symbol 247 MovieClip Frame 1
function update() {
if (_root._quality == "BEST") {
} else if (_root._quality == "HIGH") {
gotoAndStop (2);
} else if (_root._quality == "MEDIUM") {
gotoAndStop (3);
} else if (_root._quality == "LOW") {
gotoAndStop (4);
}
}
stop();
update();
setInterval(this, "update", 3000);
onPress = function () {
com.gamebrew.Common.SoundPlay("click.wav");
if (_root._quality == "BEST") {
_root._quality = "HIGH";
gotoAndStop (2);
} else if (_root._quality == "HIGH") {
_root._quality = "MEDIUM";
gotoAndStop (3);
} else if (_root._quality == "MEDIUM") {
_root._quality = "LOW";
gotoAndStop (4);
} else if (_root._quality == "LOW") {
_root._quality = "BEST";
gotoAndStop (1);
}
onRollOver();
};
onRollOver = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 0, 0);
this._parent.opt = "quality = " + _root._quality;
};
onRollOut = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
this._parent.opt = "";
};
Symbol 252 MovieClip Frame 1
stop();
onPress = function () {
if (com.gamebrew.Common.MusicGetMute() == false) {
com.gamebrew.Common.MusicSetMute(true);
if (com.gamebrew.Common.MuteGet() == false) {
com.gamebrew.Common.MovieFilterGrayScale(this);
}
gotoAndStop (2);
} else {
com.gamebrew.Common.MusicSetMute(false);
if (com.gamebrew.Common.MuteGet() == false) {
com.gamebrew.Common.MovieFilterClear(this);
}
gotoAndStop (1);
}
com.gamebrew.Common.SoundPlay("click.wav");
onRollOver();
};
onRollOver = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 0, 0);
this._parent.opt = "music = " + (com.gamebrew.Common.MusicGetMute() ? "off" : "on");
};
onRollOut = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
this._parent.opt = "";
};
Symbol 255 MovieClip Frame 1
stop();
onPress = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(this._parent.email_url, "_blank");
onRollOver();
};
onRollOver = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 0, 0);
this._parent.opt = "email creator";
};
onRollOut = function () {
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
this._parent.opt = "";
};
Symbol 256 MovieClip [mc_footer] Frame 1
stop();
opt = "";
mc_footer_label.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(_root.GB_URL, "_blank");
};
Symbol 273 MovieClip [mc_win_team] Frame 1
function DisableTeamButton() {
com.gamebrew.Common.EnableTextField(txt_name, false);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_team);
_root.ButtonDisable(this.mc_but_team);
}
function EnableTeamButton() {
com.gamebrew.Common.EnableTextField(txt_name, true);
com.gamebrew.Common.MovieFilterClear(mc_but_team);
mc_but_team.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_team.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_team.onRelease = function () {
if ((_root.mc_win.txt_name.text.length == 0) || (_root.mc_win.txt_name.text.toLowerCase() == _root.mu.user_name.toLowerCase())) {
_root.mc_win.txt_err.text = "Invalid user";
com.gamebrew.Common.SoundPlay("error.wav");
return(undefined);
}
this._parent.DisableTeamButton();
com.gamebrew.Common.SoundPlay("click.wav");
_root.sfs.sendXtMessage(_root.SERVER_EXT, "joinTeam", {nm:_root.mc_win.txt_name.text}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
_root.mc_win.txt_err.text = "Finding game";
};
}
stop();
txt_help.text = com.gamebrew.Common.StringReplace(txt_help.text, "$$$", _root.sfs.myUserName);
com.gamebrew.Common.TextFieldSelectColor(txt_name, 0);
txt_name.restrict = "^&=\\";
txt_name_listener = new Object();
txt_name_listener.field_path = _root.mc_win.txt_name;
txt_name_listener.onKeyDown = function () {
if (Key.getAscii() == 13) {
if (Selection.getFocus() == String(this.field_path)) {
_root.mc_win.mc_but_team.onRelease();
}
}
};
Key.addListener(txt_name_listener);
Selection.setFocus(_root.mc_win.txt_name);
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
delete _root.sfs.onConnection;
delete _root.sfs.onConnectionLost;
delete _root.sfs.onExtensionResponse;
delete _root.sfs.onJoinRoom;
delete this.onRelease;
_root.sfs.disconnect();
com.gamebrew.Common.SoundPlay("click.wav");
_root.EnableMainMenu();
_root.CloseWindow();
};
EnableTeamButton();
_root.sfs.onConnectionLost = function (msg, isban) {
mc_but_close.onRelease();
};
_root.sfs.onExtensionResponse = function (obj) {
if (obj._cmd == "joinTeamWait") {
_root.SaveCookie();
_root.mc_win.txt_err.text = obj.msg;
com.gamebrew.Common.SoundPlay("longbloop.wav");
} else if (obj._cmd == "info") {
_root.mc_win.txt_err.text = obj.msg;
com.gamebrew.Common.SoundPlay("error.wav");
_root.mc_win.EnableTeamButton();
}
};
_root.sfs.onJoinRoom = function () {
delete this.onConnection;
delete this.onConnectionLost;
delete this.onExtensionResponse;
delete this.onJoinRoom;
_root.mc_win.DisableTeamButton();
_root.gb_team = _root.mc_win.txt_name.text;
_root.SaveCookie();
com.gamebrew.Common.SoundPlay("longbloop.wav");
_root.mc_win.txt_err.text = "Game starting";
_root.FadeOutIn(0, 0, _root.GotoMu);
};
Symbol 280 MovieClip [mc_hiscore] Frame 1
function Enable() {
mc_but.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(this._parent.score_url, "score");
};
}
function Stop() {
stop();
delete mc_but.onRelease;
delete mc_cycle.onEnterFrame;
}
mc_but.tabEnabled = false;
Enable();
Symbol 280 MovieClip [mc_hiscore] Frame 2
function AttachFlag(cc) {
if (cc == flag_cc) {
return(undefined);
}
this.mc_flag.removeMovieClip();
var _local2 = this.createEmptyMovieClip("mc_flag", 0);
_local2._x = 121;
_local2._y = 5;
_local2.attachBitmap(flash.display.BitmapData.loadBitmap(cc + ".gif"), 0);
flag_cc = cc;
}
function Cycle() {
var _local2 = this.createEmptyMovieClip("mc_cycle", 1);
mc_cycle.onEnterFrame = function () {
var _local2 = this._parent;
if (_local2.wait > 0) {
_local2.wait--;
return(undefined);
}
var _local3 = "xx";
if (_local2.postrecd["nm_" + _local2.cycle] != null) {
_local2.txt_nm.text = _local2.postrecd["nm_" + _local2.cycle];
_local2.txt_dat.text = _local2.postrecd["sc_" + _local2.cycle];
_local2.txt_rank.text = "#" + (_local2.cycle + 1);
_local2.AttachFlag(_local2.postrecd["cc_" + _local2.cycle]);
_local2.cycle++;
if (_local2.cycle == 7) {
_local2.cycle = 0;
}
} else {
_local2.cycle = 0;
}
_local2.wait = 240;
};
}
stop();
var cycle = 0;
var wait = 0;
var flag_cc;
var postrecd = new LoadVars();
postrecd.onLoad = function (success) {
if ((!success) || (this.success == 0)) {
trace("[thread]hiscore failed: " + this.message);
_root.mc_hiscore.txt_nm.text = "Game Hiscores";
_root.mc_hiscore.txt_dat.text = "Click here to view";
} else {
trace("[thread]hiscore: " + unescape(this));
_root.mc_hiscore.Cycle();
}
delete this.onLoad;
};
var postsend = new LoadVars();
postsend.g = game_id;
postsend.m = mode_id;
postsend.sendAndLoad(score_cgi + "?cmd=bug", postrecd, "POST");
AttachFlag("xx");
Symbol 282 MovieClip [mc_tooltip] Frame 1
txt.text = this.new_text;
txt.backgroundColor = 16777113 /* 0xFFFF99 */;
txt.borderColor = 3355443 /* 0x333333 */;
txt.autoSize = "left";
txt.selectable = false;
txt._visible = false;
this.frames = 0;
this.onEnterFrame = function () {
this.frames++;
if (this.frames == 30) {
txt._visible = true;
} else if (this.frames > (30 + (txt.text.length * 10))) {
delete this.onEnterFrame;
_root[this._name].removeMovieClip();
}
};
Symbol 286 MovieClip [mc_turret_fire] Frame 12
stop();
_root[_name].removeMovieClip();
Symbol 290 MovieClip [mc_ammo] Frame 1
function removeAmmo(did_hit) {
if (((_root.game_type == 1) && (did_hit == false)) && (this.owner.user.slot != 0)) {
var _local5 = _root.PLAYER_DATA[this.owner.user.slot].team_id;
if (((_local5 == 1) && (_x <= 360)) || ((_local5 == 2) && (_x >= 360))) {
this.owner.ai_angle = this.owner.ai_angle + com.gamebrew.Common.RandomInteger(3, 5);
if (this.owner.user.slot >= 2) {
if (this.owner.ai_angle > 65) {
this.owner.ai_angle = 65;
}
} else if (this.owner.ai_angle > 50) {
this.owner.ai_angle = 50;
}
this.owner.ai_power = this.owner.ai_power + com.gamebrew.Common.RandomInteger(7, 15);
if (this.owner.ai_power > 99) {
this.owner.ai_power = 99;
}
} else if (((_local5 == 1) && (_x > 720)) || ((_local5 == 2) && (_x < 0))) {
this.owner.ai_angle = this.owner.ai_angle - com.gamebrew.Common.RandomInteger(1, 3);
if (this.owner.ai_angle < 10) {
this.owner.ai_angle = 10;
}
this.owner.ai_power = this.owner.ai_power - com.gamebrew.Common.RandomInteger(3, 10);
if (this.owner.ai_power < 1) {
this.owner.ai_power = 1;
}
} else {
var _local6 = null;
var _local4 = 99999 /* 0x01869F */;
i = 0;
while (i <= 3) {
mc = _root["mc_tank_" + i];
if (mc == null) {
} else if (_root.PLAYER_DATA[mc.user.slot].team_id == _local5) {
} else {
var _local3 = com.gamebrew.Common.CalcDistance(_x, _y, mc._x, mc._y);
if (_local3 < _local4) {
_local4 = _local3;
_local6 = mc;
}
}
i++;
}
if (_local6 != null) {
if (_local6._x < _x) {
this.owner.ai_power = this.owner.ai_power - (com.gamebrew.Common.RandomInteger(1, 5) * ((_local5 == 1) ? 1 : -1));
} else {
this.owner.ai_power = this.owner.ai_power + (com.gamebrew.Common.RandomInteger(1, 5) * ((_local5 == 1) ? 1 : -1));
}
}
}
}
this.owner.ammo = null;
_root[_name].removeMovieClip();
delete onEnterFrame;
}
type = "ammo";
onEnterFrame = function () {
if (do_hit_dirt == true) {
d = com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH);
mc2 = _root.attachMovie("mc_hit_dirt", "mc_hit_dirt_" + d, d);
mc2._rotation = _rotation;
mc2._x = _x;
mc2._y = _y;
owner.ResultNoKill("miss!");
this.removeAmmo(false);
return(undefined);
}
_x = (_x + speed.x);
_y = (_y + speed.y);
speed.x = speed.x + _root.wind_x;
speed.y = speed.y + _root.GRAVITY;
_rotation = com.gamebrew.Common.CalcAngleFromPoints(last_x, last_y, _x, _y);
last_x = _x;
last_y = _y;
var _local3 = false;
for (mc in _root) {
if (!(_root[mc] instanceof MovieClip)) {
// unexpected jump
}
if (_root[mc].type != "tank") {
// unexpected jump
}
if (_root[mc].is_dead == true) {
// unexpected jump
}
if (_root[mc].body.hitTest(_x, _y, true) == false) {
// unexpected jump
}
if ((_root[mc] == owner) || (_root[mc].team_id == owner.team_id)) {
owner.ResultBadKill(_root[mc]);
} else if (_root[mc].user.armor > 1) {
d = com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH);
mc2 = _root.attachMovie("mc_hit_block", "mc_hit_block_" + d, d);
mc2._rotation = _rotation;
mc2._x = _x;
mc2._y = _y;
owner.ResultAddKill(_root[mc]);
} else {
owner.ResultAddKill(_root[mc]);
}
_local3 = true;
this.removeAmmo(true);
break;
}
if (_local3 == true) {
return(undefined);
}
for (mc in _root) {
if (_root[mc].type != "ammo") {
continue;
}
if (((_root[mc] == owner) || (_root[mc].owner == owner)) || (_root[mc].owner.team_id == owner.team_id)) {
continue;
}
if (_root[mc].hitTest(_x, _y, true) == true) {
_root[mc].do_hit_dirt = true;
do_hit_dirt = true;
break;
}
}
if (do_hit_dirt == false) {
if (_root.mc_terrain.ground.hitTest(_x, _y, true) == true) {
do_hit_dirt = true;
} else if ((((_y > Stage.height) || (_y < -100)) || (_x > (Stage.width + 25))) || (_x < -25)) {
owner.ResultNoKill("foul!");
this.removeAmmo(false);
}
}
};
Symbol 290 MovieClip [mc_ammo] Frame 5
var d = com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH);
var mc = _root.attachMovie("mc_smoke", "mc_smoke_" + d, d);
var pt = {x:0, y:0};
this.localToGlobal(pt);
mc._x = pt.x;
mc._y = pt.y;
mc._alpha = 70;
mc._rotation = this._rotation;
mc.onEnterFrame = function () {
var _local2 = this._alpha - 2;
if (_local2 <= 0) {
this._alpha = 0;
delete this.onEnterFrame;
this.removeMovieClip();
} else {
this._alpha = _local2;
this._xscale = this._xscale + 3;
this._yscale = this._yscale + 3;
}
};
gotoAndPlay (2);
Symbol 294 MovieClip [mc_hit_block] Frame 10
_root[this._name].removeMovieClip();
stop();
Symbol 299 MovieClip [mc_hit_dirt] Frame 1
com.gamebrew.Common.SoundPlay("dirthit.wav");
Symbol 299 MovieClip [mc_hit_dirt] Frame 5
_root[this._name].removeMovieClip();
stop();
Symbol 319 MovieClip [mc_controls_left] Frame 1
function RefreshInfo() {
val_angle = int(mc_but_power._rotation + 180);
val_power = int(((mc_but_power.mc_but_power_drag._x - mc_but_power.mc_but_power_drag.MIN_POWER_LOC) / (mc_but_power.mc_but_power_drag.MAX_POWER_LOC - mc_but_power.mc_but_power_drag.MIN_POWER_LOC)) * 100);
if (val_power < 1) {
val_power = 1;
} else if (val_power > 99) {
val_power = 99;
}
txt_angle.text = ((val_angle + "\u00B0\n") + val_power) + "+";
}
function SetToPlayer() {
mc_but_power._rotation = _root.player.user.angle - 180;
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MIN_POWER_LOC + ((_root.player.user.power / 99) * (mc_but_power.mc_but_power_drag.MAX_POWER_LOC - mc_but_power.mc_but_power_drag.MIN_POWER_LOC));
RefreshInfo();
}
function StartFire(did_submit) {
if (was_submitted == true) {
return(undefined);
}
was_submitted = true;
DisableAll();
RefreshInfo();
com.gamebrew.Common.MovieFilterGrayScale(mc_but_power);
com.gamebrew.Common.MovieFilterGrayScale(mc_angle_up);
com.gamebrew.Common.MovieFilterGrayScale(mc_angle_down);
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move);
if ((val_pos == -1) || (val_pos == 0)) {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_right);
} else if ((val_pos == 1) || (val_pos == 0)) {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_left);
}
_root.ClearTooltip(null);
if (did_submit == true) {
txt_angle_old.text = txt_angle.text;
com.gamebrew.Common.SoundPlay("longbloop.wav");
mc_but_fire.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
if (_root.game_type == 1) {
var _local2 = new Object();
_local2.pos = ((val_pos == _root.player.user.pos) ? 0 : (val_pos));
_local2.ang = val_angle;
_local2.pow = val_power;
_root.sfs.sendXtMessage(_root.SERVER_EXT, "move", _local2, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else {
_root.AiRun(true);
}
} else if (_root.game_type == 1) {
_root.sfs.sendXtMessage(_root.SERVER_EXT, "move", {pow:-1}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else {
_root.AiRun(false);
}
}
function DisableGrayAll() {
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_power);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_angle_up);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_angle_down);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move_right);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move_left);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_fire);
DisableAll();
}
function DisableAll() {
Key.removeListener(this);
this.was_submitted = true;
_root.ButtonDisable(this.mc_angle_up);
_root.ButtonDisable(this.mc_angle_down);
_root.ButtonDisable(this.mc_but_power.mc_but_power_up);
_root.ButtonDisable(this.mc_but_power.mc_but_power_down);
_root.ButtonDisable(this.mc_but_power.mc_but_power_drag);
_root.ButtonDisable(this.mc_but_move);
_root.ButtonDisable(this.mc_but_move_left);
_root.ButtonDisable(this.mc_but_move_right);
_root.ButtonDisable(this.mc_but_fire);
}
function EnableMoveButton() {
com.gamebrew.Common.MovieFilterClear(mc_but_move);
mc_but_move.onRollOver = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOver(this, "abort move");
};
mc_but_move.onRollOut = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move.onRelease = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
com.gamebrew.Common.SoundPlay("click.wav");
EnableDirButtons();
_root.ClearTooltip();
};
}
function EnableDirButtons() {
val_pos = _root.player.user.pos;
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move);
_root.ButtonDisable(mc_but_move);
if (val_pos != -1) {
com.gamebrew.Common.MovieFilterClear(mc_but_move_left);
mc_but_move_left.onRollOver = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
_root.ButtonRollOver(this, "move left");
};
mc_but_move_left.onRollOut = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move_left.onRelease = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
this._parent.val_pos = -1;
this._parent.EnableMoveButton();
com.gamebrew.Common.SoundPlay("click.wav");
_root.ClearTooltip();
};
} else {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_left);
}
if (val_pos != 1) {
com.gamebrew.Common.MovieFilterClear(mc_but_move_right);
mc_but_move_right.onRollOver = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
_root.ButtonRollOver(this, "move right");
};
mc_but_move_right.onRollOut = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move_right.onRelease = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
this._parent.val_pos = 1;
this._parent.EnableMoveButton();
com.gamebrew.Common.SoundPlay("click.wav");
_root.ClearTooltip();
};
} else {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_right);
}
}
function EnableAll() {
this.onKeyDown = function () {
if ((this._parent.was_submitted == true) || (Selection.getFocus() != null)) {
return(undefined);
}
if (Key.isDown(39)) {
var _local3 = mc_but_power._rotation + 1;
if (_local3 > -90) {
mc_but_power._rotation = -90;
} else {
mc_but_power._rotation = _local3;
}
} else if (Key.isDown(37)) {
var _local3 = mc_but_power._rotation - 1;
if (_local3 < -180) {
mc_but_power._rotation = -180;
} else {
mc_but_power._rotation = _local3;
}
} else if (Key.isDown(38)) {
mc_but_power.mc_but_power_drag._x++;
if (mc_but_power.mc_but_power_drag._x > mc_but_power.mc_but_power_drag.MAX_POWER_LOC) {
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MAX_POWER_LOC;
}
} else if (Key.isDown(40)) {
mc_but_power.mc_but_power_drag._x--;
if (mc_but_power.mc_but_power_drag._x < mc_but_power.mc_but_power_drag.MIN_POWER_LOC) {
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MIN_POWER_LOC;
}
} else if (Key.isDown(17) || (Key.isDown(87))) {
StartFire(true);
} else if (Key.isDown(83)) {
_root.mc_controls.mc_but_move.onRelease();
} else if (Key.isDown(65)) {
_root.mc_controls.mc_but_move_left.onRelease();
} else if (Key.isDown(68)) {
_root.mc_controls.mc_but_move_right.onRelease();
}
RefreshInfo();
};
Key.addListener(this);
com.gamebrew.Common.MovieFilterClear(mc_angle_up);
mc_angle_up.onRollOver = _root.ButtonOver;
mc_angle_up.onRollOut = _root.ButtonOut;
mc_angle_up.onPress = _root.ButtonPress;
mc_angle_up.onRelease = _root.ButtonRelease;
mc_angle_up.onReleaseOutside = _root.ButtonReleaseOutside;
mc_angle_up.onEnterFrame = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "raise angle");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
var _local3 = mc_but_power._rotation + 1;
if (_local3 > -90) {
mc_but_power._rotation = -90;
} else {
mc_but_power._rotation = _local3;
}
RefreshInfo();
};
com.gamebrew.Common.MovieFilterClear(mc_angle_down);
mc_angle_down.onRollOver = _root.ButtonOver;
mc_angle_down.onRollOut = _root.ButtonOut;
mc_angle_down.onPress = _root.ButtonPress;
mc_angle_down.onRelease = _root.ButtonRelease;
mc_angle_down.onReleaseOutside = _root.ButtonReleaseOutside;
mc_angle_down.onEnterFrame = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "lower angle");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
var _local3 = mc_but_power._rotation - 1;
if (_local3 < -180) {
mc_but_power._rotation = -180;
} else {
mc_but_power._rotation = _local3;
}
RefreshInfo();
};
com.gamebrew.Common.MovieFilterClear(mc_but_power);
mc_but_power.mc_but_power_up.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_up.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_up.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_up.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_up.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_up.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "increase power");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
this._parent.mc_but_power_drag._x++;
if (this._parent.mc_but_power_drag._x > this._parent.mc_but_power_drag.MAX_POWER_LOC) {
this._parent.mc_but_power_drag._x = this._parent.mc_but_power_drag.MAX_POWER_LOC;
}
RefreshInfo();
};
mc_but_power.mc_but_power_down.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc_but_power.mc_but_power_down.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_down.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_down.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_down.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_down.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_down.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "decrease power");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
this._parent.mc_but_power_drag._x--;
if (this._parent.mc_but_power_drag._x < this._parent.mc_but_power_drag.MIN_POWER_LOC) {
this._parent.mc_but_power_drag._x = this._parent.mc_but_power_drag.MIN_POWER_LOC;
}
RefreshInfo();
};
mc_but_power.mc_but_power_drag.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc_but_power.mc_but_power_drag.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_drag.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_drag.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_drag.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_drag.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_drag.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "drag to adjust");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
var _local3 = {x:0, y:0};
this._parent.localToGlobal(_local3);
if (_root._xmouse > _local3.x) {
this._parent._rotation = -90;
} else if (_root._ymouse > _local3.y) {
this._parent._rotation = -180;
} else {
this._parent._rotation = com.gamebrew.Common.CalcAngleFromPoints(_local3.x, _local3.y, _root._xmouse, _root._ymouse) - 90;
}
var _local4 = com.gamebrew.Common.CalcDistance(_local3.x, _local3.y, _root._xmouse, _root._ymouse);
if (_local4 < this.MIN_POWER_LOC) {
this._x = this.MIN_POWER_LOC;
} else if (_local4 > this.MAX_POWER_LOC) {
this._x = this.MAX_POWER_LOC;
} else {
this._x = _local4;
}
RefreshInfo();
};
EnableDirButtons();
com.gamebrew.Common.MovieFilterClear(mc_but_fire);
mc_but_fire.onRollOver = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOver(this, "fire and end turn");
};
mc_but_fire.onRollOut = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_fire.onRelease = function () {
this._parent.StartFire(true);
};
this.was_submitted = false;
}
stop();
this.was_submitted = false;
this.val_pos = 0;
this.val_angle = 0;
this.val_power = 0;
txt_angle_old.text = "0\u00B0\n0+";
mc_but_power.mc_but_power_drag.MIN_POWER_LOC = 26;
mc_but_power.mc_but_power_drag.MAX_POWER_LOC = 97;
RefreshInfo();
DisableGrayAll();
Symbol 323 MovieClip [mc_controls_right] Frame 1
function RefreshInfo() {
val_angle = int(mc_but_power._rotation * -1);
val_power = int(((mc_but_power.mc_but_power_drag._x - mc_but_power.mc_but_power_drag.MIN_POWER_LOC) / (mc_but_power.mc_but_power_drag.MAX_POWER_LOC - mc_but_power.mc_but_power_drag.MIN_POWER_LOC)) * 100);
if (val_power < 1) {
val_power = 1;
} else if (val_power > 99) {
val_power = 99;
}
txt_angle.text = ((val_angle + "\u00B0\n") + val_power) + "+";
}
function SetToPlayer() {
mc_but_power._rotation = -_root.player.user.angle;
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MIN_POWER_LOC + ((_root.player.user.power / 99) * (mc_but_power.mc_but_power_drag.MAX_POWER_LOC - mc_but_power.mc_but_power_drag.MIN_POWER_LOC));
RefreshInfo();
}
function StartFire(did_submit) {
if (was_submitted == true) {
return(undefined);
}
was_submitted = true;
DisableAll();
RefreshInfo();
com.gamebrew.Common.MovieFilterGrayScale(mc_but_power);
com.gamebrew.Common.MovieFilterGrayScale(mc_angle_up);
com.gamebrew.Common.MovieFilterGrayScale(mc_angle_down);
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move);
if ((val_pos == -1) || (val_pos == 0)) {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_right);
} else if ((val_pos == 1) || (val_pos == 0)) {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_left);
}
_root.ClearTooltip(null);
if (did_submit == true) {
txt_angle_old.text = txt_angle.text;
com.gamebrew.Common.SoundPlay("longbloop.wav");
mc_but_fire.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
if (_root.game_type == 1) {
var _local2 = new Object();
_local2.pos = ((val_pos == _root.player.user.pos) ? 0 : (val_pos));
_local2.ang = val_angle;
_local2.pow = val_power;
_root.sfs.sendXtMessage(_root.SERVER_EXT, "move", _local2, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else {
_root.AiRun(true);
}
} else if (_root.game_type == 1) {
_root.sfs.sendXtMessage(_root.SERVER_EXT, "move", {pow:-1}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else {
_root.AiRun(false);
}
}
function DisableGrayAll() {
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_power);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_angle_up);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_angle_down);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move_right);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_move_left);
com.gamebrew.Common.MovieFilterGrayScale(this.mc_but_fire);
DisableAll();
}
function DisableAll() {
Key.removeListener(this);
this.was_submitted = true;
_root.ButtonDisable(this.mc_angle_up);
_root.ButtonDisable(this.mc_angle_down);
_root.ButtonDisable(this.mc_but_power.mc_but_power_up);
_root.ButtonDisable(this.mc_but_power.mc_but_power_down);
_root.ButtonDisable(this.mc_but_power.mc_but_power_drag);
_root.ButtonDisable(this.mc_but_move);
_root.ButtonDisable(this.mc_but_move_left);
_root.ButtonDisable(this.mc_but_move_right);
_root.ButtonDisable(this.mc_but_fire);
}
function EnableMoveButton() {
com.gamebrew.Common.MovieFilterClear(mc_but_move);
mc_but_move.onRollOver = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOver(this, "abort move");
};
mc_but_move.onRollOut = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move.onRelease = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
com.gamebrew.Common.SoundPlay("click.wav");
EnableDirButtons();
_root.ClearTooltip();
};
}
function EnableDirButtons() {
val_pos = _root.player.user.pos;
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move);
_root.ButtonDisable(mc_but_move);
if (val_pos != -1) {
com.gamebrew.Common.MovieFilterClear(mc_but_move_left);
mc_but_move_left.onRollOver = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
_root.ButtonRollOver(this, "move left");
};
mc_but_move_left.onRollOut = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move_left.onRelease = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == -1)) {
return(undefined);
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
this._parent.val_pos = -1;
this._parent.EnableMoveButton();
com.gamebrew.Common.SoundPlay("click.wav");
_root.ClearTooltip();
};
} else {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_left);
}
if (val_pos != 1) {
com.gamebrew.Common.MovieFilterClear(mc_but_move_right);
mc_but_move_right.onRollOver = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
_root.ButtonRollOver(this, "move right");
};
mc_but_move_right.onRollOut = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_move_right.onRelease = function () {
if ((this._parent.was_submitted == true) || (this._parent.val_pos == 1)) {
return(undefined);
}
this.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 0.25, 1, 0, 0, 0, 0);
this._parent.val_pos = 1;
this._parent.EnableMoveButton();
com.gamebrew.Common.SoundPlay("click.wav");
_root.ClearTooltip();
};
} else {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_move_right);
}
}
function EnableAll() {
this.onKeyDown = function () {
if ((this._parent.was_submitted == true) || (Selection.getFocus() != null)) {
return(undefined);
}
if (Key.isDown(37)) {
var _local3 = mc_but_power._rotation - 1;
if (_local3 < -90) {
mc_but_power._rotation = -90;
} else {
mc_but_power._rotation = _local3;
}
} else if (Key.isDown(39)) {
var _local3 = mc_but_power._rotation + 1;
if (_local3 > 0) {
mc_but_power._rotation = 0;
} else {
mc_but_power._rotation = _local3;
}
} else if (Key.isDown(38)) {
mc_but_power.mc_but_power_drag._x++;
if (mc_but_power.mc_but_power_drag._x > mc_but_power.mc_but_power_drag.MAX_POWER_LOC) {
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MAX_POWER_LOC;
}
} else if (Key.isDown(40)) {
mc_but_power.mc_but_power_drag._x--;
if (mc_but_power.mc_but_power_drag._x < mc_but_power.mc_but_power_drag.MIN_POWER_LOC) {
mc_but_power.mc_but_power_drag._x = mc_but_power.mc_but_power_drag.MIN_POWER_LOC;
}
} else if (Key.isDown(17) || (Key.isDown(87))) {
StartFire(true);
} else if (Key.isDown(83)) {
_root.mc_controls.mc_but_move.onRelease();
} else if (Key.isDown(65)) {
_root.mc_controls.mc_but_move_left.onRelease();
} else if (Key.isDown(68)) {
_root.mc_controls.mc_but_move_right.onRelease();
}
RefreshInfo();
};
Key.addListener(this);
com.gamebrew.Common.MovieFilterClear(mc_angle_up);
mc_angle_up.onRollOver = _root.ButtonOver;
mc_angle_up.onRollOut = _root.ButtonOut;
mc_angle_up.onPress = _root.ButtonPress;
mc_angle_up.onRelease = _root.ButtonRelease;
mc_angle_up.onReleaseOutside = _root.ButtonReleaseOutside;
mc_angle_up.onEnterFrame = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "raise angle");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
mc_but_power._rotation--;
if (mc_but_power._rotation < -90) {
mc_but_power._rotation = -90;
}
RefreshInfo();
};
com.gamebrew.Common.MovieFilterClear(mc_angle_down);
mc_angle_down.onRollOver = _root.ButtonOver;
mc_angle_down.onRollOut = _root.ButtonOut;
mc_angle_down.onPress = _root.ButtonPress;
mc_angle_down.onRelease = _root.ButtonRelease;
mc_angle_down.onReleaseOutside = _root.ButtonReleaseOutside;
mc_angle_down.onEnterFrame = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "lower angle");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
mc_but_power._rotation++;
if (mc_but_power._rotation > 0) {
mc_but_power._rotation = 0;
}
RefreshInfo();
};
com.gamebrew.Common.MovieFilterClear(mc_but_power);
mc_but_power.mc_but_power_up.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_up.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_up.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_up.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_up.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_up.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "increase power");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
this._parent.mc_but_power_drag._x++;
if (this._parent.mc_but_power_drag._x > this._parent.mc_but_power_drag.MAX_POWER_LOC) {
this._parent.mc_but_power_drag._x = this._parent.mc_but_power_drag.MAX_POWER_LOC;
}
RefreshInfo();
};
mc_but_power.mc_but_power_down.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc_but_power.mc_but_power_down.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_down.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_down.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_down.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_down.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_down.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "decrease power");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
this._parent.mc_but_power_drag._x--;
if (this._parent.mc_but_power_drag._x < this._parent.mc_but_power_drag.MIN_POWER_LOC) {
this._parent.mc_but_power_drag._x = this._parent.mc_but_power_drag.MIN_POWER_LOC;
}
RefreshInfo();
};
mc_but_power.mc_but_power_drag.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc_but_power.mc_but_power_drag.onRollOver = _root.ButtonOver;
mc_but_power.mc_but_power_drag.onRollOut = _root.ButtonOut;
mc_but_power.mc_but_power_drag.onPress = _root.ButtonPress;
mc_but_power.mc_but_power_drag.onRelease = _root.ButtonRelease;
mc_but_power.mc_but_power_drag.onReleaseOutside = _root.ButtonReleaseOutside;
mc_but_power.mc_but_power_drag.onEnterFrame = function () {
if (this._parent._parent.was_submitted == true) {
return(undefined);
}
_root.EnterFrameRoll(this, "drag to adjust");
if ((this.is_pressed == false) || (this.is_pressed == undefined)) {
return(undefined);
}
var _local3 = {x:0, y:0};
this._parent.localToGlobal(_local3);
if (_root._xmouse < _local3.x) {
this._parent._rotation = -90;
} else if (_root._ymouse > _local3.y) {
this._parent._rotation = 0;
} else {
this._parent._rotation = com.gamebrew.Common.CalcAngleFromPoints(_local3.x, _local3.y, _root._xmouse, _root._ymouse) - 90;
}
var _local4 = com.gamebrew.Common.CalcDistance(_local3.x, _local3.y, _root._xmouse, _root._ymouse);
if (_local4 < this.MIN_POWER_LOC) {
this._x = this.MIN_POWER_LOC;
} else if (_local4 > this.MAX_POWER_LOC) {
this._x = this.MAX_POWER_LOC;
} else {
this._x = _local4;
}
RefreshInfo();
};
EnableDirButtons();
com.gamebrew.Common.MovieFilterClear(mc_but_fire);
mc_but_fire.onRollOver = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOver(this, "fire and end turn");
};
mc_but_fire.onRollOut = function () {
if (this._parent.was_submitted == true) {
return(undefined);
}
_root.ButtonRollOut(this);
};
mc_but_fire.onRelease = function () {
this._parent.StartFire(true);
};
this.was_submitted = false;
}
stop();
this.was_submitted = false;
this.val_pos = 0;
this.val_angle = 0;
this.val_power = 0;
txt_angle_old.text = "0\u00B0\n0+";
mc_but_power.mc_but_power_drag.MIN_POWER_LOC = 26;
mc_but_power.mc_but_power_drag.MAX_POWER_LOC = 97;
RefreshInfo();
DisableGrayAll();
Symbol 327 MovieClip [mc_marker] Frame 1
txt.text = this.new_text;
txt.backgroundColor = 16777113 /* 0xFFFF99 */;
txt.borderColor = 3355443 /* 0x333333 */;
txt.autoSize = "left";
txt.selectable = false;
txt._visible = false;
this.frames = 0;
this.onEnterFrame = function () {
this.frames++;
if (this.frames == 20) {
txt._visible = true;
} else if (this.frames > (20 + (txt.text.length * 4))) {
delete this.onEnterFrame;
_root[this._name].removeMovieClip();
}
};
Symbol 327 MovieClip [mc_marker] Frame 60
_root[_name].removeMovieClip();
Symbol 333 MovieClip [mc_menu] Frame 1
function Enable() {
com.gamebrew.Common.MovieFilterClear(mc_but_quit);
mc_but_quit.onRollOver = function () {
_root.ButtonRollOver(this, "had enough?");
};
mc_but_quit.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_quit.onRelease = function () {
_root.ClearTooltip();
Disable();
_root.GotoEnding("Game Over");
};
}
function Disable() {
com.gamebrew.Common.MovieFilterGrayScale(mc_but_quit);
_root.ButtonDisable(mc_but_quit);
ClearTimer(null);
}
function StartTimer() {
ClearTimer(null);
timer_secs = _root.TURN_SECS;
timer_id = setInterval(this, "UpdateTimer", 1000);
UpdateTimer();
}
function UpdateTimer() {
if (timer_secs < 0) {
return(undefined);
}
timer_secs--;
if (timer_secs == 0) {
timer_secs = -1;
if (_root.player.is_dead == true) {
ClearTimer("game over");
if (_root.game_type == 1) {
_root.sfs.disconnect();
}
} else if (_root.mc_controls.was_submitted == false) {
ClearTimer("skipping turn");
_root.mc_controls.StartFire(false);
} else {
ClearTimer("waiting for turn");
}
} else if (_root.player.is_dead == true) {
txt_secs.text = ("leaving in " + timer_secs) + " seconds";
} else if (_root.mc_controls.was_submitted == true) {
txt_secs.text = ("waiting others in " + timer_secs) + " seconds";
} else {
txt_secs.text = ("next turn in " + timer_secs) + " seconds";
}
}
function ClearTimer(str) {
if (timer_id != null) {
clearInterval(timer_id);
}
timer_id = null;
if (str != null) {
txt_secs.text = str;
}
}
stop();
timer_id = null;
timer_secs = 0;
Enable();
if (timer_start == true) {
StartTimer();
}
Symbol 339 MovieClip [mc_caption] Frame 8
txt.text = this.arg_txt;
Symbol 339 MovieClip [mc_caption] Frame 15
txt.text = this.arg_txt;
Symbol 339 MovieClip [mc_caption] Frame 40
txt.text = this.arg_txt;
Symbol 339 MovieClip [mc_caption] Frame 50
txt.text = this.arg_txt;
_root[_name].removeMovieClip();
Symbol 343 MovieClip [mc_status] Frame 1
txt.text = this.arg_txt;
Symbol 343 MovieClip [mc_status] Frame 6
txt.text = this.arg_txt;
Symbol 343 MovieClip [mc_status] Frame 40
stop();
_root[_name].removeMovieClip();
Symbol 355 MovieClip [mc_win_end] Frame 1
stop();
txt_score.text = _root.player.user.score;
if (_root.player.user == null) {
txt_name.text = "Unknown";
} else if (_root.kongregate_username != null) {
txt_name.text = _root.kongregate_username;
if (_root.player.user.score >= 3) {
txt_msg.text = "Score Automatically Submitted";
if (_root.game_type == 0) {
_root.kongregateScores.setMode("Arcade");
} else {
_root.kongregateScores.setMode("Multiplayer");
}
_root.kongregateScores.submit(_root.player.user.score);
} else {
txt_msg.text = "Score Too Low to Submit";
}
} else if (_root.host != "gamebrew.com") {
txt_name.text = _root.gb_name;
txt_msg.text = "Play on Gamebrew to Save Your Score";
} else {
txt_name.text = _root.gb_name;
if (_root.player.user.score >= 3) {
txt_msg.text = "Score Automatically Submitted";
var lc = new LocalConnection();
lc.onStatus = function (obj) {
switch (obj.level) {
case "status" :
_root.mc_win.txt_msg.text = "Your Score Has Been Submitted.";
break;
case "error" :
_root.mc_win.txt_msg.text = "Error Could Not Submit Score.";
}
};
var dat = ("&kills=" + _root.player.user.kills);
dat = dat + ("&maxcombo=" + _root.player.user.max_combo);
dat = dat + ("&rounds=" + _root.rounds);
lc.send("gbapi", "scoreSubmit", _root.player.user.score, _root.game_type, dat);
} else {
txt_msg.text = "Score Too Low to Submit";
}
}
if (arg_title == "Disconnected") {
gotoAndStop (2);
}
mc_but_scores.onRollOver = function () {
_root.ButtonRollOver(this, "");
};
mc_but_scores.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_scores.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
if (_root.kongregate_username != null) {
if (_root.game_type == 0) {
_root.getURL(_root.KONG_SCORE_URL_1P, "_blank");
} else {
_root.getURL(_root.KONG_SCORE_URL_LIVE, "_blank");
}
} else if (_root.game_type == 0) {
_root.getURL(_root.GB_SCORE_URL, "_blank");
} else {
_root.getURL(_root.GB_SCORE_URL + "/live", "_blank");
}
};
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this, "");
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.cleanSmartfox();
_root.GotoMenu();
};
Symbol 378 MovieClip [mc_win_help] Frame 1
stop();
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.EnableMainMenu();
_root.CloseWindow();
};
mc_but_next.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_next.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_next.onRelease = function () {
gotoAndStop ("help2");
com.gamebrew.Common.SoundPlay("click.wav");
};
com.gamebrew.Common.MovieFilterGrayScale(mc_but_back);
com.gamebrew.Common.MovieFilterClear(mc_but_next);
_root.ButtonDisable(mc_but_back);
Symbol 378 MovieClip [mc_win_help] Frame 10
mc_but_back.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_back.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_back.onRelease = function () {
gotoAndStop ("help1");
com.gamebrew.Common.SoundPlay("click.wav");
};
com.gamebrew.Common.MovieFilterGrayScale(mc_but_next);
com.gamebrew.Common.MovieFilterClear(mc_but_back);
_root.ButtonDisable(mc_but_next);
Symbol 385 MovieClip [mc_win_connect] Frame 1
stop();
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
delete _root.sfs.onConnection;
delete _root.sfs.onConnectionLost;
delete _root.sfs.onExtensionResponse;
delete _root.sfs.onJoinRoom;
delete this.onRelease;
_root.sfs.disconnect();
com.gamebrew.Common.MovieFilterGrayScale(this);
com.gamebrew.Common.SoundPlay("click.wav");
_root.EnableMainMenu();
_root.CloseWindow();
};
_root.mc_win.txt.text = ("Connecting to [" + _root.SERVER_IP) + "]";
_root.sfs.onConnection = function (success) {
if (!success) {
_root.mc_win.txt.text = _root.mc_win.txt.text + "\nServer unavailable try again later";
} else {
_root.mc_win.txt.text = _root.mc_win.txt.text + "\nConnection succeeded";
this.login(_root.SERVER_ZONE, _root.gb_name, _root.gb_pw);
}
};
_root.sfs.onConnectionLost = function () {
_root.mc_win.txt.text = _root.mc_win.txt.text + "\nServer unavailable try again later";
};
_root.sfs.onExtensionResponse = function (obj) {
if (obj._cmd == "logOK") {
var _local5 = obj.v;
if (_local5 != _root.SERVER_VERSION) {
trace((("Bad server version " + _local5) + " should be ") + _root.SERVER_VERSION);
delete this.onConnection;
delete this.onConnectionLost;
delete this.onExtensionResponse;
delete this.onJoinRoom;
delete this.onRelease;
this.disconnect();
com.gamebrew.Common.SoundPlay("error.wav");
_root.OpenWindow("mc_win_versioning");
return(undefined);
}
this.myUserId = obj.id;
this.myUserName = obj.nm;
} else if (obj._cmd == "logKO") {
var _local4 = com.gamebrew.Common.StringTrim(obj.err);
if (_local4.charAt(_local4.length - 1) == ".") {
_local4 = _local4.substr(0, _local4.length - 1);
}
_root.mc_win.txt.text = _root.mc_win.txt.text + (newline + _local4);
_root.mc_win.txt.scroll = _root.mc_win.txt.maxscroll - 1;
} else if (obj._cmd == "info") {
_root.mc_win.txt.text = _root.mc_win.txt.text + (newline + obj.msg);
_root.mc_win.txt.scroll = _root.mc_win.txt.maxscroll - 1;
}
};
_root.sfs.onJoinRoom = function (roomObj) {
_root.self = roomObj.getUser(this.myUserId);
this.sendXtMessage(_root.SERVER_EXT, "init", {col:_root.color_id, slot:-1}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
if (_root.mu_type == 0) {
this.onJoinRoom = function () {
delete this.onConnection;
delete this.onConnectionLost;
delete this.onExtensionResponse;
delete this.onJoinRoom;
_root.FadeOutIn(0, 0, _root.GotoMu);
};
_root.mc_win.txt.text = _root.mc_win.txt.text + "\nWaiting for an open game";
this.sendXtMessage(_root.SERVER_EXT, "joinAuto", {}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
} else if (_root.mu_type == 1) {
_root.mc_win.txt.text = _root.mc_win.txt.text + "\nOpening private game menu";
delete this.onConnection;
delete this.onConnectionLost;
delete this.onExtensionResponse;
delete this.onJoinRoom;
this.sendXtMessage(_root.SERVER_EXT, "joinTeam", {nm:""}, it.gotoandplay.smartfoxserver.SmartFoxClient.PROTOCOL_JSON);
_root.OpenWindow("mc_win_team");
}
};
_root.sfs.connect(_root.SERVER_IP, _root.SERVER_PORT);
Symbol 392 MovieClip [mc_win_versioning] Frame 1
stop();
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
delete eval (this.onRelease.Common.SoundPlay("click.wav"));
_root.EnableMainMenu();
_root.CloseWindow();
};
mc_but_gb.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_gb.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_gb.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.getURL(_root.GB_PLAY_URL, "_top");
};
Symbol 396 MovieClip [mc_win_webmasters] Frame 1
stop();
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.EnableMainMenu();
_root.CloseWindow();
};
Symbol 406 MovieClip [mc_win_credits] Frame 1
stop();
mc_but_close.onRollOver = function () {
_root.ButtonRollOver(this);
};
mc_but_close.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_close.onRelease = function () {
com.gamebrew.Common.SoundPlay("click.wav");
_root.EnableMainMenu();
_root.CloseWindow();
};
Symbol 411 MovieClip [mc_fire_ring] Frame 1
stop();
Symbol 411 MovieClip [mc_fire_ring] Frame 5
gotoAndStop (1);
Symbol 419 MovieClip [mc_turret] Frame 1
stop();
Symbol 419 MovieClip [mc_turret] Frame 2
this._parent._y++;
pt = {x:0, y:0};
this.point.localToGlobal(pt);
tpt = {x:0, y:0};
this.localToGlobal(tpt);
d = com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH);
mc = _root.attachMovie("mc_turret_fire", "mc_turret_fire" + d, d);
mc._rotation = this._rotation * (this._parent._xscale / 100);
mc._x = pt.x;
mc._y = pt.y;
d = com.gamebrew.Common.MovieGetNextDepthAt(_root, _root.GB_GAME_DEPTH);
mc = _root.attachMovie("mc_ammo", "mc_ammo_" + d, d);
mc._rotation = this._rotation * (this._parent._xscale / 100);
mc.owner = this._parent;
this._parent.ammo = mc;
mc._x = pt.x;
mc._y = pt.y;
mc.last_x = tpt.x;
mc.last_y = tpt.y;
mc.speed = com.gamebrew.Common.CalcAngle(mc._rotation);
mc.speed.x = mc.speed.x * this._parent.target_speed;
mc.speed.y = mc.speed.y * this._parent.target_speed;
mc.do_hit_dirt = false;
Symbol 419 MovieClip [mc_turret] Frame 7
this._parent._y--;
gotoAndStop (1);
Symbol 425 MovieClip Frame 1
stop();
Symbol 425 MovieClip Frame 5
gotoAndStop (1);
Symbol 431 MovieClip Frame 1
stop();
Symbol 431 MovieClip Frame 5
gotoAndPlay ("move_left");
Symbol 431 MovieClip Frame 9
gotoAndPlay ("move_right");
Symbol 435 MovieClip Frame 1
stop();
Symbol 435 MovieClip Frame 2
stop();
Symbol 435 MovieClip Frame 3
stop();
Symbol 460 MovieClip [mc_tank] Frame 1
function ProcessCommand(pos, angle, power) {
if (is_dead == true) {
return(undefined);
}
arg_pos = pos;
arg_angle = angle;
arg_power = power;
target_pos = arg_pos;
target_angle = 90 - arg_angle;
target_speed = 3 + (arg_power / 15);
target_x = _x + (pos * _root.TANK_MOVE);
ProcessMoving();
}
function ProcessMoving() {
if (current_pos == target_pos) {
ProcessFiring();
return(undefined);
}
if (_x != target_x) {
com.gamebrew.Common.SoundPlay("roll.wav");
if (_x > target_x) {
wheels.gotoAndPlay("move_left");
} else if (_x < target_x) {
wheels.gotoAndPlay("move_right");
}
}
onEnterFrame = function () {
var _local1 = false;
if (_x == target_x) {
_local1 = true;
} else if (_x > target_x) {
_x = (_x - 2);
if (_x <= target_x) {
_local1 = true;
}
} else if (_x < target_x) {
_x = (_x + 2);
if (_x >= target_x) {
_local1 = true;
}
}
if (_local1 == true) {
current_pos = target_pos;
_x = target_x;
wheels.gotoAndStop(1);
delete onEnterFrame;
ProcessFiring();
}
};
}
function ProcessFiring() {
if (turret._rotation != target_angle) {
com.gamebrew.Common.SoundPlay("turret.wav");
}
onEnterFrame = function () {
var _local1 = false;
if (turret._rotation == target_angle) {
_local1 = true;
} else if (turret._rotation > target_angle) {
turret._rotation = turret._rotation - 2;
if (turret._rotation <= target_angle) {
_local1 = true;
}
} else if (turret._rotation < target_angle) {
turret._rotation = turret._rotation + 2;
if (turret._rotation >= target_angle) {
_local1 = true;
}
}
if (_local1 == true) {
turret._rotation = target_angle;
body.gotoAndPlay("fire");
fire_ring.gotoAndPlay("fire");
turret.gotoAndPlay("fire");
delete onEnterFrame;
}
};
}
function AnimateDie() {
gotoAndPlay ("die");
}
function AnimateError() {
com.gamebrew.Common.SoundPlay("error.wav");
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 0, 0, 0);
onEnterFrame = function () {
var _local1 = transform.colorTransform.redOffset;
_local1 = _local1 - 8;
if (_local1 < 0) {
_local1 = 0;
delete onEnterFrame;
}
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local1, 0, 0, 0);
};
}
function AnimateBlock() {
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 255, 255, 0);
onEnterFrame = function () {
var _local1 = transform.colorTransform.blueOffset;
_local1 = _local1 - 32;
if (_local1 < 0) {
_local1 = 0;
delete onEnterFrame;
}
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, _local1, _local1, 0);
};
}
function AnimateBonus() {
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 255, 255, 255, 0);
onEnterFrame = function () {
var _local1 = transform.colorTransform.redOffset;
_local1 = _local1 - 24;
if (_local1 < 0) {
_local1 = 0;
delete onEnterFrame;
}
transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, _local1, _local1, _local1, 0);
};
}
function UpdateStats(str) {
_root["txt_p" + user.slot].text = user.user_name;
if (str == null) {
if (user.armor == 0) {
_root[("txt_p" + user.slot) + "k"].text = "destroyed";
} else {
_root[("txt_p" + user.slot) + "k"].text = (((("kills " + user.kills) + " score ") + user.score) + "\narmor ") + user.armor;
}
} else {
_root[("txt_p" + user.slot) + "k"].text = str;
}
var _local2 = _root[("mc_p" + user.slot) + "a"];
_local2._visible = true;
_local2.gotoAndStop(user.armor + 1);
}
function ResultNoKill(str) {
if (this == _root.player) {
_root.OpenStatus(this, str);
}
var _local3 = 0;
while (_local3 < _root.players.length) {
if (_root.players[_local3].team_id != this.team_id) {
this.user.combo = 0;
break;
}
_local3++;
}
this.ProcessResult(0, 0, 0);
}
function ResultBadKill(enemy) {
var _local3 = _root.CountEnemies();
enemy.AnimateError();
if (enemy == _root.player) {
_root.OpenCaption("Self Inflicted!");
} else {
_root.OpenCaption("Friendly Fire!");
}
if (_local3 >= 1) {
user.combo = 0;
user.score--;
if (user.score < 0) {
user.score = 0;
}
_root.OpenStatus(this, "score -1");
UpdateStats();
ProcessResult(0, -1, 0);
} else {
_root.OpenStatus(this, "bored?");
ProcessResult(0, 0, 0);
}
}
function ResultAddKill(enemy) {
var _local4 = "";
_root.ai_change_wind = true;
var _local5 = 0;
user.combo++;
if (user.combo > user.max_combo) {
user.max_combo = user.combo;
}
user.score = user.score + user.combo;
enemy.user.armor--;
if (enemy.user.armor > 0) {
enemy.UpdateStats();
if (this == _root.player) {
_local4 = _local4 + ("score +" + user.combo);
_root.OpenStatus(this, _local4);
_root.OpenCaption("Enemy Hit!");
} else if (enemy == _root.player) {
_root.OpenStatus(enemy, "damage!");
_root.OpenCaption("Armor Hit!");
}
enemy.AnimateBlock();
ProcessResult(0, user.combo, 0);
UpdateStats();
return(undefined);
}
user.kills++;
if ((user.kills >= next_armor_bonus) && (user.armor < 3)) {
user.armor++;
_local5 = 1;
next_armor_bonus = next_armor_bonus + 3;
if (this == _root.player) {
_local4 = _local4 + "armor +1\n";
com.gamebrew.Common.SoundPlay("bonus.wav");
AnimateBonus();
}
mc = _root[("mc_p" + user.slot) + "a"];
mc["a" + user.armor].gotoAndPlay("armor_bonus");
}
UpdateStats();
enemy.AnimateDie();
enemy.is_dead = true;
if (enemy.ammo == null) {
enemy.command_on = false;
}
enemy.UpdateStats("destroyed");
if (this == _root.player) {
_local4 = _local4 + ("score +" + user.combo);
_root.OpenCaption("Enemy Killed!");
_root.OpenStatus(this, _local4);
} else if (enemy == _root.player) {
_root.OpenCaption("Game Over!");
_root.OpenStatus(enemy, "dead");
_root.mc_controls.DisableGrayAll();
_root.mc_menu.ClearTimer("you have been destroyed");
}
UpdateStats();
ProcessResult(1, user.combo, _local5);
}
function ProcessResult(kill_add, score_add, hp_add) {
if (arg_pos != 0) {
user.pos = arg_pos;
}
if (arg_angle != -1) {
user.angle = arg_angle;
}
if (arg_power != -1) {
user.power = arg_power;
}
if (score_add == -1) {
user.ally_hits = 1;
}
command_on = false;
_root.sendResults();
}
stop();
command_on = true;
next_armor_bonus = 3;
target_x = 0;
type = "tank";
if (user == null) {
turret._rotation = 45;
} else {
turret._rotation = 90 - user.angle;
}
team.gotoAndStop(team_id);
UpdateStats();
if (_root.player == this) {
_root.mc_controls.SetToPlayer();
_root.mc_controls.EnableAll();
}
Symbol 460 MovieClip [mc_tank] Frame 140
stop();
if (_root.game_type == 0) {
this.is_disconnected = true;
if (_root.player == this) {
_root.AddChat("System", 0, "You have been destroyed");
_root.mc_menu.ClearTimer("game over");
_root.GotoEnding("Game Over");
}
}
Symbol 563 MovieClip [__Packages.com.gamebrew.Common] Frame 0
class com.gamebrew.Common
{
function Common () {
}
static function ArrayClean(arr) {
if (arr.length == 0) {
return(arr);
}
var _local1 = 0;
while (_local1 < arr.length) {
if (arr[_local1] == null) {
arr.splice(_local1, 1);
_local1--;
}
_local1++;
}
return(arr);
}
static function ArrayClear(arr) {
arr.length = 0;
for (var _local2 in arr) {
delete arr[_local2];
}
}
static function ArrayPushUnique(arr, obj) {
var _local2 = arr.length;
var _local1 = 0;
while (_local1 < _local2) {
if (arr[_local1] == obj) {
return(undefined);
}
_local1++;
}
arr.push(obj);
}
static function ArrayContains(arr, obj) {
if (obj == null) {
return(false);
}
var _local2 = arr.length;
var _local1 = 0;
while (_local1 < _local2) {
if (arr[_local1] == obj) {
return(true);
}
_local1++;
}
return(false);
}
static function ArrayFind(arr, obj) {
if (obj == null) {
return(-1);
}
var _local2 = arr.length;
var _local1 = 0;
while (_local1 < _local2) {
if (arr[_local1] == obj) {
return(_local1);
}
_local1++;
}
return(-1);
}
static function ArrayClone(arr) {
var _local3 = new Array();
var _local1 = 0;
while (_local1 < arr.length) {
_local3.push(arr[_local1]);
_local1++;
}
return(_local3);
}
static function EnableTextField(txtfld, bool) {
if (bool == true) {
txtfld.type = "input";
txtfld.selectable = true;
} else {
txtfld.type = "dynamic";
txtfld.selectable = false;
}
}
static function SoundQueueAdd(lib) {
if ((sound_volume == 0) || (do_mute)) {
return(undefined);
}
var _local1 = 0;
while (_local1 < sound_queue.length) {
if (sound_queue[_local1] == lib) {
return(undefined);
}
_local1++;
}
sound_queue.push(lib);
}
static function SoundQueuePlay() {
if (((sound_volume == 0) || (sound_queue.length == 0)) || (do_mute)) {
return(undefined);
}
var _local1 = 0;
while (_local1 < sound_queue.length) {
SoundPlay(sound_queue[_local1]);
sound_queue[_local1] = null;
_local1++;
}
sound_queue = new Array();
}
static function SoundQueueClear() {
sound_queue = new Array();
}
static function SoundPlay(lib, func) {
if (((lib == null) || (sound_volume == 0)) || (do_mute)) {
return(undefined);
}
var _local2 = new Sound(_root);
_local2.attachSound(lib);
_local2.setVolume(sound_volume);
if (func != null) {
_local2.onSoundComplete = func;
}
_local2.start();
return(_local2);
}
static function SoundGetVolume() {
return(sound_volume);
}
static function SoundSetVolume(vol) {
if ((sound_volume != 0) && (vol == 0)) {
sound_queue = new Array();
}
sound_volume = vol;
}
static function MusicSetArray(arr) {
music = null;
music_array = arr;
}
static function MusicSet(lib) {
music = lib;
music_array = null;
}
static function MusicPlay() {
if (music_playing != null) {
MusicStop();
}
if ((((music_volume == 0) || (do_mute)) || (do_mute_music)) || ((music == null) && (music_array == null))) {
return(undefined);
}
music_playing = new Sound(_root);
if (music != null) {
music_playing.attachSound(music);
music_playing.setVolume(music_volume);
music_playing.onSoundComplete = function () {
this.start();
};
music_playing.start();
} else {
music_array_cur = 0;
MusicPlayArray();
}
}
static function MusicPlayArray() {
if (music_playing != null) {
MusicStop();
}
if ((((music_volume == 0) || (do_mute)) || (do_mute_music)) || (music_array == null)) {
return(undefined);
}
music_playing = new Sound(_root);
music_playing.attachSound(music_array[music_array_cur++]);
music_playing.setVolume(music_volume);
if (music_array_cur == music_array.length) {
music_playing.onSoundComplete = function () {
this.start();
};
} else {
music_playing.onSoundComplete = function () {
com.gamebrew.Common.MusicPlayArray();
};
}
music_playing.start();
}
static function MusicStop() {
music_playing.onSoundComplete = null;
music_playing.stop();
delete music_playing;
music_playing = null;
}
static function MusicGetVolume() {
return(music_volume);
}
static function MusicSetVolume(vol) {
music_volume = vol;
if (music_playing != null) {
music_playing.setVolume(music_volume);
}
}
static function MusicGetMute() {
return(do_mute_music);
}
static function MusicSetMute(bool) {
do_mute_music = bool;
if (bool == true) {
MusicStop();
} else {
MusicPlay();
}
}
static function MuteSet(bool) {
if (bool == true) {
do_mute = true;
MusicStop();
SoundQueueClear();
_root.globalvolume = new Sound(_root);
_root.globalvolume.setVolume(0);
} else {
do_mute = false;
_root.globalvolume = new Sound(_root);
_root.globalvolume.setVolume(100);
MusicPlay();
}
}
static function MuteGet() {
return(do_mute);
}
static function SetCookie(nm, key, val) {
var _local1 = SharedObject.getLocal(nm);
_local1.data[key] = val;
_local1.flush();
}
static function GetCookie(nm, key, def) {
var _local2 = SharedObject.getLocal(nm);
var _local1 = _local2.data[key];
if (((_local1 == "") || (_local1 == undefined)) || (_local1 == null)) {
return(def);
}
return(_local1);
}
static function GetQueryString() {
var _local6 = _root._url;
var _local5 = new Object();
var _local4 = _local6.substring(_local6.lastIndexOf("?") + 1, _local6.length).split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
if (_local3[0].length == 0) {
} else {
_local5[_local3[0]] = _local3[1];
}
_local2++;
}
return(_local5);
}
static function GetHost() {
var _local5 = _root._url.split("/");
var _local4 = _local5[2].toLowerCase();
var _local3 = _local4.split(".");
var _local2 = _local3.length;
if (_local2 >= 3) {
_local4 = (_local3[_local2 - 2] + ".") + _local3[_local2 - 1];
}
return(_local4);
}
static function ProtectUrl(domains) {
var _local5 = GetHost();
var _local4 = false;
var _local2 = 0;
while (_local2 < domains.length) {
var _local1 = domains[_local2];
if (_local1.indexOf("www.") == 0) {
_local1 = _local1.substr(4);
}
if (_local5 == _local1) {
_local4 = true;
break;
}
_local2++;
}
return(_local4);
}
static function GetUrlPath() {
var _local2 = _root._url;
_local2 = _local2.substr(0, _local2.lastIndexOf("/"));
return(_local2);
}
static function DrawRectangle(bd, c, x, y, w, h) {
var _local1 = x;
while (_local1 < (x + w)) {
bd.setPixel(_local1, y, c);
bd.setPixel(_local1, (y + h) - 1, c);
_local1++;
}
_local1 = y;
while (_local1 < (y + h)) {
bd.setPixel(x, _local1, c);
bd.setPixel((x + w) - 1, _local1, c);
_local1++;
}
}
static function FillRectangle(bd, c, x, y, w, h) {
bd.fillRect(new flash.geom.Rectangle(x, y, w, h), c);
}
static function DrawHLine(bd, c, x, y, w) {
var _local1 = x;
while (_local1 < (x + w)) {
bd.setPixel(_local1, y, c);
_local1++;
}
}
static function DrawVLine(bd, c, x, y, h) {
var _local1 = y;
while (_local1 < (y + h)) {
bd.setPixel(x, _local1, c);
_local1++;
}
}
static function DataFillRectangle(a, aw, ah, c, x, y, w, h) {
var _local2 = y;
while (_local2 < (y + h)) {
if ((_local2 < 0) || (_local2 >= ah)) {
} else {
var _local1 = x;
while (_local1 < (x + w)) {
if ((_local1 < 0) || (_local1 >= aw)) {
} else {
a[_local1 + (_local2 * aw)] = c;
}
_local1++;
}
}
_local2++;
}
}
static function DataCopyRectangle(ta, taw, tah, tx, ty, sa, saw, sah, sx, sy, sw, sh) {
var _local3 = 0;
while (_local3 < sh) {
var _local4 = _local3 + ty;
if ((_local4 >= tah) || (_local4 < 0)) {
} else {
var _local1 = 0;
while (_local1 < sw) {
var _local2 = _local1 + tx;
if ((_local2 >= taw) || (_local2 < 0)) {
} else {
ta[_local2 + (_local4 * taw)] = sa[(_local1 + sx) + ((_local3 + sy) * saw)];
}
_local1++;
}
}
_local3++;
}
}
static function GetFps() {
if (fps_signal == true) {
fps_time = getTimer();
} else {
fps_tempo = int(1000 / (getTimer() - fps_time));
}
fps_signal = !fps_signal;
return(fps_tempo);
}
static function NumberConfine(val, min, max) {
if (val < min) {
val = min;
} else if (val > max) {
val = max;
}
return(val);
}
static function NumberComma(n) {
var _local4 = n.toString();
var _local3 = _local4.split(".");
var _local1 = "";
var _local2 = _local3[0].length;
while (_local2--) {
if ((_local2 < (_local3[0].length - 1)) && ((((_local3[0].length - _local2) - 1) % 3) == 0)) {
_local1 = "," + _local1;
}
_local1 = _local3[0].substr(_local2, 1) + _local1;
}
if (_local3.length > 1) {
_local1 = _local1 + ("." + _local3[1]);
}
return(_local1);
}
static function NumberColor(r, g, b) {
if (r > 255) {
r = 255;
} else if (r < 0) {
r = 0;
}
if (g > 255) {
g = 255;
} else if (g < 0) {
g = 0;
}
if (b > 255) {
b = 255;
} else if (b < 0) {
b = 0;
}
return(((4278190080 | (r << 16)) | (g << 8)) | b);
}
static function NumberColorHex(r, g, b) {
return((("#" + r.toString(16)) + g.toString(16)) + b.toString(16));
}
static function RandomInteger(min, max) {
if ((min == max) || (max < min)) {
return(min);
}
return(int(Math.random() * ((max - min) + 1)) + min);
}
static function RandomNumber(min, max) {
if ((min == max) || (max < min)) {
return(min);
}
return((Math.random() * ((max - min) + 1)) + min);
}
static function RandomBit() {
return(int(Math.random() * 2));
}
static function StringUpperCaseFirst(str) {
return(str.substring(0, 1).toUpperCase() + str.substring(1, str.length));
}
static function StringReplace(str, pattern, replacement) {
return(str.split(pattern).join(replacement));
}
static function StringTrimLeft(s) {
var _local4 = 9;
var _local3 = 10;
var _local5 = 13;
var _local6 = 32;
var _local1 = 0;
while ((((s.charCodeAt(_local1) == _local6) || (s.charCodeAt(_local1) == _local5)) || (s.charCodeAt(_local1) == _local3)) || (s.charCodeAt(_local1) == _local4)) {
_local1++;
}
return(s.substring(_local1, s.length));
}
static function StringTrimLeftChar(s, char) {
var _local3 = char.charCodeAt(0);
var _local1 = 0;
while (s.charCodeAt(_local1) == _local3) {
_local1++;
}
return(s.substring(_local1, s.length));
}
static function StringTrimRight(s) {
var _local4 = 9;
var _local3 = 10;
var _local5 = 13;
var _local6 = 32;
var _local1 = s.length - 1;
while ((((s.charCodeAt(_local1) == _local6) || (s.charCodeAt(_local1) == _local5)) || (s.charCodeAt(_local1) == _local3)) || (s.charCodeAt(_local1) == _local4)) {
_local1--;
}
return(s.substring(0, _local1 + 1));
}
static function StringTrimRightChar(s, char) {
var _local3 = char.charCodeAt(0);
var _local1 = s.length - 1;
while (s.charCodeAt(_local1) == _local3) {
_local1--;
}
return(s.substring(0, _local1 + 1));
}
static function StringTrim(s) {
return(StringTrimRight(StringTrimLeft(s)));
}
static function StringTrimChar(s, char) {
return(StringTrimRightChar(StringTrimLeftChar(s, char), char));
}
static function StringContains(str, strfind) {
return(str.indexOf(strfind) >= 0);
}
static function StringStartsWith(str, strfind) {
return(str.indexOf(strfind) == 0);
}
static function StringEndsWith(str, strfind) {
return(str.lastIndexOf(strfind) == (str.length - strfind.length));
}
static function StringNumberRank(amt) {
var _local1 = amt;
if ((amt >= 4) && (amt <= 20)) {
return(_local1 + "th");
}
var _local2 = _local1.charAt(_local1.length - 1);
if (_local2 == 1) {
_local1 = _local1 + "st";
} else if (_local2 == 2) {
_local1 = _local1 + "nd";
} else if (_local2 == 3) {
_local1 = _local1 + "rd";
} else {
_local1 = _local1 + "th";
}
return(_local1);
}
static function StringPadNumber(num, sz) {
var _local2 = "" + num;
var _local1 = 0;
while (_local1 < sz) {
_local2 = "0" + _local2;
_local1++;
}
return(_local2.substr(-sz, sz));
}
static function RectangleGetCenter(rect) {
return(new flash.geom.Point(rect.x + (rect.width / 2), rect.y + (rect.height / 2)));
}
static function CalcDistance(x1, y1, x2, y2) {
var _local1 = x2 - x1;
var _local2 = y2 - y1;
return(Math.sqrt((_local1 * _local1) + (_local2 * _local2)));
}
static function CalcToRadians(angle) {
return(angle * (Math.PI/180));
}
static function CalcToDegrees(rads) {
return(rads * 57.2957795130823);
}
static function CalcAngle(angle) {
var _local2 = CalcToRadians(angle - 90);
var _local1 = new Object();
_local1.x = Math.cos(_local2);
_local1.y = Math.sin(_local2);
return(_local1);
}
static function CalcAngleDistance(angle, tgt_angle) {
angle = angle % 360;
tgt_angle = tgt_angle % 360;
if (tgt_angle < 0) {
tgt_angle = tgt_angle + 360;
}
var _local1 = tgt_angle - angle;
if (_local1 > 180) {
_local1 = _local1 - 360;
} else if (_local1 < -180) {
_local1 = _local1 + 360;
}
return(_local1);
}
static function CalcAngleFromPoints(x1, y1, x2, y2) {
var _local3 = x2 - x1;
var _local2 = y2 - y1;
var _local1 = 0;
if (_local3 == 0) {
if (_local2 == 0) {
_local1 = 0;
} else if (_local2 > 0) {
_local1 = (Math.PI/2);
} else {
_local1 = 4.71238898038469;
}
} else if (_local2 == 0) {
if (_local3 > 0) {
_local1 = 0;
} else {
_local1 = Math.PI;
}
} else if (_local3 < 0) {
_local1 = Math.atan(_local2 / _local3) + Math.PI;
} else if (_local2 < 0) {
_local1 = Math.atan(_local2 / _local3) + (Math.PI*2);
} else {
_local1 = Math.atan(_local2 / _local3);
}
return(((_local1 * 57.2957795130823) + 90) % 360);
}
static function CalcAngleShoot(angle, sx, sy, dist) {
var _local1 = CalcAngle(angle);
_local1.x = sx + (_local1.x * dist);
_local1.y = sy + (_local1.y * dist);
return(_local1);
}
static function CalcTarget(sx, sy, tx, ty) {
var _local4 = new Object();
var _local1;
var _local3 = tx - sx;
var _local2 = ty - sy;
if (_local3 == 0) {
if (_local2 == 0) {
_local1 = 0;
} else if (_local2 > 0) {
_local1 = (Math.PI/2);
} else {
_local1 = 4.71238898038469;
}
} else if (_local2 == 0) {
if (_local3 > 0) {
_local1 = 0;
} else {
_local1 = Math.PI;
}
} else if (_local3 < 0) {
_local1 = Math.atan(_local2 / _local3) + Math.PI;
} else if (_local2 < 0) {
_local1 = Math.atan(_local2 / _local3) + (Math.PI*2);
} else {
_local1 = Math.atan(_local2 / _local3);
}
_local4.x = Math.cos(_local1);
_local4.y = Math.sin(_local1);
return(_local4);
}
static function CalcTargetShoot(sx, sy, tx, ty, dist) {
var _local1 = CalcTarget(sx, sy, tx, ty);
_local1.x = sx + (_local1.x * dist);
_local1.y = sy + (_local1.y * dist);
return(_local1);
}
static function MovieDrawCircle(mc, col, r, x, y) {
var _local6 = r * 0.414213562373095;
var _local5 = (r * Math.SQRT2) / 2;
mc.lineStyle(0, col);
mc.moveTo(x + r, y);
mc.curveTo(x + r, y + _local6, x + _local5, y + _local5);
mc.curveTo(x + _local6, y + r, x, y + r);
mc.curveTo(x - _local6, y + r, x - _local5, y + _local5);
mc.curveTo(x - r, y + _local6, x - r, y);
mc.curveTo(x - r, y - _local6, x - _local5, y - _local5);
mc.curveTo(x - _local6, y - r, x, y - r);
mc.curveTo(x + _local6, y - r, x + _local5, y - _local5);
mc.curveTo(x + r, y - _local6, x + r, y);
}
static function MovieFillCircle(mc, col, r, x, y) {
var _local6 = r * 0.414213562373095;
var _local5 = (r * Math.SQRT2) / 2;
mc.beginFill(col, 100);
mc.moveTo(x + r, y);
mc.curveTo(x + r, y + _local6, x + _local5, y + _local5);
mc.curveTo(x + _local6, y + r, x, y + r);
mc.curveTo(x - _local6, y + r, x - _local5, y + _local5);
mc.curveTo(x - r, y + _local6, x - r, y);
mc.curveTo(x - r, y - _local6, x - _local5, y - _local5);
mc.curveTo(x - _local6, y - r, x, y - r);
mc.curveTo(x + _local6, y - r, x + _local5, y - _local5);
mc.curveTo(x + r, y - _local6, x + r, y);
mc.endFill();
}
static function MovieDrawRectangle(mc, col, x1, y1, x2, y2) {
mc.lineStyle(0, col);
mc.moveTo(x1, y1);
mc.lineTo(x2, y1);
mc.lineTo(x2, y2);
mc.lineTo(x1, y2);
mc.lineTo(x1, y1);
}
static function MovieFillRectangle(mc, col, x1, y1, x2, y2, alpha) {
mc.beginFill(col, ((alpha == null) ? 100 : (alpha)));
mc.moveTo(x1, y1);
mc.lineTo(x2, y1);
mc.lineTo(x2, y2);
mc.lineTo(x1, y2);
mc.lineTo(x1, y1);
mc.endFill();
}
static function MovieGetNextDepthAt(mv, group) {
var _local1 = group;
var _local2 = _local1 + 99999;
while (_local1 < _local2) {
if (mv.getInstanceAtDepth(_local1) == undefined) {
return(_local1);
}
_local1++;
}
}
static function MovieGetPrevDepthAt(mv, group) {
var _local1 = group - 1;
while (_local1 > 0) {
if (mv.getInstanceAtDepth(_local1) == undefined) {
return(_local1);
}
_local1--;
}
trace(((("MovieGetPrevDepthAt(" + mv) + ",") + group) + ") ERROR");
return(-1);
}
static function MovieGetNextDepthAtInterval(mv, group, intv) {
var _local1 = group;
if (intv > 0) {
var _local4 = _local1 + 99999;
while (_local1 < _local4) {
if (mv.getInstanceAtDepth(_local1) == undefined) {
return(_local1);
}
_local1 = _local1 + intv;
}
} else {
var _local4 = _local1 - 99999;
while (_local1 > _local4) {
if (mv.getInstanceAtDepth(_local1) == undefined) {
return(_local1);
}
_local1 = _local1 + intv;
}
}
}
static function MovieYSortDepthAt(mv, group) {
var _local1 = group;
var _local5 = group + 99999;
var _local3 = new Array();
while (_local1 < _local5) {
var _local2 = mv.getInstanceAtDepth(_local1);
if (_local2 == undefined) {
break;
}
_local3.push(_local2);
_local1++;
}
_local3.sort(_MovieYSortDepthAt);
_local1 = 0;
while (_local1 < _local3.length) {
_local3[_local1].swapDepths(group + _local1);
_local1++;
}
return(_local3);
}
static function _MovieYSortDepthAt(a, b) {
return(a._y < b._y);
}
static function MovieFilterGrayScale(mv) {
MovieFilterClear(mv);
var _local1 = [0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0.33, 0.33, 0.33, 0, 0, 0, 0, 0, 1, 0];
var _local2 = new flash.filters.ColorMatrixFilter(_local1);
mv.filters = [_local2];
}
static function MovieFilterClear(mv) {
mv.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mv.filters = null;
}
static function MovieCountClips(mv) {
var _local2 = 0;
for (var _local3 in mv) {
if (mv[_local3] instanceof MovieClip) {
_local2++;
}
}
return(_local2);
}
static function MovieRemoveAll(mv) {
for (var _local2 in mv) {
if (mv[_local2] instanceof MovieClip) {
removeMovieClip(mv[_local2]);
}
}
}
static function MovieRecursiveStop(mv) {
for (var _local2 in mv) {
if (mv[_local2] instanceof MovieClip) {
mv[_local2].stop();
MovieRecursiveStop(mv[_local2]);
}
}
}
static function MovieRecursivePlay(mv) {
for (var _local2 in mv) {
if (mv[_local2] instanceof MovieClip) {
mv[_local2].play();
MovieRecursivePlay(mv[_local2]);
}
}
}
static function MovieRemoveAllExcept(mv, nms) {
for (var _local5 in mv) {
if (mv[_local5] instanceof MovieClip) {
var _local3 = false;
var _local1 = 0;
while (_local1 < nms.length) {
if (nms[_local1] == mv[_local5]._name) {
_local3 = true;
break;
}
_local1++;
}
if (_local3 == false) {
removeMovieClip(mv[_local5]);
}
}
}
}
static function MovieRemoveStartsWith(mv, st) {
for (var _local2 in mv) {
if (mv[_local2] instanceof MovieClip) {
if (StringStartsWith(mv[_local2]._name, st)) {
removeMovieClip(mv[_local2]);
}
}
}
}
static function MovieGetRectangle(mv_relation, mv) {
var _local1 = mv.getRect();
var _local2 = {x:_local1.xMin, y:_local1.yMin};
mv_relation.localToGlobal(_local2);
var _local3 = new flash.geom.Rectangle(_local2.x, _local2.y, (_local1.xMax - _local1.xMin) + 1, (_local1.yMax - _local1.yMin) + 1);
return(_local3);
}
static function MovieTraceAll(mv) {
var _local3 = 0;
for (var _local2 in mv) {
if (mv[_local2] instanceof MovieClip) {
trace(mv[_local2]);
}
}
return(_local3);
}
static function DateToSeconds(dt) {
if (dt == null) {
dt = new Date();
}
return(dt.valueOf() / 1000);
}
static function TextFieldSelectColor(txt, bgColor) {
var _local1 = txt.textColor;
var _local11 = _local1 & 255;
var _local5 = bgColor & 255;
var _local13 = int(((_local5 - _local11) * 100) / 255);
bgColor = bgColor >> 8;
_local1 = _local1 >> 8;
var _local8 = _local1 & 255;
var _local7 = bgColor & 255;
var _local9 = int(((_local7 - _local8) * 100) / 255);
bgColor = bgColor >> 8;
_local1 = _local1 >> 8;
var _local10 = _local1 & 255;
var _local6 = bgColor & 255;
var _local12 = int(((_local6 - _local10) * 100) / 255);
var _local4 = new Color(txt);
_local4.setTransform({ra:_local12, rb:_local10, ga:_local9, gb:_local8, ba:_local13, bb:_local11});
txt.textColor = 0;
if (txt.background) {
txt.backgroundColor = 16777215 /* 0xFFFFFF */;
}
}
static var SCORE_CGI = "http://gamebrew.com/process/muscore.php";
static var music = null;
static var music_array = null;
static var music_array_cur = 0;
static var music_playing = null;
static var sound_queue = new Array();
static var sound_volume = 100;
static var music_volume = 100;
static var do_mute = false;
static var do_mute_music = false;
static var fps_signal = false;
static var fps_time = 0;
static var fps_tempo = 0;
}
Symbol 564 MovieClip [__Packages.it.gotoandplay.smartfoxserver.SmartFoxClient] Frame 0
class it.gotoandplay.smartfoxserver.SmartFoxClient extends XMLSocket
{
var objRef, os, isConnected, debug, arrayTags, messageHandlers, httpConnection, onConnect, onData, onXML, onClose, fpMajorVersion, pollingDelayFn, roomList, buddyList, myBuddyVars, activeRoomId, myUserId, myUserName, playerId, changingRoom, amIModerator, configLoader, onConfigLoadFailure, ipAddress, blueBoxIpAddress, port, onConfigLoadSuccess, onBuddyListUpdate, onBuddyList, t1, socketConnectionTimeoutThread, onConnection, onConnectionLost, close;
function SmartFoxClient (objRef) {
super();
this.objRef = objRef;
os = it.gotoandplay.smartfoxserver.ObjectSerializer.getInstance();
isConnected = false;
debug = false;
initialize();
arrayTags = {uLs:true, rmList:true, vars:true, bList:true, vs:true, mv:true};
messageHandlers = new Object();
httpConnection = new it.gotoandplay.smartfoxserver.http.HttpConnection(mx.utils.Delegate.create(this, handleHttpConnect), mx.utils.Delegate.create(this, handleHttpClose), mx.utils.Delegate.create(this, handleHttpData), mx.utils.Delegate.create(this, handleHttpError));
onConnect = connectionEstablished;
onData = gotData;
onXML = xmlReceived;
onClose = connectionClosed;
fpMajorVersion = getFpMajorVersion();
if (fpMajorVersion < 8) {
pollingDelayFn = _global.setInterval;
} else {
pollingDelayFn = _global.setTimeout;
}
setupMessageHandlers();
}
function get httpPollSpeed() {
return(_httpPollSpeed);
}
function set httpPollSpeed(sp) {
if ((sp >= MIN_POLL_SPEED) && (sp <= MAX_POLL_SPEED)) {
_httpPollSpeed = sp;
}
//return(httpPollSpeed);
}
function getFpMajorVersion() {
var _local1 = System.capabilities.version.indexOf(",");
return(Number(System.capabilities.version.substr(_local1 - 1, 1)));
}
function initialize(isLogout) {
if (isLogout == undefined) {
isLogout = false;
}
roomList = {};
buddyList = [];
myBuddyVars = [];
activeRoomId = null;
myUserId = null;
myUserName = "";
playerId = null;
changingRoom = false;
amIModerator = false;
if (!isLogout) {
isConnected = false;
isHttpMode = false;
preConnection = true;
}
}
function loadConfig(configFile, autoConnect) {
if (configFile == undefined) {
configFile = DEFAULT_CONFIG_FILE;
}
if (autoConnect == undefined) {
autoConnectOnConfigSuccess = DEFAULT_AUTO_CONNECT;
} else {
autoConnectOnConfigSuccess = autoConnect;
}
configLoader = new XML();
configLoader.ignoreWhite = true;
configLoader.onLoad = mx.utils.Delegate.create(this, onConfigLoadSucceeded);
configLoader.load(configFile);
}
function onConfigLoadSucceeded(ok) {
if (!ok) {
onConfigLoadFailure("Could not load config file!");
return(undefined);
}
var _local6 = configLoader.childNodes[0].childNodes;
var _local4 = 0;
while (_local4 < _local6.length) {
var _local5 = _local6[_local4];
var _local2 = _local5.nodeName.toLowerCase();
var _local3 = _local5.firstChild.nodeValue;
if (_local2 == "ip") {
ipAddress = (blueBoxIpAddress = _local3);
} else if (_local2 == "port") {
port = Number(_local3);
} else if (_local2 == "zone") {
defaultZone = _local3;
} else if (_local2 == "smartconnect") {
smartConnect = ((_local3 == "true") ? true : false);
} else if (_local2 == "blueboxipaddress") {
blueBoxIpAddress = _local3;
} else if (_local2 == "blueboxport") {
blueBoxPort = _local3;
} else if (_local2 == "debug") {
debug = ((_local3 == "true") ? true : false);
} else if (_local2 == "httpport") {
httpPort = Number(_local3);
} else if (_local2 == "httppollspeed") {
httpPollSpeed = (Number(_local3));
} else if (_local2 == "socketconnectiontimeout") {
socketConnectionTimeout = Number(_local3);
} else if (_local2 == "rawprotocolseparator") {
rawProtocolSeparator = _local3;
}
_local4++;
}
if (autoConnectOnConfigSuccess) {
connect(ipAddress, port);
} else {
onConfigLoadSuccess();
}
}
function onConfigLoadFailed(code) {
if (code == 404) {
onConfigLoadFailure("Could not find configuration file.");
} else {
onConfigLoadFailure("Could not load configuration file. Http status = " + code);
}
}
function getVersion() {
return((((majVersion + ".") + minVersion) + ".") + subVersion);
}
function connected() {
return(isConnected);
}
function getConnectionMode() {
var _local2 = CONNECTION_MODE_DISCONNECTED;
if (isConnected) {
if (isHttpMode) {
_local2 = CONNECTION_MODE_HTTP;
} else {
_local2 = CONNECTION_MODE_SOCKET;
}
}
return(_local2);
}
function setupMessageHandlers() {
addMessageHandler("sys", handleSysMessages);
addMessageHandler("xt", handleExtensionMessages);
}
function addMessageHandler(handlerId, handlerMethod) {
if (messageHandlers[handlerId] == undefined) {
messageHandlers[handlerId] = new Object();
messageHandlers[handlerId].handleMessage = handlerMethod;
} else {
trace(("Warning: [" + handlerId) + "] handler could not be created. A handler with this name already exist!");
}
}
function isModerator() {
return(amIModerator);
}
function handleSysMessages(xmlObj, scope) {
var _local9 = xmlObj.attributes.action;
var _local20 = xmlObj.attributes.r;
if (_local9 == "apiOK") {
scope.isConnected = true;
scope.onConnection(true);
} else if (_local9 == "apiKO") {
scope.onConnection(false);
trace("--------------------------------------------------------");
trace(" WARNING! The API you are using are not compatible with ");
trace(" the SmartFoxServer instance you're trying to connect to");
trace("--------------------------------------------------------");
} else if (_local9 == "logOK") {
scope.myUserId = xmlObj.login.attributes.id;
scope.myUserName = xmlObj.login.attributes.n;
scope.amIModerator = ((xmlObj.login.attributes.mod == "0") ? false : true);
scope.onLogin({success:true, name:scope.myUserName, error:""});
scope.getRoomList();
} else if (_local9 == "logKO") {
var _local62 = xmlObj.login.attributes.e;
scope.onLogin({success:false, name:"", error:_local62});
} else if (_local9 == "logout") {
scope.initialize(true);
scope.onLogout();
} else if (_local9 == "rmList") {
var _local10 = xmlObj.rmList.rmList;
scope.roomList = new Array();
for (var _local43 in _local10) {
var _local6 = _local10[_local43].attributes.id;
var _local2 = _local10[_local43].attributes;
var _local4 = _local2.id;
var _local22 = _local10[_local43].n.value;
var _local23 = Number(_local2.maxu);
var _local24 = Number(_local2.maxs);
var _local66 = (_local2.temp ? true : false);
var _local54 = (_local2.game ? true : false);
var _local30 = (_local2.priv ? true : false);
var _local31 = Number(_local2.ucnt);
var _local25 = Number(_local2.scnt);
var _local71 = (_local2.lmb ? true : false);
scope.roomList[_local6] = new it.gotoandplay.smartfoxserver.Room(_local4, _local22, _local23, _local24, _local66, _local54, _local30);
scope.roomList[_local6].userCount = _local31;
scope.roomList[_local6].specCount = _local25;
scope.roomList[_local6].setIsLimbo(_local71);
var _local3 = _local10[_local43].vars.vars;
var _local37 = 0;
while (_local37 < _local3.length) {
var _local28 = _local3[_local37].attributes.n;
var _local12 = _local3[_local37].attributes.t;
var _local11 = _local3[_local37].value;
var _local13;
if (_local12 == "b") {
_local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
_local13 = Number;
} else if (_local12 == "s") {
_local13 = String;
} else if (_local12 == "x") {
_local13 = function (x) {
return(null);
};
}
scope.roomList[_local6].variables[_local28] = _local13(_local11);
_local37++;
}
}
scope.onRoomListUpdate(scope.roomList);
} else if (_local9 == "joinOK") {
var _local49 = xmlObj.uLs.attributes.r;
var _local7 = xmlObj.uLs.uLs;
var _local16 = xmlObj.vars.vars;
scope.activeRoomId = Number(_local49);
var _local50 = scope.roomList[_local49];
_local50.userList = new Object();
scope.playerId = xmlObj.pid.attributes.id;
_local50.setMyPlayerIndex(xmlObj.pid.attributes.id);
_local50.variables = new Object();
var _local37 = 0;
while (_local37 < _local16.length) {
var _local28 = _local16[_local37].attributes.n;
var _local12 = _local16[_local37].attributes.t;
var _local11 = _local16[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local50.variables[_local28] = _local13(_local11);
_local37++;
}
var _local72 = 0;
var _local59 = 0;
var _local43 = 0;
while (_local43 < _local7.length) {
var _local22 = _local7[_local43].n.value;
var _local4 = _local7[_local43].attributes.i;
var _local63 = _local7[_local43].attributes.m;
var _local75 = _local7[_local43].attributes.s;
var _local51 = _local7[_local43].attributes.p;
_local50.userList[_local4] = new it.gotoandplay.smartfoxserver.User(_local4, _local22);
_local50.userList[_local4].isMod = ((_local63 == "1") ? true : false);
_local50.userList[_local4].isSpec = ((_local75 == "1") ? true : false);
_local50.userList[_local4].pid = ((_local51 == undefined) ? -1 : _local51);
if (_local50.isGame() && (_local75 == "1")) {
_local59++;
} else {
_local72++;
}
var _local14 = _local7[_local43].vars.vars;
_local50.userList[_local4].variables = {};
var _local41 = _local50.userList[_local4].variables;
_local37 = 0;
while (_local37 < _local14.length) {
var _local28 = _local14[_local37].attributes.n;
var _local12 = _local14[_local37].attributes.t;
var _local11 = _local14[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local41[_local28] = _local13(_local11);
_local37++;
}
_local43++;
}
_local50.userCount = _local72;
_local50.specCount = _local59;
scope.changingRoom = false;
scope.onJoinRoom(scope.roomList[_local49]);
} else if (_local9 == "joinKO") {
scope.changingRoom = false;
var _local65 = xmlObj.error.attributes.msg;
scope.onJoinRoomError(_local65);
} else if (_local9 == "uER") {
var _local69 = xmlObj.u.attributes.i;
var _local64 = xmlObj.u.n.value;
var _local63 = xmlObj.u.attributes.m;
var _local75 = xmlObj.u.attributes.s;
var _local51 = xmlObj.u.attributes.p;
var _local50 = scope.roomList[_local20];
_local50.userList[_local69] = new it.gotoandplay.smartfoxserver.User(_local69, _local64);
_local50.userList[_local69].isMod = ((_local63 == "1") ? true : false);
_local50.userList[_local69].isSpec = ((_local75 == "1") ? true : false);
_local50.userList[_local69].pid = ((_local51 == undefined) ? -1 : _local51);
if (_local50.isGame() && (_local75 == "1")) {
_local50.specCount++;
} else {
_local50.userCount++;
}
var _local14 = xmlObj.u.vars.vars;
_local50.userList[_local69].variables = {};
var _local41 = _local50.userList[_local69].variables;
var _local37 = 0;
while (_local37 < _local14.length) {
var _local28 = _local14[_local37].attributes.n;
var _local12 = _local14[_local37].attributes.t;
var _local11 = _local14[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
} else if (_local12 == "x") {
var _local13 = function (x) {
return(null);
};
}
_local41[_local28] = _local13(_local11);
_local37++;
}
scope.onUserEnterRoom(_local20, _local50.userList[_local69]);
} else if (_local9 == "userGone") {
var _local69 = xmlObj.user.attributes.id;
var _local50 = scope.roomList[_local20];
var _local64 = _local50.userList[_local69].name;
var _local75 = _local50.userList[_local69].isSpec;
delete _local50.userList[_local69];
if (_local50.isGame() && _local75) {
_local50.specCount--;
} else {
_local50.userCount--;
}
scope.onUserLeaveRoom(_local20, _local69, _local64);
} else if (_local9 == "pubMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47.toString());
scope.onPublicMessage(_local47.toString(), scope.roomList[_local20].userList[_local69], _local20);
} else if (_local9 == "prvMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onPrivateMessage(_local47.toString(), scope.roomList[_local20].userList[_local69], _local69, _local20);
} else if (_local9 == "dmnMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onAdminMessage(_local47.toString(), scope.roomList[_local20].userList[_local69]);
} else if (_local9 == "modMsg") {
var _local69 = xmlObj.user.attributes.id;
var _local47 = xmlObj.txt.value;
_local47 = scope.os.decodeEntities(_local47);
scope.onModeratorMessage(_local47.toString(), scope.roomList[_local20].userList[_local69]);
} else if (_local9 == "dataObj") {
var _local73 = xmlObj.user.attributes.id;
var _local60 = xmlObj.dataObj.value;
var _local61 = scope.os.deserialize(_local60);
scope.onObjectReceived(_local61, scope.roomList[_local20].userList[_local73]);
} else if (_local9 == "uVarsUpdate") {
var _local69 = xmlObj.user.attributes.id;
var _local15 = xmlObj.vars.vars;
var _local33 = scope.roomList[_local20].userList[_local69];
if (_local33.variables == undefined) {
_local33.variables = {};
}
var _local34 = [];
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
_local34.push(_local28);
_local34[_local28] = true;
if (_local12 == "x") {
delete _local33.variables[_local28];
} else {
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local33.variables[_local28] = _local13(_local11);
}
_local37++;
}
scope.onUserVariablesUpdate(_local33, _local34);
} else if (_local9 == "rVarsUpdate") {
var _local15 = xmlObj.vars.vars;
var _local50 = scope.roomList[_local20];
var _local34 = [];
if (_local50.variables == undefined) {
_local50.variables = new Object();
}
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
_local34.push(_local28);
_local34[_local28] = true;
if (_local12 == "x") {
delete _local50.variables[_local28];
} else {
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local50.variables[_local28] = _local13(_local11);
}
_local37++;
}
scope.onRoomVariablesUpdate(_local50, _local34);
} else if (_local9 == "createRmKO") {
var _local62 = xmlObj.room.attributes.e;
scope.onCreateRoomError(_local62);
} else if (_local9 == "uCount") {
var _local72 = xmlObj.attributes.u;
var _local59 = xmlObj.attributes.s;
var _local44 = scope.roomList[_local20];
_local44.userCount = Number(_local72);
_local44.specCount = Number(_local59);
scope.onUserCountChange(_local44);
} else if (_local9 == "roomAdd") {
var _local38 = xmlObj.rm.attributes;
var _local52 = _local38.id;
var _local67 = xmlObj.rm.name.value;
var _local74 = Number(_local38.max);
var _local58 = Number(_local38.spec);
var _local66 = (_local38.temp ? true : false);
var _local54 = (_local38.game ? true : false);
var _local68 = (_local38.priv ? true : false);
var _local71 = (_local38.limbo ? true : false);
var _local36 = new it.gotoandplay.smartfoxserver.Room(_local52, _local67, _local74, _local58, _local66, _local54, _local68);
_local36.setIsLimbo(_local71);
scope.roomList[_local52] = _local36;
var _local15 = xmlObj.rm.vars.vars;
_local36.variables = new Object();
var _local37 = 0;
while (_local37 < _local15.length) {
var _local28 = _local15[_local37].attributes.n;
var _local12 = _local15[_local37].attributes.t;
var _local11 = _local15[_local37].value;
if (_local12 == "b") {
var _local13 = Boolean;
_local11 = Number(_local11);
} else if (_local12 == "n") {
var _local13 = Number;
} else if (_local12 == "s") {
var _local13 = String;
}
_local36.variables[_local28] = _local13(_local11);
_local37++;
}
scope.onRoomAdded(_local36);
} else if (_local9 == "roomDel") {
var _local53 = xmlObj.rm.attributes.id;
var _local55 = scope.roomList[_local53];
delete scope.roomList[_local53];
scope.onRoomDeleted(_local55);
} else if (_local9 == "leaveRoom") {
var _local76 = xmlObj.rm.attributes.id;
scope.onRoomLeft(_local76);
} else if (_local9 == "roundTripRes") {
scope.t2 = getTimer();
scope.onRoundTripResponse(scope.t2 - scope.t1);
} else if (_local9 == "swSpec") {
var _local46 = Number(xmlObj.pid.attributes.id);
var _local48 = Number(xmlObj.pid.attributes.u);
if (_local46 > 0) {
scope.roomList[_local20].userCount++;
scope.roomList[_local20].specCount--;
}
if (!isNaN(_local48)) {
var _local50 = scope.roomList[_local20];
_local50.userList[_local48].pid = _local46;
_local50.userList[_local48].isSpec = false;
} else {
scope.playerId = _local46;
scope.onSpectatorSwitched(scope.playerId > 0, scope.playerId, scope.roomList[_local20]);
}
} else if (_local9 == "bList") {
var _local8 = xmlObj.bList.bList;
if (_local8 == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var _local18 = xmlObj.mv.mv;
if (_local18 != undefined) {
for (var it in _local18) {
var _local32 = _local18[it].attributes.n;
var _local27 = _local18[it].value;
scope.myBuddyVars[_local32] = _local27;
}
}
var _local43 = 0;
while (_local43 < _local8.length) {
var _local35 = {};
_local35.isOnline = ((_local8[_local43].attributes.s == "1") ? true : false);
_local35.name = _local8[_local43].n.value;
_local35.id = _local8[_local43].attributes.i;
_local35.isBlocked = ((_local8[_local43].attributes.x == "1") ? true : false);
_local35.variables = {};
var _local21 = _local8[_local43].vs.vs;
for (var _local37 in _local21) {
var _local29 = _local21[_local37].attributes.n;
var _local26 = _local21[_local37].value;
_local35.variables[_local29] = _local26;
}
scope.buddyList.push(_local35);
_local43++;
}
scope.onBuddyList(scope.buddyList);
} else if (_local9 == "bUpd") {
var _local39 = false;
var _local42 = xmlObj.b;
if (_local42 == undefined) {
scope.onBuddyListError(xmlObj.err.value);
return(undefined);
}
var _local35 = {};
_local35.name = _local42.n.value;
_local35.id = _local42.attributes.i;
_local35.isOnline = ((_local42.attributes.s == "1") ? true : false);
_local35.isBlocked = ((_local42.attributes.x == "1") ? true : false);
var _local21 = _local42.vs.vs;
var _local17 = null;
for (var it in scope.buddyList) {
_local17 = scope.buddyList[it];
if (_local17.name == _local35.name) {
scope.buddyList[it] = _local35;
_local35.isBlocked = _local17.isBlocked;
_local35.variables = _local17.variables;
for (var _local43 in _local21) {
var _local29 = _local21[_local43].attributes.n;
var _local26 = _local21[_local43].value;
_local35.variables[_local29] = _local26;
}
_local39 = true;
break;
}
}
if (_local39) {
scope.onBuddyListUpdate(_local35);
}
} else if (_local9 == "bAdd") {
var _local42 = xmlObj.b;
var _local35 = {};
_local35.name = _local42.n.value;
_local35.id = _local42.attributes.i;
_local35.isOnline = ((_local42.attributes.s == "1") ? true : false);
_local35.isBlocked = ((_local42.attributes.x == "1") ? true : false);
_local35.variables = {};
var _local21 = _local42.vs.vs;
for (var _local43 in _local21) {
var _local29 = _local21[_local43].attributes.n;
var _local26 = _local21[_local43].value;
_local35.variables[_local29] = _local26;
}
scope.buddyList.push(_local35);
scope.onBuddyList(scope.buddyList);
} else if (_local9 == "remB") {
var _local40 = xmlObj.n.value;
var _local35 = null;
for (var it in scope.buddyList) {
_local35 = scope.buddyList[it];
if (_local35.name == _local40) {
delete scope.buddyList[it];
scope.onBuddyList(scope.buddyList);
break;
}
}
} else if (_local9 == "bPrm") {
var _local56 = xmlObj.n.value;
var _local45 = "";
if (xmlObj.txt != undefined) {
_local45 = scope.os.decodeEntities(_local45);
}
scope.onBuddyPermissionRequest(_local56, _local45);
} else if (_local9 == "roomB") {
var _local70 = xmlObj.br.attributes.r;
var _local19 = _local70.toString().split(",");
for (var _local43 in _local19) {
_local19[_local43] = Number(_local19[_local43]);
}
scope.onBuddyRoom(_local19);
} else if (_local9 == "rndK") {
var _local57 = xmlObj.k.value;
scope.onRandomKey(_local57);
}
}
function handleExtensionMessages(dataObj, scope, type) {
if (type == undefined) {
type = "xml";
}
if (type == "xml") {
var _local6 = dataObj.attributes.action;
var _local7 = dataObj.attributes.r;
if (_local6 == "xtRes") {
var _local4 = dataObj.value;
var _local5 = scope.os.deserialize(_local4);
scope.onExtensionResponse(_local5, type);
}
} else if (type == "str") {
scope.onExtensionResponse(dataObj, type);
} else if (type == "json") {
scope.onExtensionResponse(dataObj.o, type);
}
}
function sendXtMessage(xtName, cmdName, paramObj, type, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (type == undefined) {
type = "xml";
}
if (type == "xml") {
var _local11;
_local11 = {t:"xt"};
var _local10 = {name:xtName, cmd:cmdName, param:paramObj};
var _local12 = ("<![CDATA[" + os.serialize(_local10)) + "]]>";
send(_local11, "xtReq", roomId, _local12);
} else if (type == "str") {
var _local4;
_local4 = (((((((rawProtocolSeparator + "xt") + rawProtocolSeparator) + xtName) + rawProtocolSeparator) + cmdName) + rawProtocolSeparator) + roomId) + rawProtocolSeparator;
var _local2 = 0;
while (_local2 < paramObj.length) {
_local4 = _local4 + (paramObj[_local2].toString() + rawProtocolSeparator);
_local2++;
}
sendString(_local4);
} else if (type == "json") {
var _local5 = {};
_local5.x = xtName;
_local5.c = cmdName;
_local5.r = roomId;
_local5.p = paramObj;
var _local6 = {};
_local6.t = "xt";
_local6.b = _local5;
try {
var _local13 = it.gotoandplay.smartfoxserver.JSON.stringify(_local6);
sendJson(_local13);
} catch(ex) {
if (debug) {
trace("Error in sending JSON message.");
trace((((((ex.name + " : ") + ex.message) + " : ") + ex.at) + " : ") + ex.text);
}
}
}
}
function dumpObj(obj, depth) {
if (depth == undefined) {
depth = 0;
}
if (debug) {
if (depth == 0) {
trace("+-----------------------------------------------+");
trace("+ Object Dump +");
trace("+-----------------------------------------------+");
}
for (var _local8 in obj) {
var _local4 = obj[_local8];
var _local5 = typeof(_local4);
if (_local5 != "object") {
var _local3 = "";
var _local2 = 0;
while (_local2 < depth) {
_local3 = _local3 + "\t";
_local2++;
}
_local3 = _local3 + (((((_local8 + " : ") + _local4) + " ( ") + _local5) + " )");
trace(_local3);
} else {
dumpObj(_local4, depth + 1);
}
}
}
}
function login(zone, name, pass) {
var _local3 = {t:"sys"};
var _local2 = ((((("<login z='" + zone) + "'><nick><![CDATA[") + name) + "]]></nick><pword><![CDATA[") + pass) + "]]></pword></login>";
send(_local3, "login", 0, _local2);
}
function logout() {
var _local2 = {t:"sys"};
send(_local2, "logout", -1, "");
}
function getRoomList() {
var _local2 = {t:"sys"};
send(_local2, "getRmList", (activeRoomId ? (activeRoomId) : -1), "");
}
function autoJoin() {
var _local2 = {t:"sys"};
send(_local2, "autoJoin", (activeRoomId ? (activeRoomId) : -1), "");
}
function joinRoom(newRoom, pword, isSpectator, dontLeave, oldRoom) {
var _local2 = null;
var _local7;
if (isSpectator) {
_local7 = 1;
} else {
_local7 = 0;
}
if (!changingRoom) {
if (typeof(newRoom) == "number") {
_local2 = newRoom;
} else {
for (var _local4 in roomList) {
if (roomList[_local4].name == newRoom) {
_local2 = roomList[_local4].id;
break;
}
}
}
if (_local2 != null) {
var _local9 = {t:"sys"};
var _local6 = (dontLeave ? "0" : "1");
var _local5;
if (oldRoom) {
_local5 = oldRoom;
} else {
_local5 = activeRoomId;
}
if (activeRoomId == null) {
_local6 = "0";
_local5 = -1;
}
var _local8 = ((((((((("<room id='" + _local2) + "' pwd='") + pword) + "' spec='") + _local7) + "' leave='") + _local6) + "' old='") + _local5) + "' />";
send(_local9, "joinRoom", (activeRoomId ? (activeRoomId) : -1), _local8);
changingRoom = true;
} else {
trace("SmartFoxError: requested room to join does not exist!");
}
}
}
function sendBuddyPermissionResponse(allowBuddy, targetBuddy) {
var _local2 = ((("<n res='" + (allowBuddy ? "g" : "r")) + "'><![CDATA[") + targetBuddy) + "]]></n>";
send({t:"sys"}, "bPrm", -1, _local2);
}
function sendPublicMessage(message, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
var _local3 = ("<txt><![CDATA[" + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "pubMsg", roomId, _local3);
}
function sendPrivateMessage(message, recipientId, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
var _local3 = ((("<txt rcp='" + recipientId) + "'><![CDATA[") + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "prvMsg", roomId, _local3);
}
function sendModeratorMessage(message, type, id) {
var _local2 = {t:"sys"};
var _local3 = ((((("<txt t='" + type) + "' id='") + id) + "'><![CDATA[") + os.encodeEntities(message)) + "]]></txt>";
send(_local2, "modMsg", activeRoomId, _local3);
}
function sendObject(obj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = ("<![CDATA[" + os.serialize(obj)) + "]]>";
var _local3 = {t:"sys"};
send(_local3, "asObj", roomId, _local2);
}
function sendObjectToGroup(obj, userList, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local3 = "";
for (var _local4 in userList) {
if (!isNaN(userList[_local4])) {
_local3 = _local3 + (userList[_local4] + ",");
}
}
_local3 = _local3.substr(0, _local3.length - 1);
obj._$$_ = _local3;
var _local5 = ("<![CDATA[" + os.serialize(obj)) + "]]>";
var _local6 = {t:"sys"};
send(_local6, "asObjG", roomId, _local5);
}
function setBuddyBlockStatus(buddyName, status) {
var _local2 = getBuddyByName(buddyName);
if (_local2 != null) {
if (_local2.blocked != status) {
_local2.isBlocked = status;
var _local3 = ((("<n x='" + (status ? "1" : "0")) + "'><![CDATA[") + buddyName) + "]]></n>";
send({t:"sys"}, "setB", -1, _local3);
onBuddyListUpdate(_local2);
}
}
}
function setUserVariables(varObj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local9 = {t:"sys"};
var _local6 = "<vars>";
var _local4 = roomList[roomId].userList[myUserId];
for (var _local7 in varObj) {
var _local2 = varObj[_local7];
var _local3 = null;
if (typeof(_local2) == "boolean") {
_local3 = "b";
_local2 = (_local2 ? 1 : 0);
} else if (typeof(_local2) == "number") {
_local3 = "n";
} else if (typeof(_local2) == "string") {
_local3 = "s";
} else if (typeof(_local2) == "null") {
_local3 = "x";
delete _local4.variables[_local7];
}
if (_local3 != null) {
_local4.variables[_local7] = _local2;
_local6 = _local6 + (((((("<var n='" + _local7) + "' t='") + _local3) + "'><![CDATA[") + _local2) + "]]></var>");
}
}
_local6 = _local6 + "</vars>";
send(_local9, "setUvars", roomId, _local6);
}
function setBuddyVariables(varList) {
var _local6 = {t:"sys"};
var _local4 = "<vars>";
for (var _local5 in varList) {
var _local2 = varList[_local5];
if (myBuddyVars[_local5] != _local2) {
myBuddyVars[_local5] = _local2;
_local4 = _local4 + (((("<var n='" + _local5) + "'><![CDATA[") + _local2) + "]]></var>");
}
}
_local4 = _local4 + "</vars>";
send(_local6, "setBvars", -1, _local4);
}
function dumpRoomList() {
for (var _local5 in roomList) {
var _local2 = roomList[_local5];
trace(newline);
trace("-------------------------------------");
trace(((" > Room: (" + _local5) + ") - ") + _local2.getName());
trace("isTemp: " + _local2.isTemp());
trace("isGame: " + _local2.isGame());
trace("isPriv: " + _local2.isPrivate());
trace((("Users: " + _local2.getUserCount()) + " / ") + _local2.getMaxUsers());
trace("Variables: ");
for (var _local4 in _local2.variables) {
trace((("\t" + _local4) + " = ") + _local2.getVariable(_local4));
}
trace("\rUserList: ");
var _local3 = _local2.getUserList();
for (var _local4 in _local3) {
trace((("\t" + _local3[_local4].getId()) + " > ") + _local3[_local4].getName());
}
}
}
function createRoom(roomObj, roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local7 = {t:"sys"};
var _local10 = (roomObj.updatable ? 1 : 0);
var _local5 = (roomObj.isGame ? 1 : 0);
var _local6 = 1;
var _local8 = roomObj.maxSpectators;
if (_local5 && (roomObj.exitCurrentRoom != undefined)) {
_local6 = (roomObj.exitCurrentRoom ? 1 : 0);
}
var _local3 = ((((((("<room upd='" + _local10) + "' tmp='1' gam='") + _local5) + "' spec='") + _local8) + "' exit='") + _local6) + "'>";
_local3 = _local3 + (("<name><![CDATA[" + roomObj.name) + "]]></name>");
_local3 = _local3 + (("<pwd><![CDATA[" + ((roomObj.password == undefined) ? "" : (roomObj.password))) + "]]></pwd>");
_local3 = _local3 + (("<max>" + roomObj.maxUsers) + "</max>");
if (roomObj.uCount != undefined) {
_local3 = _local3 + (("<uCnt>" + (roomObj.uCount ? "1" : "0")) + "</uCnt>");
}
if (roomObj.extension != undefined) {
_local3 = _local3 + ("<xt n='" + roomObj.extension.name);
_local3 = _local3 + (("' s='" + roomObj.extension.script) + "' />");
}
if (roomObj.vars == undefined) {
_local3 = _local3 + "<vars></vars>";
} else {
_local3 = _local3 + "<vars>";
for (var _local4 in roomObj.vars) {
_local3 = _local3 + getXmlRoomVariable(roomObj.vars[_local4]);
}
_local3 = _local3 + "</vars>";
}
_local3 = _local3 + "</room>";
send(_local7, "createRoom", roomId, _local3);
}
function leaveRoom(roomId) {
var _local3 = {t:"sys"};
var _local2 = ("<rm id='" + roomId) + "' />";
send(_local3, "leaveRoom", roomId, _local2);
}
function getRoom(roomId) {
if (typeof(roomId) == "number") {
return(roomList[roomId]);
}
if (typeof(roomId) == "string") {
for (var _local4 in roomList) {
var _local2 = roomList[_local4];
if (_local2.getName() == roomId) {
return(_local2);
}
}
}
}
function getActiveRoom() {
return(roomList[activeRoomId]);
}
function setRoomVariables(varList, roomId, setOwnership) {
if (roomId == undefined) {
roomId = activeRoomId;
}
if (setOwnership == undefined) {
setOwnership = true;
}
var _local5 = {t:"sys"};
var _local4;
if (setOwnership) {
_local4 = "<vars>";
} else {
_local4 = "<vars so='0'>";
}
var _local2 = 0;
while (_local2 < varList.length) {
_local4 = _local4 + getXmlRoomVariable(varList[_local2]);
_local2++;
}
_local4 = _local4 + "</vars>";
send(_local5, "setRvars", roomId, _local4);
}
function getXmlRoomVariable(rVar) {
var _local5 = rVar.name;
var _local1 = rVar.val;
var _local6 = (rVar.priv ? "1" : "0");
var _local4 = (rVar.persistent ? "1" : "0");
var _local2 = null;
if (typeof(_local1) == "boolean") {
_local2 = "b";
_local1 = (_local1 ? 1 : 0);
} else if (typeof(_local1) == "number") {
_local2 = "n";
} else if (typeof(_local1) == "string") {
_local2 = "s";
} else if (typeof(_local1) == "null") {
_local2 = "x";
}
if (_local2 != null) {
return(((((((((("<var n='" + _local5) + "' t='") + _local2) + "' pr='") + _local6) + "' pe='") + _local4) + "'><![CDATA[") + _local1) + "]]></var>");
}
return("");
}
function loadBuddyList() {
var _local2 = {t:"sys"};
send(_local2, "loadB", -1, "");
}
function addBuddy(buddyName) {
if ((buddyName != myUserName) && (!checkBuddy(buddyName))) {
var _local6 = roomList[activeRoomId].getUserList().getUser(buddyName);
var _local4 = {t:"sys"};
var _local3 = ("<n>" + buddyName) + "</n>";
send(_local4, "addB", -1, _local3);
}
}
function removeBuddy(buddyName) {
for (var _local3 in buddyList) {
if (buddyList[_local3].name == buddyName) {
delete buddyList[_local3];
break;
}
}
var _local5 = {t:"sys"};
var _local4 = ("<n>" + buddyName) + "</n>";
send(_local5, "remB", -1, _local4);
onBuddyList(buddyList);
}
function getBuddyByName(buddyName) {
var _local2;
for (var _local4 in buddyList) {
_local2 = buddyList[_local4];
if (_local2.name == buddyName) {
return(_local2);
}
}
return(null);
}
function getBuddyById(id) {
var _local2;
for (var _local4 in buddyList) {
_local2 = buddyList[_local4];
if (_local2.id == id) {
return(_local2);
}
}
return(null);
}
function getBuddyRoom(buddy) {
if (buddy.id != -1) {
send({t:"sys", bid:buddy.id}, "roomB", -1, ("<b id='" + buddy.id) + "' />");
}
}
function checkBuddy(name) {
var _local2 = false;
for (var _local4 in buddyList) {
if (buddyList[_local4].name == name) {
_local2 = true;
break;
}
}
return(_local2);
}
function clearBuddyList() {
buddyList = [];
send({t:"sys"}, "clearB", -1, "");
onBuddyList(buddyList);
}
function roundTripBench() {
t1 = getTimer();
var _local2 = {t:"sys"};
send(_local2, "roundTrip", activeRoomId, "");
}
function switchSpectator(roomId) {
if (roomId == undefined) {
roomId = activeRoomId;
}
var _local2 = {t:"sys"};
send(_local2, "swSpec", roomId, "");
}
function getRandomKey() {
send({t:"sys"}, "rndK", -1, "");
}
function send(header, action, fromRoom, message) {
var _local3 = makeHeader(header);
_local3 = _local3 + ((((((("<body action='" + action) + "' r='") + fromRoom) + "'>") + message) + "</body>") + closeHeader());
if (debug) {
trace(("[Sending]: " + _local3) + newline);
}
if (isHttpMode) {
httpConnection.send(_local3);
} else {
super.send(_local3);
}
}
function uploadFile(fileRef, id, nick, port) {
if (id == undefined) {
id = myUserId;
}
if (nick == undefined) {
nick = myUserName;
}
if (port == undefined) {
port = httpPort;
}
fileRef.upload((((((("http://" + ipAddress) + ":") + port) + "/default/Upload.py?id=") + id) + "&nick=") + nick);
if (debug) {
trace((((((("[UPLOAD]: http://" + ipAddress) + ":") + port) + "/default/Upload.py?id=") + id) + "&nick=") + nick);
}
}
function getUploadPath() {
return(((("http://" + ipAddress) + ":") + httpPort) + "/default/uploads/");
}
function sendString(message) {
if (debug) {
trace(("[Sending]: " + message) + newline);
}
if (isHttpMode) {
httpConnection.send(message);
} else {
super.send(message);
}
}
function sendJson(message) {
if (debug) {
trace(("[Sending - json]: " + message) + newline);
}
if (isHttpMode) {
httpConnection.send(message);
} else {
super.send(message);
}
}
function gotData(message) {
if (message.charAt(0) == rawProtocolSeparator) {
strReceived(message);
} else if (message.charAt(0) == "<") {
onXML(new XML(message));
} else if (message.charAt(0) == "{") {
jsonReceived(message);
}
}
function connectionEstablished(ok) {
if (ok) {
clearInterval(socketConnectionTimeoutThread);
preConnection = false;
var _local3 = {t:"sys"};
var _local2 = ((("<ver v='" + majVersion.toString()) + minVersion.toString()) + subVersion.toString()) + "' />";
send(_local3, "verChk", 0, _local2);
} else if (smartConnect && (preConnection)) {
if (debug) {
trace("** Socket connection failed. Trying BlueBox **");
}
isHttpMode = true;
var _local4 = ((blueBoxIpAddress != null) ? (blueBoxIpAddress) : (ipAddress));
var _local5 = ((blueBoxPort != 0) ? (blueBoxPort) : (httpPort));
httpConnection.connect(_local4, _local5);
} else {
preConnection = false;
onConnection(false);
}
}
function connectionClosed() {
isConnected = false;
if (preConnection) {
connectionEstablished(false);
} else {
initialize();
onConnectionLost();
}
}
function connect(ipAdr, port) {
if (!isConnected) {
ipAddress = ipAdr;
this.port = port;
super.connect(ipAdr, port);
socketConnectionTimeoutThread = setInterval(mx.utils.Delegate.create(this, socketTimeoutHandler), socketConnectionTimeout);
} else {
trace((("WARNING! You're already connected to -> " + ipAddress) + ":") + this.port);
}
}
function disconnect() {
close();
isConnected = false;
if (isHttpMode) {
httpConnection.close();
}
initialize();
onConnectionLost();
}
function xmlReceived(message) {
var _local2 = new Object();
message2Object(message.childNodes, _local2);
if (debug) {
trace("[Received]: " + message);
}
var _local3 = _local2.msg.attributes.t;
messageHandlers[_local3].handleMessage(_local2.msg.body, this, "xml");
}
function socketTimeoutHandler() {
clearInterval(socketConnectionTimeoutThread);
close();
}
function strReceived(message) {
var _local2 = message.substr(1, message.length - 2).split(rawProtocolSeparator);
if (debug) {
trace("[Received - Str]: " + message);
}
var _local4 = _local2[0];
messageHandlers[_local4].handleMessage(_local2.splice(1, _local2.length - 1), this, "str");
}
function jsonReceived(message) {
var _local2 = it.gotoandplay.smartfoxserver.JSON.parse(message);
if (debug) {
trace("[Received - json]: " + message);
}
var _local3 = _local2.t;
messageHandlers[_local3].handleMessage(_local2.b, this, "json");
}
function message2Object(xmlNodes, parentObj) {
var _local8 = 0;
var _local3 = null;
while (_local8 < xmlNodes.length) {
var _local4 = xmlNodes[_local8];
var _local5 = _local4.nodeName;
var _local6 = _local4.nodeValue;
if (parentObj instanceof Array) {
_local3 = {};
parentObj.push(_local3);
_local3 = parentObj[parentObj.length - 1];
} else {
parentObj[_local5] = new Object();
_local3 = parentObj[_local5];
}
for (var _local11 in _local4.attributes) {
if (typeof(_local3.attributes) == "undefined") {
_local3.attributes = {};
}
var _local2 = _local4.attributes[_local11];
if (!isNaN(Number(_local2))) {
_local2 = Number(_local2);
}
if (_local2.toLowerCase() == "true") {
_local2 = true;
} else if (_local2.toLowerCase() == "false") {
_local2 = false;
}
_local3.attributes[_local11] = _local2;
}
if (arrayTags[_local5]) {
_local3[_local5] = [];
_local3 = _local3[_local5];
}
if (_local4.hasChildNodes() && (_local4.firstChild.nodeValue == undefined)) {
var _local9 = _local4.childNodes;
message2Object(_local9, _local3);
} else {
_local6 = _local4.firstChild.nodeValue;
if (((!isNaN(_local6)) && (_local4.nodeName != "txt")) && (_local4.nodeName != "var")) {
_local6 = Number(_local6);
}
_local3.value = _local6;
}
_local8++;
}
}
function makeHeader(headerObj) {
var _local2 = "<msg";
for (var _local3 in headerObj) {
_local2 = _local2 + ((((" " + _local3) + "='") + headerObj[_local3]) + "'");
}
_local2 = _local2 + ">";
return(_local2);
}
function closeHeader() {
return("</msg>");
}
function handleDelayedPoll() {
httpConnection.send(HTTP_POLL_REQUEST);
if (fpMajorVersion < 8) {
clearInterval(pollingThread);
}
}
function handleHttpConnect(params) {
isConnected = true;
preConnection = false;
connectionEstablished(true);
httpConnection.send(HTTP_POLL_REQUEST);
}
function handleHttpClose(params) {
initialize();
onConnectionLost();
}
function handleHttpData(params) {
var _local5 = params.data;
var _local4 = _local5.split(newline);
var _local3;
var _local2 = 0;
while (_local2 < (_local4.length - 1)) {
_local3 = _local4[_local2];
if (_local3.length > 0) {
gotData(_local3);
}
_local2++;
}
if (_httpPollSpeed > 0) {
pollingThread = pollingDelayFn(mx.utils.Delegate.create(this, handleDelayedPoll), _httpPollSpeed);
} else {
httpConnection.send(HTTP_POLL_REQUEST);
}
}
function handleHttpError(params) {
if (!isConnected) {
onConnection(false);
} else {
connectionClosed();
}
}
static var MIN_POLL_SPEED = 0;
static var DEFAULT_POLL_SPEED = 750;
static var MAX_POLL_SPEED = 10000;
static var HTTP_POLL_REQUEST = "poll";
static var MODMSG_TO_USER = "u";
static var MODMSG_TO_ROOM = "r";
static var MODMSG_TO_ZONE = "z";
static var PROTOCOL_XML = "xml";
static var PROTOCOL_STR = "str";
static var PROTOCOL_JSON = "json";
static var CONNECTION_MODE_DISCONNECTED = "disconnected";
static var CONNECTION_MODE_SOCKET = "socket";
static var CONNECTION_MODE_HTTP = "http";
var DEFAULT_CONFIG_FILE = "config.xml";
var DEFAULT_AUTO_CONNECT = true;
var majVersion = 1;
var minVersion = 5;
var subVersion = 4;
var autoConnectOnConfigSuccess = true;
var defaultZone = "";
var httpPort = 8080;
var rawProtocolSeparator = "%";
var blueBoxPort = 0;
var smartConnect = true;
var socketConnectionTimeout = 5000;
var isHttpMode = false;
var _httpPollSpeed = DEFAULT_POLL_SPEED;
var pollingThread = -1;
var preConnection = true;
}
Symbol 565 MovieClip [__Packages.it.gotoandplay.smartfoxserver.ObjectSerializer] Frame 0
class it.gotoandplay.smartfoxserver.ObjectSerializer
{
static var __instance;
var tabs, xmlStr, debug, eof, ascTab, ascTabRev, hexTable;
function ObjectSerializer () {
init();
}
static function getInstance() {
if (__instance == null) {
__instance = new it.gotoandplay.smartfoxserver.ObjectSerializer();
}
return(__instance);
}
function init() {
tabs = "\t\t\t\t\t\t\t\t\t\t";
xmlStr = "";
debug = false;
eof = "";
ascTab = [];
ascTab[">"] = ">";
ascTab["<"] = "<";
ascTab["&"] = "&";
ascTab["'"] = "'";
ascTab["\""] = """;
ascTabRev = [];
ascTabRev[">"] = ">";
ascTabRev["<"] = "<";
ascTabRev["&"] = "&";
ascTabRev["'"] = "'";
ascTabRev["""] = "\"";
hexTable = new Array();
hexTable["0"] = 0;
hexTable["1"] = 1;
hexTable["2"] = 2;
hexTable["3"] = 3;
hexTable["4"] = 4;
hexTable["5"] = 5;
hexTable["6"] = 6;
hexTable["7"] = 7;
hexTable["8"] = 8;
hexTable["9"] = 9;
hexTable.A = 10;
hexTable.B = 11;
hexTable.C = 12;
hexTable.D = 13;
hexTable.E = 14;
hexTable.F = 15;
}
function serialize(obj) {
var _local2 = {};
_local2.xmlStr = "";
if (debug) {
eof = newline;
}
obj2xml(_local2, obj, 0, "");
return(_local2.xmlStr);
}
function obj2xml(envelope, obj, lev, objn) {
if (lev == 0) {
envelope.xmlStr = envelope.xmlStr + ("<dataObj>" + eof);
} else {
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev);
}
var _local8 = ((obj instanceof Array) ? "a" : "o");
envelope.xmlStr = envelope.xmlStr + ((((("<obj t='" + _local8) + "' o='") + objn) + "'>") + eof);
}
for (var _local7 in obj) {
var _local2 = typeof(obj[_local7]);
var _local3 = obj[_local7];
if ((((_local2 == "boolean") || (_local2 == "number")) || (_local2 == "string")) || (_local2 == "null")) {
if (_local2 == "boolean") {
_local3 = Number(_local3);
} else if (_local2 == "null") {
_local2 = "x";
_local3 = "";
} else if (_local2 == "string") {
_local3 = encodeEntities(_local3);
}
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev + 1);
}
envelope.xmlStr = envelope.xmlStr + ((((((("<var n='" + _local7) + "' t='") + _local2.substr(0, 1)) + "'>") + _local3) + "</var>") + eof);
} else if (_local2 == "object") {
obj2xml(envelope, _local3, lev + 1, _local7);
if (debug) {
envelope.xmlStr = envelope.xmlStr + tabs.substr(0, lev + 1);
}
envelope.xmlStr = envelope.xmlStr + ("</obj>" + eof);
}
}
if (lev == 0) {
envelope.xmlStr = envelope.xmlStr + ("</dataObj>" + eof);
}
}
function deserialize(xmlObj) {
var _local3 = new XML(xmlObj);
_local3.ignoreWhite = true;
var _local2 = new Object();
xml2obj(_local3, _local2);
return(_local2);
}
function xml2obj(xmlNode, currObj) {
var _local2 = 0;
var _local3 = xmlNode.firstChild;
while (_local3.childNodes[_local2]) {
if (_local3.childNodes[_local2].nodeName == "obj") {
var _local9 = _local3.childNodes[_local2].attributes.o;
var _local7 = _local3.childNodes[_local2].attributes.t;
if (_local7 == "a") {
currObj[_local9] = [];
} else if (_local7 == "o") {
currObj[_local9] = {};
}
xml2obj(new XML(_local3.childNodes[_local2]), currObj[_local9]);
} else {
var _local9 = _local3.childNodes[_local2].attributes.n;
var _local4 = _local3.childNodes[_local2].attributes.t;
var _local8 = _local3.childNodes[_local2].firstChild.nodeValue;
var _local5;
if (_local4 == "b") {
_local5 = function (b) {
return(Boolean(Number(b)));
};
} else if (_local4 == "n") {
_local5 = Number;
} else if (_local4 == "s") {
_local5 = String;
} else if (_local4 == "x") {
_local5 = function (x) {
return(null);
};
}
currObj[_local9] = _local5(_local8);
}
_local2++;
}
}
function encodeEntities(st) {
var _local5 = "";
var _local4 = 0;
while (_local4 < st.length) {
var _local3 = st.charAt(_local4);
var _local2 = st.charCodeAt(_local4);
if (((_local2 == 9) || (_local2 == 10)) || (_local2 == 13)) {
_local5 = _local5 + _local3;
} else if ((_local2 >= 32) && (_local2 <= 126)) {
if (ascTab[_local3] != undefined) {
_local5 = _local5 + ascTab[_local3];
} else {
_local5 = _local5 + _local3;
}
} else {
_local5 = _local5 + _local3;
}
_local4++;
}
return(_local5);
}
function decodeEntities(st) {
var _local7;
var _local6;
var _local5;
var _local3;
var _local8;
var _local2 = 0;
_local7 = "";
while (_local2 < st.length) {
_local6 = st.charAt(_local2);
if (_local6 == "&") {
_local5 = _local6;
do {
_local2++;
_local3 = st.charAt(_local2);
_local5 = _local5 + _local3;
} while ((_local3 != ";") && (_local2 < st.length));
_local8 = ascTabRev[_local5];
if (_local8 != undefined) {
_local7 = _local7 + _local8;
} else {
_local7 = _local7 + String.fromCharCode(getCharCode(_local5));
}
} else {
_local7 = _local7 + _local6;
}
_local2++;
}
return(_local7);
}
function getCharCode(ent) {
var _local1 = ent.substr(3, ent.length);
_local1 = _local1.substr(0, _local1.length - 1);
return(Number("0x" + _local1));
}
}
Symbol 566 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.HttpConnection] Frame 0
class it.gotoandplay.smartfoxserver.http.HttpConnection
{
var codec, handlers, sessionId, ipAddr, port, webUrl, loaderFactory, _classRef;
function HttpConnection (httpConnectHandler, httpCloseHandler, httpDataHandler, httpErrorHandler) {
codec = new it.gotoandplay.smartfoxserver.http.RawProtocolCodec();
handlers = [];
handlers[onHttpConnect] = httpConnectHandler;
handlers[onHttpClose] = httpCloseHandler;
handlers[onHttpData] = httpDataHandler;
handlers[onHttpError] = httpErrorHandler;
}
function getSessionId() {
return(sessionId);
}
function isConnected() {
return(connected);
}
function connect(addr, port) {
if (port == undefined) {
port = 8080;
}
ipAddr = addr;
this.port = port;
webUrl = (((("http://" + ipAddr) + ":") + this.port) + "/") + servletUrl;
sessionId = null;
loaderFactory = new it.gotoandplay.smartfoxserver.http.LoaderFactory(this, handleResponse, webUrl, paramName);
send(HANDSHAKE);
}
function close() {
send(DISCONNECT);
}
function send(message) {
if ((connected || ((!connected) && (message == HANDSHAKE))) || ((!connected) && (message == "poll"))) {
if (message != "poll") {
trace("[ Send ]: " + codec.encode(sessionId, message));
}
loaderFactory.sendAndLoad(codec.encode(sessionId, message));
}
}
function handleResponse(data) {
var _local2 = _classRef;
if (data != undefined) {
var _local3 = {};
if (data.charAt(0) == HANDSHAKE_TOKEN) {
if (_local2.sessionId == null) {
_local2.sessionId = _local2.codec.decode(data);
_local2.connected = true;
_local3.sessionId = _local2.sessionId;
_local3.success = true;
_local2.dispatchEvent(onHttpConnect, _local3);
} else {
trace("**ERROR** SessionId is being rewritten");
}
} else if (data.indexOf(CONN_LOST) == 0) {
_local3.data = {};
_local2.dispatchEvent(onHttpClose, _local3);
} else {
_local3.data = data;
_local2.dispatchEvent(onHttpData, _local3);
}
} else if (!_local2.connected) {
_local2.handleIOError("I/O error: null response from server");
}
}
function handleIOError(error) {
var _local2 = {};
_local2.message = error;
dispatchEvent(onHttpError, _local2);
}
function dispatchEvent(type, params) {
handlers[type](params);
}
static var HANDSHAKE = "connect";
static var DISCONNECT = "disconnect";
static var CONN_LOST = "ERR#01";
static var HANDSHAKE_TOKEN = "#";
static var servletUrl = "BlueBox/HttpBox.do";
static var paramName = "sfsHttp";
static var onHttpData = "onHttpData";
static var onHttpError = "onHttpError";
static var onHttpConnect = "onHttpConnect";
static var onHttpClose = "onHttpClose";
var connected = false;
}
Symbol 567 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.LoaderFactory] Frame 0
class it.gotoandplay.smartfoxserver.http.LoaderFactory
{
var poolSize, webUrl, loaderParamName, sendersPool, loadersPool, currentIndex;
function LoaderFactory (httpConnection, responseHandler, _webUrl, _loaderParamName, _poolSize) {
if (_poolSize > 0) {
poolSize = _poolSize;
} else {
poolSize = DEFAULT_POOL_SIZE;
}
webUrl = _webUrl;
loaderParamName = _loaderParamName;
sendersPool = [];
loadersPool = [];
var _local3 = 0;
while (_local3 < poolSize) {
var _local4 = new LoadVars();
var _local2 = new LoadVars();
_local2._classRef = httpConnection;
_local2.onData = responseHandler;
sendersPool.push(_local4);
loadersPool.push(_local2);
_local3++;
}
currentIndex = 0;
}
function sendAndLoad(message) {
var _local2 = sendersPool[currentIndex];
var _local3 = loadersPool[currentIndex];
_local2[loaderParamName] = message;
_local2.sendAndLoad(webUrl, _local3);
currentIndex++;
if (currentIndex >= poolSize) {
currentIndex = 0;
}
}
function handleHTTPStatus(status) {
trace("---> Status received: " + status);
}
static var DEFAULT_POOL_SIZE = 8;
}
Symbol 568 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec] Frame 0
interface it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec
{
}
Symbol 569 MovieClip [__Packages.it.gotoandplay.smartfoxserver.http.RawProtocolCodec] Frame 0
class it.gotoandplay.smartfoxserver.http.RawProtocolCodec implements it.gotoandplay.smartfoxserver.http.IHttpProtocolCodec
{
function RawProtocolCodec () {
}
function encode(sessionId, message) {
return(((sessionId == null) ? "" : (sessionId)) + message);
}
function decode(message) {
var _local1;
if (message.charAt(0) == it.gotoandplay.smartfoxserver.http.HttpConnection.HANDSHAKE_TOKEN) {
_local1 = message.substr(1, SESSION_ID_LEN);
}
return(_local1);
}
static var SESSION_ID_LEN = 32;
}
Symbol 570 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 571 MovieClip [__Packages.it.gotoandplay.smartfoxserver.Room] Frame 0
class it.gotoandplay.smartfoxserver.Room
{
var id, name, maxUsers, maxSpectators, temp, game, priv, limbo, updatable, description, userCount, specCount, userList, variables, myPlayerIndex;
function Room (id, name, maxUsers, maxSpectators, isTemp, isGame, isPrivate) {
this.id = id;
this.name = name;
this.maxUsers = maxUsers;
this.maxSpectators = maxSpectators;
temp = isTemp;
game = isGame;
priv = isPrivate;
limbo = false;
updatable = false;
description = "";
userCount = 0;
specCount = 0;
userList = new Object();
variables = new Array();
}
function getUserList() {
return(userList);
}
function getUser(userId) {
if (typeof(userId) == "number") {
return(userList[userId]);
}
if (typeof(userId) == "string") {
for (var _local4 in userList) {
var _local2 = userList[_local4];
if (_local2.getName() == userId) {
return(_local2);
}
}
}
}
function getVariable(varName) {
return(variables[varName]);
}
function getVariables() {
return(variables);
}
function getName() {
return(name);
}
function getId() {
return(id);
}
function isTemp() {
return(temp);
}
function isGame() {
return(game);
}
function isPrivate() {
return(priv);
}
function getUserCount() {
return(userCount);
}
function getSpectatorCount() {
return(specCount);
}
function getMaxUsers() {
return(maxUsers);
}
function getMaxSpectators() {
return(maxSpectators);
}
function setMyPlayerIndex(id) {
myPlayerIndex = id;
}
function getMyPlayerIndex() {
return(myPlayerIndex);
}
function setIsLimbo(b) {
limbo = b;
}
function isLimbo() {
return(limbo);
}
}
Symbol 572 MovieClip [__Packages.it.gotoandplay.smartfoxserver.User] Frame 0
class it.gotoandplay.smartfoxserver.User
{
var id, name, variables, isSpec, isMod, pid;
function User (id, name) {
this.id = id;
this.name = name;
variables = new Object();
isSpec = false;
}
function getId() {
return(id);
}
function getName() {
return(name);
}
function getVariable(varName) {
return(variables[varName]);
}
function getVariables() {
return(variables);
}
function setIsSpectator(b) {
isSpec = b;
}
function isSpectator() {
return(isSpec);
}
function setModerator(b) {
isMod = b;
}
function isModerator() {
return(isMod);
}
function getPlayerId() {
return(pid);
}
function setPlayerId(pid) {
this.pid = pid;
}
}
Symbol 573 MovieClip [__Packages.it.gotoandplay.smartfoxserver.JSON] Frame 0
class it.gotoandplay.smartfoxserver.JSON
{
function JSON () {
}
static function stringify(arg) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
switch (typeof(arg)) {
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = stringify(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = stringify(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((stringify(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
_local1 = "\"";
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\b" :
_local1 = _local1 + "\\b";
break;
case "\f" :
_local1 = _local1 + "\\f";
break;
case newline :
_local1 = _local1 + "\\n";
break;
case "\r" :
_local1 = _local1 + "\\r";
break;
case "\t" :
_local1 = _local1 + "\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + "\"");
case "boolean" :
return(String(arg));
}
return("null");
}
static function parse(text) {
var at = 0;
var ch = " ";
var _value;
var _error = function (m) {
throw {name:"JSONError", message:m, at:at - 1, text:text};
};
var _next = function () {
ch = text.charAt(at);
at = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != newline)) && (ch != "\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\b";
break;
case "f" :
_local1 = _local1 + "\f";
break;
case "n" :
_local1 = _local1 + newline;
break;
case "r" :
_local1 = _local1 + "\r";
break;
case "t" :
_local1 = _local1 + "\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
var _word = function () {
switch (ch) {
case "t" :
if (((_next() == "r") && (_next() == "u")) && (_next() == "e")) {
_next();
return(true);
}
break;
case "f" :
if ((((_next() == "a") && (_next() == "l")) && (_next() == "s")) && (_next() == "e")) {
_next();
return(false);
}
break;
case "n" :
if (!(((_next() == "u") && (_next() == "l")) && (_next() == "l"))) {
break;
}
_next();
return(null);
}
_error("Syntax error");
};
_value = function () {
_white();
switch (ch) {
case "{" :
return(_object());
case "[" :
return(_array());
case "\"" :
return(_string());
case "-" :
return(_number());
}
return((((ch >= "0") && (ch <= "9")) ? (_number()) : (_word())));
};
return(_value());
}
}
Symbol 574 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("2.6");
}
static function showPreGameAd(options) {
var _local26 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}, ad_progress:function (percent) {
}};
options = _parseOptions(options, _local26);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def") {
options.ad_started();
options.ad_finished();
return(undefined);
}
var clip = options.clip;
var _local22 = 11000;
var _local25 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local6 = chk.createEmptyMovieClip("_mochiad_bar", 4);
if (options.no_progress_bar) {
_local6._visible = false;
delete options.no_progress_bar;
} else {
_local6._x = 10;
_local6._y = _local13 - 20;
}
var _local21 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local23 = options.outline;
delete options.outline;
var _local5 = _local6.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local6.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local21);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local7 = _local6.createEmptyMovieClip("_outline", 3);
_local7.lineStyle(0, _local23, 100);
_local7.moveTo(0, 0);
_local7.lineTo(_local4 - 20, 0);
_local7.lineTo(_local4 - 20, 10);
_local7.lineTo(0, 10);
_local7.lineTo(0, 0);
chk.ad_msec = _local22;
chk.ad_timeout = _local25;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
var sendHostProgress = false;
mc.lc.sendHostLoadProgress = function (lc_name) {
sendHostProgress = true;
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local11 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local2 = (100 * _local8) / _local4;
var _local10 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local13 = Math.min(100, Math.min(_local2 || 0, _local10));
_local13 = Math.max(this.last_pcnt, _local13);
this.last_pcnt = _local13;
_local9._xscale = _local13;
options.ad_progress(_local13);
if (sendHostProgress) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local2});
if (_local2 == 100) {
sendHostProgress = false;
}
}
if (!chk.showing) {
var _local7 = _local11.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if ((_local5 > chk.ad_timeout) && (_local2 == 100)) {
options.ad_failed();
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showClickAwayAd(options) {
var _local9 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function () {
}, ad_finished:function () {
}, ad_loaded:function (width, height) {
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local9);
var clip = options.clip;
var _local8 = options.ad_timeout;
delete options.ad_timeout;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local4 = _getRes(options);
var _local10 = _local4[0];
var _local7 = _local4[1];
mc._x = _local10 * 0.5;
mc._y = _local7 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_timeout = _local8;
chk.started = getTimer();
chk.showing = false;
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
var _local20 = false;
mc.lc.regContLC = function (lc_name) {
mc._containerLCName = lc_name;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
_local2 = true;
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local2) {
delete this.onEnterFrame;
}
};
}
static function showInterLevelAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}, ad_failed:function () {
trace("[MochiAd] Couldn't load an ad, make sure that your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_loaded:function (width, height) {
}, ad_skipped:function () {
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_failed();
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = options.ad_loaded;
mc.lc.adSkipped = options.ad_skipped;
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
mc.lc.rpc = function (callbackID, arg) {
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s) {
trace("[MOCHIAD rpcTestFn] " + s);
return(s);
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
options.ad_failed();
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function showPreloaderAd(options) {
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
showPreGameAd(options);
}
static function showTimedAd(options) {
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
showInterLevelAd(options);
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local9 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local9._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local9.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local9._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local7 in options) {
_local4[_local7] = options[_local7];
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local8 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local8;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local8);
_local6.lc = _local5;
_local4.lc = _local8;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
if (clip._mochiad._containerLCName != undefined) {
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
if (_local4.id == "test") {
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
}
return(_local4);
}
static function rpc(clip, callbackID, arg) {
switch (arg.id) {
case "setValue" :
setValue(clip, arg.objectName, arg.value);
break;
case "getValue" :
var _local4 = getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod" :
var _local3 = runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local3);
break;
default :
trace("[mochiads rpc] unknown rpc id: " + arg.id);
}
}
static function setValue(base, objectName, value) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
base[_local2[_local1]] = value;
}
static function getValue(base, objectName) {
var _local2 = objectName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
return(base[_local2[_local1]]);
}
static function runMethod(base, methodName, argsArray) {
var _local2 = methodName.split(".");
var _local1;
_local1 = 0;
while (_local1 < (_local2.length - 1)) {
if ((base[_local2[_local1]] == undefined) || (base[_local2[_local1]] == null)) {
return(undefined);
}
base = base[_local2[_local1]];
_local1++;
}
if (typeof(base[_local2[_local1]]) == "function") {
return(base[_local2[_local1]].apply(base, argsArray));
}
return(undefined);
}
}
Symbol 575 MovieClip [__Packages.ArtilleryUser] Frame 0
class ArtilleryUser
{
var combo, max_combo, score, ally_hits, reason_dc;
function ArtilleryUser () {
combo = (max_combo = 0);
score = 0;
ally_hits = 0;
reason_dc = "disconnected";
}
}
Symbol 476 MovieClip [mc_audio] Frame 1
stop();
Symbol 486 MovieClip Frame 1
stop();
this.mc_mask._visible = false;
this.hitArea = this.mc_mask;
Symbol 497 MovieClip Frame 8
stop();
Symbol 529 MovieClip Frame 1
stop();
Symbol 543 MovieClip Frame 1
function EnterChat() {
if ((_root.mc_chat.txt_input.text.length <= 1) || (_root.mc_chat.txt_input.text == _root.CHAT_DEFAULT)) {
com.gamebrew.Common.SoundPlay("error.wav");
return(undefined);
}
com.gamebrew.Common.SoundPlay("click.wav");
_root.ClickChat(txt_input.text);
txt_input.text = "";
Disable();
}
function Disable() {
txt_input.text = "";
txt_input.selectable = false;
delete txt_input.onSetFocus;
delete txt_input.onKillFocus;
delete txt_input.onChanged;
com.gamebrew.Common.MovieFilterGrayScale(mc_but_chat);
mc_but_chat.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
_root.ButtonDisable(mc_but_chat);
Key.removeListener(txt_input_listener);
}
function Enable() {
txt_input.selectable = true;
txt_input.text = _root.CHAT_DEFAULT;
com.gamebrew.Common.MovieFilterClear(mc_but_chat);
mc_but_chat.transform.colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
mc_but_chat.onRollOver = function () {
_root.ButtonRollOver(this, "type text then press this");
};
mc_but_chat.onRollOut = function () {
_root.ButtonRollOut(this);
};
mc_but_chat.onRelease = function () {
this._parent.EnterChat();
};
txt_input_listener = new Object();
txt_input_listener.field_path = _root.mc_chat.txt_input;
txt_input_listener.onKeyDown = function () {
if (Key.getAscii() == 13) {
if (Selection.getFocus() == String(this.field_path)) {
_root.mc_chat.EnterChat();
Selection.setFocus(null);
} else if (_root.mc_chat.txt_input.selectable == true) {
Selection.setFocus(this.field_path);
}
}
};
Key.addListener(txt_input_listener);
txt_input.onSetFocus = function (oldFocus) {
if (this.text == _root.CHAT_DEFAULT) {
this.text = "";
}
};
txt_input.onKillFocus = function (newFocus) {
if (this.text.length == 0) {
this.text = _root.CHAT_DEFAULT;
this.scroll = 0;
this.hscroll = 0;
}
};
txt_input.onChanged = function (oldFocus) {
if (this.text == _root.CHAT_DEFAULT) {
this.text = "";
}
};
}
stop();
mc_but_chat.tabEnabled = false;
Disable();
Symbol 547 MovieClip Frame 1
stop();
Symbol 547 MovieClip Frame 17
gotoAndStop (1);
Symbol 552 MovieClip Frame 25
gotoAndPlay (1);
Symbol 553 MovieClip Frame 1
function ChangeWind(val) {
val = int(val * 1000);
var _local2 = val;
if (_local2 > 25) {
_local2 = 25;
} else if (_local2 < -25) {
_local2 = -25;
}
_local2 = Math.abs(_local2 * 4);
var _local3 = ("wind at " + Math.abs(val)) + " ";
if (val > 0) {
_local3 = _local3 + "east";
mc_wind_west._visible = false;
mc_wind_east._visible = true;
mc_wind_east._xscale = 100 + int(_local2 / 2);
} else if (val < 0) {
_local3 = _local3 + "west";
mc_wind_east._visible = false;
mc_wind_west._visible = true;
mc_wind_west._xscale = 100 + int(_local2 / 2);
} else {
mc_wind_west._visible = false;
mc_wind_east._visible = false;
_local3 = _local3 + "neutral";
}
_local3 = _local3 + "\nadjust your aim";
txt_wind.text = _local3;
txt_wind.textColor = COL1;
this.blinks = 0;
onEnterFrame = function () {
if (txt_wind.textColor == COL1) {
txt_wind.textColor = COL2;
} else {
txt_wind.textColor = COL1;
}
this.blinks++;
if (this.blinks > BLINKS) {
txt_wind.textColor = COL1;
delete this.onEnterFrame;
}
};
}
var COL1 = 28910;
var COL2 = 255;
var BLINKS = 50;