Skip to content

Commit

Permalink
Registration support
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAntares authored Sep 27, 2024
1 parent 0b8ced6 commit 36fd2d9
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions api.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
ROConfig.enableRefineUI = event.data.enableRefineUI || false;
ROConfig.enableDmgSuffix = event.data.enableDmgSuffix || false;
ROConfig.version = event.data.version || '';
ROConfig.registrationweb = event.data.registrationweb || '';
ROConfig.worldMapSettings = event.data.worldMapSettings || { episode: 98, add: [], remove: [] };
ROConfig.BGMFileExtension = event.data.BGMFileExtension || ['mp3'];
ROConfig.plugins = event.data.plugins || {};
Expand Down
6 changes: 6 additions & 0 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@
* cached one.
*/
ROBrowser.prototype.version = '';

/**
* @var {URL} URL to the server's registration site
*/
ROBrowser.prototype.registrationweb = '';

/**
* @var {Object} Dettings for World Map
Expand Down Expand Up @@ -473,6 +478,7 @@
enableDmgSuffix: this.enableDmgSuffix,
enableCheckAttendance: this.enableCheckAttendance,
version: this.version,
registrationweb: this.registrationweb,
worldMapSettings: this.worldMapSettings,
clientHash: this.clientHash,
calculateHash: this.calculateHash,
Expand Down
1 change: 1 addition & 0 deletions src/Engine/GameEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ define(function( require )
version: connection.find('version:first').text(),
langtype: connection.find('langtype:first').text(),
packetver: connection.find('packetver:first').text(),
registrationweb: connection.find('registrationweb:first').text(),
renewal: ['true', '1', 1, true].includes(connection.find('renewal:first').text().toLowerCase()),
adminList: (function(){
var list = [];
Expand Down
1 change: 1 addition & 0 deletions src/UI/Components/WinLogin/WinLogin/WinLogin.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
#WinLogin .save { position:absolute; top:32px; right:10px; display:block; width:38px; height:10px; border:none; background-color:transparent; background-repeat:no-repeat; }
#WinLogin .btn { position:absolute; border:0; width:42px; height:20px; bottom:4px; background-color:transparent; }
#WinLogin .btn.connect { right:50px; }
#WinLogin .btn.signup { left:5px; }
#WinLogin .btn.exit { right:5px; }
1 change: 1 addition & 0 deletions src/UI/Components/WinLogin/WinLogin/WinLogin.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<button class="save" type="button" data-background="login_interface/chk_saveoff.bmp" data-preload="login_interface/chk_saveon.bmp"></button>

<!-- Buttons -->
<button class="btn signup" type="button" data-background="login_interface/btn_request.bmp" data-hover="login_interface/btn_request_a.bmp" data-down="login_interface/btn_request_b.bmp"></button>
<button class="btn connect" type="submit" data-background="login_interface/btn_connect.bmp" data-hover="login_interface/btn_connect_a.bmp" data-down="login_interface/btn_connect_b.bmp"></button>
<button class="btn exit" type="button" data-background="login_interface/btn_exit.bmp" data-hover="login_interface/btn_exit_a.bmp" data-down="login_interface/btn_exit_b.bmp"></button>
</div>
20 changes: 20 additions & 0 deletions src/UI/Components/WinLogin/WinLogin/WinLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define(function(require)
*/
var DB = require('DB/DBManager');
var Client = require('Core/Client');
var Configs = require('Core/Configs');
var Preferences = require('Core/Preferences');
var Renderer = require('Renderer/Renderer');
var KEYS = require('Controls/KeyEventHandler');
Expand Down Expand Up @@ -75,6 +76,7 @@ define(function(require)
_buttonSave = ui.find('.save').mousedown(toggleSaveButton);

// Connect / Exit
ui.find('.signup').click(signup);
ui.find('.connect').click(connect);
ui.find('.exit').click(exit);
};
Expand Down Expand Up @@ -188,6 +190,24 @@ define(function(require)
// Connect
WinLogin.onConnectionRequest( user, pass );
return false;
}


/**
* Signup button func that takes the player to the <registrationweb>
*/
function signup(){
var url = Configs.get('registrationweb');

if(url){
UIManager.showPromptBox( DB.getMessage(662), 'ok', 'cancel', function(){
window.open(url);
}, null);

} else {
UIManager.showPromptBox( "No registration URL was provided.\nIf this server uses simplified registration, then input your new:\n - Username followed by _M for Male and _F for Female account (Eg: MyUser_M)\n - Password.", 'ok', 'cancel', null, null);
}

}


Expand Down
19 changes: 19 additions & 0 deletions src/UI/Components/WinLogin/WinLoginV2/WinLoginV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define(function(require)
*/
var DB = require('DB/DBManager');
var Client = require('Core/Client');
var Configs = require('Core/Configs');
var Preferences = require('Core/Preferences');
var KEYS = require('Controls/KeyEventHandler');
var UIManager = require('UI/UIManager');
Expand Down Expand Up @@ -79,6 +80,7 @@ define(function(require)

// Connect / Exit

WinLoginV2.ui.find('.signup').click(signup);
WinLoginV2.ui.find('.connect').click(connect);
WinLoginV2.ui.find('.exit').click(exit);
};
Expand Down Expand Up @@ -195,6 +197,23 @@ define(function(require)
WinLoginV2.onConnectionRequest( user, pass );
return false;
}

/**
* Signup button func that takes the player to the <registrationweb>
*/
function signup(){
var url = Configs.get('registrationweb');

if(url){
UIManager.showPromptBox( DB.getMessage(662), 'ok', 'cancel', function(){
window.open(url);
}, null);

} else {
UIManager.showPromptBox( "No registration URL was provided.\nIf this server uses simplified registration, then input your new:\n - Username followed by _M for Male and _F for Female account (Eg: MyUser_M)\n - Password.", 'ok', 'cancel', null, null);
}

}


/**
Expand Down

0 comments on commit 36fd2d9

Please sign in to comment.