mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 08:25:09 +01:00
Add multi-region launcher support
Add custom launcher as well as support for both the original TW and JP launchers.
This commit is contained in:
75
www/erupe/charsel.html
Normal file
75
www/erupe/charsel.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Simple MHF launcher</title>
|
||||
|
||||
<!--
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/firebug-lite/1.4.0/firebug-lite.js#startOpened,overrideConsole"></script>
|
||||
-->
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css">
|
||||
<!--[if IE 9]>
|
||||
<link href="css/bootstrap-ie9.css" rel="stylesheet">
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<link href="css/bootstrap-ie8.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/g/html5shiv@3.7.3"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!--[if gte IE 9]><!-->
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.bundle.min.js"></script>
|
||||
<!--<![endif]-->
|
||||
<!--[if IE 9]>
|
||||
<script src="js/bootstrap-ie9.js"></script>
|
||||
<![endif]-->
|
||||
<!--[if lte IE 8]>
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
|
||||
<script src="js/bootstrap-ie8.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script type="text/javascript" src="js/charsel.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="alertBox"></div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<div style="height:5em; margin-top:3em;">
|
||||
<h2>
|
||||
Erupe Simple Launcher
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-2"></div>
|
||||
<div class="col-8 text-center">
|
||||
<h5 class="mb-3">Character Select</h5>
|
||||
<ul id="characterlist" class="list-group char-select-list">
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-2"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 text-center">
|
||||
<button id="selectButton" class="btn btn-primary">Select</button>
|
||||
<!--
|
||||
<button id="newButton" class="btn btn-primary">New</button>
|
||||
<button id="deleteButton" class="btn btn-primary">Delete</button>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
13
www/erupe/css/main.css
Normal file
13
www/erupe/css/main.css
Normal file
@@ -0,0 +1,13 @@
|
||||
body {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
html,body {
|
||||
height: 100%;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.char-select-list {
|
||||
height: 15em;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
57
www/erupe/index.html
Normal file
57
www/erupe/index.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Simple MHF launcher</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css">
|
||||
<!--[if IE 9]>
|
||||
<link href="css/bootstrap-ie9.css" rel="stylesheet">
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<link href="css/bootstrap-ie8.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/g/html5shiv@3.7.3"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!--[if gte IE 9]><!-->
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.bundle.min.js"></script>
|
||||
<!--<![endif]-->
|
||||
<!--[if IE 9]>
|
||||
<script src="js/bootstrap-ie9.js"></script>
|
||||
<![endif]-->
|
||||
<!--[if lte IE 8]>
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
|
||||
<script src="js/bootstrap-ie8.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<nav id="titlebar" class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<a class="navbar-brand" href="#">MHF <i>Erupe</i></a>
|
||||
<ul class="navbar-nav mr-auto"></ul>
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a id="exit" class="nav-link" href="#">×</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div id="alertBox"></div>
|
||||
|
||||
<div class="container-fluid px-0 h-100">
|
||||
<div class="row no-gutters h-100">
|
||||
<div class="col-12">
|
||||
<iframe src="login.html" style="width: 100%; height: 100%; border: none; overflow:hidden;" frameBorder="0" scrolling="no"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
98
www/erupe/js/charsel.js
Normal file
98
www/erupe/js/charsel.js
Normal file
@@ -0,0 +1,98 @@
|
||||
function createErrorAlert(message) {
|
||||
parent.postMessage(message, "*");
|
||||
}
|
||||
|
||||
function createCharListItem(name, uid, weapon, HR, GR, lastLogin, sex) {
|
||||
var topDiv = $('<div/>')
|
||||
.attr("href", "#")
|
||||
.attr("uid", uid)
|
||||
.addClass("char-list-entry list-group-item list-group-item-action flex-column align-items-start");
|
||||
|
||||
var topLine = $('<div/>')
|
||||
.addClass("d-flex w-100 justify-content-between")
|
||||
.append(
|
||||
$('<h5/>')
|
||||
.addClass("mb-1")
|
||||
.text(name)
|
||||
)
|
||||
.append(
|
||||
$('<small/>')
|
||||
.text('ID:' + uid)
|
||||
);
|
||||
|
||||
var bottomLine = $('<div/>')
|
||||
.addClass("d-flex w-100 justify-content-between")
|
||||
.append($('<small/>').text('Weapon: ' + weapon))
|
||||
.append($('<small/>').text('HR: ' + HR))
|
||||
.append($('<small/>').text('GR: ' + GR))
|
||||
.append($('<small/>').text('LastLogin: ' + lastLogin))
|
||||
.append($('<small/>').text('Sex: ' + sex));
|
||||
|
||||
topDiv.append(topLine);
|
||||
topDiv.append(bottomLine);
|
||||
|
||||
$("#characterlist").append(topDiv);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
try {
|
||||
var charInfo = window.external.getCharacterInfo();
|
||||
} catch (e) {
|
||||
createErrorAlert("Error on getCharacterInfo!");
|
||||
}
|
||||
|
||||
try{
|
||||
// JQuery's parseXML isn't working properly on IE11, use the activeX XMLDOM instead.
|
||||
//$xmlDoc = $.parseXML(charInfo),
|
||||
$xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
|
||||
$xmlDoc.async = "false";
|
||||
$xmlDoc.loadXML(charInfo);
|
||||
|
||||
$xml = $($xmlDoc);
|
||||
} catch (e) {
|
||||
createErrorAlert("Error parsing character info xml!" + e);
|
||||
}
|
||||
|
||||
// Go over each "Character" element in the XML and then create a new list item for it.
|
||||
try {
|
||||
$($xml).find("Character").each(function(){
|
||||
createCharListItem(
|
||||
$(this).attr('name'),
|
||||
$(this).attr('uid'),
|
||||
$(this).attr('weapon'),
|
||||
$(this).attr('HR'),
|
||||
$(this).attr('GR'),
|
||||
$(this).attr('lastLogin'),
|
||||
$(this).attr('sex')
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
createErrorAlert("Error searching character info xml!");
|
||||
}
|
||||
|
||||
// Set the active character selection on click.
|
||||
$(".char-list-entry").click(function(){
|
||||
if(!$(this).hasClass("active")) {
|
||||
$(".char-list-entry.active").removeClass("active");
|
||||
$(this).addClass("active");
|
||||
}
|
||||
});
|
||||
|
||||
$("#selectButton").on("click", function() {
|
||||
// Get the active character selection.
|
||||
var selectedUid = $(".char-list-entry.active").attr("uid");
|
||||
|
||||
// Call into the native launcher select function.
|
||||
try{
|
||||
window.external.selectCharacter(selectedUid, selectedUid)
|
||||
} catch(e) {
|
||||
createErrorAlert("Error on select character!");
|
||||
}
|
||||
|
||||
// If we didn't error before, just close the launcher to start the game.
|
||||
setTimeout(function(){
|
||||
window.external.exitLauncher();
|
||||
}, 500);
|
||||
});
|
||||
|
||||
});
|
||||
38
www/erupe/js/login.js
Normal file
38
www/erupe/js/login.js
Normal file
@@ -0,0 +1,38 @@
|
||||
function createErrorAlert(message) {
|
||||
parent.postMessage(message, "*");
|
||||
}
|
||||
|
||||
|
||||
// Function to continually check if we got a login result yet,
|
||||
// then navigating to the character selection if we did.
|
||||
function checkAuthResult() {
|
||||
var loginResult = window.external.getLastAuthResult();
|
||||
console.log('|' + loginResult + '|');
|
||||
if(loginResult == "AUTH_PROGRESS") {
|
||||
setTimeout(checkAuthResult, 1500);
|
||||
} else if (loginResult == "AUTH_SUCCESS") {
|
||||
window.location.href = 'charsel.html'
|
||||
} else {
|
||||
createErrorAlert("Error logging in!");
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
|
||||
// Login form submission.
|
||||
$("#loginform").submit(function(e){
|
||||
e.preventDefault();
|
||||
|
||||
username = $("#username").val();
|
||||
password = $("#password").val();
|
||||
|
||||
try{
|
||||
window.external.loginCog(username, password, password);
|
||||
} catch(e){
|
||||
createErrorAlert("Error on loginCog: " + e);
|
||||
}
|
||||
|
||||
checkAuthResult();
|
||||
});
|
||||
|
||||
});
|
||||
93
www/erupe/js/main.js
Normal file
93
www/erupe/js/main.js
Normal file
@@ -0,0 +1,93 @@
|
||||
// Helper function to dynamically create a bootstrap alert box.
|
||||
function createErrorAlert(message) {
|
||||
var tmpDiv = $('<div/>')
|
||||
.attr("id", "myAlertBoxID")
|
||||
.attr("role", "alert")
|
||||
.addClass("alert alert-danger alert-dismissible fade show")
|
||||
|
||||
tmpDiv.append(message);
|
||||
tmpDiv.append($("<button/>")
|
||||
.attr("type", "button")
|
||||
.addClass("close")
|
||||
.attr("data-dismiss", "alert")
|
||||
.attr("aria-label", "Close")
|
||||
.append($("<span/>")
|
||||
.attr("aria-hidden", "true")
|
||||
.text("×")
|
||||
));
|
||||
|
||||
$("#alertBox").append(tmpDiv);
|
||||
}
|
||||
|
||||
function doLauncherInitalize() {
|
||||
try{
|
||||
window.external.getMhfMutexNumber();
|
||||
} catch(e){
|
||||
createErrorAlert("Error getting Mhf mutex number! " + e);
|
||||
}
|
||||
|
||||
try{
|
||||
var serverListXml = window.external.getServerListXml();
|
||||
} catch(e){
|
||||
createErrorAlert("Error getting serverlist.xml! " + e);
|
||||
}
|
||||
|
||||
if(serverListXml == ""){
|
||||
createErrorAlert("Got empty serverlist.xml!");
|
||||
}
|
||||
console.log(serverListXml);
|
||||
|
||||
try{
|
||||
var lastServerIndex = window.external.getIniLastServerIndex();
|
||||
} catch(e){
|
||||
createErrorAlert("Error on getIniLastServerIndex: " + e);
|
||||
}
|
||||
console.log("Last server index:" + lastServerIndex);
|
||||
|
||||
try{
|
||||
window.external.setIniLastServerIndex(0);
|
||||
} catch(e){
|
||||
createErrorAlert("Error on setIniLastServerIndex: " + e);
|
||||
}
|
||||
|
||||
try{
|
||||
var mhfBootMode = window.external.getMhfBootMode();
|
||||
} catch(e){
|
||||
createErrorAlert("Error on getMhfBootMode: " + e);
|
||||
}
|
||||
console.log("mhfBootMode:" + mhfBootMode);
|
||||
|
||||
try{
|
||||
var userId = window.external.getUserId();
|
||||
} catch(e){
|
||||
createErrorAlert("Error on getUserId: " + e);
|
||||
}
|
||||
console.log("userId:" + userId);
|
||||
|
||||
try{
|
||||
var password = window.external.getPassword();
|
||||
} catch(e){
|
||||
createErrorAlert("Error on getPassword: " + e);
|
||||
}
|
||||
console.log("password:" + password);
|
||||
}
|
||||
|
||||
$(function() {
|
||||
// Setup the titlebar and exit button so that the window works how you would expect.
|
||||
$("#titlebar").on("click", function(e) {
|
||||
window.external.beginDrag(true);
|
||||
});
|
||||
|
||||
$("#exit").on("click", function(e) {
|
||||
window.external.closeWindow();
|
||||
});
|
||||
|
||||
// Setup the error message passthrough
|
||||
$(window).on("message onmessage", function(e) {
|
||||
var data = e.originalEvent.data;
|
||||
createErrorAlert(data)
|
||||
});
|
||||
|
||||
// Initialize the launcher by calling the native/external functions it exposes in the proper order.
|
||||
doLauncherInitalize();
|
||||
});
|
||||
68
www/erupe/login.html
Normal file
68
www/erupe/login.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Simple MHF launcher</title>
|
||||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/css/bootstrap.min.css">
|
||||
<!--[if IE 9]>
|
||||
<link href="css/bootstrap-ie9.css" rel="stylesheet">
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<link href="css/bootstrap-ie8.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/g/html5shiv@3.7.3"></script>
|
||||
<![endif]-->
|
||||
|
||||
<!--[if gte IE 9]><!-->
|
||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.bundle.min.js"></script>
|
||||
<!--<![endif]-->
|
||||
<!--[if IE 9]>
|
||||
<script src="js/bootstrap-ie9.js"></script>
|
||||
<![endif]-->
|
||||
<!--[if lte IE 8]>
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
|
||||
<script src="js/bootstrap-ie8.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.0/js/bootstrap.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script type="text/javascript" src="js/login.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="alertBox"></div>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 text-center">
|
||||
<div style="height:5em; margin-top:3em;">
|
||||
<h2>
|
||||
Erupe Simple Launcher
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="segment">
|
||||
<h5 class="mb-3">Login</h5>
|
||||
<form id="loginform">
|
||||
<div class="form-group">
|
||||
<input type="text" class="form-control" id="username" placeholder="Username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" class="form-control" id="password" placeholder="Password">
|
||||
</div>
|
||||
<button id="submitButton" type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user