-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathMainMenu.php
220 lines (191 loc) · 8.26 KB
/
MainMenu.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
include_once 'MenuBar.php';
include "HostFiles/Redirector.php";
include_once "Libraries/PlayerSettings.php";
include_once 'Assets/patreon-php-master/src/PatreonDictionary.php';
include_once "APIKeys/APIKeys.php";
include_once './AccountFiles/AccountDatabaseAPI.php';
// Check if the user is banned
if (isset($_SESSION["userid"]) && IsBanned($_SESSION["userid"])) {
header("Location: ./PlayerBanned.php");
exit;
}
if (!empty($_SESSION['error'])) {
$error = $_SESSION['error'];
unset($_SESSION['error']);
echo "<script>alert('" . $error . "')</script>";
}
$language = TryGet("language", 1);
$settingArray = [];
$defaultFormat = 0;
$defaultVisibility = (isset($_SESSION["useruid"]) ? 1 : 0);
if (isset($_SESSION["userid"])) {
$savedSettings = LoadSavedSettings($_SESSION["userid"]);
for ($i = 0; $i < count($savedSettings); $i += 2) {
$settingArray[$savedSettings[intval($i)]] = $savedSettings[intval($i) + 1];
}
if (isset($_GET['language'])) {
ChangeSetting("", $SET_Language, $language, $_SESSION["userid"]);
} else if (isset($settingArray[$SET_Language])) $language = $settingArray[$SET_Language];
if (isset($settingArray[$SET_Format])) $defaultFormat = $settingArray[$SET_Format];
if (isset($settingArray[$SET_GameVisibility])) $defaultVisibility = $settingArray[$SET_GameVisibility];
}
$_SESSION['language'] = $language;
$isPatron = $_SESSION["isPatron"] ?? false;
$createGameText = ($language == 1 ? "Create Game" : "ゲームを作る");
$languageText = ($language == 1 ? "Language" : "言語");
$createNewGameText = ($language == 1 ? "Create New Game" : "新しいゲームを作成する");
$starterDecksText = ($language == 1 ? "Starter Decks" : "おすすめデッキ");
$deckUrl = TryGet("deckUrl", '');
$canSeeQueue = isset($_SESSION["useruid"]);
?>
<?php
include_once 'Header.php';
?>
<div class="core-wrapper">
<div class="game-browser-wrapper">
<div class="game-browser container bg-black" style='overflow-y:auto;'>
<?php
try {
include "ServerChecker.php";
} catch (\Exception $e) {
}
?>
</div>
</div>
<div class='create-game-wrapper'>
<?php
if (IsMobile()) echo ("<div class='create-game container bg-black' style='overflow-y:visible'>");
else echo ("<div class='create-game container bg-black' style='overflow-y:auto'>");
?>
<h2><?php echo ($createNewGameText); ?></h2>
<?php
echo ("<form style='width:100%;display:inline-block;' action='" . $redirectPath . "/CreateGame.php'>");
$favoriteDecks = [];
if (isset($_SESSION["userid"])) {
$favoriteDecks = LoadFavoriteDecks($_SESSION["userid"]);
if (count($favoriteDecks) > 0) {
$selIndex = -1;
if (isset($settingArray[$SET_FavoriteDeckIndex])) $selIndex = $settingArray[$SET_FavoriteDeckIndex];
echo ("<div class='SelectDeckInput'>Favorite Decks");
echo ("<select name='favoriteDecks' id='favoriteDecks'>");
for ($i = 0; $i < count($favoriteDecks); $i += 4) {
echo ("<option value='" . $i . "<fav>" . $favoriteDecks[$i] . "'" . ($i == $selIndex ? " selected " : "") . ">" . $favoriteDecks[$i + 1] . "</option>");
}
echo ("</select></div>");
}
}
/*
if (count($favoriteDecks) == 0) {
echo ("<div><label class='SelectDeckInput'>" . $starterDecksText . ": </label>");
echo ("<select name='decksToTry' id='decksToTry'>");
echo ("</select></div>");
}
*/
?>
<label for="fabdb"><u><a style='color:lightblue;' href='https://swustats.net/' target='_blank'>SWU Stats</a></u> or <u><a style='color:lightblue;' href='https://www.swudb.com/' target='_blank'>SWUDB</a></u> or <u><a style='color:lightblue;' href='https://sw-unlimited-db.com/' target='_blank'>SW-Unlimited-DB</a></u> Deck Link <span class="secondary">(use the url or 'Deck Link' button)</span></label>
<input type="text" id="fabdb" name="fabdb" value='<?= $deckUrl ?>'>
<?php
if (isset($_SESSION["userid"])) {
echo ("<span class='save-deck'>");
echo ("<labelfor='favoriteDeck'><input class='inputFavoriteDeck' type='checkbox' id='favoriteDeck' name='favoriteDeck' />");
echo ("Save to Favorite Decks</label>");
echo ("</span>");
}
?>
<label for="gameDescription" class='game-name-label'>Game Name</label>
<input type="text" id="gameDescription" name="gameDescription" placeholder="Game #">
<?php
echo ("<label for='format' class='SelectDeckInput'>Format</label>");
echo ("<select name='format' id='format' onchange='toggleInfoBox()'>");
if ($canSeeQueue) {
echo ("<option value='premierf' " . ($defaultFormat == 0 ? " selected" : "") . ">Premier</option>");
echo ("<option value='reqsundo' " . ($defaultFormat == 1 ? " selected" : "") . ">Request-Undo Premier</option>");
}
echo ("<option value='openform'" . ($defaultFormat == 4 ? " selected" : "") . ">Open Format</option>");
echo ("</select>");
?>
<?php
if ($canSeeQueue) {
echo '<label for="public" class="privacy-label"><input class="privacy-input" type="radio" id="public" name="visibility" value="public" ' . ($defaultVisibility == 1 ? 'checked="checked"' : "") . '>';
echo ('Public</label>');
} else {
echo '<p class="login-notice">❗<a href="./LoginPage.php">Log In</a> to be able to create public games.</p>';
}
?>
<label for="private" class='privacy-label'>
<input type="radio" class='privacy-input' id="private" name="visibility" value="private" <?php if ($defaultVisibility == 0) echo 'checked="checked"'; ?> />Private</label>
<!--
<label for="deckTestMode">
<input class='SelectDeckInput' type="checkbox" id="deckTestMode" name="deckTestMode" value="deckTestMode">
Single Player</label>
-->
<div style=' text-align:center;'>
<input type="submit" class="create-game-button" value="<?php echo ($createGameText); ?>">
</div>
</form>
</div>
</div>
<div class="karabast-column" >
<div class="karabast-overview container bg-blue" >
<p><b>Karabast is an open-source, fan-made platform.</b></p>
<p>It is an educational tool only, meant to facilitate researching decks and strategies that is supportive of in-person play. As such, direct competition through the form of automated tournaments or rankings will not be added.</p>
<p>This tool is free to use and is published non-commercially. Payment is not required to access any functionality.</p>
</div>
<div class="karabast-news container bg-black" style='<?php if (IsMobile()) echo ("display:none; "); ?>'>
<h2>News</h2>
<div style="position: relative;">
<div style='vertical-align:middle; text-align:center;'>
<a href="https://swustats.net" target="_blank">
<img src="./Images/SWUStatsHypergeo.webp" alt="SHD" style="max-width: 100%; border-radius: 5px;">
</a>
<div style="text-align: left;">
<h3 style="margin: 15px 0; display: block;">SWU Stats</h3>
<p>Are you tired of missing with Triple Dark Raid? Curious exactly how unlucky you got when you missed with Vader? Wonder no more! Now you can automatically calculate your odds of hitting with Search top X effects based on your deck composition at SWU Stats!</p>
</div>
</div>
<?php
/*
if (!$isPatron) {
echo '<div>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8442966023291783"
crossorigin="anonymous"></script>
<!-- MainMenu -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-8442966023291783"
data-ad-slot="5060625180"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>';
}
*/
?>
</div>
</div>
</div>
</div>
<script>
function changeLanguage() {
window.location.search = '?language=' + document.getElementById('languageSelect').value;
}
function toggleInfoBox() {
var formatSelect = document.getElementById('format');
var infoBox = document.getElementById('info-box');
if (formatSelect.value === 'openform') {
infoBox.style.display = 'block';
} else {
infoBox.style.display = 'none';
}
}
// Ensure the info box is displayed correctly based on the default selected format
window.onload = function() {
toggleInfoBox();
};
</script>
<?php
include_once 'Disclaimer.php';
?>