erstmal is das Thema schon wieder uralt und außerdem geht das anders.
damals ging es aufjenden Fall noch,jetzt hab ich keine Ahnung
Geht in den Em2 ordner und dann hierhin EasyMetin2_de_\cfg\web\javascripts
dort öffnet ihr die launcher.js und edet das
InitWindow(241,506,"Easymetin2")
function ResizeTriggerMouseMove(e){
var currentHeight = e.clientY;
if (this.oriHeight && this.clientsContainerOriHeight) {
var height = this.clientsContainerOriHeight + (currentHeight - this.oriHeight);
document.getElementById("main").style.height = height < 0 ? "0" : (height + "px");
}
}
function RegisterEvents(){
MultiLauncher.init("game_clients_container");
$("title").observe("mousedown",function(){
External.MoveWindow();
});
$("recharge_btn").observe("click",function(){
External.CreateNewDlg('Recharge.html', 3);
});
$("hide_user_info").observe("click",function(){
//$("user_packs").toggle();
})
$("close_window_btn").observe("click", function () {
base.CookieAdapter.DeleteCookie("bot_name");
External.QuitDlg(false);
});
$("min_window_btn").observe("click",function(){
External.MinWindow();
});
$("start_game_btn").observe("click",function(){
var index = MultiLauncher.generateIndex();
if ( MultiLauncher.canStartNewGame() ) {
if(External.StartNewGame(index) == true) MultiLauncher.addClient(index);
}else{
MultiLauncher.warnAboutMaxClientNumber();
}
});
$("window_resize_trigger").observe("mousedown",fun ction(e){
this.oriHeight = e.clientY;
this.clientsContainerOriHeight = $("main").offsetHeight;
this.setCapture();
this.observe("mousemove",ResizeTriggerMouseMove);
this.observe("mouseup",function () {
this.releaseCapture();
this.stopObserving("mousemove",ResizeTriggerMouseM ove);
})
})
}
var MultiLauncher = {
maxClientNumber: 3,
container: null,
container:null,
clients: [],
generateIndex: function(){
var i = 0;
while(1){
if (this.find(i) == -1) {
return i;
}
i++;
}
},
init:function(container){
this.container = $(container);
this.createSavedClients();
},
find:function(index){
for(var i=0;i<this.clients.length;i++){
if (this.clients[i] != undefined && this.clients[i].index == index) {
return i;
}
}
return -1;
},
addClient: function(index){
this.clients.push(new GameClient(this.container,index,arguments[1],arguments[2]));
},
createSavedClients: function () {
var savedRoles = External.GetRememberedRoleNameList().split(",");
savedRoles.pop();
savedRoles = savedRoles.inGroupsOf(2);
for(var i = 0;i<savedRoles.length;++i){
this.createNewClient(savedRoles[i][0],savedRoles[i][1],this.generateIndex());
}
},
createNewClient: function(accountName,roleName,index){
External.AddGameConsole(index,roleName);
this.addClient(index,accountName,roleName);
$("game_closed_name_container_" + index).innerHTML = accountName;
$("role_name_container_" + index).innerHTML = roleName;
},
deleteClient: function(index){
for(var i=0;i<this.clients.length;i++){
if (this.clients[i].index == index) {
this.clients[i].stopCheckStates();
this.clients[i].removeEle();
delete this.clients[i];
this.clients[i] = null;
this.clients.splice(i,1);
}
}
},
canStartNewGame: function(){
return External.GetStartedGamesCount() < this.maxClientNumber;
},
warnAboutMaxClientNumber: function(){
External.ShowAlert("You can only launch 3 game client!");
}
}
function GameClient(container,index){
this.container = $(container);
this.index = index;
this.partialName = "client_unit";
this.refreshTimer = null;
this.roleName = arguments[3] == undefined ? "" : arguments[3];
this.accoutName = arguments[2] == undefined ? "" : arguments[2];
this.restartFailedCount = 0;
this.isTryingStartGame = false;
this.restartTimer = null;
this.countDownTimers = [];
this.manualClose = false;
this.applyElements = function(){
this.container.insert({bottom:RenderPartial(this.p artialName,this.index)});
};
this.registerTooltips = function(){
// Forget remembered role
$("forget_role_btn_"+this.index).summary = infoStrs.launcher.forget_role_tooltip_summary;
$("forget_role_btn_"+this.index).tip_title = infoStrs.launcher.forget_role_tooltip_text;
RegisterTooltip($("forget_role_btn_"+this.index),{ summary_prop: "summary"});
// Show log
$("running_show_log_btn_"+this.index).tip_title = infoStrs.launcher.not_available;
$("running_show_log_btn_"+this.index).summary = infoStrs.launcher.show_log_summary;
RegisterTooltip($("running_show_log_btn_"+this.ind ex),{summary_prop: "summary"});
$("closed_show_log_btn_"+this.index).tip_title = infoStrs.launcher.not_available;
$("closed_show_log_btn_"+this.index).summary = infoStrs.launcher.show_log_summary;
RegisterTooltip($("closed_show_log_btn_"+this.inde x),{summary_prop: "summary"});
// Close game client
$("stop_game_btn_"+this.index).tip_title = infoStrs.launcher.stop_game_tooltip;
$("stop_game_btn_"+this.index).summary = infoStrs.launcher.stop_game_tooltip_summary;
RegisterTooltip($("stop_game_btn_"+this.index),{su mmary_prop: "summary"});
// Auto connection settings
var setTo = ($("auto_connect_btn_"+this.index).className == "reconnect_on");
$("auto_connect_btn_"+this.index).tip_title = setTo ? infoStrs.launcher.auto_connect_tooltip_on_text : infoStrs.launcher.auto_connect_tooltip_off_text;
$("auto_connect_btn_"+this.index).summary = infoStrs.launcher.auto_connect_tooltip_summary;
RegisterTooltip($("auto_connect_btn_"+this.index), {summary_prop: "summary",refreshable: true});
// HP and EXP display
$("hp_bar_container_"+this.index).summary = infoStrs.launcher.hp;
RegisterTooltip($("hp_bar_container_"+this.index), {summary_prop: "summary",refreshable:true});
$("exp_bar_container_"+this.index).summary = infoStrs.launcher.exp;
RegisterTooltip($("exp_bar_container_"+this.index) ,{summary_prop: "summary",refreshable:true});
// Close game when opening game
$("close_game_when_entering_game_"+this.index).tip _title = infoStrs.launcher.stop_game_tooltip;
$("close_game_when_entering_game_"+this.index).sum mary = infoStrs.launcher.stop_game_tooltip_summary;
RegisterTooltip($("close_game_when_entering_game_" +this.index),{summary_prop: "summary",refreshable:true});
}
this.registerEvents = function(){
$("forget_role_btn_"+this.index).observe("click",f unction(){
External.DeleteGameConsole(this.index);
if(External.RemoveRole(this.roleName.toString())){
MultiLauncher.deleteClient(this.index);
}
External.HideToolTip();
}.bind(this));
$("reconnect_btn_"+this.index).observe("click",fun ction(){
try{
clearTimeout(this.restartTimer);
for(var i=0;i<this.countDownTimers.length;i++){
try{clearTimeout(this.countDownTimers[i]);}catch(e){}
}
}catch(e){}
External.AutoReconnectGame(this.index);
this.isTryingStartGame = false;
}.bind(this));
$("reconnect_cancel_btn_"+this.index).observe("cli ck",function(){
try{
External.SetAutoConnect(false,this.index);
clearTimeout(this.restartTimer);
for(var i=0;i<this.countDownTimers.length;i++){
try{clearTimeout(this.countDownTimers[i]);}catch(e){}
}
}catch(e){}
$("game_restart_container_" + this.index).hide();
$("game_start_operator_container_" + this.index).show();
this.isTryingStartGame = false;
}.bind(this));
$("stop_game_btn_"+this.index).observe("click",fun ction(){
this.closeGame();
this.manualClose = true;
}.bind(this));
$("auto_connect_btn_"+this.index).observe("click", function(ele){
var setTo = (ele.className == "reconnect_off");
External.SetAutoConnect(setTo,parseInt(this.index, 10));
ele.className = setTo ? "reconnect" : "reconnect_off";
ele.tip_title = setTo ? infoStrs.launcher.auto_connect_tooltip_on_text : infoStrs.launcher.auto_connect_tooltip_off_text;
}.bind(this,$("auto_connect_btn_"+this.index)));
$("restart_game_btn_"+this.index).observe("click", function(){
if ( MultiLauncher.canStartNewGame() ) {
External.RestartGame(parseInt(this.index,10),this. roleName);
}else{
MultiLauncher.warnAboutMaxClientNumber();
}
}.bind(this));
$("auto_login_btn_"+this.index).observe("click",fu nction(){
if (MultiLauncher.canStartNewGame()) {
if(External.RestartGame(parseInt(this.index,10),th is.roleName)){
this.manualClose = false;
}
}else{
MultiLauncher.warnAboutMaxClientNumber();
}
}.bind(this));
$("close_game_when_entering_game_"+this.index).obs erve("click",function(){
this.manualClose = true;
External.StopGame(this.index);
}.bind(this));
this.registerTooltips();
};
this.startCheckState = function(){
this.refreshTimer = setInterval(function(){
//Get role's detail information:life,mana,exp...
var currentState = External.GetGameState(parseInt(this.index,10));
var isAutoConnect = External.GetAutoConnectSetting(this.index);
try{
switch(currentState){
//Game console has been deleted
case -1:
MultiLauncher.deleteClient(this.index);
break;
case 0://GS_UNOPENGAME
if (isAutoConnect && this.manualClose == false) {
$("game_restart_container_"+this.index).show();
$("game_start_operator_container_"+this.index).hid e();
if (this.isTryingStartGame == false) {
this.startCountDown();
}
}else{
$("game_restart_container_"+this.index).hide();
$("game_start_operator_container_"+this.index).sho w();
}
break;
case 1://GS_OPENINGGAME
break;
case 2://GS_OPENEDGAME
eval("var gameInfo = "+External.GetRoleInfo(this.index));
if (gameInfo == {}) return;
this.restartFailedCount = 0;//reset launch game failed times
this.refreshRoleInfo(gameInfo);
break;
default:
break;
}
var states = ["game_closed","game_entering","game_running"];
this.switchTo(currentState == -1 ? states[0] : states[currentState]);
$("auto_connect_btn_"+this.index).className = isAutoConnect ? "reconnect" : "reconnect_off";
$("auto_connect_btn_"+this.index).tip_title = isAutoConnect ? infoStrs.launcher.auto_connect_tooltip_on_text : infoStrs.launcher.auto_connect_tooltip_off_text;
}catch(e){}
}.bind(this),500);
};
this.startCountDown = function(){
$("reconnect_times_"+this.index).innerHTML = this.restartFailedCount;
if (this.restartFailedCount >= RECONNECT_TIME_OUT.length) {
//never auto restart this client again;
$("reconnect_count_down_container_" + this.index).hide();
$("reconnect_cancel_btn_" + this.index).hide();
}else{
this.isTryingStartGame = true;
var countDownTime = RECONNECT_TIME_OUT[this.restartFailedCount];
this.restartFailedCount++;
$("reconnect_count_down_container_" + this.index).show();
$("reconnect_cancel_btn_" + this.index).show();
//refresh count down number every second
this.countDownTimers = [];
for(var i=0;i<countDownTime/1000;i++){
this.countDownTimers.push(
setTimeout(function(i){
try{$("reconnect_count_down_container_" + this.index).innerHTML = infoStrs.launcher.reconnect_in.replace("%seconds", i.toString());}catch(e){}
}.bind(this,i),countDownTime-i*1000)
);
}
this.restartTimer = setTimeout(function(){
if (this.manualClose == false) {
if(External.AutoReconnectGame(this.index)){
this.manualClose = false;
this.isTryingStartGame = false;
}else{
//if launch game client failed,try again
this.startCountDown();
};
}
}.bind(this),countDownTime);
}
};
this.refreshRoleInfo = function(roleInfo){
if (!roleInfo.name.strip().blank()) {
$A([
$("active_role_name_container_"+this.index),
$("error_role_name_container_"+this.index),
$("role_name_container_"+this.index)
]).each(function (name_contaienr) {
name_contaienr.innerHTML = roleInfo.name.split(",")[1];
});
$("game_closed_name_container_" + this.index).innerHTML = roleInfo.name.split(",")[0];
this.roleName = roleInfo.name.split(",")[1];
}
try{
$("lvl_container_"+this.index).innerHTML = roleInfo.level;
var hp_percent = parseInt(roleInfo.hp/roleInfo.maxhp*100,10);
hp_percent = hp_percent > 0 ? hp_percent : 0;
var exp_percent = parseInt(roleInfo.exp/roleInfo.nextExp*100000,10);
exp_percent = Math.round(exp_percent / 10) /100
$("hp_bar_container_"+this.index).tip_title = "<span style='color:yellow'>"+roleInfo.hp + "</span>/<span style='color:#aaffff'>" + roleInfo.maxhp+"</span><b style='color:white'>("+hp_percent+"%)</b>";
$("exp_bar_container_"+this.index).tip_title = "<span style='color:yellow'>"+roleInfo.exp + "</span>/<span style='color:#aaffff'>" + roleInfo.nextExp+"</span><b style='color:white'>("+exp_percent+"%)</b>";
$("hp_bar_"+this.index).style.width = parseInt(roleInfo.hp/roleInfo.maxhp*100,10)+"%";
$("exp_bar_"+this.index).style.width = exp_percent+"%";
}catch(e){}
}
this.closeGame = function(){
External.StopGame(parseInt(this.index,10));
this.switchTo("game_closed");
}
this.switchTo = function(state){
if (this.state != state) {
this.state = state;
this.hideAllEle();
$(state+"_container_"+this.index).show();
if (state == "game_closed"){
if ((this.roleName != undefined) && !(this.roleName.strip().blank())) {
$("auto_login_btn_"+this.index).show();
$("restart_game_btn_"+this.index).hide();
}else{
$("auto_login_btn_"+this.index).hide();
$("restart_game_btn_"+this.index).show();
}
}
}
};
this.hideAllEle = function(){
try{
$("game_closed_container_"+this.index).hide();
$("game_error_container_"+this.index).hide();
$("game_running_container_"+this.index).hide();
$("game_entering_container_"+this.index).hide();
}catch(e){}
};
this.removeEle = function(){
$("game_closed_container_"+this.index).remove();
$("game_error_container_"+this.index).remove();
$("game_running_container_"+this.index).remove() ;
$("game_entering_container_"+this.index).remove( );
};
this.stopCheckStates = function(){
clearInterval(this.refreshTimer);
}
this.applyElements();
this.registerEvents();
this.startCheckState();
};
//versionType:0.0.7.12.1031
function IsTheLatestVersion(localVersion, serverVersion) {
if (parseInt(localVersion.split(".")[0]) > parseInt(serverVersion.split(".")[0])){
return true;
}
if (parseInt(localVersion.split(".")[1]) > parseInt(serverVersion.split(".")[1])){
return true;
}
if (parseInt(localVersion.split(".")[2]) > parseInt(serverVersion.split(".")[2])) {
return true;
}
if (parseInt(localVersion.split(".")[3]) >= parseInt(serverVersion.split(".")[3])) {
return true;
}
return false
}
function LoadVersionList(){
var versions = External.GetVersionList();
if (versions.match(/HTTP(.*?)404/) != null) {
ReportException("xml文件没找到");
$("latest_version_container").hide();
$("latest_version_info_container").hide();
$("update_btn").hide();
return ;
}
if (versions.strip().blank()) return ;
var xmlDocument = new ActiveXObject("Microsoft.XMLDOM");
xmlDocument.loadXML(versions);
var latestVersionName = xmlDocument.lastChild.firstChild.getElementsByTagN ame("versionname")[0].text;
latestVersionName = latestVersionName.gsub(" ","").toLowerCase().substr(14, latestVersionName.gsub(" ","").toLowerCase().length);
var isLastestVersion = IsTheLatestVersion(External.GetBotVersion().gsub(" ","").toLowerCase(), latestVersionName );
var showTag = isLastestVersion ? "span" : "a";
if (isLastestVersion) {
$("latest_version_container").hide();
$("latest_version_info_container").show();
$("update_btn").hide();
}else{
$("latest_version_container").show();
$("latest_version_info_container").hide();
$("update_btn").show();
}
if (!isLastestVersion) {
$($("version_info").getElementsByTagName(showTag)[0]).observe("click",function(){
OpenPageInNewWindow(WEB_DOWNLOAD_PAGE_URL);
});
}
return "";
}
function startFetchVersionList(){
External.StartFetchVersionList();
var timer = setInterval(function(){
if (External.HasFetchedVersionList() == true) {
LoadVersionList();
clearInterval(timer);
}
},1000);
}
function DynamicalFitWindowSize(){
try{
var dim = $(document.body).getDimensions();
External.Resize(dim.width,dim.height);
}catch(e){}
}
function StartRefeshClients() {
setInterval(function () {
var injectedGames = External.GetInjectedGames().split(",");
injectedGames.pop();
injectedGames.each(function (id) {
if (MultiLauncher.find(id) == -1) {
MultiLauncher.addClient(id);
}
});
for (var i = 0; i < MultiLauncher.clients.length; i++) {
var client = MultiLauncher.clients[i];
if (client == null) return;
if (injectedGames.indexOf(client.index.toString()) == -1 && client.roleName == "") {
MultiLauncher.deleteClient(client.index);
}
};
var remain_available_client_number = MultiLauncher.maxClientNumber - External.GetStartedGamesCount();
$("remain_available_client_number").innerHTML = infoStrs.launcher.clients_number_description.repla ce(
"%number",
remain_available_client_number.toString().bold().b ig()
);
if (External.HaveBalance() == true) {
SwitchButtonType("normal");
} else {
SwitchButtonType(External.InActivities() ? "activities" : "disabled");
}
RefreshExpireTime();
}, 1000)
}
function RefreshExpireTime() {
$("expire_time").innerHTML = External.GetAccountExpireTime();
}
function SwitchButtonType(type) {
var types = ["normal", "activities", "disabled"];
var start_btn_classes = ["btn_start", "btn_start_activities", "btn_start_disable"];
var btn_classes = ["btn", "btn_activities", "btn_disable"];
$A(types).each(function (t, index) {
if (t == type) {
$A(document.getElementsByClassName("unit-start-button")).each(function (item) {
$(item).addClassName(btn_classes[index]);
});
$A(document.getElementsByClassName("start-button")).each(function (item) {
$(item).addClassName(start_btn_classes[index]);
});
} else {
$A(document.getElementsByClassName("unit-start-button")).each(function (item) {
$(item).removeClassName(btn_classes[index]);
});
$A(document.getElementsByClassName("start-button")).each(function (item) {
$(item).removeClassName(start_btn_classes[index]);
});
}
});
}