diff --git a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/PlayerInfoRequestHandler.java b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/PlayerInfoRequestHandler.java index 14a92d295..3a8634232 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/PlayerInfoRequestHandler.java +++ b/gemp-lotr/gemp-lotr-async/src/main/java/com/gempukku/lotro/async/handler/PlayerInfoRequestHandler.java @@ -6,6 +6,7 @@ import com.gempukku.lotro.game.Player; import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.QueryStringDecoder; +import com.alibaba.fastjson.JSON; import java.lang.reflect.Type; import java.util.Map; @@ -27,8 +28,7 @@ public class PlayerInfoRequestHandler extends LotroServerRequestHandler implemen String participantId = getQueryParameterSafely(queryDecoder, "participantId"); Player resourceOwner = getResourceOwnerSafely(request, participantId); - String playerName = resourceOwner.getName(); - responseWriter.writeJsonResponse(JsonConvert.toJson(playerName)); + responseWriter.writeJsonResponse(JSON.toJSONString(resourceOwner.GetUserInfo())); } else { throw new HttpProcessingException(404); diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/admin.html b/gemp-lotr/gemp-lotr-async/src/main/web/admin.html index 35d81f2b3..5bd114ee5 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/admin.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/admin.html @@ -1,34 +1,2 @@ - - -

Cache

-Clear cache - -

Message of the Day

- -
- MotD:
- -
- -

Collections

- -

Add items

- -
- Type:
- Product:
- Players:
- -
- -

Add items to collection

- -
- Type:
- Reason:
- Product:
- -
- - - \ No newline at end of file +You don't need this anymore :)

+Go to the main hall and click on the Admin tab instead. \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/ban.html b/gemp-lotr/gemp-lotr-async/src/main/web/ban.html index f1236e8d6..9c734ca72 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/ban.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/ban.html @@ -1,198 +1,2 @@ - - - Gemp-LotR Ban Manager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ban user

-

Permanently

-
- Name (case-sensitive):
- -
-

Temporarily

-
- Name (case-sensitive):
- Duration: -
- -
-

Unban user

-
- Name (case-sensitive):
- -
-

Find suspicious behaviour

-

Multiple user accounts

-
- Name (case-sensitive):
- -
-
- - +You don't need this anymore :)

+Go to the main hall and click on the Admin tab instead. \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css index 01edd0a95..4124db980 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css +++ b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/hall.css @@ -140,8 +140,7 @@ button > span { #serverInfo { align-items:stretch; overflow: visible; - flex-grow: 1; - + flex-shrink: 1; padding: 7px; position: sticky; @@ -171,14 +170,26 @@ button > span { #gameHall { overflow-y: scroll; + width: calc(100% ); +} + +#gameHallMain { + flex-direction: column; + width: 100%; +} + +#hall { + flex-grow: 3; } .hall-tab { background: linear-gradient(to top, #200902, #111111 80%) !important; - width: calc(100% - 2.8em) ; + width: calc(100% - 0.4em); height: 100%; overflow-x: hidden; - + display: flex; + flex-direction: row; + gap: 2px; flex-grow: 3; gap: 5px; } @@ -572,16 +583,8 @@ table.tables tr.privateForPlayer { -#helpMain, -#eventsMain { - width: calc(100% - 0.4em); -} -#ui-tabs-1, -#ui-tabs-2, -#ui-tabs-3, -#ui-tabs-4 -/*#ui-tabs-5*/ { +#main > .ui-tabs-panel { overflow-x: hidden; overflow-y: hidden; height: 100%; diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/icons.css b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/icons.css index eab8452b6..58efe2880 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/icons.css +++ b/gemp-lotr/gemp-lotr-async/src/main/web/css/gemp-001/icons.css @@ -1,3 +1,22 @@ +.custom-icon { + background-color: transparent; /* make the button transparent */ + background-repeat: no-repeat; /* make the background image appear only once */ + background-position: 0px 0px; /* equivalent to 'top left' */ + background-size: 20px; + border: none; /* assuming we don't want any borders */ + cursor: pointer; /* make the cursor like hovering over an element */ + height: 20px; /* make this the size of your image */ + padding-left: 30px ; /* make text start to the right of the image */ + vertical-align: middle; /* align the text vertically centered */ + filter: brightness(0) invert(1); +} + +.ui-tabs .ui-tabs-nav li > a.custom-icon { + padding: 0.5em 1em 0.5em 35px; + /*background-origin: content-box;*/ + background-position: 10px center; +} + .icon-discord { background-image: url("../../images/icons/discord-brands.svg"); } @@ -16,6 +35,7 @@ .icon-hall { background-image: url("../../images/icons/swords.svg"); + background-size: 25px; } .icon-help { @@ -46,21 +66,8 @@ background-image: url("../../images/icons/store-slash-solid.svg"); } -.custom-icon { - background-color: transparent; /* make the button transparent */ - background-repeat: no-repeat; /* make the background image appear only once */ - background-position: 0px 0px; /* equivalent to 'top left' */ - background-size: 20px; - border: none; /* assuming we don't want any borders */ - cursor: pointer; /* make the cursor like hovering over an element */ - height: 20px; /* make this the size of your image */ - padding-left: 30px ; /* make text start to the right of the image */ - vertical-align: middle; /* align the text vertically centered */ - filter: brightness(0) invert(1); +.icon-admin { + background-image: url("../../images/icons/toolbox-solid.svg"); } -.ui-tabs .ui-tabs-nav li > a.custom-icon { - padding: 0.5em 1em 0.5em 35px; - /*background-origin: content-box;*/ - background-position: 10px center; -} + diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html index c96e9d373..06de965d3 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html @@ -10,12 +10,15 @@ - - + + + + + - + @@ -57,12 +60,16 @@ var hall; $(document).ready(function () { - chat = new ChatBoxUI("Game Hall", $("#chat"), "/gemp-lotr-server", true, null, false, true, null, true); - chat.showTimestamps = true; - - hall = new GempLotrHallUI("/gemp-lotr-server", chat); $("#main").tabs(); + //Hiding the Users tab until that feature is ready + $("#tabs > ul :nth-child(5)").hide(); + + chat = new ChatBoxUI("Game Hall", $("#chat"), "/gemp-lotr-server", true, null, false, null, true); + chat.showTimestamps = true; + + hall = new GempLotrHallUI("/gemp-lotr-server", chat); + var infoDialog = $("
") .dialog({ @@ -118,7 +125,6 @@ return true; }); - $("#ui-tabs") }); @@ -157,121 +163,126 @@
  • Server Info
  • - +
  • My Account
  • +
  • + Admin +
  • -
    -
    -
    - - - - - - - - - - - - +
    + -
    -
    -
    Waiting Tables(0)
    -
    - - - - - - - - -
    FormatTable InfoStatusPlayersActions
    +
    +
    +
    Waiting Tables(0)
    +
    + + + + + + + + +
    FormatTable InfoStatusPlayersActions
    +
    + +
    Playing Tables(0)
    +
    + + + + + + + + +
    FormatTable InfoStatusPlayersActions
    +
    + +
    Finished Tables(0)
    +
    + + + + + + + + +
    FormatTable InfoStatusPlayersWinner
    +
    + +
    Tournament Queues(0)
    +
    + + + + + + + + + + + + +
    FormatCollectionQueue nameStartsSystemPlayersCostPrizesActions
    +
    + +
    Active Tournaments(0)
    +
    + + + + + + + + + + + +
    FormatCollectionTournament nameSystemStageRoundPlayersActions
    +
    +
    - -
    Playing Tables(0)
    -
    - - - - - - - - -
    FormatTable InfoStatusPlayersActions
    -
    - -
    Finished Tables(0)
    -
    - - - - - - - - -
    FormatTable InfoStatusPlayersWinner
    -
    - -
    Tournament Queues(0)
    -
    - - - - - - - - - - - - -
    FormatCollectionQueue nameStartsSystemPlayersCostPrizesActions
    -
    - -
    Active Tournaments(0)
    -
    - - - - - - - - - - - -
    FormatCollectionTournament nameSystemStageRoundPlayersActions
    -
    -
    diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin.html b/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin.html new file mode 100644 index 000000000..51fd0b836 --- /dev/null +++ b/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin.html @@ -0,0 +1,105 @@ + + +
    + + +
    +
    +

    Cache

    + Clear cache + +

    Message of the Day

    + +
    + MotD:
    + +
    + +

    Collections

    + +

    Add items

    + +
    + Type:
    + Product:
    + Players:
    + +
    + +

    Add items to collection

    + +
    + Type:
    + Reason:
    + Product:
    + +
    +
    +
    +
    +
    +

    Ban user

    +

    Permanently

    +
    + Name (case-sensitive):
    + +
    +

    Temporarily

    +
    + Name (case-sensitive):
    + Duration: +
    + +
    +

    Unban user

    +
    + Name (case-sensitive):
    + +
    +

    Find suspicious behaviour

    +

    Multiple user accounts

    +
    + Name (case-sensitive):
    + +
    +
    +
    +
    +
    + + + + diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin/leagueAdmin.html b/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin/leagueAdmin.html new file mode 100644 index 000000000..13dace688 --- /dev/null +++ b/gemp-lotr/gemp-lotr-async/src/main/web/includes/admin/leagueAdmin.html @@ -0,0 +1,288 @@ + + + Gemp-LotR League Administration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    League

    + +

    Add sealed league

    + +
    + Name:
    + Cost (in silver):
    + Start (YYYYMMDD):
    + Format: +
    + Series duration in days:
    + Maximum matches in series:
    + + +
    + +

    Add solo-draft league

    + +
    + Name:
    + Cost (in silver):
    + Start (YYYYMMDD):
    + Format: +
    + Series duration in days:
    + Maximum matches in series:
    + + +
    + +

    Add constructed league

    + +
    + Name:
    + Cost (in silver):
    + Start (YYYYMMDD):
    + Prize multiplier (e.g. 0.7):
    + Collection: +
    + +
    +
    + Series definition:
    + Format: +
    + Series duration in days:
    + Maximum matches in series:
    +
    +
    + + + +
    + + + diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js index 5860a1bec..e58494973 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js @@ -1,5 +1,6 @@ var ChatBoxUI = Class.extend({ name:null, + userInfo:null, userName:null, pingRegex:null, mentionRegex:null, @@ -35,7 +36,8 @@ var ChatBoxUI = Class.extend({ toggleChatButton:null, - init:function (name, div, url, showList, playerListener, showHideSystemButton, showLockButton, displayChatListener, allowDiscord=false) { + + init:function (name, div, url, showList, playerListener, showHideSystemButton, displayChatListener, allowDiscord=false) { var that = this; this.hiddenClasses = new Array(); @@ -61,16 +63,12 @@ var ChatBoxUI = Class.extend({ that.appendMessage("Unknown chat problem occured (error=" + xhr.status + ")", "warningMessage"); }); this.enableDiscord = allowDiscord; - + this.comm.getPlayerInfo(function(json) { - that.userName = json; - that.pingRegex = new RegExp("@" + json + "\\b"); - that.mentionRegex = new RegExp("(?)\\b" + json + "\\b"); + that.initPlayerInfo(json); }, this.chatErrorMap()); - - if (this.name != null) { if(this.name == "Game Hall") @@ -158,31 +156,13 @@ var ChatBoxUI = Class.extend({ this.hideMessageClass("systemMessage"); } - // if (showLockButton) { - // this.lockButton = $("").button( - // {icons:{ - // primary:"ui-icon-locked" - // }, text:false}); - // this.lockButton.click( - // function () { - // if (that.lockChat) { - // $('#lockChatButton').button("option", "icons", {primary:'ui-icon-locked'}); - // that.lockChat = false; - // } else { - // $('#lockChatButton').button("option", "icons", {primary:'ui-icon-unlocked'}); - // that.lockChat = true; - // } - // }); - // } - if (showList) { this.chatListDiv = $("
    "); this.div.append(this.chatListDiv); } if (this.hideSystemButton != null) this.div.append(this.hideSystemButton); - // if (this.lockButton != null) - // this.div.append(this.lockButton); + this.div.append(this.chatTalkDiv); this.comm.startChat(this.name, @@ -205,6 +185,13 @@ var ChatBoxUI = Class.extend({ this.talkBoxHeight = 0; } }, + + initPlayerInfo:function (playerInfo) { + this.userInfo = playerInfo; + this.userName = this.userInfo.name; + this.pingRegex = new RegExp("@" + this.userName + "\\b"); + this.mentionRegex = new RegExp("(?)\\b" + this.userName + "\\b"); + }, hideMessageClass:function (msgClass) { diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js index 28d801da6..d7c66bc12 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js @@ -723,6 +723,12 @@ var GempLotrCommunication = Class.extend({ }); }, + //NEVER EVER EVER use this for actual authentication + // This is strictly to simplify things like auto-hiding + // of the admin panel. If you actually need functionality + // gated behind authorization, it goes on the server + // and not in here. + getPlayerInfo:function (callback, errorMap) { $.ajax({ type:"GET", diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js index 07049e464..3fdbe2287 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js @@ -535,7 +535,7 @@ var GempLotrGameUI = Class.extend({ } var chatRoomName = (this.replayMode ? null : ("Game" + getUrlParam("gameId"))); - this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, true, displayChatListener); + this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, displayChatListener); this.chatBox.chatUpdateInterval = 3000; if (!this.spectatorMode && !this.replayMode) { diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js index 121ee98c5..ffe2e4fc3 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js @@ -11,6 +11,8 @@ var GempLotrHallUI = Class.extend({ tablesDiv:null, buttonsDiv:null, + adminTab:null, + userInfo:null, pocketDiv:null, pocketValue:null, @@ -19,24 +21,25 @@ var GempLotrHallUI = Class.extend({ init:function (url, chat) { var that = this; + this.chat = chat; + this.comm = new GempLotrCommunication(url, function (xhr, ajaxOptions, thrownError) { if (thrownError != "abort") { if (xhr != null) { if (xhr.status == 401) { - chat.appendMessage("Game hall problem - You're not logged in, go to the main page to log in", "warningMessage"); + that.chat.appendMessage("Game hall problem - You're not logged in, go to the main page to log in", "warningMessage"); return; } else { - chat.appendMessage("The game hall had a problem communicating with the server (" + xhr.status + "), no new updates will be displayed.", "warningMessage"); - chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage"); + that.chat.appendMessage("The game hall had a problem communicating with the server (" + xhr.status + "), no new updates will be displayed.", "warningMessage"); + that.chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage"); return; } } - chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage"); - chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage"); + that.chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage"); + that.chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage"); } }); - - this.chat = chat; + this.tablesDiv = $("#tablesDiv"); this.tableDescInput = $("#tableDescInput"); this.isPrivateCheckbox = $("#isPrivateCheckbox"); @@ -46,6 +49,23 @@ var GempLotrHallUI = Class.extend({ this.decksSelect = $("#decksSelect"); this.timerSelect = $("#timerSelect"); this.buttonsDiv = $("#buttonsDiv"); + + this.adminTab = $("#tabs > ul :nth-child(7)"); + this.adminTab.hide(); + + this.comm.getPlayerInfo(function(json) + { + that.userInfo = json; + if(that.userInfo.type.includes("a") || that.userInfo.type.includes("l")) + { + that.adminTab.show(); + } + else + { + that.adminTab.hide(); + } + }); + var hallSettingsStr = $.cookie("hallSettings"); if (hallSettingsStr == null) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html b/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html index 13dace688..9c734ca72 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html @@ -1,288 +1,2 @@ - - - Gemp-LotR League Administration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    League

    - -

    Add sealed league

    - -
    - Name:
    - Cost (in silver):
    - Start (YYYYMMDD):
    - Format: -
    - Series duration in days:
    - Maximum matches in series:
    - - -
    - -

    Add solo-draft league

    - -
    - Name:
    - Cost (in silver):
    - Start (YYYYMMDD):
    - Format: -
    - Series duration in days:
    - Maximum matches in series:
    - - -
    - -

    Add constructed league

    - -
    - Name:
    - Cost (in silver):
    - Start (YYYYMMDD):
    - Prize multiplier (e.g. 0.7):
    - Collection: -
    - -
    -
    - Series definition:
    - Format: -
    - Series duration in days:
    - Maximum matches in series:
    -
    -
    - - - -
    - - - +You don't need this anymore :)

    +Go to the main hall and click on the Admin tab instead. \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java index c23b5732b..1642c101e 100644 --- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java +++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java @@ -75,4 +75,18 @@ public class Player { public int hashCode() { return _name != null ? _name.hashCode() : 0; } + + public PlayerDefinition GetUserInfo() { + return new PlayerDefinition(_name, _type); + } + + public class PlayerDefinition { + public String name; + public String type; + + public PlayerDefinition(String name, String info) { + this.name = name; + type = info; + } + } }