Obviously this script isn't a full replacement for the FXWebStore. The recently give-away Runaway.w2i refuses to install/extract with 7zip or this script, but works fine with the FXWebStore.
I don't know why or how.
I examined the processes in Process Hacker, and, while the other games had 7zr.exe (extracting w2i) then w2i.exe (installing extracted files) pop up during the installation process, this one had only w2i.exe pop up to install it.
';
var arrContestTrophies = new Array();
var trophyToShow = '';
var trophyToShowUses = 0;
if (typeof contest.prizes!="undefined")
for (var iInterval=0; iInterval
';
if (contest.prizes[iInterval].range[0]==contest.prizes[iInterval].range[1])
html += '$rank_0º
';
else
html += '$rank_0º al $rank_1º
';
html += '
$pfx_number Puntos FX
';
html += '
';
html += '
$trophy
$uses usos
';
var trophy = contest.prizes[iInterval].trophy;
if (trophyToShow=='')
trophyToShow = trophy;
if (trophyToShow==trophy && typeof contest.prizes[iInterval].trophy_uses!="undefined")
trophyToShowUses += contest.prizes[iInterval].trophy_uses*(contest.prizes[iInterval].range[1]-contest.prizes[iInterval].range[0]+1);
html = html.replace("$rank_0",contest.prizes[iInterval].range[0]);
html = html.replace("$rank_1",contest.prizes[iInterval].range[1]);
html = html.replace("$pfx_number",contest.prizes[iInterval].credits);
html = html.replace("$pfx_visible",contest.prizes[iInterval].credits==0?"visibility:hidden;":"");
html = html.replace("$trophy_image",typeof arrTrophies[trophy]=="undefined" ? "" : arrTrophies[trophy].Image);
html = html.replace("$trophy",typeof arrTrophies[trophy]=="undefined" ? "" : arrTrophies[trophy].Name);
html = html.replace("$visible_uses",typeof arrTrophies[trophy]=="undefined" || typeof contest.prizes[iInterval].trophy_uses=="undefined" ? "display:none;" : "");
html = html.replace("$uses",typeof arrTrophies[trophy]=="undefined" || typeof contest.prizes[iInterval].trophy_uses=="undefined" ? "" : contest.prizes[iInterval].trophy_uses);
arrContestTrophies[trophy] = trophy;
}
html += '';
for (var iTrophy in arrContestTrophies) {
if (iTrophy=="" || arrContestTrophies[iTrophy]==undefined || arrTrophies[iTrophy].Name==undefined)
continue;
var collection;
for (var iCollection=0; iCollection';
html += '
';
html += '
$trophy pertenece a la colección $collection
';
var short_name = arrTrophies[iTrophy].Name;
if (short_name.length>10)
short_name = short_name.slice(0,7)+"...";
html = html.replace("$trophy_image",arrTrophies[iTrophy].Image);
html = html.replace("$trophy",short_name);
html = html.replace("$collection",collection.Name);
html += '';
html += '
';
for (var iColTrophy=0; iColTrophy
';
html = html.replace("$trophy_image",arrTrophies[collection.Trophies[iColTrophy]].Image);
}
html += '';
html += '';
html += '';
}
html += '';
html += '
');
return;
}
FXPlanet.game_launch_window = plugin_result.Window;
game_launch_time = 10.0; // 30.0; // ahora el juego se muestra poco después de empezar a cargarse
game_launch_errors = 0;
// si el juego ya esta lanzado, lo reutiliza
if (FXPlanet.game_launch_survive_if_possible) {
data = FXPlanet.CallLauncher("state");
if (CheckLauncherTimeOut(data,30000,launch_try,"gls_game_launch-state"))
return;
if (data.Result) {
FXPlanet.game_launch_survive_if_possible = data.Game_State=="playing" && data.Game_Id==game_id;
if (FXPlanet.game_launch_survive_if_possible) {
data = FXPlanet.CallLauncher("notify?data=hwnd_"+FXPlanet.game_launch_window);
send_notifications = true;
if (CheckLauncherTimeOut(data,30000,launch_try,"gls_game_launch-notify"))
return;
if (data.Result) {
DebugLog("gls_game_launch notify "+FXPlanet.game_launch_window+" OK");
game_launch_time = 1.0; // para que el principio de gls_game_running muestre el juego
game_launch_state = gls_game_update;
FXPlanet.CallLauncherIPCCom("setvardic","plugin_window,"+FXPlanet.game_launch_window); // sirve para detectar plugin en otra ventana
}
}
}
}
else {// lanza el juego
command_line = '&cmd=/HWND '+FXPlanet.game_launch_window+game_launch_params;
if (FXPlanet.get_params.indexOf("reload_test")!=-1)
command_line = command_line+"/reload_test";
DebugLog("gls_game_launch launch");
data = FXPlanet.CallLauncher("launch?id="+game_id+command_line);
if (CheckLauncherTimeOut(data,30000,launch_try,"gls_game_launch-launch"))
return;
if (data.Result) {
FXPlanet.SendStat("has_ever_game_launched","web_new_game_launched");
ShowGameProgressText(String("$game_name cargando...").replace("$game_name",FXPlanet.game_name));
DebugLog("lanzado");
game_launch_state = gls_game_update;
FXPlanet.CallLauncherIPCCom("setvardic","plugin_window,"+FXPlanet.game_launch_window); // sirve para detectar plugin en otra ventana
//FXPlanet.AjaxCall("ajax/set_user_info.php", { Language: FXPlanet.locale }); // antes informaba del idioma de la sesioon al servidor navy
}
}
break;
case gls_game_update:
// PASO 10: esperar a que el juego este actualizado
data = FXPlanet.CallLauncher("state");
if (!data.Result || data.Result=="Error")
break;
if (data.Game_State=="playing") {
game_launch_state = gls_game_running;
// estadÃstica de gente nueva que juega
FXPlanet.SendStat("has_ever_played","web_new_user_played");
FXPlanet.game_launched_playing = true;
FXPlanet.game_launched_playing_last_time = 0;
$("#debug_version").html("9-"+PluginCall("Version").Version+"-"+PluginCall("VersionFXP").Version+"-"+
FXPlanet.CallLauncher("version").Version+"-"+FXPlanet.CallLauncherIPCCom("game_version","").Reply);
if (!FXInstallEntertainment.is_busy) // si no está en marcha el entretenimiento, mostrar el juego ya
FXPlanet.GameLaunchShow();
}
else if (data.Game_State=="updating") {
data = FXPlanet.CallLauncher("download_ex?id="+game_id+"&core=1&isw2i=0");
if (data.Result && data.Result!="Error") {
ShowGameProgress(data,"Descargando actualización de "+FXPlanet.game_name+"","Actualizando "+FXPlanet.game_name+"");
// si no está en marcha el entretenimiento, ponerlo en marcha (para entretener al usuario)
if ((data.State=="downloading" || data.State=="installing") && !FXInstallEntertainment.IsLaunched())
FXInstallEntertainment.Show();
}
}
else if (data.Game_State=="none" || data.Game_State=="main") {
game_launch_errors++;
if (game_launch_errors>=20) {
DebugLog("gls_game_update relanzando juego: "+json_encode(data).replace(/\n/g,' '));
game_launch_state = gls_start;
}
}
FXPlanet.ProcessNotifications();
break;
case gls_game_running:
// PASO 11: mostrar juego y responder a sus notificaciones
time_out = 1000;
game_launch_time -= 1.0;
if (game_launch_time>-0.5 && game_launch_time<0.5) {
DebugLog("gls_game_running juego cargado ");
$("#game_progress_container").hide();
FXPlanet.GameLaunchShow();
}
else if (game_launch_time>0) {
if ($("#fxplanet_object").css("top")==FXPlanet.game_launch_plugin_position)
$("#game_progress_container").hide();
else
ShowGameProgressText(String("$game_name cargando...").replace("$game_name",FXPlanet.game_name));
}
// verificar que el juego sigue en marcha, reiniciandolo si peta
if (FXPlanet.game_auto_relaunch) {
data = FXPlanet.CallLauncher("state");
if (data.Result && data.Result!="Error" && (data.Game_State=="playing" || data.Game_State=="setting" || data.Game_State=="updating"))
FXPlanet.game_launched_playing_last_time = 0;
else if (++FXPlanet.game_launched_playing_last_time>=5) {
DebugLog("gls_game_running relanzando juego: "+json_encode(data).replace(/\n/g,' '));
game_launch_state = gls_start;
}
}
// verificar que el juego no se ha abierto en otra ventana/pestaña
data = FXPlanet.CallLauncherIPCCom("getvardic","plugin_window");
if (data.Result=="Ok" && data.Reply!="" && data.Reply!=FXPlanet.game_launch_window) {
ShowMessage('Juego en otra ventana',FXPlanet.game_name+' se ha abierto en otra ventana o pestaña del navegador.
Para seguir jugando, utiliza esa ventana o pestaña.',false);
GameExit("",function(){});
}
// Enviar notificaciones pendientes
if (send_notifications)
FXPlanet.Notification.flush();
FXPlanet.ProcessNotifications();
break;
}
if (game_launch_state_previous!=game_launch_state)
time_out = 0;
setTimeout("GameLaunch("+launch_try+")",time_out);
}
function GameExit(confirm_text,callback)
{
if (!FXPlanet.game_launched) {
callback();
return;
}
var cb_exit = function()
{
FXPlanet.game_launched = false;
FXPlanet.game_launched_playing = false;
ArrayAddIfNotExist(FXPlanet.game_avoid_show,"not_loaded");
FXPlanet.GameLaunchStop();
$("#install_entertainment").empty();
$("#install_entertainment").hide();
$("#fxplanet_object").remove();
callback();
};
if (confirm_text===null || confirm_text===undefined)
confirm_text = "Para realizar esta acción es necesario abandonar la partida. ¿Estás seguro?";
if (confirm_text!="" && FXPlanet.must_confirm_exit_game)
ConfirmDialog("Abandonar la partida",confirm_text,cb_exit);
else
cb_exit();
}
function BeforeUnload()
{
return "Al cerrar la página saldrás del juego. ¿Estás seguro?";
}
function WaitForReplyChallenge(challenge,callback)
{
var cb = callback;
var tries = 30;
var _challenge = challenge;
var func_wait = function() {
try {
if ((--tries)<=0) {
DebugLog("https no responde");
cb("","HTTPS_NO_CONNECTION","No hay conexión con el servidor.\n\nPor favor, vuelve a intentarlo en unos minutos");
return;
}
frame_content = $("#https")[0].contentWindow.document.body.innerHTML;
reply_challenge = GetXMLData(frame_content,"reply_challenge");
hash_passw = GetXMLData(frame_content,"user_hash_passw");
if (reply_challenge=="" || GetXMLData(frame_content,"challenge")!=_challenge)
throw "continue";
else if (reply_challenge=="error" || hash_passw=="") {
SetCookie("user_pass_known","");
cb("","WRONG_PASS","La contraseña no es correcta");
}
else {
SetCookie("user_pass_known","true");
SetCookie("user_hash_passw",hash_passw);
DebugLog("reply_challenge->"+reply_challenge+";hash_passw->"+hash_passw);
user_hash_passw = hash_passw;
cb(reply_challenge,"","");
}
}
catch(err) {
setTimeout(func_wait,500);
}
};
func_wait();
}
function WaitForFrameContent(element_id,search_content,callback)
{
var cb = callback;
var func_wait = function() {
try {
element = document.getElementById(element_id);
if (element==null) {
cb("");
return;
}
frame_content = element.contentWindow.document.body.innerHTML;
if (frame_content.indexOf(search_content)!=-1) {
cb(frame_content);
return;
}
throw "continue";
}
catch(err) {
setTimeout(func_wait,500);
}
};
func_wait();
}
FXPlanet.LoginWithPass = function(email,user_pass,user_hold_logged,cb_ok,cb_ko)
{
FXPlanet.Login(email,"",hashPassword(user_pass,email),user_hold_logged,cb_ok,cb_ko);
}
FXPlanet.Login = function(email,user_id,user_hash,user_hold_logged,cb_ok,cb_ko)
{
user_hash_passw = user_hash;
var arrParams;
FXPlanet.doing_login = true;
$("#js_loading").show();
FXPlanet.AjaxCallEx("ajax/login_get_challenge.php", { mail: email }, function(reply) {
if (reply._resultStr!="WU_OK") {
FXPlanet.doing_login = false;
FXPlanet.Event.trigger("login_ko",reply);
if (typeof cb_ko==='function') cb_ko(reply);
return;
}
login_url = "https://juegos.fxinteractive.com/fx/application/wu2_login.php?email="+bin2hex(email)+"&challenge="+bin2hex(reply.Challenge);
if (user_hash_passw!="")
login_url += "&hash_passw="+bin2hex(user_hash_passw);
DebugLog("login_url->"+login_url+"<-");
DebugLog("challenge->"+reply.Challenge);
if ($("#https").length==0)
$("body").prepend('');
$("#https").attr("src",login_url);
WaitForReplyChallenge(reply.Challenge,function(reply_challenge,error,error_message) {
if (reply_challenge=="") {
FXPlanet.doing_login = false;
var obj = new Object;
obj._resultStr = error;
obj._resultMsg = error_message;
FXPlanet.Event.trigger("login_ko",obj);
if (typeof cb_ko==='function') cb_ko(obj);
return;
}
if (user_id!="")
arrParams = { userid: user_id, hash: reply_challenge, navy: navy_session };
else
arrParams = { mail: email, hash: reply_challenge, navy: navy_session };
FXPlanet.AjaxCallEx("ajax/login.php", arrParams, function(reply) {
$("#js_loading").hide();
if (reply._resultStr!="WU_OK") {
FXPlanet.doing_login = false;
FXPlanet.Event.trigger("login_ko",reply);
if (typeof cb_ko==='function') cb_ko(reply);
return;
}
var emailLogged = reply.UserMail!="" ? reply.UserMail : email;
FXPlanet.social_user_logged = false;
FXPlanet.User.uid = reply.UserId;
FXPlanet.Event.trigger("login",emailLogged,reply.Alias,reply.Country,reply.CountryBirth,reply.UserId,"",user_hold_logged);
if (typeof cb_ok==='function') cb_ok(reply);
});
});
});
}
FXPlanet.LoginWithCookies = function(cb_ok,cb_ko)
{
if (user_logged) {
if (typeof cb_ok==='function') cb_ok();
return;
}
if (typeof cb_ok==='function') FXPlanet.Event.subscribe('login', cb_ok);
if (typeof cb_ko==='function') FXPlanet.Event.subscribe('login_ko', cb_ko);
if (!FXPlanet.doing_login) {
FXPlanet.doing_login = true;
FXPlanet.AjaxCallEx("ajax/login_with_session.php", {}, function(reply) {
FXPlanet.doing_login = false;
if (reply._resultStr=="WU_OK") {
FXPlanet.social_user_logged = false;
FXPlanet.User.uid = reply.UserId;
FXPlanet.Event.trigger("login",reply.UserMail,reply.Alias,reply.Country,reply.CountryBirth,reply.UserId);
user_hash_passw = GetCookie("user_hash_passw");
}
else if (GetCookie("user_email")!="" && GetCookie("user_pass_known")=="true") {
DebugLog("FXPlanet.LoginWithCookies");
FXPlanet.Login(GetCookie("user_email"),"","",true);
}
else if (FXPlanet.social_network=="fb") {
FXPlanet.GetSocialData(function() { FXPlanet.SocialLogin(false,null); },cb_ko);
}
else
if (typeof cb_ko==='function') cb_ko();
});
}
}
function OnLogin(mail,alias,country,country_birth,session,page,user_hold_logged)
{
DebugLog("OnLogin "+mail);
FXPlanet.doing_login = false;
user_logged = true;
user_email = mail;
user_alias = alias;
user_country = country;
user_country_birth = country_birth;
SetCookie("user_email",(user_hold_logged!==false)?user_email:"");
$("input[name=alias]").val(user_alias);
ShowPage(page);
if (typeof BarraProgreso=='undefined' || FXPlanet.social_user!="")
user_email_validated = true;
else // activa el texto "email" de la barra de progreso
FXPlanet.AjaxCall("ajax/is_validated.php", {}, function(xml) {
user_email_validated = GetXMLData(xml,'result')=='ok';
if (user_email_validated)
BarraProgreso.setEmail();
});
// estadÃstica de gente nueva que hace login
FXPlanet.SendStat("has_ever_logged","web_new_user_logged");
// comprobacion de usuario baneado
FXPlanet.AjaxCallEx("ajax/generic.php", { call: "User.CheckBan", Game: game_id }, function(reply) {
if (reply._resultStr=="WC_ERROR_BANNED") {
var message = 'Tu cuenta ha sido desactivada hasta el $date.
Temporary workaround:
Download your games as normal via FX Store. Then, once the w2i has downloaded, check that it opens with 7zip.
If it does, it's a good w2i image. Save it and back it up.
If it doesn't, save it anyway (in case we ever find a proper fix), but also save the extracted files and make a 7zip out of them. Then, rename that 7zip as a w2i file.
EDIT: confirmed that the only game afaik that has this problem is Runaway. Tested with Imperium II la conquista de hispania, and the newly downloaded w2i is the same as always. Should be the same for most other FX w2i games. Let me know of any that don't work.
See Reddit post here about the problems: https://old.reddit.com/r/FreeGameFindings/comments/g8wtfu/pc_game_runaway_a_road_adventure/
Obviously this script isn't a full replacement for the FXWebStore. The recently give-away Runaway.w2i refuses to install/extract with 7zip or this script, but works fine with the FXWebStore.
I don't know why or how.
I examined the processes in Process Hacker, and, while the other games had 7zr.exe (extracting w2i) then w2i.exe (installing extracted files) pop up during the installation process, this one had only w2i.exe pop up to install it.