Files
chocomae/src/web/js/lib/maestro_info.js
T

53 lines
886 B
JavaScript

class MaestroInfo {
constructor() {
this.maestroID = sessionStorage.getItem("maestroID");
this.maestroName = "";
this.accountType = 0;
this.playerCount = 0;
}
loadMaestroInfo(onSuccess, onFail) {
let self = this;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/maestro_info.php",
"maestro_id=" + this.maestroID,
(jsonData) => {
self.maestroName = jsonData["name"];
self.accountType = jsonData["accountType"];
self.playerCount = jsonData["playerCount"];
onSuccess();
},
(errorMessage, errorCode) => {
onFail(errorMessage, errorCode);
}
);
}
getMaxPlayerCount() {
switch(this.accountType) {
case 0:
case 1:
case 100:
case 101:
return 20;
case 2:
return 50;
case 3:
return 100;
}
}
getRegisteredPlayerCount() {
return this.playerCount;
}
}