projects-jenz/RaceTimer/webproject/target/racetimer_web-1.0-SNAPSHOT/WEB-INF/PlayerInfo.jsp
2019-03-02 15:17:41 +01:00

330 lines
16 KiB
Plaintext

<%--
Document : PlayerInfo
Created on : 04-11-2018, 20:57:35
Author : install1
--%>
<%@page import="java.util.ArrayList"%>
<%@page import="FunctionLayer.RecentTimes"%>
<%@page import="FunctionLayer.UserBanners"%>
<%@page import="FunctionLayer.MapBoard"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="java.util.List"%>
<%@page import="FunctionLayer.Users"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Player Stats</title>
</head>
<body>
<div align="center">
<div id="overview" class="btn btn-info overviewclass" >Overview</div>
</div>
<%
DecimalFormat df = new DecimalFormat();
List<RecentTimes> recentTimes = (List<RecentTimes>) session.getAttribute("RecentTimes");
List<UserBanners> UB = (List<UserBanners>) session.getAttribute("UserBanners");
List<MapBoard> DifferentiateMapBoard = (List<MapBoard>) session.getAttribute("MapBoard");
String VerifyAdmins = session.getAttribute("VerifyAdmin") == null ? "0" : String.valueOf(session.getAttribute("VerifyAdmin"));
int VerifyAdmin = Integer.valueOf(VerifyAdmins);
StringBuilder sb = new StringBuilder();
String SteamID64 = (String) request.getAttribute("CommunityID");
if (SteamID64 != null) {
sb.append("https://steamcommunity.com/profiles/").append(SteamID64);
} else {
sb.append("https://steamcommunity.com/profiles/");
}
List<Integer> PlayerPositions = (List<Integer>) request.getAttribute("positions");
Users user = (Users) request.getAttribute("user");
List<MapBoard> PlayerRelatedMapBoard = (List<MapBoard>) request.getAttribute("PlayerRelatedMapBoard");
df.setMaximumFractionDigits(1);
if (user != null && recentTimes != null) {
%>
<div class="container">
<div class="row">
<div class="col-sm">
<div align="center" class="fake-2">
<br>
<br>
<a target="_blank" href="<%out.println(sb.toString());%>">
<button style="border: none"
class="list-group-item list-group-item-action" >
<span class="fake-link" >
<div> <%out.println(user.getName());%></div>
<div> <%out.println(user.getSteamID());%></div>
<div>
<img src="<%out.println(user.getAvatar()); %>">
</div>
<div>
<% out.print("Rank: " + user.getRank()); %>
</div>
<div>
<% out.print("Points: " + user.getPlayerPoints()); %>
</div>
<div>
<% out.print("Times: " + user.getTimes()); %>
</div>
<%
String img = "";
int UBIndex = 0;
while (UB.size() > UBIndex) {
if (UB.get(UBIndex).getUser().equals(user)) {
break;
}
UBIndex++;
}
if (UBIndex < UB.size()) {
for (int i = 0; i < UB.get(UBIndex).getUrlBanners().size(); i++) {
switch (UB.get(UBIndex).getUrlBanners().get(i)) {
case 25: {
img = "https://unloze.com/images/badges/Event-Manager.png";
break;
}
case 19: {
img = "https://unloze.com/images/badges/Discord-Manager.png";
break;
}
case 15: {
img = "https://unloze.com/images/badges/Event-Winner.png";
break;
}
case 12: {
img = "https://unloze.com/images/badges/VIP.png";
break;
}
case 11: {
img = "https://unloze.com/images/badges/Global-Admin.png";
break;
}
case 10: {
img = "https://unloze.com/images/badges/Leader.png";
break;
}
case 8: {
img = "https://unloze.com/images/badges/Tech-Staff.png";
break;
}
case 7: {
img = "https://unloze.com/images/badges/Admin.png";
break;
}
case 6: {
img = "https://unloze.com/images/badges/Mapper.png";
break;
}
}
%>
<div>
<img src="<%out.println(img);%>">
</div>
<% }
}
%>
</span> </button>
</a>
</div>
<%
for (int i = 0; i < PlayerRelatedMapBoard.size(); i++) {
%>
<div align="center" class="group">
<div class="element" data-id="<%=PlayerRelatedMapBoard.get(i).getMapName()%>" >
<span href="#" class="fake-link" >
<%out.println(" Map " + PlayerRelatedMapBoard.get(i).getMapName());%>
</span>
</div>
</div>
<span class="fake-2" >
<div align="center">
<%out.println("Map Position: " + (PlayerRelatedMapBoard.get(i).getMapvalues().get(PlayerPositions.get(i)).getPosition() + 1)); %>
</div>
<div align="center"> <%out.println("Time: 0" + (int) Math.floor(PlayerRelatedMapBoard.get(i).getMapvalues().get(PlayerPositions.get(i)).getTime())
+ ":" + (df.format((PlayerRelatedMapBoard.get(i).getMapvalues().get(PlayerPositions.get(i)).getTime() - Math.floor(PlayerRelatedMapBoard.get(i).getMapvalues().get(PlayerPositions.get(i)).getTime())) * 100)));%></div>
<div align="center"> <%out.println("Map Points: " + PlayerRelatedMapBoard.get(i).getMapvalues().get(PlayerPositions.get(i)).getMapPoints() + "/100"); %></div>
</span>
<%
if (VerifyAdmin > 0) {
%>
<div align="center">
<button value="<%out.print(user.getSteamID());%>" id="<%out.print(PlayerRelatedMapBoard.get(i).getMapName());%>" onclick="DeleteEntryFunc(this.value, this.id)" >
<span href="#" class="fake-link" >
<%out.println("Delete Entry");%>
</span>
</button>
</div>
<%
}
%>
<br>
<br>
<%
}
}
%>
</div>
</div>
</div>
<div class="header">
<div class="leftH" id="leftHDiv" >
<div id="lefth1">
<% String AdminName = (String) request.getSession().getAttribute("AdminName");
if (AdminName != null) {
%>
<h1>You are logged in as: <%=AdminName%> </h1>
<%
} %>
<h1>Recently improved times: </h1>
</div>
<%
for (int i = 0; i < recentTimes.size(); i++) {
if (recentTimes.get(i).getUser().equals(user)) {
%>
<div>
<%out.print("\n" + recentTimes.get(i).getMYSQLStage()); %>
</div>
<div>
<%
float fdefault = recentTimes.get(i).getImprovedTime();
int MinuteAdjusterImproved = (int) fdefault;
float secondsAdjusterImproved = Float.valueOf(String.format("%.2f", (fdefault - MinuteAdjusterImproved) * 100));
out.print("\nImproved by: 0" + MinuteAdjusterImproved + ":"
+ secondsAdjusterImproved);
%>
</div>
<br>
<%
}
}
%>
</div>
</div>
<div class="header">
<div class="rightH group1" id="rightHDiv" >
<div id="righth1">
<h1>Maps with no time yet:</h1>
</div>
<%
List<MapBoard> feex = new ArrayList(PlayerRelatedMapBoard);
List<MapBoard> feex1 = new ArrayList(DifferentiateMapBoard);
feex1.removeAll(feex);
for (int i = 0; i < feex1.size(); i++) {
%>
<div class="element1" id="<%=feex1.get(i).getMapName()%>" >
<span href="#" class="fake-link2" >
<%out.print("\n" + feex1.get(i).getMapName()); %>
</span>
</div>
<br>
<%
}
%>
</div>
</div>
<style>
.fake-link {
color: #007bff;
text-decoration: underline;
cursor: pointer;
position: relative;
z-index: 3;
}
.fake-link2 {
color: #007bff;
text-decoration: underline;
cursor: pointer;
position: relative;
z-index: 3;
}
.fake-2{
position: relative;
z-index: 3;
}
.fake-2 a{
display:inline-block;
width: 300px;
}
.overviewclass{
position: relative;
z-index: 3;
}
.header {
display: inline-block;
width: 100%;
position: absolute;
z-index: 1;
top: 0px;
}
.leftH {
position: absolute;
z-index: 2;
float: left;
top: 0px;
}
.rightH {
position: absolute;
z-index: 2;
float: right;
top: 0px;
}
</style>
<script type="text/javascript">
</script>
<script>
$("#overview").click(function () {
document.getElementById('1112').submit();
});
$('.group1 .element1').click(function () {
id1 = $(this).attr('id');
document.getElementById("mapindexes1").value = id1;
document.getElementById('1114').submit();
});
$('.group .element').click(function () {
id = $(this).attr('data-id');
document.getElementById("mapindexes").value = id;
document.getElementById('1111').submit();
});
function DeleteEntryFunc(steamID, map)
{
document.getElementById("PlayerRelatedMap").value = map;
document.getElementById("SteamID").value = steamID;
document.getElementById('1113').submit();
}
$("#leftHDiv").css({
position: 'relative',
right: '-150px'
});
$("#lefth1").css({
position: 'relative',
right: '125px'
});
$("#rightHDiv").css({
position: 'relative',
});
$("#righth1").css({
position: 'relative',
});
</script>
<form id="1111" name="mapfnfo" action="FrontController" method="POST">
<input type="hidden" name="command" value="mapfnfo">
<input type="hidden" name="mapname" id='mapindexes' value=''>
</form>
<form id="1112" name="SessionAttributeHandler" action="FrontController" method="POST">
<input type="hidden" name="command" value="SessionAttributeHandler">
</form>
<form id="1113" name="DeleteEntry" action="FrontController" method="POST">
<input type="hidden" name="command" value="DeleteEntry">
<input type="hidden" name="DeleteIndexSteamID" id='SteamID' value=''>
<input type="hidden" name="PlayerRelatedMap" id='PlayerRelatedMap' value=''>
</form>
<form id="1114" name="mapfnfo" action="FrontController" method="POST">
<input type="hidden" name="command" value="mapfnfo">
<input type="hidden" name="mapname" id='mapindexes1' value=''>
</form>
</body>
</html>